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

2013-12-08 Thread walt
On 12/07/2013 05:58 PM, gottl...@nyu.edu wrote:
 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?

It has the same problem.  I looked more carefully at the systemd logs and
found that lvm was running before the xhci kernel module was loaded, hence
the usb3 drive was not visible yet.

I fixed the problem by adding After=basic to the lvm.service file, and
now it works as expected. (Expected by me, anyway :)

 
 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

That last file must have been added for version .104.  I'll take a look,
thanks.



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

2013-12-08 Thread Canek Peláez Valdés
On Sun, Dec 8, 2013 at 10:15 AM, walt w41...@gmail.com wrote:
 On 12/07/2013 05:58 PM, gottl...@nyu.edu wrote:
 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?

 It has the same problem.  I looked more carefully at the systemd logs and
 found that lvm was running before the xhci kernel module was loaded, hence
 the usb3 drive was not visible yet.

 I fixed the problem by adding After=basic to the lvm.service file, and
 now it works as expected. (Expected by me, anyway :)

Well, at least is working, however is kinda an ugly fix. Could you
create the file /etc/modules-load.d/usb3.conf, with the line xhci in
it, reboot, and see if your little hack is not needed then? Also, if
you are using an initramfs, could you rebuild it before trying?

 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

 That last file must have been added for version .104.  I'll take a look,
 thanks.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México



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

2013-12-08 Thread Neil Bothwick
On Sun, 8 Dec 2013 11:12:23 -0600, Canek Peláez Valdés wrote:

  It has the same problem.  I looked more carefully at the systemd logs
  and found that lvm was running before the xhci kernel module was
  loaded, hence the usb3 drive was not visible yet.
 
  I fixed the problem by adding After=basic to the lvm.service
  file, and now it works as expected. (Expected by me, anyway :)  
 
 Well, at least is working, however is kinda an ugly fix. Could you
 create the file /etc/modules-load.d/usb3.conf, with the line xhci in
 it, reboot, and see if your little hack is not needed then? Also, if
 you are using an initramfs, could you rebuild it before trying?

Alternatively, build xhci into the kernel, since you need it at every
boot.


-- 
Neil Bothwick

For security reasons, all text in this mail is double-rot13 encrypted.


signature.asc
Description: PGP signature


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

2013-12-08 Thread walt
On 12/08/2013 10:39 AM, Neil Bothwick wrote:
 On Sun, 8 Dec 2013 11:12:23 -0600, Canek Peláez Valdés wrote:
 
 It has the same problem.  I looked more carefully at the systemd logs
 and found that lvm was running before the xhci kernel module was
 loaded, hence the usb3 drive was not visible yet.

 I fixed the problem by adding After=basic to the lvm.service
 file, and now it works as expected. (Expected by me, anyway :)  

 Well, at least is working, however is kinda an ugly fix. Could you
 create the file /etc/modules-load.d/usb3.conf, with the line xhci in
 it, reboot, and see if your little hack is not needed then? Also, if
 you are using an initramfs, could you rebuild it before trying?
 
 Alternatively, build xhci into the kernel, since you need it at every
 boot.

Both of the suggestions above reversed the order of the journalctl
messages so that the usb3 drive appears before lvm.service is run,
but pvscan still finds no volumes and the volume group is not active
after bootup :(

I changed After=basic.target to After=sysinit.target, which still
gets it working well enough for my primitive needs.  IMHO that fix
allows me to decrement ${HACKED} by one :)








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

2013-12-08 Thread Sam Jorna
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/12/13 09:36, walt wrote:
 On 12/08/2013 10:39 AM, Neil Bothwick wrote:
 On Sun, 8 Dec 2013 11:12:23 -0600, Canek Peláez Valdés wrote:

 It has the same problem.  I looked more carefully at the systemd logs
 and found that lvm was running before the xhci kernel module was
 loaded, hence the usb3 drive was not visible yet.

 I fixed the problem by adding After=basic to the lvm.service
 file, and now it works as expected. (Expected by me, anyway :)  

 Well, at least is working, however is kinda an ugly fix. Could you
 create the file /etc/modules-load.d/usb3.conf, with the line xhci in
 it, reboot, and see if your little hack is not needed then? Also, if
 you are using an initramfs, could you rebuild it before trying?

 Alternatively, build xhci into the kernel, since you need it at every
 boot.
 
 Both of the suggestions above reversed the order of the journalctl
 messages so that the usb3 drive appears before lvm.service is run,
 but pvscan still finds no volumes and the volume group is not active
 after bootup :(
 
 I changed After=basic.target to After=sysinit.target, which still
 gets it working well enough for my primitive needs.  IMHO that fix
 allows me to decrement ${HACKED} by one :)
 
 
 
 
 
 
Just a thought, but isn't there a unit file for autoloading modules
(therefore making it usable as a After= target)?

