Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#45553 - [arch-install-scripts] arch-chroot fails if the chroot does not contain file etc/resolv.conf

Attached to Project: Arch Linux
Opened by Sebastian Pipping (sping) - Saturday, 04 July 2015, 19:42 GMT
Last edited by Dave Reisner (falconindy) - Saturday, 04 July 2015, 21:17 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Hi!

arch-chroot seems to refuse entering chroots without etc/resolv.conf.
Is that intended?

Here is how to reproduce it on the shell:

# ls root_amd64/etc/resolv.conf
ls: cannot access root_amd64/etc/resolv.conf: No such file or directory

# arch-chroot root_amd64/ /bin/echo foo
mount: mount point root_amd64//etc/resolv.conf does not exist
==> ERROR: failed to setup resolv.conf

# touch root_amd64/etc/resolv.conf

# arch-chroot root_amd64/ /bin/echo foo
foo

I am happy to help with debugging if needed.

Best, S
This task depends upon

Closed by  Dave Reisner (falconindy)
Saturday, 04 July 2015, 21:17 GMT
Reason for closing:  Won't fix
Additional comments about closing:  arch-chroot won't finish building your chroot for you. If you expect to have a functional resolver inside the chroot, you need a (even blank) /etc/resolv.conf.
Comment by Dave Reisner (falconindy) - Saturday, 04 July 2015, 20:04 GMT
/etc/resolv.conf is a file owned by a basic package. How are you setting up your chroot such that you don't have the 'filesystem' package installed?
Comment by Sebastian Pipping (sping) - Saturday, 04 July 2015, 20:12 GMT
root_amd64/ is not Arch linux. It's a different distribution.
Comment by Dave Reisner (falconindy) - Saturday, 04 July 2015, 20:27 GMT Comment by Sebastian Pipping (sping) - Saturday, 04 July 2015, 20:35 GMT
That patch seems to leave the chroot with no resolv.conf and no connectivity.
I noticed the

# ensure file exists to bind mount over
if [[ ! -f $resolv_conf ]]; then
install -Dm644 /dev/null "$resolv_conf" || return 1
fi

in the lines above. Could it be that it needs to be moved out of the if to work?
Comment by Sebastian Pipping (sping) - Saturday, 04 July 2015, 20:35 GMT
(the outer if, not miving install out of the inner if)
Comment by Dave Reisner (falconindy) - Saturday, 04 July 2015, 20:53 GMT
You can't really have it both ways. You're knowingly creating a chroot without an /etc/resolv.conf but you want a functional resolver. I'd suggest you augment whatever you're using to create your chroot so that it touches /etc/resolv.conf. Then arch-chroot works.

I really don't want to get into the business of writing to a chroot's /etc. I can get away with the logic you cite because it's highly likely that the symlink replacing /etc/resolv.conf points to /run (for systemd-networkd) -- this is tmpfs, not durable storage.
Comment by Sebastian Pipping (sping) - Saturday, 04 July 2015, 21:12 GMT
Here's a patch to make it work including clean-up, if you change your mind.

Loading...