New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please mount resolv.conf in systemd-nspawn by default #5075

Closed
safinaskar opened this Issue Jan 13, 2017 · 1 comment

Comments

2 participants
@safinaskar

safinaskar commented Jan 13, 2017

Submission type

  • Request for enhancement (RFE)

systemd version the issue has been seen with

232

Used distribution

Debian Stretch

I use systemd-nspawn. Usually I use Debian as system for both host system and container. It seems systemd doesn't manage resolv.conf in Debian.

Please, automount resolv.conf in systemd-nspawn by default. I. e. make option "--bind /etc/resolv.conf:/etc/resolv.conf" default. I often change internet connection on my host system. And this doesn't change /etc/resolv.conf inside container by default.

@poettering

This comment has been minimized.

Show comment
Hide comment
@poettering

poettering Jan 13, 2017

Member

Sorry, but this is not going to work. Most software modifying /etc/resolv.conf actually writes the new config into a new temporary file and then simply renames it to /etc/resolv.conf, so that from the outside things are atomic: either the old version or the new version is in place, but never a half-written version.

This logic is incomptible with bind mounts, as with them the actual file itself is referenced, not the path to it. Hence, after the first such update the container will still see the old version, and this cannot even be fixed.

Hence, bind mounting doesn't really help much. If anything it makes things worse, not better.

Note that we actually already fall back to bind mounting if we operate on a read-only OS image, because then we have no other option.

Anyway, closing this, as this wouldn't work. I hope this makes sense, Sorry!

Member

poettering commented Jan 13, 2017

Sorry, but this is not going to work. Most software modifying /etc/resolv.conf actually writes the new config into a new temporary file and then simply renames it to /etc/resolv.conf, so that from the outside things are atomic: either the old version or the new version is in place, but never a half-written version.

This logic is incomptible with bind mounts, as with them the actual file itself is referenced, not the path to it. Hence, after the first such update the container will still see the old version, and this cannot even be fixed.

Hence, bind mounting doesn't really help much. If anything it makes things worse, not better.

Note that we actually already fall back to bind mounting if we operate on a read-only OS image, because then we have no other option.

Anyway, closing this, as this wouldn't work. I hope this makes sense, Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment