| How to resolve "sudo: unable to resolve host" error in Ubuntu |
|
|
|
|
I came to an error on my Ubuntu machine after I added dhcp Internet settings and added Domain Name and Host Name under Host Settings. The error message was: sudo: unable to resolve host username-desktop and the problem was, I am not able to use sudo command in any way to gain access to root, which obviously is necessary to perform many operations in Ubuntu systems. So, here is the work around to resolve this issue. 1. Go to "System -> Administration -> Users and Groups" and set password for root user 2. Now, open a terminal (Applications -> Accessories -> Terminal" 3. Enter command "su -" and it will prompt you for password 4. Enter your root password to gain access as the root user 5. Now, you can work and perform as an root user and can modify the system files. 6. At this stage, we need to modify /etc/hosts. Please open it in vi editor with following command: vi /etc/hosts 7. Modify this file to look like the following entries (please do replace username below with the first username you have assigned): 127.0.0.1 localhost 8. Save the file using ZZ in vi editor and open a new terminal window or tab 9. Now, enter sudo command or sudo fdisk -l and it should work fine! |
| < Prev | Next > |
|---|