Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] Re: [systemd] lvm.service running too early? [HACKED] "Canek Peláez Valdés" <caneko@×××××.com>