Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I tried to alter my network settings, but the network set-up window wouldn't open. This also affects other admins i.e. printer. I thought it might have something to do with a stuck login window, maybe.
I don't know why the menu items don't work though...
This is what happened
----
I typed: sudo network-admin
Answer: unable to look-up name va gehostbyname
------
The problem may be that I had set up a network with with another computer, then decided to change the name of this computer (not the other one). When I changed the name in the network set up it gave a msg: "If you change the name you may not be able to access some files." Well, I thought that meant on the other computer and not the admin files. Next thing I know I couldnt reopen the networking set-up. If I can't resolve this I might have to reinstall Ubuntu.
This is what happened
----
I typed: sudo network-admin
Answer: unable to look-up name via gehostbyname
------
The problem may be that I had set up a network with with another computer, then decided to change the name of this computer (not the other one). When I changed the name in the network set up it gave a msg: "If you change the name you may not be able to access some files." Well, I thought that meant on the other computer and not the admin files. Next thing I know I couldnt reopen the networking set-up. If I can't resolve this I might have to reinstall Ubuntu.
Aha, interesting. I did a quick google an found this thread in the ubuntu forums which looks to be the same thing.
Just to verify that I understand the problem, can you tell me if you get the same thing when you try to sudo any other command?
OK from the Ubuntu forum post... what it means is that the missing loopback name in the /etc/hosts is causing sudo to fail. By the way, you should be able to read your /etc/hosts file to post it here - it should be readable by all.
If the above description is an accurate representation of the problem (I can't tell without seeing your /etc/hosts file), you need to reboot in single user mode and edit your /etc/passwd file from there. Please post your /etc/hosts file so I can see what is missing. If you really can't read it that it might be the permissions which are wrong. If this is the case, paste the output of this command here:
I had similar trouble last week: I changed my hostname & rebooted. Thereafter I couldn't use sudo.
The solution was to reboot into "Safe" or "Recovery".
That leaves you logged in as root.
Make sure the file /etc/hosts has the line 127.0.0.1 localhost myhostname
Set your hostname hostname myhostname
But for some reason, that didn't update the file /etc/hostname, so I had to edit that file so it held my hostname, rebooted, and all was well.
OK from the Ubuntu forum post... what it means is that the missing loopback name in the /etc/hosts is causing sudo to fail. By the way, you should be able to read your /etc/hosts file to post it here - it should be readable by all.
If the above description is an accurate representation of the problem (I can't tell without seeing your /etc/hosts file), you need to reboot in single user mode and edit your /etc/passwd file from there. Please post your /etc/hosts file so I can see what is missing. If you really can't read it that it might be the permissions which are wrong. If this is the case, paste the output of this command here:
Code:
ls -lF /etc/hosts
Still can't get into it. Even tried to boot via recovery, but it hung and had to manually reboot the machine.
If my memory serves me correctly, 127.0.0.1 localhost may have been accidentally deleted instead of doing a name change. If that is of any consequence.
Still can't get into it. Even tried to boot via recovery, but it hung and had to manually reboot the machine.
If my memory serves me correctly, 127.0.0.1 localhost may have been accidentally deleted instead of doing a name change. If that is of any consequence.
What do you mean "can't get to it"? Can you even log in? I'm not quite understanding where the process is failing. OK, tell me exactly what fails when you try this process:
Open a terminal window (Applications -> Accessories -> Terminal)
Type in the command
Code:
ls -lF /etc/hosts
. If there is any output please paste it here.
If you can't enter recovery mode then to fix it you'll need to boot from the live CD, mount your hard disk and edit the file that way.
What do you mean "can't get to it"? Can you even log in? I'm not quite understanding where the process is failing. OK, tell me exactly what fails when you try this process:
Open a terminal window (Applications -> Accessories -> Terminal)
Type in the command
Code:
ls -lF /etc/hosts
. If there is any output please paste it here.
If you can't enter recovery mode then to fix it you'll need to boot from the live CD, mount your hard disk and edit the file that way.
Typed: 1s -1F /etc/hosts
Reply: command not found
/etc/hosts did not exist before I restarted today. The boot prompt said that the computer name was invalid and began diagnositc automatically which fixed this so I could see the etc/hosts file. I still cannot open the network file to set up network and to veiw the hosts from there.
Here is the hosts file.
-----
127.0.0.1 localhost Powerspec 2 Powerspec 2 Powerspec 2 Powerspec 2
# 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
192.168.0.1 Powerspec 1
-----
Hope this tells you something.
It is a good start!
Your /etc/hosts file is wrong.
It looks as though you have tried to name your machine both "Powerspec 1" and "Powerspec 2". These are both bad names as hostnames should not have spaces in them. Use your favourite editor to make your /etc/hosts file look exactly like this:
Code:
127.0.0.1 localhost
192.168.0.1 powerspec
# 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
Now you need to set your hostname properly, as root execute this command: hostname powerspec
Check that this has worked properly: cat /etc/hostname
You should get a reply of powerspec
If not do this as root, (you should be as I think you are logged into "Recovery" kernel, in which case you are root): echo powerspec > /etc/hostname
Then reboot, into your normal kernel (not the Recovery one).
Things should be a lot better.
HTH
Thanks Matthew for pointing out the spelling for "ls".
I note a serious mistake in my previous post:
echo powerspec > /etc/hosts
Should read:
echo powerspec > /etc/hostname
I have edited my post to reflect this.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.