Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to reinstall grub on a second disk, following the instructions at Purge & Reinstall Grub.

After doing sudo chroot /mnt, when I attempt apt-get update, I get lot of failed to fetch messages. Apparently DNS is not working, since running the host command on any hostname times out: no servers could be reached.

If I exit the chroot, host and apt-get update work just fine.

share|improve this question
add comment

2 Answers

According to your description your chrooted environment has no information about valid nameservers (DNS). You can copy the file /etc/resolv.conf into the etc directory of your chroot environment. You could also edit the file /mnt/etc/resolv.conf (or if you are inside the chroot in /etc/resolv.conf) and add the line

nameserver 8.8.8.8

This uses a nameserver from Google.

When your system has valid information about DNS servers it will work again as expected.

share|improve this answer
add comment

Inside the chroot, edit /etc/resolv.conf (nano /etc/resolv.conf) and insert the following line:

nameserver 8.8.8.8

Name resolution should work now.

PS: Press Ctrl+O,Enter to save the file in nano and Ctrl+X to exit.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.