osbuild-run: remove any /etc/nsswitch.conf
On some hosts, systemd-tmpfiles will generate an nsswitch.conf configuring DNS to be done via systemd-resolved, but this will require the container to be booted and resolved to be running. In other cases, a proper fall-back is configured, so this is not a problem, but on some hosts this means DNS does not work. Conversely, the default behavior with no nsswitch.conf at all works just fine, always using nss-dns. Let's simply delete the file if it is there, and rely on the default. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
7c7fcecd47
commit
3669978577
1 changed files with 11 additions and 0 deletions
11
osbuild-run
11
osbuild-run
|
|
@ -60,12 +60,23 @@ def tmpfiles():
|
|||
subprocess.run(["systemd-tmpfiles", "--create"])
|
||||
|
||||
|
||||
def nsswitch():
|
||||
# the default behavior is fine, but using nss-resolve does not
|
||||
# necessarily work in a non-booted container, so make sure that
|
||||
# is not configured.
|
||||
try:
|
||||
os.remove("/etc/nsswitch.conf")
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ldconfig()
|
||||
sysusers()
|
||||
update_ca_trust()
|
||||
update_ca_certificates()
|
||||
tmpfiles()
|
||||
nsswitch()
|
||||
|
||||
r = subprocess.run(sys.argv[1:])
|
||||
sys.exit(r.returncode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue