Bug 10814

Summary: populate-volatile.sh causes confusing boot messages with read-only-rootfs
Product: [Build System, Metadata & Runtime] OE-Core Reporter: André Draszik <byo>
Component: coreAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: jacob.kroon, meta.mr.watcher, meta.watcher, sgw
Version: unspecified   
Target Milestone: 2.3 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
suggested patch none

Description André Draszik 2016-12-15 15:32:15 UTC
rm: can't remove '/etc/resolv.conf': Read-only file system
ln: /etc/resolv.conf: File exists


recipes-core/initscripts/initscripts-1.0/volatiles contains an entry:
l root root 0644 /etc/resolv.conf /var/run/resolv.conf

which causes populate-volatile.sh to execute the following in link_file():
  if [ -L \"$2\" ]; then
    [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
  elif [ -d \"$2\" ]; then
    ...

At the time the image is created, /etc/resolv.conf is already a symlink to /var/run/resolv.conf, but at boot time when populate-volatiles.sh is run, /var/run/resolv.conf doesn't exist, causing it to try to rm -f and ln -sf which of course fails due to the read-only filesystem.

I would suggest to remove the readlink check on $1 as per the attached patch.
Comment 1 André Draszik 2016-12-15 15:37:26 UTC
Created attachment 3563 [details]
suggested patch
Comment 2 Ross Burton 2016-12-15 15:59:14 UTC
That code has more backslashes than other characters!

Can you submit the patch to the list please?
Comment 3 André Draszik 2017-01-18 10:52:15 UTC
It looks like this has been merged http://git.openembedded.org/openembedded-core/commit/?id=765ee275f5499254b1f09e394c757072bea5f459 so this can probably be closed :-)
Comment 4 Jacob Kroon 2019-08-19 11:33:46 UTC
I'm still seeing these warnings in my distro, using master as of today:

...
Starting udev
rm: can't remove ´/tmp´: Read-only file system
rm: can't remove ´/etc/resolv.conf´: Read-only file system
ln: /etc/resolv.conf: File exists
INIT: Entering runlevel: 5
...

This is with sysvinit, no systemd.

I've been using Martin's patch here:

http://lists.openembedded.org/pipermail/openembedded-core/2018-July/152886.html

to silence them locally, but the patch never got merged, and I can't tell if the patch is correct or not.
Comment 5 Jacob Kroon 2019-08-19 12:07:54 UTC
Just to clarify, the warnings above is when I *don't* use Martin's patch. They go away when patch is applied.
Comment 6 Jacob Kroon 2019-08-29 11:45:57 UTC
Patch has been merged now:

commit fb028a0a25c02ab56ad262afd8e6e9495a44673d
Author: Martin Hundebøll <martin@geanix.com>
Date:   Wed Aug 21 12:25:53 2019 +0200