Bug 16056

Summary: populate-volatile.sh fails with read-only-rootfs
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Andrea Moretto <moretto.andrea>
Component: coreAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: ccasciato, meta.mr.watcher, meta.watcher, moretto.andrea, poky.bs.watcher, poky.watcher, randy.macleod
Version: 5.3   
Target Milestone: 6.0   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Andrea Moretto 2025-11-07 08:53:58 UTC
| NOTE: Executing read_only_rootfs_hook ...
| DEBUG: Executing shell function read_only_rootfs_hook
| Populating volatile Filesystems.
| /workdir/build/tmp/work/orange_pi_zero2-poky-linux/core-image-base/1.0/rootfs/etc/init.d/populate-volatile.sh: line 223: /proc/cmdline: Permission denied
| WARNING: /workdir/build/tmp/work/orange_pi_zero2-poky-linux/core-image-base/1.0/temp/run.read_only_rootfs_hook.122:194 exit 1 from '/workdir/build/tmp/work/orange_pi_zero2-poky-linux/core-image-base/1.0/rootfs/etc/init.d/populate-volatile.sh'
| WARNING: Backtrace (BB generated script):
| 	#1: read_only_rootfs_hook, /workdir/build/tmp/work/orange_pi_zero2-poky-linux/core-image-base/1.0/temp/run.read_only_rootfs_hook.122, line 194
| 	#2: main, /workdir/build/tmp/work/orange_pi_zero2-poky-linux/core-image-base/1.0/temp/run.read_only_rootfs_hook.122, line 205
| DEBUG: Python function do_rootfs finished
ERROR: Task (/workdir/build/../sources/poky/meta/recipes-core/images/core-image-base.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 6617 tasks of which 6616 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /workdir/build/../sources/poky/meta/recipes-core/images/core-image-base.bb:do_rootfs
    log: /workdir/build/tmp/work/orange_pi_zero2-poky-linux/core-image-base/1.0/temp/log.do_rootfs.122
Summary: There was 1 ERROR message, returning a non-zero exit code.
Comment 1 Randy MacLeod 2025-11-13 15:36:00 UTC
We're not seeing this on the YP AB.

What distro are you using to build and is  /proc/cmdline readable?
Ultimately, we shouldn't be reading the host machine /proc/cmdline
so we'll put a check in place.
Comment 2 Andrea Moretto 2025-11-13 15:56:58 UTC
I am building on docker with image "crops/poky:ubuntu-22.04".

/proc/cmdline is readable in the host:

pokyuser@1da421201e77:/workdir/build$ cat /proc/cmdline 
BOOT_IMAGE=(hd3,gpt2)/vmlinuz-6.17.7-300.fc43.x86_64 root=/dev/mapper/ssd-root ro rd.lvm.lv=ssd/root rhgb quiet iommu=pt intel_iommu=on
pokyuser@1da421201e77:/workdir/build$ uname -a
Linux 1da421201e77 6.17.7-300.fc43.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Nov  2 15:30:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
pokyuser@1da421201e77:/workdir/build$
Comment 3 Ross Burton 2025-11-13 16:13:24 UTC
That's interesting. I wonder if the problem is that it's running under pseudo when it breaks.  Can you stat /proc/cmdline inside the container?

However, I have a fix, because checking the kernel flags at rootfs-time is wrong.  Would you be able to verify that https://gitlab.com/rossburton/openembedded-core/-/commit/f9bd584b58757cbf9e66e07b8c77539e09f94157 fixes the build for you?
Comment 4 Andrea Moretto 2025-11-13 16:19:13 UTC
pokyuser@1f6d65711241:/workdir/build$ stat /proc/cmdline
  File: /proc/cmdline
  Size: 136       	Blocks: 0          IO Block: 1024   regular file
Device: 8dh/141d	Inode: 4026532015  Links: 1
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-11-13 16:16:54.876135386 +0000
Modify: 2025-11-13 16:16:54.876135386 +0000
Change: 2025-11-13 16:16:54.876135386 +0000
 Birth: -

I have patched in a similar way as the patch you suggested (basically checking if the file exists before reading from it), and it fixes the build.
Comment 5 Ross Burton 2026-05-21 15:03:55 UTC
Merged in 52a6a9f23587cab65c76b6e9c9ec9721563854e0.