Swap on LVM2 LV not activated on boot under systemd Reproducible: Always hpms ~ # equery l systemd lvm2 * Searching for systemd ... [IP-] [ ] sys-apps/systemd-224-r1:0/2 * Searching for lvm2 ... [IP-] [ ] sys-fs/lvm2-2.02.116:0 hpms ~ # blkid /dev/sda: UUID="3979d882-b00b-a19f-a0f2-110627aa71e5" UUID_SUB="76117c38-7c1e-0050-f2b6-e3dba7614653" LABEL="hpsm:0" TYPE="linux_raid_member" /dev/sdb: UUID="55bf24bb-28d1-377f-90fe-be71208b88bf" UUID_SUB="8b382149-7254-cb5e-fa2d-29a517a31dcc" LABEL="hpsm:1" TYPE="linux_raid_member" /dev/sdc: UUID="Y6F8T5-aomu-Vkpr-wWOb-nRiQ-3CAc-svVeLK" TYPE="LVM2_member" /dev/sdd1: LABEL="BOOT" UUID="d9761732-f0f8-46bb-8791-ebc342488ecb" TYPE="ext3" PARTUUID="d490f761-01" /dev/mapper/system-swap: LABEL="SWAP" UUID="ef485f87-471f-4795-ad12-63e31326d7cd" TYPE="swap" /dev/mapper/system-root: LABEL="ROOT" UUID="f37f9afe-e484-42b1-aca8-252fe5ffe519" TYPE="xfs" /dev/md0: UUID="HR7nBe-lioP-dw2H-UaKM-Lp70-xtBk-Lv9yca" TYPE="LVM2_member" /dev/md1: UUID="QSS10X-DJx1-lpMF-bgda-7E3s-xfIw-uOJFpC" TYPE="LVM2_member" hpms ~ # cat /etc/fstab LABEL=BOOT /boot ext3 defaults 1 2 LABEL=ROOT / xfs defaults 0 1 LABEL=SWAP none swap defaults 0 0 From journalctl -b: Aug 28 17:46:52 hpms systemd[1]: dev-disk-by\x2dlabel-SWAP.device: Job dev-disk-by\x2dlabel-SWAP.device/start timed out. Aug 28 17:46:52 hpms systemd[1]: Timed out waiting for device dev-disk-by\x2dlabel-SWAP.device. Aug 28 17:46:52 hpms systemd[1]: Dependency failed for /dev/disk/by-label/SWAP. Aug 28 17:46:52 hpms systemd[1]: Dependency failed for Swap. Aug 28 17:46:52 hpms systemd[1]: swap.target: Job swap.target/start failed with result 'dependency'. Aug 28 17:46:52 hpms systemd[1]: dev-disk-by\x2dlabel-SWAP.swap: Job dev-disk-by\x2dlabel-SWAP.swap/start failed with result 'dependency'. Aug 28 17:46:52 hpms systemd[1]: dev-disk-by\x2dlabel-SWAP.device: Job dev-disk-by\x2dlabel-SWAP.device/start failed with result 'timeout'. hpms ~ # tree /dev/disk /dev/disk ├── by-id │ ├── ata-SPCC_Solid_State_Disk_P1501496000000008618 -> ../../sdc │ ├── ata-ST3000DM001-1CH166_Z1F4EYER -> ../../sda │ ├── ata-WDC_WD6400AAKS-00A7B0_WD-WCASY1072633 -> ../../sdb │ ├── lvm-pv-uuid-HR7nBe-lioP-dw2H-UaKM-Lp70-xtBk-Lv9yca -> ../../md0 │ ├── lvm-pv-uuid-QSS10X-DJx1-lpMF-bgda-7E3s-xfIw-uOJFpC -> ../../md1 │ ├── lvm-pv-uuid-Y6F8T5-aomu-Vkpr-wWOb-nRiQ-3CAc-svVeLK -> ../../sdc │ ├── md-name-hpsm:0 -> ../../md0 │ ├── md-name-hpsm:1 -> ../../md1 │ ├── md-uuid-3979d882:b00ba19f:a0f21106:27aa71e5 -> ../../md0 │ ├── md-uuid-55bf24bb:28d1377f:90febe71:208b88bf -> ../../md1 │ ├── usb-HP_iLO_Internal_SD-CARD_000002660A01-0:0 -> ../../sdd │ ├── usb-HP_iLO_Internal_SD-CARD_000002660A01-0:0-part1 -> ../../sdd1 │ ├── wwn-0x5000c50065b3a70b -> ../../sda │ └── wwn-0x50014ee2ac535b04 -> ../../sdb ├── by-label │ └── BOOT -> ../../sdd1 ├── by-path │ ├── pci-0000:00:1d.0-usb-0:1.3.1:1.0-scsi-0:0:0:0 -> ../../sdd │ └── pci-0000:00:1d.0-usb-0:1.3.1:1.0-scsi-0:0:0:0-part1 -> ../../sdd1 └── by-uuid └── d9761732-f0f8-46bb-8791-ebc342488ecb -> ../../sdd1 hpms ~ # free total used free shared buff/cache available Mem: 10205756 50300 10086864 412 68592 10108856 Swap: 0 0 0 hpms ~ # swapon -a hpms ~ # swapon -s Filename Type Size Used Priority /dev/mapper/system-swap partition 4194300 0 -1 hpms ~ # free total used free shared buff/cache available Mem: 10205756 51376 10084988 412 69392 10107732 Swap: 4194300 0 4194300
Please attach output of "emerge --info systemd lvm2" so we can see which USE flags you have enabled, kernel version, etc.
To summarize the information dump above: the swap device never shows up under /dev/by-label/SWAP, so systemd never sees it and times out after 90 seconds.
Created attachment 410540 [details] emerge.info.txt emerge --info systemd lvm2 attached
This thread looks relevent. http://thread.gmane.org/gmane.comp.sysutils.systemd.devel/6292 What are you using to generate your initramfs?
I use better-initramfs https://bitbucket.org/piotrkarbowski/better-initramfs
I have contacted Piotr Karbowski, maintainer of better initramfs, probably he can help. Tomorrow I will try genkernel.
Could you give dracut a try, at least as a troubleshooting step? I have no experience with "better-initramfs", and we don't have it packaged on Gentoo.
(In reply to Mike Gilbert from comment #2) > To summarize the information dump above: the swap device never shows up > under /dev/by-label/SWAP, so systemd never sees it and times out after 90 > seconds. Seems like the root cause. better-initramfs uses `findfs` to resolve LABEL= to a block device. It does not create /dev/disk/by-label/* nodes at all. By default, if possible, it does mount devtmpfs under /dev, then start lvm. LVM itself is unlikely to do the /dev/disk/by-label/ symlinks, at the end of initramfs's init phase, the /dev is mount-moved to /newroot/dev and switch_root is executed to follow up with the 'real' init system. Back in the days I used udev I remember that udev init script had a trigger that was resulting in creating all the nodes so I did not ever run into such issue. At this moment I run mdev on all my boxes and the mdev init script (from mdev-like-a-boss) does create the /dev/disk/by-*/* symlinks, thus I cannot reproduce this issue. As by default better-initramfs uses devtmpfs and no a mdev as a hotplug agent, meaning creating the by-* symlinks would be a bit tricky, but I could hook it into the findfs thing I think. I will try to address it at initramfs level tomorrow. fwiw unless systemd-udev is supposed to create the symlinks, even when lvm is *already* assembled when systemd starts, this bug should be marked as a not a gentoo issue.
Yep, with dracut's initramfs - swap enabled: hpms ~ # tree /dev/disk /dev/disk ├── by-id │ ├── ata-SPCC_Solid_State_Disk_P1501496000000008618 -> ../../sdc │ ├── ata-ST3000DM001-1CH166_Z1F4EYER -> ../../sda │ ├── ata-WDC_WD6400AAKS-00A7B0_WD-WCASY1072633 -> ../../sdb │ ├── dm-name-system-root -> ../../dm-1 │ ├── dm-name-system-swap -> ../../dm-0 │ ├── dm-uuid-LVM-GCxB8wxuSkd0FhD7rT8hm0qfkxXA6c1peGaMerf11YlnjVe384H1y0ND4JGb1gYj -> ../../dm-0 │ ├── dm-uuid-LVM-GCxB8wxuSkd0FhD7rT8hm0qfkxXA6c1pKXbmXQKNQW6HNI5mt6aQpok0pMk3A5tq -> ../../dm-1 │ ├── lvm-pv-uuid-HR7nBe-lioP-dw2H-UaKM-Lp70-xtBk-Lv9yca -> ../../md0 │ ├── lvm-pv-uuid-QSS10X-DJx1-lpMF-bgda-7E3s-xfIw-uOJFpC -> ../../md1 │ ├── lvm-pv-uuid-Y6F8T5-aomu-Vkpr-wWOb-nRiQ-3CAc-svVeLK -> ../../sdc │ ├── md-name-hpsm:0 -> ../../md0 │ ├── md-name-hpsm:1 -> ../../md1 │ ├── md-uuid-3979d882:b00ba19f:a0f21106:27aa71e5 -> ../../md0 │ ├── md-uuid-55bf24bb:28d1377f:90febe71:208b88bf -> ../../md1 │ ├── usb-HP_iLO_Internal_SD-CARD_000002660A01-0:0 -> ../../sdd │ ├── usb-HP_iLO_Internal_SD-CARD_000002660A01-0:0-part1 -> ../../sdd1 │ ├── wwn-0x5000c50065b3a70b -> ../../sda │ └── wwn-0x50014ee2ac535b04 -> ../../sdb ├── by-label │ ├── BOOT -> ../../sdd1 │ ├── ROOT -> ../../dm-1 │ └── SWAP -> ../../dm-0 ├── by-path │ ├── pci-0000:00:1d.0-usb-0:1.3.1:1.0-scsi-0:0:0:0 -> ../../sdd │ └── pci-0000:00:1d.0-usb-0:1.3.1:1.0-scsi-0:0:0:0-part1 -> ../../sdd1 └── by-uuid ├── d9761732-f0f8-46bb-8791-ebc342488ecb -> ../../sdd1 ├── ef485f87-471f-4795-ad12-63e31326d7cd -> ../../dm-0 └── f37f9afe-e484-42b1-aca8-252fe5ffe519 -> ../../dm-1 hpms ~ # free total used free shared buff/cache available Mem: 10205756 49444 10093184 408 63128 10110452 Swap: 4194300 0 4194300 Please, close bug.
(In reply to Piotr Karbowski from comment #8) > fwiw unless systemd-udev is supposed to create the symlinks, even when lvm > is *already* assembled when systemd starts, this bug should be marked as a > not a gentoo issue. Rhe /dev/disk/by-label symlinks get created in /lib/udev/13-dm-disk.rules. This rule would only fire when it gets an add or change event for a dm device. If lvm already created the device in the initramfs, this event would never happen. In other words, if udev is not running before you activate lvm, you may have problems.
I am not sure what we can do in systemd side then for letting that initram creation tool to work :/