Suddenly no sudo command can be executed and no internet connection established

mike_linux

Active Member
Joined
Nov 20, 2020
Messages
137
Reaction score
67
Credits
1,287
Hi guys, I have made some changes via the sudo -R command because of the installation of dependencies for packages I needed for a robotics course, and after that I cannot execute the sudo command anymore and my internet connection is down. I am using Ubuntu 20.04. LTS. The other problem is that I cannot remember my root password to get access. I have posted a screenshot which describes the problem. Hope you can help me so I can proceed with my course. The chmod commands I issued in the screenshot are based on a google search to fix the problem but it doesn't work.

IMG_3228.JPG
 


The other problem is that I cannot remember my root password to get access.
I'm not sure if the link above will fix the trouble. But maybe. There has been a trend in some Linux, including Ubuntu, that the root account is locked... and therefore you do not set a root password when you install Ubuntu. When you use sudo in Ubuntu, you would give user mike's password, and it should allow you do do administrative tasks.


I have made some changes via the sudo -R command
The Ubuntu man page for sudo does not list a -R option, so I can't really guess if that caused your problem. There is a -r option related to SELinux, but I don't think Ubuntu typically uses SELinux. I see in the screenshot that you used chown -R, so maybe you're just a bit confused. Or I am. ;)

Anyway, fix your ability to use sudo first above all else. You can't use chown or install your robotics software without sudo access. You can't even update your system without sudo.
 
Last edited:
Hi @stan, hope you're doing fine :).

I have checked out this guide but I need to reset my superuser password not the user password. This guide describes how to reset the user pass. When I try to issue su my_pass then I get the an Authentication failed error message despite the right password.

EDIT:
I have managed to reset my root password using this guide :). Now I will proceed if I can fix the main problem. As I can see I still have no internet access :(. I am using the TP TL-WN823N USB adapter which I had setup using this guide. And worked until yesterday where suddenly the internet connection was lost.
 
Last edited:
I'm not sure if the link above will fix the trouble. But maybe. There has been a trend in some Linux, including Ubuntu, that the root account is locked... and therefore you do not set a root password when you install Ubuntu. When you use sudo in Ubuntu, you would give user mike's password, and it should allow you do do administrative tasks.



The Ubuntu man page for sudo does not list a -R option, so I can't really guess if that caused your problem. There is a -r option related to SELinux, but I don't think Ubuntu typically uses SELinux. I see in the screenshot that you used chown -R, so maybe you're just a bit confused. Or I am. ;)

Anyway, fix your ability to use sudo first above all else. You can't use chown or install your robotics software without sudo access. You can't even update your system without sudo.
I have used this solution here @stan. That is why I issued chmod -R :).
 
I have checked out this guide but I need to reset my superuser password not the user password.
I'm glad you have resolved the root password issue, but let me dwell on this for a moment. As I mentioned before, the root account on modern Ubuntu is locked by default. It can be unlocked, and I suppose you have done so, whether intentionally or by accident. To make life easier, keep your root password the same as your user password. To be more secure, don't unlock your root account. ;)

Your screenshot shows you may not well understand what it means to "become root." The simple way to tell is to look at your terminal prompt: if it ends with $, you are a regular user, if it ends with #, you are root. As a regular user, you need to sudo to give administrative commands. As root, you do not use sudo. You can make it possible for root to use sudo too, but why?

Your link is using Lubuntu 2014... be careful using old instructions. It showed:
Code:
$ su root     #enter password
$ chmod 644 /usr/lib/sudo/sudoers.so
$ chown -R root /usr/lib/sudo
Note their example did not change $ to # after becoming root... a bad example. Maybe 'su root' worked in 2014, but you did realize that it doesn't work now, and you used 'sudo su' which usually does work, but it didn't in your screenshot... it threw errors, maybe because the root account was locked, I'm not sure.

When you used 'chown -R'... you still had the $ prompt so you were not root (plus the errors should have woke you up to this fact too). You could have used 'sudo chown -R' and given your password (mike's password), and it should have worked. Well, not really.... the files in that directory are already owned by root (and sudoers.so permissions are already 644 too), so you wouldn't have changed anything anyway. ;)

I hope that helps your understanding of root, and what may be part of your troubles. Before changing permissions (chmod) or ownership (chown)... it's a good idea to use ls -al to see what they are first and try to understand the repercussions. Changing root-owned files might break your system or leave you vulnerable to malicious activities. :oops:
 
I am using the TP TL-WN823N USB adapter which I had setup using this guide. And worked until yesterday where suddenly the internet connection was lost.
Holy $#*%... that's a lot of effort. Often a kernel update will break things like this. So my first guess would be to try to go through that video again, step-by-step, to see if it will fix it.

My better advice would be to buy a wireless dongle that is more Linux friendly. There seem to be a number of them, as low as $10. My go-to dongle is TP-Link TL-WN722N. It's a little older, slower, and it's big and clunky (antenna gives better range).... but this dongle has worked (plug-and-play) in every single Linux distro I've ever plugged it into, and that's a lot. I've usually paid about $12-$15.

Your dongle on Amazon does not show Linux compatibility.

Here's an example on Amazon, Linux compatible, $10, small form factor (less range), with almost 59,000 positive reviews.
 
Last edited:
Holy $#*%... that's a lot of effort. Often a kernel update will break things like this. So my first guess would be to try to go through that video again, step-by-step, to see if it will fix it.

My better advice would be to buy a wireless dongle that is more Linux friendly. There seem to be a number of them, as low as $10. My go-to dongle is TP-Link TL-WN722N. It's a little older, slower, and it's big and clunky (antenna gives better range).... but this dongle has worked (plug-and-play) in every single Linux distro I've ever plugged it into, and that's a lot. I've usually paid about $12-$15.

