Arch Linux

Please read this before reporting a bug:

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!

FS#43540 - [arch-install-scripts] arch-chroot: mount error, no hostname resolution in chroot

Attached to Project: Arch Linux
Opened by Alain Kalker (ackalker) - Thursday, 22 January 2015, 13:14 GMT
Last edited by Dave Reisner (falconindy) - Sunday, 15 February 2015, 20:14 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



Trying to chroot to an Arch Linux filesystem, I get the following error, and hostname resolution doesn't work:

# arch-chroot mnt
mount: mount point mnt/etc/resolv.conf is a symbolic link to nowhere
# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 34 Jan 22 2015 /etc/resolv.conf -> ../run/systemd/resolve/resolv.conf
# ping
ping: unknown host

The system I'm chrooting to has systemd-resolved.service enabled and working fine, hostname resolution works fine when I boot it.

I think this case needs some special handling in arch-chroot:

- if <chroot>/etc/resolv.conf is a symlink pointing at ../run/systemd/resolve/resolv.conf or /run/systemd/resolve/resolv.conf, create a dummy file at <chroot>/run/systemd/resolve/resolv.conf and bind-mount host /etc/resolv.conf onto that.
- if <chroot>/etc/resolv.conf is a regular file, bind-mount host /etc/resolv.conf as usual.

Additional info:
* package version(s)
arch-install-scripts 14-1
* config and/or log files etc.

Steps to reproduce:
This task depends upon

Closed by  Dave Reisner (falconindy)
Sunday, 15 February 2015, 20:14 GMT
Reason for closing:  Fixed
Additional comments about closing:  arch-install-scripts v15
Comment by Alain Kalker (ackalker) - Saturday, 24 January 2015, 09:43 GMT
*{in the tmpfs mounted on <chroot>/run,} create a dummy file at ...
Comment by Dave Reisner (falconindy) - Monday, 26 January 2015, 23:13 GMT
I think it's best to just handle this generically. Could you check that arch-chroot in git does what you want? Specifically, it ought to be addressed by:
Comment by Alain Kalker (ackalker) - Wednesday, 28 January 2015, 12:45 GMT
Thanks for the quick reply.

Yes, this change makes it do what I want for the case where mnt/etc/resolv.conf is a symlink. It would be nice if it could also deal with the case where mnt/etc/resolv.conf doesn't exist at all, i.e. building an entirely "/etc'less" system with the help of systemd.
I know that that isn't the way in which Arch Linux currently works, but hey, why not look toward the future? :-)
Comment by Alain Kalker (ackalker) - Wednesday, 28 January 2015, 13:03 GMT
Nevermind, your solution doesn't touch the chroot in any way unless absolutely necessary. It even works on a read-only chroot, nice!

Your solution is fine with me, congrats! :-)