FS#64490 - [arch-install-scripts] Host root is mounted to /etc/resolv.conf

Attached to Project: Arch Linux
Opened by Maxim (mxfm) - Wednesday, 13 November 2019, 21:19 GMT
Last edited by morganamilo (morganamilo) - Monday, 18 November 2019, 04:02 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To No-one
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: after switching in arch-chroot host root is mounted to /etc/resolv.conf.

According to the source (https://git.archlinux.org/arch-install-scripts.git/tree/arch-chroot.in#n26) there is some logic to handle special cases of resolv.conf, but in my setup I have plain, not linked file.


Additional info:
* package version(s) 22-1
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:

1) Mount some partition to some directory or do a bind mount.
2) Call lsblk, try to delete /etc/resolv.conf.

I noticed this issue some time ago.
This task depends upon

Closed by  morganamilo (morganamilo)
Monday, 18 November 2019, 04:02 GMT
Reason for closing:  Not a bug
Additional comments about closing:  it's a feature
Comment by Dave Reisner (falconindy) - Wednesday, 13 November 2019, 21:37 GMT
> host root is mounted to /etc/resolv.conf.

I can't parse this. You can't possibly mean that a directory is mounted on a file. Do you mean /etc/resolv.conf from the host is bind mounted into the chroot? That's worked as intended.
Comment by Eli Schwartz (eschwartz) - Wednesday, 13 November 2019, 21:50 GMT
$ sudo mount --bind /var/lib/archbuild/extra-x86_64/root /var/lib/archbuild/extra-x86_64/root && sudo arch-chroot /var/lib/archbuild/extra-x86_64/root/ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 698.7G 0 disk
├─sda1 8:1 0 2M 0 part
├─sda2 8:2 0 10G 0 part [SWAP]
└─sda3 8:3 0 688.6G 0 part /etc/resolv.conf


Okay, that looks bizarre and I think lsblk is broken in attempting to convey the meaning behind this, but also, that is not actually a bug.

$ sudo mount --bind /var/lib/archbuild/extra-x86_64/root /var/lib/archbuild/extra-x86_64/root && sudo arch-chroot /var/lib/archbuild/extra-x86_64/root/ findmnt /etc/resolv.conf
TARGET SOURCE FSTYPE OPTIONS
/etc/resolv.conf /dev/sda3[/etc/resolv.conf] btrfs rw,relatime,space_cache,subvolid=5,subvol=/etc/resolv.conf

It's a completely ordinary bind mount, as expected.

$ sudo mount --bind /var/lib/archbuild/extra-x86_64/root /var/lib/archbuild/extra-x86_64/root && sudo arch-chroot /var/lib/archbuild/extra-x86_64/root/ file /etc/resolv.conf
/etc/resolv.conf: ASCII text

It's a completely ordinary ASCII text file, as expected, not a directory.

> try to delete /etc/resolv.conf

Why would you want to do that? Because you hate the internet? This is an unsupported operation.
Comment by Maxim (mxfm) - Thursday, 14 November 2019, 05:14 GMT
> Do you mean /etc/resolv.conf from the host is bind mounted into the chroot? That's worked as intended.

I see. I was confused by ...

> Okay, that looks bizarre and I think lsblk is broken in attempting to convey the meaning behind this, but also, that is not actually a bug.

this. I thought there is some bug in mounting.

> Why would you want to do that? Because you hate the internet? This is an unsupported operation.

Because during installation I move my custom resolv.conf from backup to /etc/resolv.conf. This cannot be done because of the following error:
mv: inter-device move failed: 'etc.resolv.conf.back' to '/mnt/2/etc/resolv.conf'; unable to remove target: Device or resource busy

The solution is to unmount resolv.conf.

Tl;dr I was confused by lsblk output and mv error, concluded that there is arch-chroot bug. If it works as intended, the issue can be closed.
Comment by Eli Schwartz (eschwartz) - Thursday, 14 November 2019, 05:16 GMT
You could also restore your resolv.conf backup from outside of the arch-chroot environment.

Loading...