Your dongle on Amazon does not show Linux compatibility.

Here's an example on Amazon, Linux compatible, $10, small form factor (less range), with almost 59,000 positive reviews.
Cool I will check the dongle out, but in general my dongle is also compatible with linux but tedious to set it up (especially if you are very new to linux). My dongle cost 10€ :). At present I have connected my laptop via LAN cable so I can proceed with my course for now.
 
Compatible when you beat it over the head! LOL. But that's not "Linux friendly." ;)

I can't guarantee the $10 dongle will be plug-and-play.... but I can almost guarantee that the one that I use, TL-WN722N, would be. I've never had an issue with it.
 
I'm glad you have resolved the root password issue, but let me dwell on this for a moment. As I mentioned before, the root account on modern Ubuntu is locked by default. It can be unlocked, and I suppose you have done so, whether intentionally or by accident. To make life easier, keep your root password the same as your user password. To be more secure, don't unlock your root account. ;)
To be honest I believe I unlocked it accidentally. How can I prevent from unlocking my root account?

Your screenshot shows you may not well understand what it means to "become root." The simple way to tell is to look at your terminal prompt: if it ends with $, you are a regular user, if it ends with #, you are root. As a regular user, you need to sudo to give administrative commands. As root, you do not use sudo. You can make it possible for root to use sudo too, but why?
This is something I mostly forget to look for that # is root and $ is user.

Your link is using Lubuntu 2014... be careful using old instructions. It showed:
Code:
$ su root     #enter password
$ chmod 644 /usr/lib/sudo/sudoers.so
$ chown -R root /usr/lib/sudo
Note their example did not change $ to # after becoming root... a bad example. Maybe 'su root' worked in 2014, but you did realize that it doesn't work now, and you used 'sudo su' which usually does work, but it didn't in your screenshot... it threw errors, maybe because the root account was locked, I'm not sure.

When you used 'chown -R'... you still had the $ prompt so you were not root (plus the errors should have woke you up to this fact too). You could have used 'sudo chown -R' and given your password (mike's password), and it should have worked. Well, not really.... the files in that directory are already owned by root (and sudoers.so permissions are already 644 too), so you wouldn't have changed anything anyway. ;)

I hope that helps your understanding of root, and what may be part of your troubles. Before changing permissions (chmod) or ownership (chown)... it's a good idea to use ls -al to see what they are first and try to understand the repercussions. Changing root-owned files might break your system or leave you vulnerable to malicious activities. :oops:
I believe in future it is better not to touch the ownership and mode of files which I am not sure about where they are related. So I will only use chown and chmod for files in my projects where I can have a better overview of them. Thanks for the advice. Unfortunately, the course uses a vm image of Lubuntu I don't know why. Maybe they didn't want to create a new one who knows.
 
Compatible when you beat it over the head! LOL. But that's not "Linux friendly." ;)

I can't guarantee the $10 dongle will be plug-and-play.... but I can almost guarantee that the one that I use, TL-WN722N, would be. I've never had an issue with it.
Which one should I buy here are three versions from v1 to v3. I believe v3 the new one right?
 
Which one should I buy here are three versions from v1 to v3. I believe v3 the new one right?
Not sure if you mean the $10 dongle, or the one that I use... I don't see any version revisions on them, but I know they do revise products and keep the same model number. So, yes, v3 would be the newest one, but read the specs to be sure it still advertises Linux. It will usually tell you the Linux kernel version that is compatible (has built-in drivers). None will tell you the latest kernel... they are not that up to date with their advertising, and that's partly why I can't guarantee plug-and-play for you. Sadly, it happens sometimes that products say they work with Linux, and then they don't... or they don't work well. That's why a large number of positive reviews can help give confidence in a particular product. You won't read through thousands of reviews, but scan through some, looking especially for Linux comments.
 
Last edited:
How can I prevent from unlocking my root account?
Well, honestly, I don't think you want to prevent it... you just want to be careful about it. It's really fairly easy to both unlock root and to lock it back.


One way to tell if the root account is locked:
Code:
sudo passwd -S root
This will show, at the beginning of the line, after root, either a L (locked) or a P (usable password). There are other ways too. This article covers different ways of detecting, locking, and unlocking root, and they have images to clearly see the outputs from Ubuntu 20.04.

Locking root disables logging in as root, but it does not prevent you from becoming root with sudo su. If you have a long list of 'sudo' tasks you need to do for your course, it makes sense to become root so you don't have to keep typing 'sudo' over and over.

In your screenshot, sudo su failed. Is this now working properly since you corrected the password issue?
 
Last edited:
Well, honestly, I don't think you want to prevent it... you just want to be careful about it. It's really fairly easy to both unlock root and to lock it back.


One way to tell if the root account is locked:
Code:
sudo passwd -S root
This will show, at the beginning of the line, after root, either a L (locked) or a P (usable password). There are other ways too. This article covers different ways of detecting, locking, and unlocking root, and they have images to clearly see the outputs from Ubuntu 20.04.

Locking root disables logging in as root, but it does not prevent you from becoming root with sudo su. If you have a long list of 'sudo' tasks you need to do for your course, it makes sense to become root so you don't have to keep typing 'sudo' over and over.

In your screenshot, sudo su failed. Is this now working properly since you corrected the password issue?
THX @stan for the explanation and the suggestion. Yes the sudo su command now works again :). I will look after the article to learn more about.
 

Members online


Latest posts

Top