#1032934 live-build: Package systemd-resolved breaks name resolution, because of /etc/resolv.conf being linked to /run/systemd/resolve/stub-resolv.conf

#1032934#5
Date:
2023-03-14 11:24:42 UTC
From:
To:
"apt-get systemd-resolved" (i.e. including systemd-resolved in
config/package-lists/...) will overwrite existing /etc/resolv.conf
(inside chroot) with link to /run/systemd/resolve/stub-resolv.conf which
is not available, because /run is not mounted inside chroot. And
because systemd-resolved is not started while in chroot.

Since name resolution does not work anymore, retrieving package lists in
subsequent phases fail:

[2023-03-14 11:45:19] lb chroot_archives chroot remove --debug
D: Reading configuration file config/common
D: Reading configuration file config/bootstrap
D: Reading configuration file config/chroot
D: Reading configuration file config/binary
D: Reading configuration file config/source
P: Deconfiguring file /etc/apt/sources.list
D: Executing: apt-get --yes -o Acquire::Retries=5 -o APT::Color=false update
Ign:1 http://deb.debian.org/debian bookworm InRelease
Ign:2 http://security.debian.org bookworm-security InRelease
Ign:3 http://deb.debian.org/debian bookworm-updates InRelease
Ign:1 http://deb.debian.org/debian bookworm InRelease
Ign:2 http://security.debian.org bookworm-security InRelease
Ign:3 http://deb.debian.org/debian bookworm-updates InRelease
Ign:1 http://deb.debian.org/debian bookworm InRelease
Ign:2 http://security.debian.org bookworm-security InRelease
Ign:3 http://deb.debian.org/debian bookworm-updates InRelease
Ign:1 http://deb.debian.org/debian bookworm InRelease
Ign:2 http://security.debian.org bookworm-security InRelease
Ign:3 http://deb.debian.org/debian bookworm-updates InRelease
Ign:1 http://deb.debian.org/debian bookworm InRelease
Ign:2 http://security.debian.org bookworm-security InRelease
Ign:3 http://deb.debian.org/debian bookworm-updates InRelease
Err:1 http://deb.debian.org/debian bookworm InRelease
  Could not resolve 'aptcacher.lan'
Err:2 http://security.debian.org bookworm-security InRelease
  Could not resolve 'aptcacher.lan'
Err:3 http://deb.debian.org/debian bookworm-updates InRelease
  Could not resolve 'aptcacher.lan'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/bookworm/InRelease  Could not resolve 'aptcacher.lan'
W: Failed to fetch http://security.debian.org/dists/bookworm-security/InRelease  Could not resolve 'aptcacher.lan'
W: Failed to fetch http://deb.debian.org/debian/dists/bookworm-updates/InRelease  Could not resolve 'aptcacher.lan'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Since we are now pretty much at the end of the whole lb chroot -phase,
this might not be such big deal. The image will eventually be built
anyway.

I am wondering if it would be possible to mount /run in the chroot as
/proc and /sys are mounted?

If /run is mounted and if the build host itself is using
systemd-resolved, there shouldn't be any issues.