Bug 10814 - populate-volatile.sh causes confusing boot messages with read-only-rootfs
Summary: populate-volatile.sh causes confusing boot messages with read-only-rootfs
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.3 M3
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-12-15 15:32 UTC by André Draszik
Modified: 2019-08-29 11:45 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
suggested patch (1.94 KB, patch)
2016-12-15 15:37 UTC, André Draszik
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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