What happened:
I used a program with a really bad GUI file picker and as I tried to traverse the file system, I accidentally hit the "back" button on the side of the mouse which seemingly acted like a regular left mouse click that caused me to move a folder high up in the file system into another folder. I either moved a folder from root into anoter subfolder of root (e.g. moved /A
into /B
) or a folder from a subfolder from root into a sub-sub-folder (e.g. moved /A/B into /A/C)
. I also recall that this mistake likely happened near or in the /usr
folder.
Problem:
Immediately after this mistake, all icons in Gnome were gone (although applications I had open seemed to work fine) and as I tried to open a shell to try to revert my mistake, it wouldn't open anymore (the click animation played, but no window opened). I restarted the system and after some wall of text that was too quick for me to read (it was the typical checklist-style wall of text) I was greeted with a white text on black background message reading:
/dev/nvme0n1p5: recovering journal
/dev/nvme0n1p5: clean, 897720/12004096 files, 21338613/51200000
I waited for some time but nothing really happened after that.
What I tried so far (using Grub's recovery root shell):
I compared my /
folder with that mentioned on the official Ubuntu website: https://help.ubuntu.com/lts/installation-guide/armhf/apcs02.html. My root folder is a superset of all folders mentioned on that website. Specifically, it contains:
bin, boot, cdrom, dev, etc, home, lib, lib32, lib64, libx32, lost+found, media, mnt, opt, proc, root, run, sbin, snap, srv, swapfile, sys, tmp, usr, var
My /usr
folder contains: bin, games, include, lib, lib32, lin64, libexec, libx32, local, sbin, src
I tried to find out which folders where edited roughly at the same time the error happened. For that, I executed ls -l
and unfortunately no folder seemed to have a time matching that of the mistake.
I read up online, most people recommend to somehow (Grub Recovery mode or via Live-CD) open a root shell and then do: fsck -f /
. Those posts try to also fix the recovering journal
issue, but theirs was caused by e.g. a power outage causing files to be corrupted. I refrained from trying that as I don't think the underlying file system is broken, I just moved a folder in the wrong spot.
Question:
How shall I proceed? If I could find out which folder I had moved, I could easily revert my mistake
Update 1:
System information:
Distro: Ubuntu 20.4.?. Unfortunately, running lsb_release
in recovery mode gives a ModuleNotFound
error, with the traceback ending in apt_pkg.Error: E: Error reading the CPU table
, so I can't tell you which exact version.
Kernel: 5.4.0-81-generic
I ran fsck -f /dev/nvme0n1p5
from a USB drive as suggested, that yielded the following output:
ubuntu@ubuntu:~$ sudo fsck -f /dev/nvme0n1p5
fsck from util-linux 2.34
e2fsck 1.45.5 (07-Jan-2020)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/nvme0n1p5: 897720/12804096 files (0.4% non-contiguous), 21338886/51200000 blocks
Note the number of files and blocks checked is exactly the same as in the printout I get when just booting directly into Ubuntu