Wind River Support Network

HomeDefectsLIN9-5175
Fixed

LIN9-5175 : unable to mount LVM partition when booting

Created: Aug 31, 2017    Updated: Mar 4, 2019
Resolved Date: Oct 16, 2017
Found In Version: 9.0.0.9
Fix Version: 9.0.0.11
Severity: Severe
Applicable for: Wind River Linux 9
Component/s: Userspace

Description

The system does not boot normally when using LVM inside /etc/fstab 
It fails with the following error: 
[FAILED] Failed to start LVM2 PV scan on device 3:1.
See 'systemctl status lvm2-pvscan@3:1.service' for details.

Workaround

Disable the WRL9 lvm2 services and create a new one, based on the one from WRL8

 # systemctl disable lvm2-lvmetad.service
 # systemctl disable lvm2-lvmetad.socket
 # systemctl disable lvm2-monitor.service
 # systemctl disable lvm2-pvscan@.service
 # systemctl mask lvm2-lvmetad.service
 # systemctl mask lvm2-lvmetad.socket
 # systemctl mask lvm2-monitor.service
 # systemctl mask lvm2-pvscan@.service

 # cat > /lib/systemd/system/lvm2.service << EOF
[Unit]
Description=LVM activation
DefaultDependencies=no
Before=local-fs.target

[Service]
ExecStart=/usr/sbin/vgchange -ay --sysinit
Type=oneshot
TimeoutSec=0
RemainAfterExit=yes

[Install]
WantedBy=sysinit.target

EOF

 # systemctl enable lvm2.service

Steps to Reproduce

1. Clone the cgl branch of wrlinux9
$ git clone --branch WRLINUX_9_LTS_CVE   https://windshare.windriver.com/ondemand/remote.php/gitsmart/WRLinux-9-LTS-CVE/wrlinux-9

2. Configure a project with: 
$ ./wrlinux-9/setup.sh --machines qemux86-64 intel-x86-64 --distro wrlinux-cgl --layers wr-cgl --templates feature/kvm feature/vm-guest-support feature/wr-hp-support feature/syslog-ng feature/LAMP feature/installer-support feature/target-toolchain feature/gdb feature/oprofile feature/system-stats feature/valgrind feature/cgp-full 

3. Source the environment
$ source oe-init-buil-env

4. change BB_NO_NETWORK to 0 in conf/local.conf

5. build the cgl image
$ bitbake wrlinux-image-glibc-cgl

6. create an aditional disk image for qemu
$ ./tmp/sysroots/x86_64-linux/usr/bin/qemu-img create -f qcow hd0.vdisk 5000M

7. Run the qemu image with the following command:
$ runqemu qemux86-64 nographic qemuparams="hd0.vdisk -boot order=c" bootparams="selinux=0"

9. Create a new partition for LVM volumes
# fdisk /dev/hda
Press n for a new partition.
Press p for a primary partition.
Partition number (1-4): 1
Enter the default first cylinder by pressing Enter.
Last cylinder or +size or +sizeM or +sizeK (2-400, default 400):
Set the type of partition by pressing t.
Choose the partition you created in the previous steps. In this example, the partition number is 1.
Enter 8e for a Linux LVM partition.
write changes to disk and quit.
Command (m for help): w
Command (m for help): q

10. Use lvmdiskscan to list the devices capable of being used as a physical volume. Then create a physical volume on one of them: 
# pvcreate /dev/hda1

11. Create a volume group:
# vgcreate vg_opt /dev/hda1

12. Create logical volumes:
# lvcreate -L 4G vg_opt -n lv_opt
mkfs.ext4 /dev/mapper/vg_opt-lv_opt
mount /dev/mapper/vg_opt-lv_opt /opt

13. Create a mountpoint in /etc/fstab as such:
/dev/mapper/vg_opt-lv_opt /opt 		  ext4 	     async,atime,auto,dev,exec,rw,suid,nouser 1 2

14. Reboot

After the reboot, the pvscan service will fail with a similar error:
[FAILED] Failed to start LVM2 PV scan on device 3:1.
See 'systemctl status lvm2-pvscan@3:1.service' for details.

Other Downloads


Live chat
Online