My USB stick is now full of backups, and I need to delete at least one to upgrade Nextcloud. I cant.

I try rm -f ./nextcloud-bkp_2017* and I get:

rm: cannot remove './nextcloud-bkp_20171211.tar': Permission denied

So I try sudo rm -f ./nextcloud-bkp_2017* and get:

-bash: sudo: command not found

I then try su And, it asks for a password.

I have tried every password I know, and some I didn't.

It always comes up:

su: Authentication failure

I even try (without knowing if it's the correct app):

apt install sudoer

and, of course, get:

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Is there anything I can do?

Where did sudo go?


1 Answer 1


If sudo is not installed and you don't know the root password, the only way would be to attach your USB stick to another PC and clean it up.

If sudo is installed, then it may be a path setting problem. The "sudo" binary should normally be in "/usr/bin". You can search for it:

find / -name sudo 2>/dev/null

(the "2>/dev/null" part is to get rid of all "Permission denied" warnings you get in the result)

And then use the path:

/usr/bin/sudo rm -f ./nextcloud-bkp_2017*

If it works, you need to see what is wrong in "/etc/profile" file (where the PATH is originally set) and fix it.

It would help if you mention you RasPi and OS versions. And also what user you are logged on with.

  • 1
    Well, certainly I got somewhere: -bash: /usr/bin/sudo: Structure needs cleaning It still didn't clear the files. All I know is: NextCloudPi v0.46.6, and it's a PiB There's no lsb or lshw.
    – user256787
    Commented Feb 3, 2020 at 15:04
  • 2
    @user256787 so you can sudo now. That "Structure needs cleaning" means the file system is corrupted. Normally you should unmount the disk and use "e2fsk" to fix it. Google the error or ask in a seperate question in linux forums.
    – Sohail
    Commented Feb 3, 2020 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.