Skip to content
  • Thomas Haller's avatar
    dns: change behavior for "rc-manager=symlink" to preserve "/etc/resolv.conf" as file · 15177a34
    Thomas Haller authored
    The purpose of "rc-manager=symlink" is so that the administrator can point
    the "/etc/resolv.conf" as a symlink to a certain file, and thus indicating
    that a certain component is responsible to manage resolv.conf, while others
    should stay away from it.
    For example, systemd-resolved never touches "/etc/resolv.conf", but
    expects the admin to setup the symlink appropriately. It also recognizes
    whether the symlink points to it's own resolv.conf in /run or to another
    component.
    
    Previously, "rc-manager=symlink" would always replace a regular file
    with a symlink to "/var/run/NetworkManager/resolv.conf". Only if
    "/etc/resolv.conf" is already a symlink somewhere else, NM would not
    touch it. This with the exception that if "/etc/resolv.conf" points to
    "/var/run/NetworkManager/resolv.conf", it would replace the symlink
    with the same link to raise inotify events.
    
    Change behavior so if "/etc/resolv.conf" is already a regular file, keep
    it as file.
    This means, if you have multiple components that don't care, everybody
    can write the "/etc/resolv.conf" (as file) and there is no clear
    expressed responsibility.
    It was wrong that NetworkManager would convert the file to a symlink,
    this should be reserved to the admin. Instead, NetworkManager should
    accept that the intent is unspecified and preserve the regular file.
    It's up to the admin to replace the symlink to somewhere else (to keep
    NM off), or to point it to "/var/run/NetworkManager/resolv.conf", to show
    the explicit intent.
    
    The wrong behavior causes dangling symlinks when somebody disables
    NetworkManager for good.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1367551
    15177a34