Page 1 of 1
Unable to resolve error - no idea why?
Posted: Fri Apr 27, 2018 1:31 pm
by theMusicMan
Hi All
Have booted up my Pi3+ after not being home for a few days, so I decided to do the usual update and upgrade commands at the terminal. This is what I received as a reply...
Code: Select all
root@RPi3B:~# sudo apt-get upgrade
sudo: unable to resolve host RPi3B: Connection timed out
I did change the hostname a few days ago, but it worked after that perfectly fine for a few days. Can anyone offer some advice please.
Thanks
John
Re: Unable to resolve error - no idea why?
Posted: Fri Apr 27, 2018 1:38 pm
by B.Goode
Does using sudo if you are already logged in as root confuse the issue... ?
Re: Unable to resolve error - no idea why?
Posted: Fri Apr 27, 2018 1:48 pm
by jbudd
sudo: unable to resolve host RPi3B: Connection timed out
Edit - rewritten!
The current hostname should be consisent between /etc/hostname, /etc/hosts and $HOSTNAME.
So long as the two files have the same value, you might fix it with
, or rebooting.
Re: Unable to resolve error - no idea why?
Posted: Fri Apr 27, 2018 3:01 pm
by thagrol
theMusicMan wrote: ↑Fri Apr 27, 2018 1:31 pm
Hi All
Have booted up my Pi3+ after not being home for a few days, so I decided to do the usual update and upgrade commands at the terminal. This is what I received as a reply...
Code: Select all
root@RPi3B:~# sudo apt-get upgrade
sudo: unable to resolve host RPi3B: Connection timed out
I did change the hostname a few days ago, but it worked after that perfectly fine for a few days. Can anyone offer some advice please.
Thanks
John
How did you change the hostname?
And did you update /etc/hosts to match?
I've been working on a script to change hostname on first boot and found that if you don't update /etc/host you'll see that error. The last line of the default raspbian hosts file reads"127.0.0.1 raspberrypi". In your case change it to "127.0.0.1 RPI3B". Leave the other "127.0.0.1" line unchanged.
Re: Unable to resolve error - no idea why?
Posted: Fri Apr 27, 2018 5:19 pm
by theMusicMan
jbudd wrote: ↑Fri Apr 27, 2018 1:48 pm
sudo: unable to resolve host RPi3B: Connection timed out
Edit - rewritten!
The current hostname should be consisent between /etc/hostname, /etc/hosts and $HOSTNAME.
So long as the two files have the same value, you might fix it with
, or rebooting.
I tried rebooting - no joy, just the same. But I didn't amend the etc/hosts file, just etc/hostname
You've pinpointed the issue though, so many thanks for that.
Really enjoying learning all things linux

Re: Unable to resolve error - no idea why?
Posted: Fri Apr 27, 2018 5:22 pm
by theMusicMan
thagrol wrote: ↑Fri Apr 27, 2018 3:01 pm
theMusicMan wrote: ↑Fri Apr 27, 2018 1:31 pm
Hi All
Have booted up my Pi3+ after not being home for a few days, so I decided to do the usual update and upgrade commands at the terminal. This is what I received as a reply...
Code: Select all
root@RPi3B:~# sudo apt-get upgrade
sudo: unable to resolve host RPi3B: Connection timed out
I did change the hostname a few days ago, but it worked after that perfectly fine for a few days. Can anyone offer some advice please.
Thanks
John
How did you change the hostname?
And did you update /etc/hosts to match?
I've been working on a script to change hostname on first boot and found that if you don't update /etc/host you'll see that error. The last line of the default raspbian hosts file reads"127.0.0.1 raspberrypi". In your case change it to "127.0.0.1 RPI3B". Leave the other "127.0.0.1" line unchanged.
Hi
I changed the hostname by using nano to edit the etc/hostname file, and didn't update etc/hosts to match. I am getting a whole host of errors on reboot now too. Boot process advised me to use
... to investigate the logs, which I did and there are several lines indicated in red. I may have a look at what they all mean, but I am not afraid to admit, I am a learner at them moment so this may very well be above my pay grade haha. I'll press on though and see if I can determine what's happened though it might be just as well to create a new install SD card. I have another on order from Amazon, arriving tomorrow.

Re: Unable to resolve error - no idea why?
Posted: Fri Apr 27, 2018 5:23 pm
by B.Goode
It's probably 'cheating' by making things too easy, but just to observe that there is an option in the raspi-config utility to change the hostname. I'm pretty sure it makes consistent changes in all the relevant places, and reminds you to reboot if necessary.