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
2
  • Read the documentation on how grep works. It looks for a "pattern" in /something/, but that something, by default, is stdin, which would cause the "hang" that you describe - just grep waiting for input! You have only provided the pattern (which /looks like/ a file path), not the input. Commented Oct 14, 2024 at 7:16
  • Hmm, do you believe exiting the program when it hung could have caused this issue? That makes sense, but I have no idea why this would delete my /bin files Commented Oct 17, 2024 at 3:54

1 Answer 1

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.

2
  • Yes, the issue is with many commands. Reboot, shutdown, sudo, ls, fdisk... were all missing. Machine is running of its usual disk, built-in orange pi emmc chip. In initramfs I checked my boot / root partitions, but fsck found no errors. Any other suggestions to check? I can restore /bin from a copy, but I would really like to know why this is occurring so I can prevent it in the future. Is it possible the issue occured because I forced a restart by holding the power button, since 'reboot' didn't work? Its unlikely the device was rooted right? Commented Oct 17, 2024 at 4:06
  • I added an update, any ideas? Commented Oct 25, 2024 at 16:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.