Can't get into sudo - HELP!

Sarangan Thuraisingham/சாரங்கன் துரைசிங்கம் sarangan.thuraisingham at
Sat Nov 18 04:07:04 UTC 2006

On Fri, 2006-11-17 at 22:24 -0500, Ed Smits wrote:
> I'm a relatively new UBUNTU user, using Dapper. My laptop has a NIC
> and a WiFi card, both work. NIC is set for fixed IP at the office,
> WiFi is set for DHCP. I haven't yet figured out hardware profiles, so
> my solution has been to disable the WiFi at work and reverse this at
> home.
> Got home today, turned on the laptop, took forever to boot. Tried to
> start the Network app to switch to the WiFi card, nothing happened.
> After many false starts I opened a terminal and tried to run something
> as sudo, got the following error:
> sudo: unable to lookup hostname via gethostbyname()
> hostname being my correct unqualified hostname.
> I opened my hosts file and see only 2 entries (besides the IPv6 ones)
> localhost localhost
> Having more experience with Fedora (but not much more) I figured no
> big deal, I'll log in as root and fix this, of course I don't have
> root logins enabled...
> I went to the rootsudo FAQ at Ubuntu, tried to follow their suggestion
> to go to another terminal window, log in as myself, do a sudo -i and
> then startx -- :1 to get a graphical login as root so I could fix my
> problem. No go, same gethostbyname error when I sudo.
> Questions:
> 1) how do I get in to my system without going back to the office where
> I assume the problem will not affect me
if you want root access you can also try starting in  recovery mode. To
do that, when you start your laptop, in your grub menu choose the entry
with the recovery option. For example I am running Edgy and I would
choose "Ubuntu, kernel 2.6.15-27-386 (recovery)" to start in recovery

> 2) what should my hosts file contain if that is the problem?

My host file:
saru at saru-laptop:~$ cat /etc/hosts localhost saru-laptop saru-laptop servalan uglogin

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Your computer is called something other than localhost right? Because
accoriding to your hosts file, gethostname for ( will return
localhost. In my case it will return "saru-laptop".

ECS, University of Southampton, UK

More information about the ubuntu-users mailing list