0

this is the 2nd time I have come across this error, and I am trying to understand why it occurred. Has my device been compromised, as suggested here?

I am running Ubuntu 22.04

Steps taken leading up to error:

sudo chmod 600 configfile.yaml (From inside /etc/netplan/)
sudo configfile.yaml (commented out irrelevant line, ctrl-x, yes, saved file)

When I attempted to apply my changes...

(base) user@device:/etc/netplan$ sudo netplan apply
-bash: /usr/bin/sudo: no such file or directory
(base) user@device: cd /usr/bin
(base) user@device: ls
-bash: /usr/bin/ls: no such file or directory

Suddenly, almost every command failed to run. Though /usr/bin still existed, many commands were missing.

My path variable seemed fine...

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

But I could not do anything. I tried rebooting, it failed to find an init file in any folders, loading to 'initramfs'

run-init: cant execute '/sbin/init': No such file or directory

I do not know what the issue was, but many files in 'root/sbin, root/bin, root/lib' were entirely missing.

Copying these folders from a clean install resolved the problem, allowing me to boot again, but I am trying to understand why the issue occurred, how I can prevent it from occurring again, and if my device has been rooted as a result of some open ports.

If it is helpful...

The first time this occurred, I tried to run this file sudo sh ./script.sh.

grep /etc/netplan/configfile.yaml >> output.txt
grep /etc/hostapd/configfile.conf
ip a show wlan0 >> output.txt
echo "Text..." >> output.txt
systemctl enable netplan >> output.txt 

Issues with the script, Sure. Nothing in here seems like it should have bricked my machine though.

UPDATE:

It happened again. No idea why. I tried to ssh in and it wouldn’t accept my key. Wanted me to manually login. Typed it out but it kept saying ‘invalid password’.

After I copied over the missing folders from the 2nd time, I tried the following

  • [x] Read tested all Disk chunks
  • [x] fsck’d boot drive (mmcblk0p1). Can’t figure out how to fsck root drive. It’s mounted in initramfs, if i umount it, the folder /dev disappears, and I can’t fsck if.
  • [x] Tried reinstalling/repairing ubuntu core libraries

1 Answers1

0
(base) user@device: cd /usr/bin
(base) user@device: ls
-bash: /usr/bin/ls: no such file or directory

Asuming that this occurred while the machine was running off its usual disk, then this is the issue - not just sudo.

Either something is masking /usr/bin, the files have been deleted or the filesystem has gone away.

I tried rebooting, it failed to find an init file in any folders

Most likely options 2 or 3 then. Reboot from removable media, check the disk and filesystems for errors.

symcbean
  • 23,767
  • 2
  • 38
  • 58