1

We're building a pseudo-embedded system, where we're trying to replace Centos7.x with RHEL9.x (or AlmaLinux9.x).

CentOS7.x used config files as scripts in /etc/sysconfig/network-scripts but RHEL9.x prefers ini-style files in /etc/NetworkManager/system-connections. So far all's well. The syntax is different, but not wildly impenetrable.

However - we want to keep the rootfs read-only, and used to have symlinks to another read/write partition for these configuration files, and that's something that NetworkManager doesn't seem to like. (It will for example patch /etc/resolv.conf at the slightest provocation, and refuses to follow symlinks for the .nmconnection files.)

Is there a way to use NetworkManager with a Read-Only rootfs? I don't mind having static symlinks for e.g. /etc/NetworkManager and /etc/resolv.conf to a writable filesystem - but simply replacing the files with symlinks doesn't seem to work.

/etc/resolv.conf

[Edited to add:] One reason why replacing e.g. /etc/resolv.conf with a symlink doesn't work is that NetworkManager at startup does not try to edit this file, but instead creates another file in /etc/ and then renames it. Is there a way to tell NetworkManager not to do that?

[Further edit:] It looks very much like this bug, that was reported in 2006. It looks like it was never resolved.

/etc/NetworkManager/

Setting this to a symlink to a folder on another partition works - If SELinux is disabled. If I enable SELinux, it fails.

2
  • 1
    What if you make /etc/NetworkManager a symlink to an alternative directory, rather than the individual files?
    – larsks
    Commented Jul 4, 2023 at 20:25
  • 1
    About SELinux: you can try using semanage fcontext -a -e (see examples) to get it working as usual. Requires to run restorecon at the end.
    – A.B
    Commented Nov 22, 2023 at 20:06

0

You must log in to answer this question.

Browse other questions tagged .