Resize correct root partition in image mode
By default, cloud-init attempts to resize what is mounted at /. Image mode has the root filesystem mounted at /sysroot which results in the following errors cropping up in a cloud-init run
2025-05-22 22:39:37,696 - cc_growpart.py[DEBUG]: '/' SKIPPED: stat of 'composefs' failed: [Errno 2] No such file or directory: 'composefs'
2025-05-22 22:39:37,697 - handlers.py[DEBUG]: finish: init-network/config-growpart: SUCCESS: config-growpart ran successfully
2025-05-22 22:39:37,697 - modules.py[DEBUG]: Running module resizefs (<module 'cloudinit.config.cc_resizefs' from '/usr/lib/python3.9/site-packages/cloudinit/config/cc_resizefs.py'>) with frequency always
2025-05-22 22:39:37,697 - handlers.py[DEBUG]: start: init-network/config-resizefs: running config-resizefs with frequency always
2025-05-22 22:39:37,697 - helpers.py[DEBUG]: Running config-resizefs using lock (<cloudinit.helpers.DummyLock object at 0x7ff2dd1bad90>)
2025-05-22 22:39:37,697 - util.py[DEBUG]: Reading from /proc/2415/mountinfo (quiet=False)
2025-05-22 22:39:37,697 - util.py[DEBUG]: Read 3665 bytes from /proc/2415/mountinfo
2025-05-22 22:39:37,697 - cc_resizefs.py[DEBUG]: resize_info: dev=composefs mnt_point=/ path=/
2025-05-22 22:39:37,697 - cc_resizefs.py[DEBUG]: 'composefs' doesn't appear to be a valid device path. Trying '/dev/composefs'
2025-05-22 22:39:37,697 - cc_resizefs.py[WARNING]: Device '/dev/composefs' did not exist. cannot resize: dev=composefs mnt_point=/ path=/
This is also misleading, because the actual resize of /sysroot is handled via bootc-generic-growpart.service anyways
This merge request changes the defaults to attempt to resize /sysroot and ignore / instead. It felt right to disable resize_rootfs as well, because it purely deals with the root filesystem (that is, what is mounted at /).
After this change, no warnings are seen in cloud-init logs
2025-05-26 22:12:34,941 - modules.py[DEBUG]: Running module growpart (<module 'cloudinit.config.cc_growpart' from '/usr/lib/python3.9/site-packages/cloudinit/config/cc_growpart.py'>) with frequency always
2025-05-26 22:12:34,941 - handlers.py[DEBUG]: start: init-network/config-growpart: running config-growpart with frequency always
2025-05-26 22:12:34,942 - helpers.py[DEBUG]: Running config-growpart using lock (<cloudinit.helpers.DummyLock object at 0x7f74ef7c40d0>)
2025-05-26 22:12:34,942 - subp.py[DEBUG]: Running command ['growpart', '--help'] with allowed return codes [0] (shell=False, capture=True)
2025-05-26 22:12:34,947 - util.py[DEBUG]: Reading from /proc/2718/mountinfo (quiet=False)
2025-05-26 22:12:34,948 - util.py[DEBUG]: Read 3680 bytes from /proc/2718/mountinfo
2025-05-26 22:12:34,948 - util.py[DEBUG]: Reading from /sys/class/block/nvme0n1p3/partition (quiet=False)
2025-05-26 22:12:34,948 - util.py[DEBUG]: Read 2 bytes from /sys/class/block/nvme0n1p3/partition
2025-05-26 22:12:34,948 - util.py[DEBUG]: Reading from /sys/devices/pci0000:00/0000:00:04.0/nvme/nvme0/nvme0n1/dev (quiet=False)
2025-05-26 22:12:34,948 - util.py[DEBUG]: Read 6 bytes from /sys/devices/pci0000:00/0000:00:04.0/nvme/nvme0/nvme0n1/dev
2025-05-26 22:12:35,099 - subp.py[DEBUG]: Running command ['growpart', '--dry-run', '/dev/nvme0n1', '3'] with allowed return codes [0] (shell=False, capture=True)
2025-05-26 22:12:35,181 - util.py[DEBUG]: resize_devices took 0.234 seconds
2025-05-26 22:12:35,181 - cc_growpart.py[DEBUG]: '/sysroot' NOCHANGE: no change necessary (/dev/nvme0n1, 3)
2025-05-26 22:12:35,181 - handlers.py[DEBUG]: finish: init-network/config-growpart: SUCCESS: config-growpart ran successfully
2025-05-26 22:12:35,181 - modules.py[DEBUG]: Running module resizefs (<module 'cloudinit.config.cc_resizefs' from '/usr/lib/python3.9/site-packages/cloudinit/config/cc_resizefs.py'>) with frequency always
2025-05-26 22:12:35,181 - handlers.py[DEBUG]: start: init-network/config-resizefs: running config-resizefs with frequency always
2025-05-26 22:12:35,182 - helpers.py[DEBUG]: Running config-resizefs using lock (<cloudinit.helpers.DummyLock object at 0x7f74ef7c4130>)
2025-05-26 22:12:35,182 - cc_resizefs.py[DEBUG]: Skipping module named resizefs, resizing disabled
2025-05-26 22:12:35,182 - handlers.py[DEBUG]: finish: init-network/config-resizefs: SUCCESS: config-resizefs ran successfully
You could also disable growpart completely, but there are uses for it beyond the root partition, and this felt like the better fix