- -- 
Sam Jorna
sam.t.jo...@gmail.com
GnuPG Key ID: 12D3EE0C
Fingerprint:
6D14 8366 16F5 638E 3A29
1FED 5D5C 62D9 12D3 EE0C

Secure your E-mail:
http://www.gnupg.org
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQGcBAEBAgAGBQJSpQM3AAoJEF1cYtkS0+4MrI8MAKGdzdY5GLDwk1+1JF+DGMiC
RzHrrEVS/+bf8q/z8VSjFPvsIaML9x2yu/Iw2ucvFoFpk4D3n3DGBZrpRhEJiH5a
rj/caeoSH6Hs3qId+AAPfCLMl2cnAT1SdbmKnL1B+kHDdi3fPVgbIlJPjOIVUJ4J
JOh6/56iSSGo3xlwvRwii3su3xHFYYqs9YpTrJzFxaLL/sNIreiUDzA6wkB/BNEX
WvSXAXE7LLt7xo2CvMSU5uGhiCp0rR2iEUbGvZ08fkLLqZn4EGU97fzB7OQ5J6km
70yty45f4Sx55zwYTd7ekpTC0prl8dn8xlwARchmVaByBvIrbu1u+zeEYhvKf7G+
cYWKQ3y1VRCVBDWkLRrn6S2tUwDTCLGyzpLWMcl26oc9rguJ0ZUT7BL0zN0p5cfd
gJ6VZ9MsiXGgv1U3bduBGV7AQUREHQpItdM7z9kjKcEjqaILJX9FLluDDwhTHfcr
bIcRDPj+m8kdZvtznY7MWjoSp1RhOJlhaDbSpVXz+g==
=PWbf
-END PGP SIGNATURE-



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

2013-12-08 Thread Canek Peláez Valdés
On Sun, Dec 8, 2013 at 4:36 PM, walt w41...@gmail.com wrote:
 On 12/08/2013 10:39 AM, Neil Bothwick wrote:
 On Sun, 8 Dec 2013 11:12:23 -0600, Canek Peláez Valdés wrote:

 It has the same problem.  I looked more carefully at the systemd logs
 and found that lvm was running before the xhci kernel module was
 loaded, hence the usb3 drive was not visible yet.

 I fixed the problem by adding After=basic to the lvm.service
 file, and now it works as expected. (Expected by me, anyway :)

 Well, at least is working, however is kinda an ugly fix. Could you
 create the file /etc/modules-load.d/usb3.conf, with the line xhci in
 it, reboot, and see if your little hack is not needed then? Also, if
 you are using an initramfs, could you rebuild it before trying?

 Alternatively, build xhci into the kernel, since you need it at every
 boot.

 Both of the suggestions above reversed the order of the journalctl
 messages so that the usb3 drive appears before lvm.service is run,
 but pvscan still finds no volumes and the volume group is not active
 after bootup :(

Sounds like another module is then missing at early boot up time. Do
you have CONFIG_BLK_DEV_DM compiled in-kernel, or as a module? What
about the other CONFIG_DM_* options?

If they are modules, put them in a /etc/modules-load.d/*.config file.

 I changed After=basic.target to After=sysinit.target, which still
 gets it working well enough for my primitive needs.  IMHO that fix
 allows me to decrement ${HACKED} by one :)

Not editing unit files would be best, I think.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México



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

2013-12-08 Thread Canek Peláez Valdés
On Sun, Dec 8, 2013 at 5:39 PM, Sam Jorna sam.t.jo...@gmail.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 09/12/13 09:36, walt wrote:
 On 12/08/2013 10:39 AM, Neil Bothwick wrote:
 On Sun, 8 Dec 2013 11:12:23 -0600, Canek Peláez Valdés wrote:

 It has the same problem.  I looked more carefully at the systemd logs
 and found that lvm was running before the xhci kernel module was
 loaded, hence the usb3 drive was not visible yet.

 I fixed the problem by adding After=basic to the lvm.service
 file, and now it works as expected. (Expected by me, anyway :)

 Well, at least is working, however is kinda an ugly fix. Could you
 create the file /etc/modules-load.d/usb3.conf, with the line xhci in
 it, reboot, and see if your little hack is not needed then? Also, if
 you are using an initramfs, could you rebuild it before trying?

 Alternatively, build xhci into the kernel, since you need it at every
 boot.

 Both of the suggestions above reversed the order of the journalctl
 messages so that the usb3 drive appears before lvm.service is run,
 but pvscan still finds no volumes and the volume group is not active
 after bootup :(

 I changed After=basic.target to After=sysinit.target, which still
 gets it working well enough for my primitive needs.  IMHO that fix
 allows me to decrement ${HACKED} by one :)






 Just a thought, but isn't there a unit file for autoloading modules
 (therefore making it usable as a After= target)?

That's what /etc/modules-load.d is for:

http://www.freedesktop.org/software/systemd/man/modules-load.d.html

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México