You are not logged in.

#1 2023-10-11 19:14:28

HomyC0der
Member
Registered: 2023-09-25
Posts: 20

Removed all in /tmp dir - after restarting loading only BIOS

Hello, i have deleted all in /tmp directory< system crashed, after rebooting there are no bootloaders (Neither Windows or Linux (grub)), I had Arch and Windows 11.

I tried to load from live cd to check out what is it.

lsbk (i had root, home and swap mounts - nothing there now):

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0 683.9M  1 loop /run/archiso/sfs/airootfs
sda           8:0    1 119.3G  0 disk 
└─sda1        8:1    1 119.2G  0 part /run/archiso/bootmnt
nvme0n1     259:0    0 476.9G  0 disk 
├─nvme0n1p1 259:9    0   300M  0 part 
├─nvme0n1p2 259:10   0   128M  0 part 
├─nvme0n1p3 259:11   0 198.1G  0 part 
├─nvme0n1p4 259:12   0   900M  0 part 
├─nvme0n1p5 259:13   0  13.7G  0 part 
├─nvme0n1p6 259:14   0    10G  0 part 
├─nvme0n1p7 259:15   0  69.8G  0 part 
└─nvme0n1p8 259:16   0 184.1G  0 part

After i tried to mount all again the same way as an installation i could locate to all files of my system:

mkswap /dev/nvme0n1p6
swapon /dev/nvme0n1p6

mount /dev/nvme0n1p7 /mnt/
mount /dev/nvme0n1p8 /mnt/home

But when i'm trying to arch-chroot, i'm getting an error:

[root@sysrescue /]# arch-chroot /mnt
chroot: failed to run command ‘/bin/bash’: No such file or directory

How can i resque my system? Help please..

Offline

#2 2023-10-11 19:54:22

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,104

Re: Removed all in /tmp dir - after restarting loading only BIOS

100$ that you meant to remove all in /tmp dir but flubbed up the command and ended up deleting the entirety of your system - or you had some link linking back to your root - for what reason did you think you needed to do that in the first place?

Check file system size with df -h or so. Assuming you indeed killed everything, hope you have backups.  If you don't have backups you're basically SoL, hope for Testdisk, but don't hope too much. See your available options in https://wiki.archlinux.org/title/File_recovery

Offline

#3 2023-10-11 19:57:50

HomyC0der
Member
Registered: 2023-09-25
Posts: 20

Re: Removed all in /tmp dir - after restarting loading only BIOS

V1del wrote:

100$ that you meant to remove all in /tmp dir but flubbed up the command and ended up deleting the entirety of your system - or you had some link linking back to your root - for what reason did you think you needed to do that in the first place?

Check file system size with df -h or so. Assuming you indeed killed everything, hope you have backups.  If you don't have backups you're basically SoL, hope for Testdisk, but don't hope too much. See your available options in https://wiki.archlinux.org/title/File_recovery

No, i have all my system files at all in /mnt after mounting, but cant log to arch-root to make bootloader

Offline

#4 2023-10-11 20:13:35

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Removed all in /tmp dir - after restarting loading only BIOS

i have all my system files at all in /mnt after mounting

[root@sysrescue /]# arch-chroot /mnt
chroot: failed to run command ‘/bin/bash’: No such file or directory

stat /mnt/bin/bash /mnt/usr/bin/bash

Offline

#5 2023-10-11 20:14:25

HomyC0der
Member
Registered: 2023-09-25
Posts: 20

Re: Removed all in /tmp dir - after restarting loading only BIOS

seth wrote:

i have all my system files at all in /mnt after mounting

[root@sysrescue /]# arch-chroot /mnt
chroot: failed to run command ‘/bin/bash’: No such file or directory

stat /mnt/bin/bash /mnt/usr/bin/bash
stat: cannot statx '/mnt/bin/bash': No such file or directory
  File: /mnt/usr/bin/bash
  Size: 1075760   	Blocks: 2104       IO Block: 4096   regular file
Device: 259,15	Inode: 7110        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-10-11 16:44:49.696657516 +0000
Modify: 2023-05-21 11:56:54.000000000 +0000
Change: 2023-09-19 21:12:42.809404990 +0000
 Birth: 2023-09-19 21:12:42.806071618 +0000

