Fails when /etc/resolv.conf is set for dynamic updates

Bug #54867 reported by Matti Lindell
4
Affects Status Importance Assigned to Milestone
schroot (Ubuntu)
Undecided
Unassigned

Bug Description

schroot fails to chroot when resolvconf package is configured with "Prepare /etc/resolv.conf for dynamic updates?" enabled (on target chroot).

When I'm trying to schroot from Dapper system to Edgy chroot:

I: Executing '20network setup-start ok'
`/etc/resolv.conf' -> `/var/lib/schroot/mount/edgy/etc/resolv.conf'
cp: cannot create regular file `/var/lib/schroot/mount/edgy/etc/resolv.conf': No such file or directory

chroot configuration look like this:
[edgy]
type=block-device
description=Ubuntu Edgy (unstable)
priority=4
groups=admin
root-groups=admin
device=/dev/mapper/VolGrp00-LVEdgyRoot
mount-options=-o atime,sync,user_xattr
run-setup-scripts=true
run-exec-scripts=true

Revision history for this message
Matti Lindell (mlind) wrote :

/etc/schroot/setup.d/20network doesn't seem to cope with /etc/resolv.conf symlink on chroot

Revision history for this message
João Pinto (joaopinto) wrote :

I am the same issue trying to use a Feisty schroot on Feisty.

I: Executing ‘20network setup-start ok’
`/etc/resolv.conf' -> `/var/lib/schroot/mount/feisty.i386-02147a4e-d19d-4853-8a42-429dae050c7e/etc/resolv.conf'
cp: cannot create regular file `/var/lib/schroot/mount/feisty.i386-02147a4e-d19d-4853-8a42-429dae050c7e/etc/resolv.conf': No such file or directory
I: Executing ‘50sbuild setup-stop fail’

Changed in schroot:
status: New → Confirmed
Revision history for this message
Roger Leigh (rleigh) wrote :

Just to clarify, are you running resolvconf inside the chroot, outside the chroot, or both?

Is /etc/resolv.conf a symlink inside or outside the chroot, or both?

Currently we don't support resolvconf or anything else that is dynamically updating resolv.conf, like NetworkManager. Suggestions for how to handle this properly would be much appreciated.

Thanks,
Roger

Revision history for this message
João Pinto (joaopinto) wrote :

I am not able to reproduce this problem with schroot 1.2.1-1ubuntu2 (now resolv.conf is copied during the schroot setup).

Revision history for this message
Roger Leigh (rleigh) wrote :

I would be interested to know if this still affects the current stable 1.2.3 release, and additionally the new stable 1.4.0 release.

I'm using resolvconf (and hence a symlinked /etc/resolv.conf) on my *host* system, and resolv.conf is successfully copied into the chroot.

If /etc/resolv.conf is a symlink *inside* the chroot, then cp will copy to the file pointed to by the symlink. This is the default behaviour of cp, and I see nothing in the manpage to tell it to not dereference the destination (you can for the source). Hence if the symlink is invalid, the copy will fail. It's not clear this is a bug in schroot, or rather a broken symlink in the chroot causing problems.

If there's a way to make cp snap links for the destination, this is something we can add. However, if the admin deliberately symlinked /etc/resolv.conf to somewhere else for their own reasons, this behaviour would be equally wrong. It's not clear that the current behaviour is actually wrong /per se/ except for the special case that the symlink is invalid (points to nowhere).

Regards,
Roger

Revision history for this message
Stephen Phillips (stephen-kent-phillips) wrote :

I just experienced this same issue. In my case, the problem was that I didn't properly install the chroot.

I used debootstrap to build the chroot directory, but I accidentally specified a different directory than what I put in my chroot configuration file (/etc/schroot/schroot.conf). As a result, the path that chroot was mounting did not have an etc directory in it.

When I changed /etc/schroot/schroot.conf to point to the correct path, everything worked correctly.

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

Other bug subscribers

Bug attachments