resolv.conf symlink is broken after clean debootstrap

Bug #1713149 reported by Stéphane Graber
40
This bug affects 7 people
Affects Status Importance Assigned to Milestone
resolvconf (Ubuntu)
Fix Released
Undecided
Unassigned
systemd (Ubuntu)
Invalid
Critical
Unassigned

Bug Description

Reproducer:
 - debootstrap artful artful

Expected:
 - "chroot artful cat /etc/resolv.conf" doesn't fail.
 - /etc/resolv.conf is a symlink to something valid in /run

Actual:
 - "chroot artful cat /etc/resolv.conf" gets you "No such file or directory"
 - /etc/resolv.conf is a symlink to "../run/resolvconf/resolv.conf"
 - "../run/resolvconf/resolv.conf" is a symlink to "../run/systemd/resolve/stub-resolv.conf" which is an invalid symlink as that points to /run/run/systemd/resolve/stub-resolv.conf" rather than "/run/systemd/resolve/stub-resolv.conf"

This causes all LXC image creation to fail, causing autopkgtest to fail (as noticed by the kernel team) and has been causing all images to fail building on the upstream build system for the past two days.

root@vm04:~# chroot artful ls -lh /etc/resolv.conf /run/resolvconf/
lrwxrwxrwx 1 root root 29 Aug 25 20:20 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

/run/resolvconf/:
total 4.0K
-rw-r--r-- 1 root root 0 Aug 25 20:21 enable-updates
drwxr-xr-x 2 root root 4.0K Aug 25 20:20 interface
lrwxrwxrwx 1 root root 39 Aug 25 20:18 resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

root@vm04:~# chroot zesty ls -lh /etc/resolv.conf /run/resolvconf/
lrwxrwxrwx 1 root root 29 Aug 25 20:20 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

/run/resolvconf/:
total 8.0K
-rw-r--r-- 1 root root 0 Aug 25 20:20 enable-updates
drwxr-xr-x 2 root root 4.0K Aug 25 20:20 interface
-rw-r--r-- 1 root root 357 Aug 25 20:15 resolv.conf

Tags: artful
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Revision history for this message
Vinson Lee (vlee) wrote :
tags: added: artful
Revision history for this message
Steve Langasek (vorlon) wrote :

This may have been fixed just now by demoting resolvconf from important to extra. If the next image build is still broken after this change, please shout.

Ideally the debootstrap would have worked at all points without archive override changes, but having missed that, we should just get resolvconf out of the way.

Changed in systemd (Ubuntu):
importance: Undecided → Critical
status: Confirmed → Incomplete
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Correct that there is a bug with debootstrap above, if both this new systemd & resolvconf are being bootstrapped together. (as both src:systemd and src:resolvconf try to setup /etc/resolv.conf symlink)

Dropping resolvconf from important should resolve this.

The ExecStartPre change should then be dropped.

Changed in systemd (Ubuntu):
status: Incomplete → In Progress
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Adding resolvconf task as well, since now:
$ sudo debootstrap --include=resolvconf artful artful

is broken.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package resolvconf - 1.79ubuntu8

---------------
resolvconf (1.79ubuntu8) artful; urgency=medium

  * Dereference /etc/resolf.conf when creating runtime configuration when
    migrating to resolvconf managed /etc/resolv.conf. The contents of
    /etc/resolv.conf (rather than the symlink target information) is
    needed in /run/resolvconf/resolv.conf and
    /run/resolvconf/interface/original.resolvconf during migration until
    resolvconf updates the config next. LP: #1713149

 -- Dimitri John Ledkov <email address hidden> Tue, 29 Aug 2017 14:04:33 +0100

Changed in resolvconf (Ubuntu):
status: New → Fix Released
Revision history for this message
Vinson Lee (vlee) wrote :

artful preseed installs are still failing for me because of hostname resolutions during in-target.

After base-installer completes, the in-target installation fails to resolve the artful repositories. The target has /etc/resolv.conf but /etc/resolv.conf is not working or available through in-target. in-target is missing the entire /run/systemd directory.

# chroot /target ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Aug 29 22:32 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

# chroot /target ls -l /run/systemd/resolve/
total 4
-rw-r--r-- 1 root root 89 Aug 29 22:32 stub-resolv.conf

# chroot /target cat /etc/resolv.conf
search <redacted>
nameserver <redacted>

# chroot /target ls -l /run
total 12
drwxrwxrwt 2 root root 4096 Aug 29 22:30 lock
drwxr-xr-x 2 root root 4096 Aug 29 22:30 mount
drwxr-xr-x 3 root root 4096 Aug 29 22:32 systemd
-rw-rw-r-- 1 root utmp 0 Aug 29 22:30 utmp

# in-target ls -l /etc/resolv.conf
Aug 29 22:37:04 in-target: lrwxrwxrwx 1 root root 39 Aug 29 22:32 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

# in-target ls -l /run/systemd/resolve/
Aug 29 22:40:27 in-target: ls: cannot access '/run/systemd/resolve/'
Aug 29 22:40:27 in-target: : No such file or directory

# in-target cat /etc/resolv.conf
Aug 29 22:41:48 in-target: cat: /etc/resolv.conf
Aug 29 22:41:48 in-target: : No such file or directory

# in-target ls -l /run/
Aug 29 22:44:32 in-target: total 0
Aug 29 22:44:32 in-target: drwxr-xr-x 2 root root 40 Aug 29 22:26 lock
Aug 29 22:44:32 in-target: drwxr-xr-x 2 root root 60 Aug 29 22:26 mount
Aug 29 22:44:32 in-target: drwxr-xr-x 4 root root 100 Aug 29 22:30 udev

Changed in systemd (Ubuntu):
status: In Progress → Invalid
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

@vlee please open a new bug report, and please extract and attach debian-installer logs, e.g. /var/log/syslog from the d-i environment.

Revision history for this message
Frank Burkhardt (fbo) wrote :

Hi,

(installing Bionic here)

a possible solution is to make sure, /target/run is already mounted (bind-mount to /run) when debootstrap is running which will make systemd create its resolv.conf copy in the correct /run-filesystem. Otherwise, it would write to the /target-partition and in-target would hide the stuff in there when doint its bind-mounts.

For now I create (and make executable) the script /usr/lib/base-installer.d/41init-run via early_command:

#!/bin/sh
mkdir -p /target/run
mount --bind /run /target/run

IMHO this should be done by the base-installer.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.