]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
initscripts: populate-volatile: suppress read-only-rootfs warnings
authorAndré Draszik <adraszik@tycoint.com>
Tue, 20 Dec 2016 09:02:40 +0000 (09:02 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 22 Dec 2016 08:46:37 +0000 (08:46 +0000)
rm: can't remove '/etc/resolv.conf': Read-only file system
ln: /etc/resolv.conf: File exists

/etc/default/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.

[YOCTO #10814]

Signed-off-by: André Draszik <adraszik@tycoint.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh

index cf0d2bf9661097221e1297cce9e292bd9d7c4d0e..22a71ecaaed1e8cd0ee3fbcf45fa157717832eb1 100755 (executable)
@@ -70,7 +70,7 @@ mk_dir() {
 link_file() {
        EXEC="
        if [ -L \"$2\" ]; then
-               [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
+               [ \"\$(readlink -f \"$2\")\" != \"$1\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
        elif [ -d \"$2\" ]; then
                if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then
                        cp -a $2/* $1 2>/dev/null;