Skip to content

Erratic behaviour with toolbox /etc/resolv.conf when changing its symlink target in host #718

@nanonyme

Description

@nanonyme

Describe the bug
toolbox seems to resolve the final target of /etc/resolv.conf when creating the image. This is causing a set of weird side-effects

  • If /etc/resolv.conf is a real file when creating toolbox and is changed to point to /run/systemd/resolve/stub-resolv.conf after creating toolbox, there will be a broken symlink chain /etc/resolv.conf -> /run/host/etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf (this should be fixed through Also bind mount systemd-resolved /run directories #707)
  • If /etc/resolv.conf points to /run/systemd/resolve/stub-resolv.conf and it's change to /run/systemd/resolve/resolv.conf, the change is not reflected inside toolbox at all

Steps how to reproduce the behaviour

  1. sudo rm /etc/resolv.conf && sudo touch /etc/resolv.conf
  2. toolbox enter
  3. readlink -f /etc/resolv.conf
  4. exit
  5. sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
  6. toolbox enter
  7. readlink -f /etc/resolv.conf

Expected behaviour
Step 3 outputs /run/host/etc/resolv.conf, step 7 outputs /run/systemd/resolv/stub-resolv.conf

Actual behaviour
Step 3 outputs /run/host/etc/resolv.conf, step 7 outputs nothing because /etc/resolv.conf is now a symlink to a broken symlink

Output of toolbox --version (v0.0.90+)
toolbox version 0.0.99.1

Toolbox package info (rpm -q toolbox)
toolbox-0.0.99.1-1.fc34.x86_64

Output of podman version

Version:      3.0.1
API Version:  3.0.0
Go Version:   go1.16
Built:        Mon Feb 22 16:08:57 2021
OS/Arch:      linux/amd64

Podman package info (rpm -q podman)
podman-3.0.1-1.fc34.x86_64

Info about your OS
Fedora SIlverblue 34

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions