Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: [systemd] lvm.service running too early? [HACKED]
Date: Sun, 08 Dec 2013 17:12:31
Message-Id: CADPrc80+wwCHkPTA_MDi-TZEBMTV4QUzuopkbdRn_KeUn1AyhQ@mail.gmail.com
In Reply to: [gentoo-user] Re: [systemd] lvm.service running too early? [HACKED] by walt
1 On Sun, Dec 8, 2013 at 10:15 AM, walt <w41ter@×××××.com> wrote:
2 > On 12/07/2013 05:58 PM, gottlieb@×××.edu wrote:
3 >> On Sat, Dec 07 2013, Canek Peláez Valdés wrote:
4 >>
5 >>> On Dec 7, 2013 12:40 PM, "walt" <w41ter@×××××.com> wrote:
6 >>>>
7 >>>> Just updated my stable amd64 machine to use systemd and all is working
8 >>>> okay except for the lvm.service.
9 >>>>
10 >>>> The lvm.service starts with no errors, but OTOH it finds no physical or
11 >>>> logical volumes. I suspect this happens because the drive using lvm2
12 >>>> is in a usb3 external dock instead of attached to the mobo.
13 >>>>
14 >>>> When I run 'systemctl restart lvm' manually, the usb3 disk is activated
15 >>>> and mounted successfully. Thus I think the lvm.service runs too early
16 >>>> during boot.
17 >>>>
18 >>>> Here is my lvm.service (which I copied from another distro, IIRC):
19 >>>>
20 >>>> #cat /etc/systemd/system/lvm.service
21 >>>>
22 >>>> [Unit]
23 >>>> Description=LVM
24 >>>> DefaultDependencies=no
25 >>>> Requires=systemd-udev-settle.service
26 >>>> Before=shutdown.target local-fs.target
27 >>>>
28 >>>> [Service]
29 >>>> Type=oneshot
30 >>>> RemainAfterExit=yes
31 >>>> ExecStart=/sbin/pvscan --ignorelockingfailure
32 >>>> ExecStart=/sbin/vgscan --mknodes --ignorelockingfailure
33 >>>> ExecStart=/sbin/vgchange --sysinit -a ly
34 >>>> ExecStop=/sbin/lvchange --sysinit -a ln $(/sbin/vgs -o vg_name
35 >>> --noheadings --nosuffix)
36 >>>> ExecStop=/sbin/lvchange --sysinit -a ln
37 >>>> ExecStop=/sbin/vgchange --sysinit -a ln
38 >>>>
39 >>>> [Install]
40 >>>> WantedBy=sysinit.target
41 >>>>
42 >>>> Is there an elegant way to fix the problem as opposed to a hack?
43 >>>
44 >>> I believe that for recent enough versions of LVM2, it includes an official
45 >>> lvm2.service unit file(s). Could you try that one and see if it works as
46 >>> you expect?
47 >
48 > It has the same problem. I looked more carefully at the systemd logs and
49 > found that lvm was running before the xhci kernel module was loaded, hence
50 > the usb3 drive was not visible yet.
51 >
52 > I "fixed" the problem by adding "After=basic" to the lvm.service file, and
53 > now it works as expected. (Expected by me, anyway :)
54
55 Well, at least is working, however is kinda an ugly fix. Could you
56 create the file /etc/modules-load.d/usb3.conf, with the line xhci in
57 it, reboot, and see if your little hack is not needed then? Also, if
58 you are using an initramfs, could you rebuild it before trying?
59
60 >> I have the recent lvm2 (2.02.104) and the unit files in
61 >> /usr/lib/systemd/system are called
62 >>
63 >> lvm2-lvmetad.service
64 >> lvm2-lvmetad.socket
65 >> lvm2-monitor.service
66 >> lvm2-pvscan@.service
67 >
68 > That last file must have been added for version .104. I'll take a look,
69 > thanks.
70
71 Regards.
72 --
73 Canek Peláez Valdés
74 Posgrado en Ciencia e Ingeniería de la Computación
75 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] Re: [systemd] lvm.service running too early? [HACKED] Neil Bothwick <neil@××××××××××.uk>