All of a sudden any sudo command not working anymore


I’m a noobie to Linux, so looking for some help on this one.

Platform information:
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 9 (stretch)
Linux 4.14.79-v7+
openHAB 2.4.0-1 (Release Build)

After some time, all of a sudden, I cannot use any "sudo… " command anymore from SSH. Other commands like “ls” and “dmsg” are working fine.

I login with the ‘openhabian’ user to the SSH terminal.

[14:02:50] openhabian@homehab:~$ sudo openhabian-config
-bash: /usr/bin/sudo: No such file or directory

I tried googling for this but the only explaination for this issue I found that it could be a disk malfuction. Is this really the case?

I tried rebooting the RPi, same isssue. PaperUI comes up but all my Things are offline (UNINITIALIZED)

Can I fix this issue? or do I need to reinstall?

Probably, unless you accidentally deleted the sudo file yourself which is unlikely.

You probably need to reinstall. The file system corruption could be caused by the RPi losing power in which case your SD card is probably fine. But it could also be caused by the SD card wearing out. In that case you will have to replace the SD card.

It is theoretically possible to replace the missing sudo file, but it will require you to mount the SD card on another machine that can read ext4 filesystems. Then find the Raspbian version of sudo somewhere and replace the file. BUT, it is unlikely that this is the only file that is missing on this machine. You will spend WAY more time checking and verifying that nothing else is missing then you would if you just start over again. And even if you do this successfully, if the SD card is indeed wearing out it’s just going to become corrupt again almost immediately.

I hope you have backups. Good luck!

Hi rikoshark,

Thank you for the reply and the detailes. I was afraid of that. I did a re-instal yesterdayl. I will take a close look when reinstalling/reconfiguring and see if I can reproduce the problem.