Skip to contentSkip to conversation

Btrfs Root Filesystem Remount Issue with systemd on Yocto

DISCUSSION [email protected] 2 participants 3 messages Feb 25, 2025

lore
Share & tools
lore
#0 lore raw

Hello everyone,

I'm experiencing an issue on my custom Yocto-built system where my Btrfs root filesystem (mounted as root using Btrfs) ends up being mounted read-only during boot. It appears that the systemd-remount-fs.service fails to properly remount the filesystem, even though the initial kernel mount succeeds.

*System details:*

* Yocto project build (using meta-tegra layer for Jetson Orin Nano)
* Kernel: linux-yocto 6.12.11
* Systemd: 257.3
* Root filesystem type: Btrfs

*Issue description:* During boot, the kernel mounts the Btrfs root filesystem correctly. However, later in the boot process, systemd-remount-fs attempts to remount the root and other filesystems with modified mount options, and fails with errors like “must be superuser to use mount”. This failure forces the system into maintenance mode because subsequent mounts (e.g. /tmp) also fail.

I have increased the debug log levels (using kernel parameters such as systemd.log_level=debug and udev.log_priority=debug ) to gather more detailed logs, but I’m still trying to pinpoint the exact reason for the failure. It seems likely that the new remount method introduced in systemd 257 (and later) doesn’t play well with Btrfs once the filesystem is already mounted.

*Steps already taken:*

* Verified that the initial kernel mount of Btrfs is successful.
* Confirmed that /etc/fstab contains the correct options.
* Enabled extra logging for systemd and udev to capture more debug output.
* Considered workarounds such as disabling systemd-remount-fs or adjusting mount options to avoid a remount.

*Questions:*

* Does anyone have experience with a similar issue on Yocto systems using Btrfs and systemd 257+?
* Are there any known workarounds or configuration tweaks (in fstab or systemd) that can prevent systemd-remount-fs from attempting a problematic remount?
* What additional debug steps would you recommend to isolate the issue further?

Any help or pointers to relevant documentation or similar issues would be greatly appreciated.

Thank you!

#1 lore raw
Quoted 2 lines

Issue description: During boot, the kernel mounts the Btrfs root filesystem correctly. However, later in the boot process, systemd-remount-fs attempts to remount the root and other filesystems with modified mount options, and fails with errors like “must be superuser to use mount”. This failure forces the system into maintenance mode because subsequent mounts (e.g. /tmp) also fail.

I am not suspecting the mount options, rather the permissions.

Are the device and mount points owned by UID 0 (zero)?

"The message must be superuser to use mount is a hint to a permission problem. The Linux system expects most system files to be owned by UID 0 (root)"

(source: https://stackoverflow.com/questions/71448426/mount-dev-mqueue-must-be-superuser-to-use-mount-when-starting-a-yocto-linux)

author
#2 lore raw
Quoted 3 lines

Are the device and mount points owned by UID 0 (zero)?

Using the ls -lah command on my host machine reveals that the mount point is indeed owned by my user account, not root. Strange, an image created from the scarthgap branch the same way as now on the master leads to the correct mount point permissions (root). Is there any way how I can change the owner of the mointpoint in my Yocto project?

Thanks in advance for the help!