In preparation of a chroot I'm doing an mount --bind /etc/resolv.conf ${MOUNTPOINT}/etc/resolv.conf. I need this because the ${MOUNTPOINT} contains a broken etc/resolv.conf.

However, mount is missing the point of the operation. It complains that ${MOUNTPOINT}/etc/resolv.conf "is a symbolic link to nowhere". Yes, I know. That's why I'm doing the rebind in the first place.

[edit] By request, /etc/resolv.conf is a normal file:

-rw-r--r-- 1 root root 42 Feb 6 12:52 /etc/resolv.conf

with normal content


This should also be used after the chroot, but not by changing the actual ${MOUNTPOINT}/etc/resolv.conf. That should remain as-is:

lrwxrwxrwx 1 root root 27 Jun 14 2017 ${MOUNTPOINT}/etc/resolv.conf -> /run/resolvconf/resolv.conf

(Background: I know about rebinding /run/ in the context of resolv.conf. Doesn't work for me, /etc/resolv.conf is a real file and not a symbolic link. It's only ${MOUNTPOINT}/etc/resolv.conf that's broken, and it's only broken during the chroot so I can't just overwrite it).

  • 1
    I honestly got lot. Would you add la -la /etc/resolv.conf output to the question? – Rui F Ribeiro Mar 12 '18 at 12:50
  • @RuiFRibeiro: Are you aware of bind mounts, especially for files? They are a tad obscure, I know. – MSalters Mar 12 '18 at 12:51
  • I only have used it to mount directories. resolvconf/dnsmask might be getting in your way, and I would not use any of them in a server setting. – Rui F Ribeiro Mar 12 '18 at 12:53
  • @RuiFRibeiro: resolvconf is indeed getting in my way during the chroot. That's what I'm trying to avoid here. – MSalters Mar 12 '18 at 12:58
  • I do not use resolvconf in any of my Debian servers. – Rui F Ribeiro Mar 12 '18 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.