Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Systemd + LVM2: volumes not mounted
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Mon Dec 31, 2012 4:11 pm    Post subject: Systemd + LVM2: volumes not mounted Reply with quote

I am playing around with systemd. I use LVM and the vg is enabled using an initramfs built by genkernel. Systemd starts but hangs waiting for a job to mount /var. When I get the emergency prompt I can see from lvs the vg is active but only the root partition (on an LV) is mounted. At this point the boot hangs of course. I found an lvm.service file on the Gentoo wiki:

    [Unit]
    Description=Linux Volume Manager
    DefaultDependencies=no
    Requires=systemd-udev-settle.service
    After=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 2> /dev/null)
    ExecStop=/sbin/lvchange --sysinit -a ln
    ExecStop=/sbin/vgchange --sysinit -a ln

    [Install]
    WantedBy=sysinit.target

Thre is a LVM started mesage in the journal so why do the volumes not get mounted? Have I missed some customisation?

TIA and Happy New Year!
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Thu Jan 03, 2013 2:20 pm    Post subject: Reply with quote

I have been researching this for the last three days but have found nothing. If you include "mount -a" in the unit the partitions get mounted but the lvm.service still fails and this messes up the rest of the dependency chain. One thing I have found is that despite the partitions getting created under /dev/mapper, udev no nothing about them:
Code:

# udevadm info -p /dev/mapper/vg00-rootfs -q all
syspath not found

Does this give anyone a clue?
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
Josef.95
Advocate
Advocate


Joined: 03 Sep 2007
Posts: 2288
Location: Germany

PostPosted: Thu Jul 04, 2013 4:29 pm    Post subject: Reply with quote

binro,
i think the Info from https://bugs.gentoo.org/show_bug.cgi?id=424637
and https://bugs.gentoo.org/show_bug.cgi?id=453594
should help.
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Fri Jul 05, 2013 6:50 am    Post subject: Reply with quote

Thanks, I will try the lvm ebuild patch tomorrow.
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Sat Jul 06, 2013 11:00 am    Post subject: Reply with quote

I applied the patch, re-emerged lvm, set LVMETAD=1 in lvm.conf, build a new ramdisk and rebooted using OpenRC. That seemed to work OK, although there were less messages at the start of the boot. I then rebooted using systemd as the init and the result was the same as before: no LVs mounted (except root as usual). Did I miss something?
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Sat Jul 06, 2013 11:16 am    Post subject: Reply with quote

Perhaps try to succeed using dracut, but there is a comment in a dracut setup module:
Quote:
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
# files, but provides the one below:
inst_rules 64-device-mapper.rules

_________________
fun2gen2
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Sun Jul 07, 2013 10:05 am    Post subject: Reply with quote

I seem to have all those dm rules. I don't think there is any point using dracut to build the ramdisk, the genkernel one works perfectly well, it creates all the /dev/dm-* devices, systemd just doesn't mount them.
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
asotirov
n00b
n00b


Joined: 06 Mar 2007
Posts: 13

PostPosted: Tue Aug 13, 2013 2:44 pm    Post subject: Same problem Reply with quote

Binro,

Have you solved this ?
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Tue Aug 13, 2013 2:52 pm    Post subject: Re: Same problem Reply with quote

asotirov wrote:
Binro,
Have you solved this ?

No. I am loosing interest. :-(
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
pums974
Tux's lil' helper
Tux's lil' helper


Joined: 27 Feb 2010
Posts: 78

PostPosted: Tue Aug 13, 2013 5:46 pm    Post subject: Reply with quote

I believe there is two bugs concerning this issue :

https://bugs.gentoo.org/show_bug.cgi?id=480066
https://bugs.gentoo.org/show_bug.cgi?id=453594

The second one has been closed recently so it may be important to re-check with the last version.
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Wed Aug 14, 2013 6:31 am    Post subject: Reply with quote

pums974 wrote:
I believe there is two bugs concerning this issue :

https://bugs.gentoo.org/show_bug.cgi?id=480066
https://bugs.gentoo.org/show_bug.cgi?id=453594

The second one has been closed recently so it may be important to re-check with the last version.

I have already tried the LVMETAD route as noted above, and it did not help. Last weekend I noticed there is now a system-lvmetad service, so I enabled that and *still* no change. Let's OpenRC is around for a long time!
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
asotirov
n00b
n00b


Joined: 06 Mar 2007
Posts: 13

PostPosted: Wed Aug 21, 2013 11:19 am    Post subject: ... Reply with quote

Me too i've tried almost anything. When logged in emerg. console just mount -a does the job which means that lvm has already been activated.
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Wed Aug 21, 2013 12:36 pm    Post subject: Re: ... Reply with quote

asotirov wrote:
Me too i've tried almost anything. When logged in emerg. console just mount -a does the job which means that lvm has already been activated.

I also see that. You can of course modify the LVM service unit to include a "mount -a" command but I have always assumed that since the mount jobs have not completed there would be problems.
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Wed Aug 21, 2013 12:42 pm    Post subject: Reply with quote

ulenrich wrote:
Perhaps try to succeed using dracut, but there is a comment in a dracut setup module:
Quote:
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
# files, but provides the one below:
inst_rules 64-device-mapper.rules

I have tried dracut but that completely fails to mount the VG! All things systemd seem doomed to fail (see).
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Wed Aug 21, 2013 3:31 pm    Post subject: Reply with quote

- First of all you have to prove the prerequisite, for example some installations have both, which is due to changing Gentoo policy but is plainly is wrong:
/lib/udev or /usr/lib/udev (respective /lib/systemd or /usr/lib/systemd)
I mean it is some double step you want to take, but the first step is to verify a proper systemd installation.

- Are you aware of the subtle difference in the CMDLINE between
PARAMETER - and - rd.PARAMETER
The later is meant for initrd consumption

- default is init=/usr/lib/systemd/systemd
also there lives a symlink at /usr/bin/systemd. I don't know what dracut makes of it, does it only copy the symlink without the real executable? Set the dracut generate loglevel high and lsinitrd to prove ...
(exists there in the initrd /usr/lib/udev/rules.d/69-dm-lvm-metad.rules)

- there is some hardwired /etc/fstab config possible with dracut.

Disclaimer: I don't use any lvm but only some devmapper functionality to mount my crypted /home. Obviously there is a german guy who managed to get lvm run by using dracut:
http://forums.gentoo.org/viewtopic-t-967752-highlight-.html
_________________
fun2gen2
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Thu Aug 22, 2013 6:17 am    Post subject: Reply with quote

That link is hardly very encouraging! My systemd set up is as installed by Gentoo and works if you nurse it a little. The genkernel route mounts the root file system and then times-out on the mounts and drops to the emergency console. Issuing "mount -a" and "systemctl default" gets you a functioning system. Booting via dracut doesn't mount anything, it doesn't even activate the VG. I will try the "rd.lvm.lv=" parameters and see what they do.
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Thu Aug 22, 2013 10:19 am    Post subject: Reply with quote

Today dracut-032 the NEWS states:
Quote:
dracut-032
==========
- add parameter --print-cmdline
This prints the kernel command line parameters for the current disk layout.
$ dracut --print-cmdline
rd.luks.uuid=luks-e68c8906-6542-4a26-83c4-91b4dd9f0471 rd.lvm.lv=debian/root rd.lvm.lv=debian/usr root=/dev/mapper/debian-root rootflags=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered rootfstype=ext4
- dracut.sh: add --persistent-policy option and persistent_policy conf option
--persistent-policy <policy>:
Use <policy> to address disks and partitions.
<policy> can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
- dracut now creates the initramfs without udevadm
that means the udev database does not have to populated
and the initramfs can be built in a chroot with
/sys /dev /proc mounted
- if $libdirs is unset, fall back to ld.so.cache paths
- always assemble /usr device in initramfs
- bash module added (disable it, if you really want dash)
- continue to boot, if the main loop times out, in systemd mode
...

You'll better wait arriving this version in Gentoo? Perhaps you got caught by some timeout? The cmdline example in front might help you regarding rd.lvm ...
_________________
fun2gen2
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Fri Aug 23, 2013 6:22 am    Post subject: Reply with quote

I tried the rd.lvm.lv parameters and of course they made absolutely no difference. However, sitting at the emergency prompt, I entered a vgscan+vgchange and everything sprung into life. I also got a lot of messages:

    The link /dev/vg00/rootfs should had been created by udev but it was not found. Falling back to direct link creation.
    The link /dev/vg00/home should had been created by udev but it was not found. Falling back to direct link creation.
    The link /dev/vg00/var should had been created by udev but it was not found. Falling back to direct link creation.

I am convinced this is the heart of the problem, I first posted about this three years ago but there was never a resolution. I have several Gentoo+LVM systems and they all produce these mesages during boot, and similar ones during shutdown. Get udev to create the nodes and the LVM problem will be solved!
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Fri Aug 23, 2013 8:03 am    Post subject: Reply with quote

Of cause udev! There is something wrong regarding:
/usr/lib/udev/rules.d/69-dm-lvm-metad.rules
Is it included in your dracut initrd?
(lsinitrd /boot/initrd|grep metad)
_________________
fun2gen2
Back to top
View user's profile Send private message
brendlefly62
n00b
n00b


Joined: 19 Dec 2009
Posts: 25

PostPosted: Sat Aug 24, 2013 1:22 am    Post subject: Reply with quote

Just to share how I have sort of circumvented the same problem... I have encrypted partition with root and several other lvm volumes made accessible by custom init script.

I circumvented the systemd - lvm problem by explicitly mounting all of my local filesystems (lvm volumes) in the initramfs init which launches systemd via busybox switch_root. I found that further commenting these volumes out of my normal /etc/fstab also eliminates the irritating systemd wait for "starting job..." to time out. Not sure if that leaves the system reliable?

Presently, since I'm just evaluating gnome-3.8.0 and still also have openRC init installed and available via secondary selection from grub menu, I have restored my original fstab, and I just wait out the systemd "starting job..." messages. Since all file systems are already mounted, when this times out (about a minute) it proceeds straight to a functioning system. Thus, I launch gnome-session via gdm enabled by systemd || or || i launch lxde via lxdm - depending on which grub menu entry I select upon boot.
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Sat Aug 24, 2013 10:23 am    Post subject: Reply with quote

ulenrich wrote:
Of cause udev! There is something wrong regarding:
/usr/lib/udev/rules.d/69-dm-lvm-metad.rules
Is it included in your dracut initrd?
(lsinitrd /boot/initrd|grep metad)

This is the output from dracut, it is skipping all the dm and lvm stuff, why?


    Executing: /usr/bin/dracut -f
    *** Including module: i18n ***
    *** Including module: dm ***
    Skipping udev rule: 64-device-mapper.rules
    Skipping udev rule: 60-persistent-storage-dm.rules
    Skipping udev rule: 55-dm.rules
    *** Including module: dmraid ***
    Skipping udev rule: 64-md-raid.rules
    *** Including module: kernel-modules ***
    Omitting driver i2o_scsi
    *** Including module: lvm ***
    Skipping udev rule: 64-device-mapper.rules
    Skipping udev rule: 56-lvm.rules
    Skipping udev rule: 60-persistent-storage-lvm.rules
    *** Including module: resume ***
    *** Including module: rootfs-block ***
    *** Including module: terminfo ***
    *** Including module: udev-rules ***
    Skipping udev rule: 91-permissions.rules
    Skipping program /lib/udev/create_floppy_devices as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/edd_id as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/firmware.sh as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/firmware as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/firmware.agent as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/hotplug.functions as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/fw_unit_symlinks.sh as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/path_id as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/input_id as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/usb_id as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/pcmcia-socket-startup as it cannot be found and is flagged to be optional
    Skipping program /lib/udev/pcmcia-check-broken-cis as it cannot be found and is flagged to be optional
    Skipping program /etc/pcmcia/config.opts as it cannot be found and is flagged to be optional
    *** Including module: systemd ***
    Skipping program /usr/lib/systemd/system/cryptsetup.target as it cannot be found and is flagged to be optional
    Skipping program /usr/lib/systemd/system/systemd-ask-password-plymouth.path as it cannot be found and is flagged to be optional
    Skipping program /usr/lib/systemd/system/systemd-ask-password-plymouth.service as it cannot be found and is flagged to be optional
    Skipping program /usr/lib/systemd/system/systemd-random-seed-load.service as it cannot be found and is flagged to be optional
    Skipping program /usr/lib/modules-load.d/*.conf as it cannot be found and is flagged to be optional
    *** Including module: base ***
    *** Including module: fs-lib ***
    Skipping program xfs_db as it cannot be found and is flagged to be optional
    Skipping program xfs_check as it cannot be found and is flagged to be optional
    Skipping program xfs_repair as it cannot be found and is flagged to be optional
    Skipping program xfs_metadump as it cannot be found and is flagged to be optional
    Skipping program jfs_fsck as it cannot be found and is flagged to be optional
    Skipping program btrfsck as it cannot be found and is flagged to be optional
    *** Including module: shutdown ***
    Skipping program kexec as it cannot be found and is flagged to be optional
    *** Including modules done ***
    *** Installing kernel module dependencies and firmware ***
    *** Installing kernel module dependencies and firmware done ***
    *** Pre-linking files ***
    *** Pre-linking files done ***
    *** Stripping files ***
    *** Stripping files done ***
    *** Creating image file ***
    *** Creating image file done ***

_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Sat Aug 24, 2013 1:05 pm    Post subject: Reply with quote

You really should bug Gentoo to upgrade dracut-032
_________________
fun2gen2
Back to top
View user's profile Send private message
binro
Guru
Guru


Joined: 06 May 2005
Posts: 517
Location: Bangkok, Thailand

PostPosted: Mon Aug 26, 2013 10:02 am    Post subject: Reply with quote

The lsinitrd showed some DM and LVM rules were in fact installed. I tried to make my own dracut-032 ebuild but there were problems. I shall have to wait for the official one.
_________________
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1159

PostPosted: Tue Aug 27, 2013 5:37 pm    Post subject: Reply with quote

Uuuups: Don't try dracut-032
That was a summer sunshine - dont care about nothing release!

(I diffed the release with its git: all over the place syntax fixes regarding variable defaults)
_________________
fun2gen2
Back to top
View user's profile Send private message
lkraav
Tux's lil' helper
Tux's lil' helper


Joined: 13 Oct 2004
Posts: 121
Location: Estonia

PostPosted: Sat Aug 31, 2013 10:30 pm    Post subject: Reply with quote

lvm2-2.02.99-r2 seems to have solved detection troubles for me.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum