Gentoo Archives: gentoo-user

From: gottlieb@×××.edu
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [systemd] lvm.service running too early?
Date: Sun, 08 Dec 2013 01:58:18
Message-Id: 87siu4p0ib.fsf@nyu.edu
In Reply to: Re: [gentoo-user] [systemd] lvm.service running too early? by "Canek Peláez Valdés"
1 On Sat, Dec 07 2013, Canek Peláez Valdés wrote:
2
3 > On Dec 7, 2013 12:40 PM, "walt" <w41ter@×××××.com> wrote:
4 >>
5 >> Just updated my stable amd64 machine to use systemd and all is working
6 >> okay except for the lvm.service.
7 >>
8 >> The lvm.service starts with no errors, but OTOH it finds no physical or
9 >> logical volumes. I suspect this happens because the drive using lvm2
10 >> is in a usb3 external dock instead of attached to the mobo.
11 >>
12 >> When I run 'systemctl restart lvm' manually, the usb3 disk is activated
13 >> and mounted successfully. Thus I think the lvm.service runs too early
14 >> during boot.
15 >>
16 >> Here is my lvm.service (which I copied from another distro, IIRC):
17 >>
18 >> #cat /etc/systemd/system/lvm.service
19 >>
20 >> [Unit]
21 >> Description=LVM
22 >> DefaultDependencies=no
23 >> Requires=systemd-udev-settle.service
24 >> Before=shutdown.target local-fs.target
25 >>
26 >> [Service]
27 >> Type=oneshot
28 >> RemainAfterExit=yes
29 >> ExecStart=/sbin/pvscan --ignorelockingfailure
30 >> ExecStart=/sbin/vgscan --mknodes --ignorelockingfailure
31 >> ExecStart=/sbin/vgchange --sysinit -a ly
32 >> ExecStop=/sbin/lvchange --sysinit -a ln $(/sbin/vgs -o vg_name
33 > --noheadings --nosuffix)
34 >> ExecStop=/sbin/lvchange --sysinit -a ln
35 >> ExecStop=/sbin/vgchange --sysinit -a ln
36 >>
37 >> [Install]
38 >> WantedBy=sysinit.target
39 >>
40 >> Is there an elegant way to fix the problem as opposed to a hack?
41 >
42 > I believe that for recent enough versions of LVM2, it includes an official
43 > lvm2.service unit file(s). Could you try that one and see if it works as
44 > you expect?
45
46 I have the recent lvm2 (2.02.104) and the unit files in
47 /usr/lib/systemd/system are called
48
49 lvm2-lvmetad.service
50 lvm2-lvmetad.socket
51 lvm2-monitor.service
52 lvm2-pvscan@.service
53
54 I have *no* custom unit files for systemd or lvm (only homebrew unit is
55 for my autobackup script).
56
57 A few weeks ago there was a confusion between /sbin and /usr/sbin for
58 the lvm2 files (lvm, pvchange, etc). But that is working fine now.
59 Indeed I use systemd with lvm2 and my lv's are all recognized and
60 mounted automatically.
61
62 allan

Replies

Subject Author
[gentoo-user] Re: [systemd] lvm.service running too early? [HACKED] walt <w41ter@×××××.com>