0

cb@coreboot-bm-4:~$ pwd /home/cb cb@coreboot-bm-4:~$ sudo mv /* ADL-P/

and now I can't do anything

when I try something like:

cb@coreboot-bm-4:~$ ls -bash: /bin/ls: No such file or directory

2 Answers 2

0

The problem is not only the the binaries in /bin and /usr/bin are moved. But even if you run them directly, they won't be able to find their libraries. In other words,you won't be able to move back / from that shell.

Many VM providers offer you the option to mount a rescue system, or other ISO. If you can upload your own ISO, I recommend: https://www.system-rescue.org/. Or use an installer ISO and try to access the shell.

For example, the standard Debian installer offers "rescue mode" by selecting Advanced options -> Rescue mode. Click through the dialogs and when it asks which filesystem root to use select Do not use a root filesystem and Execute a shell in the installer environment.

Regardless if you used debian, systemrescuecd or any other method. Once you have a shell:

  1. Identify the root device with fdisk -l
  2. Mount the root device: mkdir -p /mnt/root && mount /dev/vda1 /mnt/root. (replace /dev/vda1 with the actual device!)
  3. Move everything back: mv /mnt/root/ADL-P/* /mnt/root

In some rescue shells, like the debian one, you can get an error: Can't rename ... : Directory not empty. Only in that case you need to use the -n option: mv -n /mnt/root/ADL-P/* /mnt/root

  1. Reboot the system: reboot (perhaps you need to manually remove the ISO from your provider's dashboard)

Good luck!

-1

Try /ADL-P/usr/bin/sudo /ADL-P/usr/bin/mv /ADL-P /

Edit: Just found this one https://askubuntu.com/questions/951134/accidentally-moved-usr-bin

13
  • cb@coreboot-bm-4:~$ FSP_Integration/ADL-P/usr/bin/sudo FSP_Integration/ADL-P/usr/bin/mv /ADL-P / bash: FSP_Integration/ADL-P/usr/bin/sudo: No such file or directory Commented Mar 10, 2022 at 10:38
  • Humm lets go step by step lets try to Locate /usr/bin in the new path so FSP_Integration/ADL-P/usr/bin/ls FSP_Integration/ADL-P/
    – ser356
    Commented Mar 10, 2022 at 10:56
  • Right, but how to locate /usr/bin to new path? Commented Mar 10, 2022 at 11:01
  • Does FSP_Integration/ADL-P/usr/bin/ls FSP_Integration/ADL-P/ return error? if not you have located new "root" path, now invoking FSP_Integration/ADL-P/usr/bin/cd .. located u un the new use bin
    – ser356
    Commented Mar 10, 2022 at 11:19
  • FSP_Integration/ADL-P/usr/bin/<command> executes every command as it would be un the past now the last step is mover the files to /
    – ser356
    Commented Mar 10, 2022 at 11:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .