How to resolve hostnames in chroot? - Ask Ubuntu
i try repair broken ubunu 14.04 chroot. did, boot ubuntu usb mounted original system has repaired , changed system chroot:
sudo mount /dev/sdxy /mnt sudo mount -o bind /dev /mnt/dev sudo mount -o bind /sys /mnt/sys sudo mount -t proc /proc /mnt/proc sudo cp /proc/mounts /mnt/etc/mtab sudo chroot /mnt /bin/bash
that worked fine, in chroot
environment don't have access internet, apt
isn't able resolve hostnames. supposed do?
ping www.askubuntu.com
does not work either.
on newer ubuntu systems, name resolution handled resolvconf service, , /etc/resolv.conf symbolic link /run/resolvconf/resolv.conf. can either add bind mount /run filesystem along other bind mounts before executing chroot command
sudo mount -o bind /run /mnt/run
so chroot system picks host system's dns settings or, once you're in chrooted system, temporarily create static /etc/resolv.conf nameserver(s) of choice e.g.
echo 'nameserver 8.8.4.4' | sudo tee -a /etc/resolv.conf
Comments
Post a Comment