systemd-resolved re-creates /run/systemd/resolve/*resolv.conf for every IPv6 RA received
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd |
Unknown
|
Unknown
|
|||
systemd (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Bionic |
Won't Fix
|
Wishlist
|
Unassigned | ||
Focal |
Fix Released
|
Wishlist
|
Dan Streetman | ||
Groovy |
Fix Released
|
Wishlist
|
Dan Streetman | ||
Hirsute |
Fix Released
|
Wishlist
|
Dan Streetman |
Bug Description
[impact]
networking changes, like RA events, can cause systemd-resolved to re-write the resolv.conf file, even if the contents didn't change, resulting in unnecessary increased amount of inotify events
[test case]
see original description for ipv6ra-related reproducer, or simple reproducer here:
configure networkd with some config for (e.g.) eth0, but not a config that would result in /etc/resolv.conf changing when the interface goes up/down - for example, use static config with no DNS search domains. Then bring eth0 up/down while observing the md5sum (file content) does not change but the mtime does change.
root@lp1891215-h:~# ip l set down dev eth0
root@lp1891215-h:~# md5sum /etc/resolv.conf
db23e8007851519
root@lp1891215-h:~# stat -t -L /etc/resolv.conf
/etc/resolv.conf 740 8 81a4 101 103 fc 188 1 0 0 1625238218 1625238216 1625238216 0 4096
root@lp1891215-h:~# ip l set up dev eth0
root@lp1891215-h:~# md5sum /etc/resolv.conf
db23e8007851519
root@lp1891215-h:~# stat -t -L /etc/resolv.conf
/etc/resolv.conf 740 8 81a4 101 103 fc 188 1 0 0 1625238227 1625238226 1625238226 0 4096
[regression potential]
regressions would result in incorrect or missing data in the resolv.conf file, possibly resulting in dns failures or errors
[scope]
this is needed for h and eralier
this is (potentially) fixed upstream by f3e1f00d0344591
[original description]
# Issue description:
On 2 Linode VMs that are used as lxd hosts, we noticed that /run/systemd/
The log noise is the observable problem that would be nice to see addressed:
root@lxd02:~# uptime
17:55:48 up 9:52, 1 user, load average: 0.18, 0.11, 0.05
root@lxd02:~# journalctl -b0 | grep -cF dnsmasq
158609
Upon further investigation, it seems that systemd-resolved re-creates the resolv.conf and stub-resolv.conf files whenever an IPv6 RA is received.
1) One can observe that by setting systemd-resolved's service in debug mode:
$ sudo systemctl edit systemd-resolved
and in the editor that is opened, add and save this content:
[Service]
Environment=
then restart systemd-resolved and watch the logs scroll by with:
$ journalctl -fu systemd-resolved
3) In another terminal, watch the files be recreated with:
watch -d -n 0.1 stat /run/systemd/
3) In yet another terminal, run a packet capture and watch "ICMP6, router advertisement" messages come by:
sudo tcpdump -ni eth0 icmp6
You will see that every time a RA packet comes in, resolved's journal will log this:
Aug 11 17:33:55 lxd02 systemd-
And the stat monitoring terminal will blink to highlight the new inode and timestamps of the freshly replaced stub-resolv.conf file.
# Additional information:
root@lxd02:~# lsb_release -rd
Description: Ubuntu 20.04.1 LTS
Release: 20.04
root@lxd02:~# apt-cache policy systemd
systemd:
Installed: 245.4-4ubuntu3.2
Candidate: 245.4-4ubuntu3.2
Version table:
*** 245.4-4ubuntu3.2 500
500 http://
100 /var/lib/
245.4-4ubuntu3 500
500 http://
root@lxd02:~# uname -a
Linux lxd01 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
CVE References
Changed in systemd (Ubuntu): | |
importance: | Undecided → Low |
description: | updated |
Changed in systemd (Ubuntu): | |
status: | Incomplete → In Progress |
description: | updated |
Changed in systemd (Ubuntu): | |
status: | In Progress → Fix Released |
Changed in systemd (Ubuntu Focal): | |
status: | New → In Progress |
Changed in systemd (Ubuntu Groovy): | |
status: | New → In Progress |
Changed in systemd (Ubuntu Hirsute): | |
status: | New → In Progress |
importance: | Undecided → Wishlist |
Changed in systemd (Ubuntu Groovy): | |
importance: | Undecided → Wishlist |
Changed in systemd (Ubuntu Focal): | |
importance: | Undecided → Wishlist |
Changed in systemd (Ubuntu Hirsute): | |
assignee: | nobody → Dan Streetman (ddstreet) |
Changed in systemd (Ubuntu Groovy): | |
assignee: | nobody → Dan Streetman (ddstreet) |
Changed in systemd (Ubuntu Focal): | |
assignee: | nobody → Dan Streetman (ddstreet) |
Changed in systemd (Ubuntu Bionic): | |
importance: | Undecided → Wishlist |
description: | updated |
description: | updated |
strace'ing systemd-resolved showed that files under /run/systemd/ netif/links/ are re-created as well when a RA comes in but their content never changes yet the stub-resolv.conf is created over and over:
root@lxd02:~# cat /run/systemd/ netif/links/ * /run/systemd/ resolve/ stub-resolv. conf | md5sum; stat -c "%i" /run/systemd/ resolve/ stub-resolv. conf d31b3e4c96894aa d7 - netif/links/ * /run/systemd/ resolve/ stub-resolv. conf | md5sum; stat -c "%i" /run/systemd/ resolve/ stub-resolv. conf d31b3e4c96894aa d7 - netif/links/ * /run/systemd/ resolve/ stub-resolv. conf | md5sum; stat -c "%i" /run/systemd/ resolve/ stub-resolv. conf d31b3e4c96894aa d7 - netif/links/ * /run/systemd/ resolve/ stub-resolv. conf | md5sum; stat -c "%i" /run/systemd/ resolve/ stub-resolv. conf d31b3e4c96894aa d7 - netif/links/ * /run/systemd/ resolve/ stub-resolv. conf | md5sum; stat -c "%i" /run/systemd/ resolve/ stub-resolv. conf d31b3e4c96894aa d7 - netif/links/ * /run/systemd/ resolve/ stub-resolv. conf | md5sum; stat -c "%i" /run/systemd/ resolve/ stub-resolv. conf d31b3e4c96894aa d7 -
4cec911154fd89f
625
root@lxd02:~# cat /run/systemd/
4cec911154fd89f
624
root@lxd02:~# cat /run/systemd/
4cec911154fd89f
625
root@lxd02:~# cat /run/systemd/
4cec911154fd89f
625
root@lxd02:~# cat /run/systemd/
4cec911154fd89f
624
root@lxd02:~# cat /run/systemd/
4cec911154fd89f
625