0
sudo: unable to resolve host

I think I need to edit the /etc/hosts file to make an entry for 127.0.1.1 PC name.

But how can I do that if I can't access sudo? It seems to have gone since I updated to 13.10.

I have tried nano, which still doesn't work.

kiri
  • 28,986

2 Answers2

2

I'd suggest you boot into recovery mode then edit the hosts file with these steps:

  1. Boot into recovery mode with steps from here: How do I boot into recovery mode?

    Steps 2 - 5 below are from the above question.

  2. Hold Shift after your BIOS has passed, then choose:
    "Advanced options → something ending with '(recovery mode)'"

  3. Choose the "Drop to root shell prompt" option
  4. Remount the root partition as R/W with this command:

    mount -o remount,rw /
    
  5. If you have separate partitions, execute this command to mount them:

    mount -a
    
  6. Edit the /etc/hosts file with this command :

    nano /etc/hosts  # Replace `nano` with your favourite command line editor
    
  7. Make the changes you want.
  8. Press these keys to save and exit it: Ctrl+X; Y; Enter

    Note: If there's a + between two keys, press those at the same time. If there's a ; between two key sequences, press the first sequence, then release it, then press the second.

  9. Reboot:

    reboot
    
kiri
  • 28,986
1

If you set a password on the root account, you can try :

su -

After putting the correct password in (if set) you should be "root" and free to change the files as needed.

Avinash Raj
  • 80,446