The problem: Unable to boot into Ubuntu.
Causes:
Compilation of a package, (NekoProjectII/W) which had errors and in turn made the system unbootable, the error code was
sbin/init not found
Tried to fix using a live boot usb, here I made a BIG mistake, as i proceeded to:
-
- Copy the whole of /lib, /usr and /lib64 from the usb to the installation.
-
- Copy the whole of /lib, from the usb to the installation OVERWRITING FILES (As far as I can remember)
-
- Accidentally DELETED Important files, such as ALL of /lib/modules (Maybe a few more, doubt though)
I tried re-installing what I deleted, but to no avail, as installations failed because of the missing modules (This makes me feel like how I felt when I deleted the library that is required by apt, that can only be installed with apt)
After this, booting into ubuntu made it think that the installation was in the USB live drive, as far as i can tell, causing it to show
UUID Does not exist, dropping to shell
and dropping into BusyBox terminal (Which I am completely unfamiliar with)Shortly after, grub became slow, (Updating screen), I doubt this means anything but when I went into advanced options for Ubuntu I saw that there was NO kernel 5.4.0-60, aka the version I use
What I Can't Do:
- Use
APT
- Use
DPKG
- Use
update-initramfs
orupdate-initramfs.distrib
-
- I Believe all these errors have to do with missing modules, as it explicitly mentions that.
Before anything else, if you are wondering why I'm chrooting, it's because I can actually get into the system, without it kicking me or panicking and halting.
Here's the error that came out when trying to re-install the modules:
root@ubuntu:/# sudo apt install --reinstall linux-image-5.4.0-60-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 14 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for linux-image-5.4.0-60-generic:amd64
root@ubuntu:/# sudo apt install linux-image-5.4.0-60-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-5.4.0-60-generic is already the newest version (5.4.0-60.67).
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (19: No such device)
Setting up linux-image-5.4.0-60-generic (5.4.0-60.67) ...
depmod: ERROR: could not open directory /lib/modules/5.4.0-60-generic: No such f
ile or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-5.4.0-60-generic (--configure):
installed linux-image-5.4.0-60-generic package post-installation script subproc
ess returned error exit status 1
Setting up initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-60-generic
cat: /proc/cmdline: No such file or directory
W: missing /lib/modules/5.4.0-60-generic
W: Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/5.4.0-60-generic: No such f
ile or directory
depmod: FATAL: could not search modules: No such file or directory
cat: /var/tmp/mkinitramfs_UvIVHU/lib/modules/5.4.0-60-generic/modules.builtin: N
o such file or directory
find: ‘/var/tmp/mkinitramfs_UvIVHU/lib/modules/5.4.0-60-generic/kernel’: No such
file or directory
grep: /proc/cpuinfo: No such file or directory
W: Couldn't identify type of root file system for fsck hook
depmod: WARNING: could not open modules.order at /var/tmp/mkinitramfs_UvIVHU/lib
/modules/5.4.0-60-generic: No such file or directory
depmod: WARNING: could not open modules.builtin at /var/tmp/mkinitramfs_UvIVHU/l
ib/modules/5.4.0-60-generic: No such file or directory
/usr/sbin/update-initramfs: 185: cannot create /var/lib/initramfs-tools/5.4.0-60
-generic: Directory nonexistent
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned
error exit status 2
Errors were encountered while processing:
linux-image-5.4.0-60-generic
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
Note that I'm using chroot onto a mounted partition (/mnt = nvme0n1p4 aka where my Ubuntu installation is) The error is pretty long, I know, but what I don't know is what else to do (I would like to not reinstall the system, unless I can somehow use chroot to run APTIK, a backup program).
Basically, fixing something equals fix something else, rinse and repeat until I'm absolutely lost.
Any help is appreciated, I'm gonna go relax for some minutes...