sudo (errormessage>> sudo: unable to lookup via gethostbyname())

Для новичков как вообще в Linux, так и в конкретной теме, к которой относится вопрос.

Модератор: Bizdelnick

Nrik
Сообщения: 4

sudo

Сообщение Nrik »

#error on "sudo":
user@:~$ sudo gedit /etc/hosts
sudo: unable to lookup {hostname} via gethostbyname()
#reason: "hostname" not exists! : in file /etc/hosts 127.0.0.1 = ''
#question: how can i repair the error if i can`t edit /etc/hosts ?
##language: rus, lat, eng
Спасибо сказали:
v04bvs
Сообщения: 636
ОС: Debian GNU/Linux

Re: sudo

Сообщение v04bvs »

1.
su
<root password>
vim /etc/hosts

2. If you don't know root's password and you have physical access to the machine, just reboot it and in kernel command line (for example use "e" button in grub) add parameter init=/bin/sh. (Note: I don't know if LILO have this feature) After loading you will be root in console, enter mount -o remount,rw /; vim /etc/hosts; mount -o remount,ro /; sync; sync; umount /; reboot -f

file /etc/hosts should have line like this:
127.0.0.1 localhost.localdomain localhost

sorry for my terrible engilsh :-)
Спасибо сказали:
Nrik
Сообщения: 4

Re: sudo

Сообщение Nrik »

v04bvs писал(а):
02.01.2006 15:46
1.
su
<root password>
vim /etc/hosts

2. If you don't know root's password and you have physical access to the machine, just reboot it and in kernel command line (for example use "e" button in grub) add parameter init=/bin/sh. (Note: I don't know if LILO have this feature) After loading you will be root in console, enter mount -o remount,rw /; vim /etc/hosts; mount -o remount,ro /; sync; sync; umount /; reboot -f

file /etc/hosts should have line like this:
127.0.0.1 localhost.localdomain localhost

sorry for my terrible engilsh :-)




[/etc/hosts]
127.0.0.1 localhost.localdomain localhost

#The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
[eof]
Спасибо сказали:
Аватара пользователя
sash-kan
Администратор
Сообщения: 13939
Статус: oel ngati kameie
ОС: GNU

Re: sudo

Сообщение sash-kan »

Nrik

Код: Выделить всё

$ cat /etc/nsswitch.conf

?
Писать безграмотно - значит посягать на время людей, к которым мы адресуемся, а потому совершенно недопустимо в правильно организованном обществе. © Щерба Л. В., 1957
при сбоях форума см.блог
Спасибо сказали:
Аватара пользователя
Jan2ary
Бывший модератор
Сообщения: 630
Статус: Тщедушный очкарик

Re: sudo

Сообщение Jan2ary »

Когда-то мне довелось на Ubuntu-Live сменить hostname, после чего я не мог делать hostname обратно и всякие su и sudo.
Решилось через

sudo -p %h old_hostname passwd

может поможет...

Oh, sorry, may be in English...
Looks like you have changed your hostname, but this hostname isn't resolved in /etc/hosts?
It's possible if you give your old hostname to sudo command like this:

sudo -p %h old_host_name vi /etc/host

you'll get what you are want, I hope. So good luck.
Sorry for terrible Engilsh.
Не шалю, никого не трогаю, починяю примус...
Спасибо сказали: