[gentoo-user] [systemd] lvm.service running too early?

2013-12-07 Thread walt
Just updated my stable amd64 machine to use systemd and all is working
okay except for the lvm.service.

The lvm.service starts with no errors, but OTOH it finds no physical or
logical volumes.  I suspect this happens because the drive using lvm2
is in a usb3 external dock instead of attached to the mobo.

When I run 'systemctl restart lvm' manually, the usb3 disk is activated
and mounted successfully.  Thus I think the lvm.service runs too early
during boot.

Here is my lvm.service (which I copied from another distro, IIRC):

#cat /etc/systemd/system/lvm.service 

[Unit]
Description=LVM
DefaultDependencies=no
Requires=systemd-udev-settle.service
Before=shutdown.target local-fs.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/pvscan --ignorelockingfailure
ExecStart=/sbin/vgscan --mknodes --ignorelockingfailure
ExecStart=/sbin/vgchange --sysinit -a ly
ExecStop=/sbin/lvchange --sysinit -a ln $(/sbin/vgs -o vg_name --noheadings 
--nosuffix)
ExecStop=/sbin/lvchange --sysinit -a ln
ExecStop=/sbin/vgchange --sysinit -a ln

[Install]
WantedBy=sysinit.target

Is there an elegant way to fix the problem as opposed to a hack?

Thanks for any clues.





Re: [gentoo-user] [systemd] lvm.service running too early?

2013-12-07 Thread Canek Peláez Valdés
On Dec 7, 2013 12:40 PM, walt w41...@gmail.com wrote:

 Just updated my stable amd64 machine to use systemd and all is working
 okay except for the lvm.service.

 The lvm.service starts with no errors, but OTOH it finds no physical or
 logical volumes.  I suspect this happens because the drive using lvm2
 is in a usb3 external dock instead of attached to the mobo.

 When I run 'systemctl restart lvm' manually, the usb3 disk is activated
 and mounted successfully.  Thus I think the lvm.service runs too early
 during boot.

 Here is my lvm.service (which I copied from another distro, IIRC):

 #cat /etc/systemd/system/lvm.service

 [Unit]
 Description=LVM
 DefaultDependencies=no
 Requires=systemd-udev-settle.service
 Before=shutdown.target local-fs.target

 [Service]
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=/sbin/pvscan --ignorelockingfailure
 ExecStart=/sbin/vgscan --mknodes --ignorelockingfailure
 ExecStart=/sbin/vgchange --sysinit -a ly
 ExecStop=/sbin/lvchange --sysinit -a ln $(/sbin/vgs -o vg_name
--noheadings --nosuffix)
 ExecStop=/sbin/lvchange --sysinit -a ln
 ExecStop=/sbin/vgchange --sysinit -a ln

 [Install]
 WantedBy=sysinit.target

 Is there an elegant way to fix the problem as opposed to a hack?

I believe that for recent enough versions of LVM2, it includes an official
lvm2.service unit file(s). Could you try that one and see if it works as
you expect?

You should run systemd-delta from time to time to see if you are overriding
anything in your /etc directory.

Regards.





Re: [gentoo-user] [systemd] lvm.service running too early?

2013-12-07 Thread gottlieb
On Sat, Dec 07 2013, Canek Peláez Valdés wrote:

 On Dec 7, 2013 12:40 PM, walt w41...@gmail.com wrote:

 Just updated my stable amd64 machine to use systemd and all is working
 okay except for the lvm.service.

 The lvm.service starts with no errors, but OTOH it finds no physical or
 logical volumes.  I suspect this happens because the drive using lvm2
 is in a usb3 external dock instead of attached to the mobo.

 When I run 'systemctl restart lvm' manually, the usb3 disk is activated
 and mounted successfully.  Thus I think the lvm.service runs too early
 during boot.

 Here is my lvm.service (which I copied from another distro, IIRC):

 #cat /etc/systemd/system/lvm.service

 [Unit]
 Description=LVM
 DefaultDependencies=no
 Requires=systemd-udev-settle.service
 Before=shutdown.target local-fs.target

 [Service]
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=/sbin/pvscan --ignorelockingfailure
 ExecStart=/sbin/vgscan --mknodes --ignorelockingfailure
 ExecStart=/sbin/vgchange --sysinit -a ly
 ExecStop=/sbin/lvchange --sysinit -a ln $(/sbin/vgs -o vg_name
 --noheadings --nosuffix)
 ExecStop=/sbin/lvchange --sysinit -a ln
 ExecStop=/sbin/vgchange --sysinit -a ln

 [Install]
 WantedBy=sysinit.target

 Is there an elegant way to fix the problem as opposed to a hack?

 I believe that for recent enough versions of LVM2, it includes an official
 lvm2.service unit file(s). Could you try that one and see if it works as
 you expect?

I have the recent lvm2 (2.02.104) and the unit files in
/usr/lib/systemd/system are called

lvm2-lvmetad.service
lvm2-lvmetad.socket 
lvm2-monitor.service
lvm2-pvscan@.service

I have *no* custom unit files for systemd or lvm (only homebrew unit is
for my autobackup script).

A few weeks ago there was a confusion between /sbin and /usr/sbin for
the lvm2 files (lvm, pvchange, etc).  But that is working fine now.
Indeed I use systemd with lvm2 and my lv's are all recognized and
mounted automatically.

allan