Offline

#6 2023-10-11 20:21:03

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Removed all in /tmp dir - after restarting loading only BIOS

Please stop fully quoting previous posts, you're bloating the thread.

ls -l /mnt

With a little luck, you

V1del wrote:

flubbed up the command and ended up deleting

only the symlinks in the root dir… (bin, sbin, lib & lib64)

Offline

#7 2023-10-11 20:24:50

HomyC0der
Member
Registered: 2023-09-25
Posts: 20

Re: Removed all in /tmp dir - after restarting loading only BIOS

ls -l /mnt
total 72
drwxr-xr-x   2 root root  4096 Jan  1  1970 boot
drwxr-xr-x  20 root root  4220 Oct 11 18:38 dev
drwxr-xr-x   2 root root  4096 Sep 19 21:49 efi
drwxr-xr-x  11 root root  4096 Oct 11 18:51 etc
drwxr-xr-x   4 root root  4096 Sep 19 22:11 home
lrwxrwxrwx   1 root root     7 Sep 18 13:18 lib -> usr/lib
lrwxrwxrwx   1 root root     7 Sep 18 13:18 lib64 -> usr/lib
drwx------   2 root root 16384 Sep 19 20:56 lost+found
drwxr-xr-x   2 root root  4096 Jan 31  2023 mnt
lrwxrwxrwx   1 root root    33 Sep 19 21:33 Moscow -> /usr/share/zoneinfo/Europe/Moscow
drwxr-xr-x   8 root root  4096 Oct  4 14:49 opt
dr-xr-xr-x 329 root root     0 Oct 11 19:12 proc
drwxr-x---  13 root root  4096 Oct  8 11:03 root
drwxr-xr-x   2 root root  4096 Sep 19 21:10 run
lrwxrwxrwx   1 root root     7 Sep 18 13:18 sbin -> usr/bin
lrwxrwxrwx   1 root root    19 Sep 20 10:29 snap -> /var/lib/snapd/snap
drwxr-xr-x   4 root root  4096 Sep 19 21:12 srv
dr-xr-xr-x  13 root root     0 Oct 11 17:50 sys
drwxrwxrwt   2 root root  4096 Oct 10 20:52 tmp
drwxr-xr-x   4 root root  4096 Oct  5 13:59 traefik
drwxr-xr-x   2 root root  4096 Oct  5 14:09 traefik.toml
drwxr-xr-x   9 root root  4096 Oct  8 10:55 usr
drwxr-xr-x  12 root root  4096 Oct 10 17:21 var

Offline

#8 2023-10-11 20:28:28

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Removed all in /tmp dir - after restarting loading only BIOS

Only /bin seems gone, so symlink that to usr/bin (like sbin) and try to chroot again.

Offline

#9 2023-10-11 20:33:27

HomyC0der
Member
Registered: 2023-09-25
Posts: 20

Re: Removed all in /tmp dir - after restarting loading only BIOS

ln -s /mnt/usr/bin/ /mnt/bin
[root@sysrescue ~]# arch-chroot /mnt
chroot: failed to run command ‘/bin/bash’: No such file or directory
umount: /mnt/proc: target is busy.

Offline

#10 2023-10-11 20:35:33

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Removed all in /tmp dir - after restarting loading only BIOS

That's not how ln works…

ln -s usr/bin /mnt/bin

Offline

#11 2023-10-16 09:49:03

zavage
Member
From: Denver, CO
Registered: 2013-11-09
Posts: 2

Re: Removed all in /tmp dir - after restarting loading only BIOS

If from a live USB you can see most of your filesystem is still there. Might be good time to make a copy btw if anything important. What I'd do is see what is there, if arch-chroot fails to /mnt then I'd almost

pacstrap /mnt base

. But it sounds like a separate issue, the bootloader is somehow not installed ? Find out if you are on UEFI boot or BIOS boot, then just re-install the bootloader. Make sure bios/uefi is configured to boot from the right drive as well. With os-prober installed I'd just re-install grub and it will re-create it all.

And yeah that's weird /bin symlink is missing... something did something spooky it wasn't just clearing the /tmp directory

Last edited by zavage (2023-10-16 09:53:14)

Offline

Board footer

Powered by FluxBB