[Bug 2138450] [NEW] Restoring resolv.conf is broken
Sebastian Weyer
2138450 at bugs.launchpad.net
Thu Jan 15 14:29:57 UTC 2026
Public bug reported:
Starting in version 3.10.0 of the ubuntu image snap, restoring the
resolv.conf file at the end of the build has been broken. Instead of
restoring the backed up resolv.conf.tmp file, the host's resolv.conf
file will remain in the image on top of the backed up file.
Since commit 069af78, `RestoreResolvConf` is called an additional time.
The first call to this function works correctly, whereas the second
doesn't.
This is because between the first and the second call to that function,
the file `$chroot/etc/resolv.conf` is converted into a symlink pointing
to `/run/systemd/resolve/stub-resolv.conf` which is a runtime generated
file from systemd. That symlink will be backed up correctly by
`BackupAndCopyResolvConf` but when `setupGrub()` in
`internal/statemachine/bootloader_helper.go` tries to restore it, it
will fail because `RestoreResolvConf` will try to follow the symlink and
check if that file exists by running `if !osutil.FileExists(){}`.
In order to fix this, we should only return nil if the file doesn't
exist and the symlink doesn't exist.
A pull request has been prepared here:
https://github.com/canonical/ubuntu-image/pull/287
This issue is critical for releasing an image for NVIDIA Tegra devices.
The images for these devices are built on builders located in the Boston
lab and contain a DNS configuration with a local address which results
in it being broken on other devices:
nameserver 10.189.128.2
search ppa
** Affects: ubuntu-image
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to Ubuntu Image.
https://bugs.launchpad.net/bugs/2138450
Title:
Restoring resolv.conf is broken
Status in Ubuntu Image:
New
Bug description:
Starting in version 3.10.0 of the ubuntu image snap, restoring the
resolv.conf file at the end of the build has been broken. Instead of
restoring the backed up resolv.conf.tmp file, the host's resolv.conf
file will remain in the image on top of the backed up file.
Since commit 069af78, `RestoreResolvConf` is called an additional
time. The first call to this function works correctly, whereas the
second doesn't.
This is because between the first and the second call to that
function, the file `$chroot/etc/resolv.conf` is converted into a
symlink pointing to `/run/systemd/resolve/stub-resolv.conf` which is a
runtime generated file from systemd. That symlink will be backed up
correctly by `BackupAndCopyResolvConf` but when `setupGrub()` in
`internal/statemachine/bootloader_helper.go` tries to restore it, it
will fail because `RestoreResolvConf` will try to follow the symlink
and check if that file exists by running `if !osutil.FileExists(){}`.
In order to fix this, we should only return nil if the file doesn't
exist and the symlink doesn't exist.
A pull request has been prepared here:
https://github.com/canonical/ubuntu-image/pull/287
This issue is critical for releasing an image for NVIDIA Tegra
devices. The images for these devices are built on builders located in
the Boston lab and contain a DNS configuration with a local address
which results in it being broken on other devices:
nameserver 10.189.128.2
search ppa
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-image/+bug/2138450/+subscriptions
More information about the foundations-bugs
mailing list