Bug 11331 - volatile-binds preventing systemd-resolved to work
Summary: volatile-binds preventing systemd-resolved to work
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.4 M1
Assignee: Maxin B. John
QA Contact:
URL:
Whiteboard: Please also backport to 2.3.1
: 11969 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-04-11 15:27 UTC by Andrea Galbusera
Modified: 2018-12-25 03:12 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Galbusera 2017-04-11 15:27:47 UTC
Seems like commit fcd48092d7bcab0cad2606e65332da62420935ad (From OE-Core rev: 4a44a7658cebafab336f061f270b6ff44150a6d6) shadowed tmpfiles.d/etc.conf provided by systemd recipe. 

If resolved is enabled in systemd, at least creating a symlink from /etc/resolv.conf to /run/systemd/resolve/resolv.conf is required for resolution to work as expected.


root@raspberrypi3:~# systemd-resolve google.com     
google.com: 216.58.205.78

-- Information acquired via protocol DNS in 226.7ms.
-- Data is authenticated: no

while...

root@raspberrypi3:~# ping google.com
ping: bad address 'google.com'

Putting the aforementioned symlink in place bring back the expected behaviour.
Did not investigate if any other shadowed tmpfile.d affects normal operation.
Comment 1 Ross Burton 2017-06-06 11:36:36 UTC
Maxin, can you take this one please?
Comment 2 Maxin B. John 2017-06-07 14:39:49 UTC
Similar failure in sysvinit as well (/etc/resolv.conf file exists, but it is empty)

rm: cannot remove '/tmp': Read-only file system
rm: cannot remove '/etc/resolv.conf': Read-only file system
ln: failed to create symbolic link '/etc/resolv.conf': Read-only file system
INIT: Entering runlevel: 5
Comment 3 Maxin B. John 2017-06-08 12:40:41 UTC
We can provide a fix by creating a symlink from  /run/systemd/resolve/resolv.conf to /etc/resolv.conf with "resolved" enabled in systemd. 

However, that breaks the images (eg: core-image-sato) where resolution is handled by connman:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=6700
The workaround for this bug was to disable "resolved" and "networkd" in systemd.

+PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved"
+PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd"
Comment 4 Maxin B. John 2017-06-08 12:56:29 UTC
For "read-only" filesystem, creating link from "/var/run/connman/resolv.conf", to "/etc/resolv.conf" fails.


# systemctl status systemd-tmpfiles-setup.service

[[0;1;31m●[[0m systemd-tmpfiles-setup.service - Create Volatile Files and Directories
   Loaded: loaded (/lib/systemd/system/systemd-tmpfiles-setup.service; static; vendor preset: enabled)
   Active: [[0;1;31mfailed[[0m (Result: exit-code) since Thu 2017-06-08 12:53:56 UTC; 36s ago
     Docs: man:tmpfiles.d(5)
           man:systemd-tmpfiles(8)
  Process: 366 ExecStart=/bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev [[0;1;31m(code=exited, status=1/FAILURE)[[0m
 Main PID: 366 (code=exited, status=1/FAILURE)

Jun 08 12:53:56 qemux86-64 systemd[1]: Starting Create Volatile Files and Directories...
Jun 08 12:53:56 qemux86-64 systemd-tmpfiles[366]: [[0;1;31msymlink(/var/run/connman/resolv.conf, /etc/resolv.conf) failed: Read-only file system[[0m
Jun 08 12:53:56 qemux86-64 systemd-tmpfiles[366]: [[0;1;39m"/var/log" already exists and is not a directory.[[0m
Jun 08 12:53:56 qemux86-64 systemd-tmpfiles[366]: [[0;1;39m"/var/tmp" already exists and is not a directory.[[0m
Jun 08 12:53:56 qemux86-64 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Main process exited, code=exited, status=1/FAILURE[[0m
Jun 08 12:53:56 qemux86-64 systemd[1]: [[0;1;31mFailed to start Create Volatile Files and Directories.[[0m
Jun 08 12:53:56 qemux86-64 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Unit entered failed state.[[0m
Jun 08 12:53:56 qemux86-64 systemd[1]: [[0;1;39msystemd-tmpfiles-setup.service: Failed with result 'exit-code'.[[0m
Comment 5 Maxin B. John 2017-06-08 14:39:23 UTC
(In reply to comment #4)
> For "read-only" filesystem, creating link from
> "/var/run/connman/resolv.conf", to "/etc/resolv.conf" fails.
> 
> 
> # systemctl status systemd-tmpfiles-setup.service
> 
> [[0;1;31m●[[0m systemd-tmpfiles-setup.service - Create Volatile Files and
> Directories
>    Loaded: loaded (/lib/systemd/system/systemd-tmpfiles-setup.service;
> static; vendor preset: enabled)
>    Active: [[0;1;31mfailed[[0m (Result: exit-code) since Thu 2017-06-08
> 12:53:56 UTC; 36s ago
>      Docs: man:tmpfiles.d(5)
>            man:systemd-tmpfiles(8)
>   Process: 366 ExecStart=/bin/systemd-tmpfiles --create --remove --boot
> --exclude-prefix=/dev [[0;1;31m(code=exited, status=1/FAILURE)[[0m
>  Main PID: 366 (code=exited, status=1/FAILURE)
> 
> Jun 08 12:53:56 qemux86-64 systemd[1]: Starting Create Volatile Files and
> Directories...
> Jun 08 12:53:56 qemux86-64 systemd-tmpfiles[366]:
> [[0;1;31msymlink(/var/run/connman/resolv.conf, /etc/resolv.conf) failed:
> Read-only file system[[0m
> Jun 08 12:53:56 qemux86-64 systemd-tmpfiles[366]: [[0;1;39m"/var/log"
> already exists and is not a directory.[[0m
> Jun 08 12:53:56 qemux86-64 systemd-tmpfiles[366]: [[0;1;39m"/var/tmp"
> already exists and is not a directory.[[0m
> Jun 08 12:53:56 qemux86-64 systemd[1]:
> [[0;1;39msystemd-tmpfiles-setup.service: Main process exited, code=exited,
> status=1/FAILURE[[0m
> Jun 08 12:53:56 qemux86-64 systemd[1]: [[0;1;31mFailed to start Create
> Volatile Files and Directories.[[0m
> Jun 08 12:53:56 qemux86-64 systemd[1]:
> [[0;1;39msystemd-tmpfiles-setup.service: Unit entered failed state.[[0m
> Jun 08 12:53:56 qemux86-64 systemd[1]:
> [[0;1;39msystemd-tmpfiles-setup.service: Failed with result 'exit-code'.[[0m

placing a symlink to "/dev/null" in "/etc/tmpfiles.d/connman_resolvconf.conf" for read-only-rootfs fixes this one.
Comment 6 Maxin B. John 2017-06-12 16:29:42 UTC
Fix sent to oe-core:

http://lists.openembedded.org/pipermail/openembedded-core/2017-June/137960.html
Comment 8 Andrea Galbusera 2017-06-16 15:00:09 UTC
I reproduced the original test case and can confirm the original issue is fixed by the above patch. Thanks!
Comment 9 Kai Kang 2018-12-25 03:12:50 UTC
*** Bug 11969 has been marked as a duplicate of this bug. ***