systemd-resolved is not installable in Docker images
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu Docker Images |
Fix Released
|
Undecided
|
Cristovao Cordeiro | ||
dpkg (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
systemd (Ubuntu) |
Fix Released
|
Undecided
|
Nick Rosbrook |
Bug Description
Since 30 August (going by my daily CI builds, I do see the changelog entry for resolved is a few days older), I get this:
Selecting previously unselected package systemd-resolved.
Preparing to unpack .../321-
Unpacking systemd-resolved (251.4-1ubuntu1) ...
dpkg: error processing archive /tmp/apt-
unable to make backup link of './etc/resolv.conf' before installing new version: Invalid cross-device link
The reason this fails is that Docker mounts resolv.conf, readonly, from the host system, so dpkg is not allowed to move/replace it.
(To be clear, I do not need systemd-resolved in my container. "apt install devscripts" pulled it in, and debtree does not tell me why. "apt install --no-install-
Related branches
- Lukas Märdian: Approve
-
Diff: 114 lines (+77/-3)4 files modifieddebian/changelog (+43/-2)
debian/systemd-resolved.postinst (+10/-0)
debian/systemd-resolved.postrm (+24/-0)
dev/null (+0/-1)
summary: |
- systemd-resolved in kinetic image tries to replace resolv.conf + systemd-resolved is not installable in Docker images |
Changed in systemd (Ubuntu): | |
status: | In Progress → Fix Committed |
Thanks for filing this bug, Peter.
The issue here is not related to /etc/resolv.conf being read-only (it is actually a RW file) [1]. The issue lies in the fact that it is always mounted in a running container by docker itself [2].
During a package installation process, dpkg performs backups of existing files through hard links. Hard links cannot be performed across mounts, hence, dpkg fails to install systemd-resolved when it tried to backup /etc/resolv.conf
$ apt-file search /etc/resolv.conf
...
systemd-resolved: /etc/resolv.conf
This is the error being triggered: dpkg-install- qDQYcB/ 21-systemd- resolved_ 251.4-1ubuntu1_ amd64.deb (--unpack):
dpkg: error processing archive /tmp/apt-
unable to make backup link of './etc/resolv.conf' before installing new version: Invalid cross-device link
Now, while I am unsure where this bug belongs, this should be a good place to start a discussion.
For further context, this is the bug where systemd-resolved split and /etc/resolv.conf ownership were discussed [3].
[1] https:/ /github. com/moby/ moby/pull/ 5129/files /docs.docker. com/storage/ #good-use- cases-for- bind-mounts /bugs.debian. org/cgi- bin/bugreport. cgi?bug= 939904
[2] https:/
[3] https:/