Bug#1017714: systemd-resolved: deletes /etc/resolv.conf after package removal

Raphaël Halimi raphael.halimi at gmail.com
Fri Aug 19 12:01:36 BST 2022


Package: systemd-resolved
Version: 251.3-2~exp1
Severity: critical

(filing the bug as critical since it "makes unrelated software on the 
system (or the whole system) break", feel free to downgrade)

Dear developers,

The new systemd-resolved package takes over /etc/resolv.conf, and 
unconditionally makes it a symlink it to 
/run/systemd/resolve/stub-resolv.conf. Moreover, after the package is 
removed, the symlink is also removed, leaving the system with no 
/etc/resolv.conf, and thus, a broken DNS resolution.

/etc/resolv.conf is not considered as a conffile since technically, it 
doesn't belong to any package (and is not listed as a conffile by 
systemd-resolved, which treats it as a normal file), but if it's 
considered as a configuration file (it's located in /etc after all), I 
believe this behavior severely transgresses Debian Policy 10.7.3 on both 
points ("local changes must be preserved during a package upgrade" and 
"configuration files must be preserved when the package is removed").

One (conservative) solution would be to not touch /etc/resolv.conf at 
all, leaving the users create the symlink to 
/run/systemd/resolve/stub-resolv.conf (or 
/run/systemd/resolve/resolv.conf) themselves. This would solve both 
transgressions at once. One could argue that it wouldn't make sense to 
install systemd-resolved and not use it in /etc/resolv.conf, but the 
service would still provide the bus and glibc APIs.

If /etc/resolv.conf is not considered a configuration file, and this new 
behavior does not transgresses the Debian Policy, then the package 
should at least leave the system with a working /etc/resolv.conf file 
after removal, for example by copying the contents of 
/run/systemd/resolve/resolv.conf (optionally stripping comments and 
empty lines) in maintainers scripts.

Regards,

-- 
Raphaël Halimi



More information about the Pkg-systemd-maintainers mailing list