Override symlink with a normal file

Author: Sacred-SalamanderCreated Sep 26, 2026Updated Sep 27, 2026

Under systemd /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf

So under a systemd system I need to do like this to setup my mount namespace with my own content on /etc/resolv.conf

$ bwrap --dev-bind / / --proc /proc --tmpfs /run --tmpfs /tmp --unshare-net --ro-bind /run/systemd/resolve /run/systemd/resolve --ro-bind-data 13 /run/systemd/resolve/stub-resolv.conf bash 13< <(echo "nameserver 1.1.1.1")

I would like to see something like this instead

$ bwrap --dev-bind / / --proc /proc --tmpfs /run --tmpfs /tmp --unshare-net --ro-bind-data 13 /etc/resolv.conf bash 13< <(echo "nameserver 1.1.1.1")

Bubblewrap doesn't allow this, it will always resolve the symlink, I would like an option or flag to not resolve the symlink but instead create a normal file in the mount namespace, an overlay file

I know it can be dangerous to escape symlinks, that's why bubblewrap has the checks and this behavior, but I still think this is a legit thing you want to do sometimes, when you are aware of the risks

I would suggest something like a --no-follow-symlink or simliar flag I can do just before --ro-bind-data or --file which would change the behavior of the later, or a completely new data bind / file combo that doesn't follow the symlink first, but makes the user aware it can be dangerous