2

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):

  1. 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

  2. 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.

  3. 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

iMrFelix
  • 121
  • yes you can, but do the changes booting from a live pendrive... – jpbrain Aug 26 '21 at 22:18
  • You've provided no OS & release details; however a GUI file-browser does not have permissions to do what you're asking for under Ubuntu, so what OS are you asking about? A GUI browser should only have access to directories in $HOME which will not impact the system boot. – guiverc Aug 26 '21 at 22:28
  • I wonder if dpkg -C (or dpkg --audit) might be helpful in identifying what was moved? – steeldriver Aug 26 '21 at 22:32
  • 3
    I don't see /usr/share in your list. – mook765 Aug 26 '21 at 22:35
  • @guiverc Sorry I was not explicit on the system, I added the information. I agree with you that the application (MeshLab, a 3D viewer) doesn't have write access outside the $HOME directory and therefore isn't able to perform such modifications. Nevertheless, the problem appeared right when I used the file picker. – iMrFelix Aug 26 '21 at 22:55
  • @steeldriver running either command in Grub's recovery root shell doesn't produce any output – iMrFelix Aug 26 '21 at 22:55
  • @mook765 You just saved me! That indeed did the trick, my machine booted up like normal! Is there a principled way of discovering that to be the problem? – iMrFelix Aug 26 '21 at 23:01
  • If everything works normal I'd tend to say we found the culprit... – mook765 Aug 26 '21 at 23:04
  • Indeed, everything's back to normal! – iMrFelix Aug 26 '21 at 23:16

0 Answers0