[Note: against F22-branch, but installing rawhide content, that's how I hit the bug]
systemd changed to generate a symlink resolv.conf -> /run/networkd/resolv.conf which doesn't exist at installation time.
(What we should do at some point is tell NetworkManager to serialize its state into the installation root and get out of the business of writing these files directly)
https://bugzilla.redhat.com/show_bug.cgi?id=1116651
From: Colin Walters walters@verbum.org
systemd changed to generate a symlink resolv.conf -> /run/networkd/resolv.conf which doesn't exist at installation time.
(What we should do at some point is tell NetworkManager to serialize its state into the installation root and get out of the business of writing these files directly)
https://bugzilla.redhat.com/show_bug.cgi?id=1116651 --- pyanaconda/network.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py index f1b3ab8..dee420f 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -28,6 +28,7 @@ from pyanaconda import iutil import socket import os +import errno import time import threading import re @@ -913,10 +914,15 @@ def copyFileToPath(fileName, destPath='', overwrite=False): if not os.path.isfile(fileName): return False destfile = os.path.join(destPath, fileName.lstrip('/')) - if (os.path.isfile(destfile) and not overwrite): + if overwrite: + try: + os.unlink(destfile) + except OSError, e: + if e.errno != errno.ENOENT: + raise + elif os.path.exists(destfile): return False - if not os.path.isdir(os.path.dirname(destfile)): - iutil.mkdirChain(os.path.dirname(destfile)) + iutil.mkdirChain(os.path.dirname(destfile)) shutil.copy(fileName, destfile) return True
@@ -1086,7 +1092,7 @@ def write_network_config(storage, ksdata, instClass, rootpath): disableIPV6(rootpath) copyIfcfgFiles(rootpath) copyDhclientConfFiles(rootpath) - copyFileToPath("/etc/resolv.conf", rootpath, overwrite=flags.livecdInstall) + copyFileToPath("/etc/resolv.conf", rootpath, overwrite=True) instClass.setNetworkOnbootDefault(ksdata) # NM_CONTROLLED is not mirrored in ksdata disableNMForStorageDevices(rootpath, storage)
Doing a quick self-review, I started wondering why the "only write `/etc/resolv.conf` if it didn't exist, or livecd" logic existed. (Which I'm changing to "overwrite always"). This goes way way back to https://github.com/rhinstaller/anaconda/commit/633fb6244a6dbbf07cbb0e8547bd9...
Possibly, we could enhance the logic here to say "only overwrite if not owned by an RPM"? Or we just say that people should do network configuration in `%post` (which would overwrite whatever Anaconda did).
We should say that systemd should not be creating a broken symlink and leave the livecd logic alone. I do like the bit where overwrite really means replace it. As that old commit explains, some people drop in these files themselves and expect it to be left alone.
Ok, how about "overwrite if it's a broken symlink"?
That just seems like a hack to me. What if another package wants to create a broken symlink on purpose? systemd is what is broken here, it is what should be fixed. It assumes that no other package in the install package set might create /etc/resolv.conf, something that it has no way of knowing at install time. If it really wants this symlink it should be checking it at runtime.
The complexity here is systemd *is* creating it at "runtime", but allow `%post` to work we're running systemd-tmpfiles at install time.
The way `systemd-tmpfiles` works, it won't overwrite anything that already exists at that time. So this is really an install time only bug.
As far as "What if another package wants to create a broken symlink on purpose?" - That doesn't seem like a realistic scenario to me.
anaconda-patches@lists.fedorahosted.org