package systemd-resolved 253.5-1ubuntu7 failed to install/upgrade: installed systemd-resolved package post-installation script subprocess returned error exit status 1 [cp: '/etc/resolv.conf' and '/run/systemd/resolve/stub-resolv.conf' are the same file]

Bug #2047975 reported by CloudRoot AB
64
This bug affects 8 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Committed
Undecided
Unassigned
Noble
Fix Committed
High
Nick Rosbrook

Bug Description

[Impact]

For users that disabled the stub-resolver, and in doing so also created a symlink /etc/resolv.conf -> /run/systemd/resolve/resolv.conf (note this is not the correct way to disable the stub-resolver), upgrading from Jammy to Noble will fail with:

cp: '/etc/resolv.conf' and '/run/systemd/resolve/stub-resolv.conf' are the same file

This logic in systemd-resolved.postinst is guarded by a version check, and is only run on upgrades from systemd versions before 251.4-2 (which in practice means only upgrades from Jammy), and on new installs.

[Test Plan]

Start a VM or container running Jammy. Disable the stub-resolver, and create the symlink /etc/resolv.conf -> /run/systemd/resolve/resolv.conf:

$ mkdir -p /etc/systemd/resolved.conf.d/
$ cat > /etc/systemd/resolved.conf.d/no-stub-resolver.conf << EOF
[Resolve]
DNSStubListener=no
EOF

$ ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
$ systemctl restart systemd-resolved

Then, run an upgrade to Noble:

$ do-release-upgrade --devel

NB that currently, even devel upgrades are disabled to from Jammy to Noble, so the upgrade would need to be run as:

$ wget http://archive.ubuntu.com/ubuntu/dists/noble-proposed/main/dist-upgrader-all/24.04.18/noble.tar.gz
$ tar xf noble.tar.gz
$ ./noble

Inspect the relevant output and logs to ensure that systemd-resolved was upgraded successfully during the upgrade.

[Where problems could occur]

The fix is to make such a failure non-fatal. This is safe because although manually creating this symlink is not necessary, it will not impact the operation of systemd-resolved. Hence, failing to make this cp will not impact the user. Later in the postinst, we force the new symlink anyways.

If something was wrong with the change, it would likely cause the systemd-resolved.postinst to fail a different way.

[Original Description]

upgraded from 22.04 -> 24.04

ProblemType: Package
DistroRelease: Ubuntu 24.04
Package: systemd-resolved 253.5-1ubuntu7
ProcVersionSignature: Ubuntu 6.2.0-39.40~22.04.1-generic 6.2.16
Uname: Linux 6.2.0-39-generic x86_64
ApportVersion: 2.27.0-0ubuntu6
Architecture: amd64
CasperMD5CheckResult: pass
CloudArchitecture: x86_64
CloudID: none
CloudName: none
CloudPlatform: none
CloudSubPlatform: config
Date: Wed Jan 3 21:06:55 2024
ErrorMessage: installed systemd-resolved package post-installation script subprocess returned error exit status 1
InstallationDate: Installed on 2023-02-27 (311 days ago)
InstallationMedia: Ubuntu-Server 22.04.1 LTS "Jammy Jellyfish" - Release amd64 (20220809)
Python3Details: /usr/bin/python3.11, Python 3.11.7, python3-minimal, 3.11.4-5
PythonDetails: N/A
RebootRequiredPkgs: Error: path contained symlinks.
RelatedPackageVersions:
 dpkg 1.22.1ubuntu5
 apt 2.7.6
SourcePackage: systemd
Title: package systemd-resolved 253.5-1ubuntu7 failed to install/upgrade: installed systemd-resolved package post-installation script subprocess returned error exit status 1
UpgradeStatus: Upgraded to noble on 2024-01-03 (0 days ago)
mtime.conffile..etc.systemd.resolved.conf: 2023-02-27T21:16:55.869158

Revision history for this message
CloudRoot AB (cloudrootab) wrote :
affects: ubuntu → systemd (Ubuntu)
tags: removed: need-duplicate-check
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
summary: package systemd-resolved 253.5-1ubuntu7 failed to install/upgrade:
installed systemd-resolved package post-installation script subprocess
- returned error exit status 1
+ returned error exit status 1 [cp: '/etc/resolv.conf' and
+ '/run/systemd/resolve/stub-resolv.conf' are the same file]
tags: added: mantic
Revision history for this message
Nick Rosbrook (enr0n) wrote (last edit ):

I got some information from a user on a more recent duplicate (bug 2063533). The problem seems to be that some users, when disabling the stub-resolver, also create a symlink /etc/resolv.conf -> /run/systemd/resolve/resolv.conf. This is not actually necessary because systemd-resolved will make stub-resolv.conf a symlink to resolv.conf when DNSStubListener=no.

Hence, the command

cp "${DPKG_ROOT}/etc/resolv.conf" "${DPKG_ROOT}/run/systemd/resolve/stub-resolv.conf"

in systemd-resolved.postinst fails because the source and destination are *both* symlinks to /run/systemd/resolve/resolv.conf.

Changed in systemd (Ubuntu Noble):
status: New → Triaged
importance: Undecided → High
assignee: nobody → Nick Rosbrook (enr0n)
tags: added: foundations-todo systemd-sru-next
Nick Rosbrook (enr0n)
tags: removed: foundations-todo
Nick Rosbrook (enr0n)
Changed in systemd (Ubuntu):
status: Confirmed → Fix Committed
Nick Rosbrook (enr0n)
description: updated
Nick Rosbrook (enr0n)
description: updated
description: updated
Nick Rosbrook (enr0n)
Changed in systemd (Ubuntu Noble):
status: Triaged → In Progress
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote (last edit ):

This is related to https://askubuntu.com/questions/1510951/do-release-upgrade-from-22-04-to-24-04-deleted-systemd-resolved right?

Since I manually upgraded a machine and after the upgrade:
 - systemd-resolved wasn't there
 - resolvconf was still installed
 - no domain resolution was working

Once I manually installed systemd-resolved, all the above were fixed.

EDIT: Fixed link

Revision history for this message
Nick Rosbrook (enr0n) wrote :

> This is related to https://discourse.ubuntu.com/t/ubuntu-desktop-s-24-10-dev-cycle-the-roadmap/45120 right?

I don't see how this is related.

> Once I manually installed systemd-resolved, all the above were fixed.

This bug is not about systemd-resolved not getting installed on upgrades (that is bug 2063464).

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Sorry I put the wrong link even on editing...

I meant https://askubuntu.com/questions/1510951/do-release-upgrade-from-22-04-to-24-04-deleted-systemd-resolved but as you noted is definitely lp:2063464 which I still noticed since I went through dist-upgrade manually.

Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello CloudRoot, or anyone else affected,

Accepted systemd into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/255.4-1ubuntu8.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in systemd (Ubuntu Noble):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-noble
Revision history for this message
Nick Rosbrook (enr0n) wrote :
Download full text (6.0 KiB)

I have verified the fix using 255.4-1ubuntu8.1 from noble-proposed. I created a LXD jammy container:

root@j:~# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

And then disabled the stub-resolver according to the test plan:

root@j:~# mkdir -p /etc/systemd/resolved.conf.d/
root@j:~# cat > /etc/systemd/resolved.conf.d/no-stub-resolver.conf << EOF
[Resolve]
DNSStubListener=no
EOF
root@j:~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
root@j:~# systemctl restart systemd-resolved
root@j:~# systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2024-05-22 15:10:08 UTC; 19s ago
       Docs: man:systemd-resolved.service(8)
             man:org.freedesktop.resolve1(5)
             https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
             https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
   Main PID: 1079 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 18947)
     Memory: 4.5M
        CPU: 57ms
     CGroup: /system.slice/systemd-resolved.service
             └─1079 /lib/systemd/systemd-resolved

May 22 15:10:08 j systemd[1]: Starting Network Name Resolution...
May 22 15:10:08 j systemd-resolved[1079]: Positive Trust Anchors:
May 22 15:10:08 j systemd-resolved[1079]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7>
May 22 15:10:08 j systemd-resolved[1079]: Negative trust anchors: home.arpa 10.in-addr.arpa 16.172.in-addr.arpa 17.172>
May 22 15:10:08 j systemd-resolved[1079]: Using system hostname 'j'.
May 22 15:10:08 j systemd[1]: Started Network Name Resolution.

Then, started the upgrade (using the tarball for the reasons mentioned in test plan):

root@j:~# wget http://archive.ubuntu.com/ubuntu/dists/noble-proposed/main/dist-upgrader-all/24.04.18/noble.tar.gz
--2024-05-22 15:10:36-- http://archive.ubuntu.com/ubuntu/dists/noble-proposed/main/dist-upgrader-all/24.04.18/noble.tar.gz
Resolving archive.ubuntu.com (archive.ubuntu.com)... 185.125.190.39, 91.189.91.82, 185.125.190.36, ...
Connecting to archive.ubuntu.com (archive.ubuntu.com)|185.125.190.39|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1274850 (1.2M) [application/x-gzip]
Saving to: ‘noble.tar.gz’

noble.tar.gz 100%[================================================>] 1.21M 1.73MB/s in 0.7s

2024-05-22 15:10:37 (1.73 MB/s) - ‘noble.tar.gz’ saved [1274850/1274850]

root@j:~# tar xf noble.tar.gz
root@j:~# ./noble --frontend DistUpgradeViewNonInteractive
[ ... ]

After the upgrade was complete:

root@j:~# systemctl status systemd-resolved
● systemd-resolved.service - Network Name Reso...

Read more...

tags: added: verification-done-noble
removed: verification-needed-noble
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (systemd/255.4-1ubuntu8.1)
Download full text (4.9 KiB)

All autopkgtests for the newly accepted systemd (255.4-1ubuntu8.1) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

389-ds-base/unknown (armhf, s390x)
aide/unknown (s390x)
amavisd-new/unknown (s390x)
apport/2.28.1-0ubuntu3 (arm64)
apport/unknown (s390x)
appstream/unknown (s390x)
apt/2.7.14build2 (armhf)
apt/unknown (s390x)
asterisk/unknown (s390x)
at-spi2-core/unknown (s390x)
ayatana-indicator-session/unknown (s390x)
bind9/unknown (amd64, armhf, i386, s390x)
bolt/unknown (amd64, s390x)
casper/unknown (s390x)
casync/unknown (s390x)
ceph/unknown (s390x)
clamav/unknown (amd64)
clevis/unknown (s390x)
cloudflare-ddns/unknown (s390x)
clutter-1.0/unknown (amd64)
cockpit/unknown (s390x)
collectd/unknown (s390x)
colord/unknown (s390x)
comitup/unknown (amd64, s390x)
conntrack-tools/unknown (amd64)
corosync/3.1.7-1ubuntu3 (arm64)
corosync/unknown (s390x)
corosync-qdevice/unknown (amd64, s390x)
coturn/unknown (armhf, s390x)
cron/unknown (ppc64el, s390x)
crun/unknown (amd64, s390x)
cryptsetup/2:2.7.0-1ubuntu4 (arm64)
csync2/unknown (amd64, s390x)
cups/unknown (amd64, s390x)
dbus/1.14.10-4ubuntu4 (i386)
dbus/unknown (amd64, armhf, s390x)
dbus-broker/unknown (amd64, s390x)
debos/unknown (amd64)
dhcpcd/unknown (armhf, s390x)
dlm/unknown (amd64)
dovecot/unknown (amd64)
dpdk/23.11-1build3 (amd64)
dq/20240101-1 (amd64)
exim4/unknown (amd64, armhf)
expeyes/unknown (amd64)
fcgiwrap/unknown (amd64)
fluidsynth/unknown (amd64, i386)
freedom-maker/unknown (amd64, armhf, i386)
freedombox/unknown (amd64)
freeradius/unknown (amd64)
fwupd/unknown (amd64)
gamemode/unknown (i386)
gdm3/unknown (amd64)
golang-github-coreos-go-systemd/unknown (amd64)
gpsd/unknown (amd64)
gvfs/unknown (s390x)
haproxy/unknown (amd64)
hddemux/unknown (amd64)
hwloc/unknown (amd64, s390x)
incus/unknown (amd64)
init-system-helpers/unknown (amd64)
initramfs-tools/unknown (amd64)
interception-tools/unknown (amd64)
janus/unknown (amd64)
keyman/unknown (amd64)
knot/unknown (amd64)
knot-resolver/unknown (amd64)
libcamera/0.2.0-3fakesync1build6 (amd64, armhf)
libei/1.2.1-1 (amd64)
libinput/unknown (amd64)
liblinux-systemd-perl/unknown (amd64)
libreswan/unknown (amd64)
libsdl2/unknown (amd64)
libsfml/2.6.1+dfsg-2build2 (armhf)
libsfml/unknown (amd64)
libsoup2.4/2.74.3-6ubuntu1 (ppc64el)
libsoup2.4/unknown (amd64)
libsoup3/unknown (amd64)
libusbauth-configparser/unknown (amd64)
libvirt/unknown (amd64)
lighttpd/unknown (amd64)
linux-ibm/unknown (amd64)
logiops/unknown (amd64)
logrotate/unknown (amd64)
mariadb/unknown (amd64)
mediawiki/unknown (amd64)
mir/unknown (amd64)
mkosi/unknown (amd64)
monitoring-plugins-systemd/unknown (amd64)
mosquitto/unknown (amd64)
multipath-tools/unknown (amd64)
munin/unknown (amd64)
mutter/unknown (amd64)
nagios-tang/unknown (amd64, s390x)
ndctl/unknown (armhf, s390x)
network-manager/unknown (amd64, s390x)
nextepc/unknown (amd64)
nix/unknown (amd64, armhf)
nut/unknown (amd64, armhf, s390x)
open-build-service/unknown (amd64)
openssh/unknown (amd64)
openvpn/unknown (amd64)
openzwave/unknown (amd64)
ovn/unknown (amd64)
pam/unknown (amd64, i386)
pdns-recursor/unknown (amd64)
pgagroal/unknown (amd64)
pgbouncer/unknown ...

Read more...

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

Other bug subscribers

Remote bug watches

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