Repository navigation
Description
systemd version the issue has been seen with
255.4
Used distribution
Custom built BSP-firmware using ptxdist
Linux kernel version used
6.9.12
CPU architectures issue was seen on
aarch64
Component
systemd-gpt-auto-generator, systemd-repart
Expected behaviour you didn't see
systemd-growfs-root.service should not be configured to run.
Unexpected behaviour you saw
growfs-root.service being added by/to generator.late.
[FAILED] Failed to start systemd-growfs-root.service.
root 00:00 : ~ # find / -name "growfs"
find: /proc/259: No such file or directory
/run/systemd/generator.late/local-fs.target.d/50-order-systemd-growfs-root.service.conf
/run/systemd/generator.late/-.mount.wants/systemd-growfs-root.service
find: /media/usb0: No such device
/usr/lib/systemd/system/[email protected]
/usr/lib/systemd/system/systemd-growfs-root.service
/usr/lib/systemd/systemd-growfs
The failing of the service due to rootfs being ro is not the issue I want to address, but it's mere presence.
Steps to reproduce the problem
Steps
- Run systemd-repart as configured. Please see below (we only run systemd-repart during rc.once).
- Reboot
Additional Info
It seems like gpt-auto-generator generates the drop-in when it finds GUID:59 in the other/unbooted partition.
Additional program output to the terminal or log subsystem illustrating the issue
root 05:28 : ~ # sfdisk -l /dev/mmcblk2
Disk /dev/mmcblk2: 3.64 GiB, 3909091328 bytes, 7634944 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 6FF14787-3191-4269-B06D-BB7FBC884AA2
Device Start End Sectors Size Type
/dev/mmcblk2p1 2048 4095 2048 1M Linux filesystem
/dev/mmcblk2p2 4096 2101247 2097152 1G Linux root (ARM-64)
/dev/mmcblk2p3 2101248 4198399 2097152 1G Linux root (ARM-64)
/dev/mmcblk2p4 4198400 7634903 3436504 1.6G Linux filesystem
root 05:32 : ~ # sfdisk --part-attrs /dev/mmcblk2 2
root 05:32 : ~ # sfdisk --part-attrs /dev/mmcblk2 3
GUID:59
root 14:57 : ~ # cat /etc/rc.once.d/repart
#!/bin/sh
if systemd-analyze condition "ConditionKernelCommandLine=!root=/dev/nfs"; then
echo "Repartitioning the root disk"
systemd-repart --dry-run=no --definitions=/etc/repart.rc-once.d/
echo "Growing the current root partition"
/usr/lib/systemd/systemd-growfs /
else
echo "Skipping repart in rc.once while running NFS boot"
exit 0
fi
root 14:57 : ~ # for f in $(ls /etc/repart.rc-once.d/*); do echo "'cat $f'"; cat $f; echo; done
'cat /etc/repart.rc-once.d/50-barebox-environment.conf'
[Partition]
Type=linux-generic
Label=barebox-environment
'cat /etc/repart.rc-once.d/50-system0.conf'
[Partition]
Type=root
Label=system0
SizeMinBytes=1G
SizeMaxBytes=1G
Priority=10
'cat /etc/repart.rc-once.d/50-system1.conf'
[Partition]
Type=root
Label=system1
Format=ext4
SizeMinBytes=1G
SizeMaxBytes=1G
Priority=20
'cat /etc/repart.rc-once.d/60-appdata.conf'
[Partition]
Type=linux-generic
Label=appdata
Format=ext4
SizeMinBytes=1G
SizeMaxBytes=4G
Priority=30
Weight=2000
Activity
tksc commentedon Oct 15, 2024
Any thoughts on that one?
poettering commentedon Oct 15, 2024
So the gpt-generator always generates the units for the "newest" root partition it finds on the dissected disk. it dtermines "newest" by doing a (slightly modified) strverscmp() compare on all matching root disks. This means your "system1" partition will always win.
what it currently does not take into consideration is what is already mounted. that's partly because it is already invoked in the initrd, where nothing should be mounted, and partly because we want that generators are "idempotent" to some point, i.e. that they come to the same results given the same inputs. And while config files and kernel cmdline are clearly valid "inputs" for this, it's not entirely clear the root fs is.
But i guess, it is surprising what happens here. hence, maybe we should tweak the dissection logic so that it takes into consideration the current rootfs when figuring out which root fs to use. Happy to review a patch for this
[-]gpt-auto-generator should not regard GUID:59 in redundant / unbooted root partition[/-][+]gpt-auto-generator: when dissecting partition table, and multiple root partitions are available, always prefer the one already mounted to / if that exists[/+]udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
udev-builtin-blkid: look for ESP/XBOOTLDR only in initrd; afterwards …
two udev blkid builtin tweaks (#36968)
udev: new "image_dissect" builtin that can be used to generate symlin…