1

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 or update-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...

  • Okay, I'll get writing. – CattoByte Jan 13 '21 at 18:03
  • @Nmath, there it is, I believe that is enough information, anything else you let me know, thanks in advance. – CattoByte Jan 13 '21 at 18:20
  • Instead of using chroot, I might suggest that you try to reinstall the problematic packages by dropping to a root shell prompt: See: https://askubuntu.com/a/92558 | In some cases if an install gets really messy, unfortunately sometimes it might be more prudent to try to reinstall the OS. This might also be helpful: https://askubuntu.com/questions/475517/what-would-happen-if-init-was-deleted/475524? – Nmath Jan 13 '21 at 19:48
  • You can do a "dirty" reinstall. Where you do not check the format box. Then any files you have created will remain, but any system files you edited will be overwritten with defaults. System settings or anything in / may be overwritten with defaults. Good backups still important https://help.ubuntu.com/community/UbuntuReinstallation & http://ubuntuforums.org/showthread.php?t=1941872 – oldfred Jan 13 '21 at 20:49
  • @Nmath I am unable to go into safe mode (first link) as it still kicks me, but i'll check out the second link tomorrow, it's late today – CattoByte Jan 13 '21 at 21:07
  • Also, @oldfred, i'll check that out, thanks to both of you, really. – CattoByte Jan 13 '21 at 21:09
  • @oldfred I remember seeing a way to save /usr, basically installed programs, save 'em on a list to be installed later. Do you know about something like that? I'm very hesitant about re-installing as it's deleting /usr, /etc, /lib etc (installer's on words) even when not formating, so it works. – CattoByte Jan 14 '21 at 10:57
  • Its something I do as part of my backup script. If upgrading, you may want to edit it to remove obsolete, old kernels or others. It will not re-install anything already installed. https://help.ubuntu.com/community/ReinstallingSamePackages but you do this from working system. You also can export from synaptic. http://askubuntu.com/questions/17823/how-to-list-all-installed-packages Your apt log files will also show what you installed, but then not easy to reinstall. – oldfred Jan 14 '21 at 13:11
  • @oldfred I ended up reinstalling the system and packages, your solution did work, so if you want to go ahead and give an answer I'll accept it. – CattoByte Jan 14 '21 at 17:51

1 Answers1

0

This problem was fixed by reinstalling the system.


I found out you can select an option on a live USB called Reinstall Ubuntu XX.XX, which re-installs the operating system without deleting any data (except thigns like lib, usr, but not home).

As I'm writing this, the installation is around 70% complete.


The problem with what I did to the computer reminds me of when I accidentally deleted a library, not any library though, a library that APT depended on, which could ONLY be installed with apt.

I recommend backing your data up just in case re-installing does something, I've had massive success with the paid version of APTIK, a good backup manager that did everything perfectly except preserver folder icons (personal ones I put). This isn't sponsored, I just thought some people would like to know about it, as it has to do with this subject.

All I have to say is, be careful with the terminal, even compiling code can mess you up.