Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 601578

Summary: sys-apps/systemd - systemd-gpt-auto-generator and systemd-fstab-generator generate duplicate unit files for swap partitions in some cases
Product: Gentoo Linux Reporter: Matthias Nagel <matthias.nagel>
Component: Current packagesAssignee: Gentoo systemd Team <systemd>
Status: RESOLVED UPSTREAM    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Matthias Nagel 2016-12-04 11:42:38 UTC
I have a pure UEFI system (kernel with EFI stub support), I do not use a ramdisk and have a GTP partition scheme.

My kernel is loaded as follows

bzImage-4.8.12.efi ro root=/dev/sda5 rootfstype=ext4 resume=/dev/sda4 init=/usr/lib/systemd/systemd quiet

(N.b.: I must use the names of the device files for the partitions, because I do not have a ramdisk.)

My /etc/fstab is

LABEL=BOOT  /boot  vfat  noatime,ro              1 2
LABEL=ROOT  /      ext4  noatime,acl,user_xattr  0 1
LABEL=SWAP  none   swap  sw                      0 0
LABEL=HOME  /home  ext4  noatime,acl,user_xattr  0 2

During startup two unit files for the same swap partition are created:
(a) /run/systemd/generator/dev-disk-by\x2dlabel-SWAP.swap
(b) /run/systemd/generator.late/swap.target.wants/dev-sda4.swap

(a) is created by systemd-fstab-generator, (b) is created by systemd-gpt-auto-generator

Full file layout (find /run/systemd/ -name '*swap*')
/run/systemd/generator.late/swap.target.wants
/run/systemd/generator.late/swap.target.wants/dev-sda4.swap
/run/systemd/generator.late/dev-sda4.swap
/run/systemd/generator/swap.target.requires
/run/systemd/generator/swap.target.requires/dev-disk-by\x2dlabel-SWAP.swap
/run/systemd/generator/dev-disk-by\x2dlabel-SWAP.swap

Of course, one of the unit files fails during start-up because the swap partition has already been mounted by the other unit file and this triggers annoying warning during start-up.
Comment 1 Matthias Nagel 2016-12-04 11:44:32 UTC
Sorry, I did a copy-and-paste error. Of course, the paths of the two unit files are:
(a) /run/systemd/generator/dev-disk-by\x2dlabel-SWAP.swap
(b) /run/systemd/generator.late/dev-sda4.swap
Comment 2 Mike Gilbert gentoo-dev 2018-02-26 22:18:13 UTC
If you still experience this issue, please report it upstream.