Error when booting system after an update

Hello. 2 days ago I was updating system but PC suffered a unexpected shutdown, when I booted I got error: file ‘/boot/initramfs-linux.img’ not found.
I tried to boot fallback initramfs in bootloader but same error appeared. Searching in forums I read I have to chroot in a live session but nothing happened, maybe I’m mounting everything in a wrong way or is there another solution for my problem. Here is how I was doing everything:

[liveuser@eos-2023.05.28 ~]$ sudo su
[root@EndeavourOS liveuser]# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0   1.7G  1 loop /run/archiso/airootfs
sda      8:0    1   3.8G  0 disk 
└─sda1   8:1    1   3.8G  0 part /run/archiso/bootmnt
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0   512M  0 part 
├─sdb2   8:18   0    50G  0 part 
├─sdb3   8:19   0     2G  0 part 
└─sdb4   8:20   0   879G  0 part 
[root@EndeavourOS liveuser]# lsblk -f
NAME   FSTYPE   FSVER LABEL      UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0  squashfs 4.0                                                         0   100% /run/archiso/airootfs
sda                                                                                  
└─sda1 vfat     FAT32 EOS_202305 E8F6-05A9                                 2G    48% /run/archiso/bootmnt
sdb                                                                                  
├─sdb1 vfat     FAT32 BOOT       37D3-8191                                           
├─sdb2 ext4     1.0   root       f965f8a9-1ba3-4b57-8cce-1891bc2dcf36                
├─sdb3 swap     1     swap       e466a595-5567-411f-88dd-e70ea1e560a1                
└─sdb4 ext4     1.0   home       4b8c715b-e003-44e2-954c-721a33801d83                
[root@EndeavourOS liveuser]# fdisk -l
Disk /dev/sda: 3.77 GiB, 4051697664 bytes, 7913472 sectors
Disk model: v245o           
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0586d15f

Device     Boot Start     End Sectors  Size Id Type
/dev/sda1  *     2048 7913471 7911424  3.8G  c W95 FAT32 (LBA)


Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA HDWD110 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 63EB6ABF-20EA-4175-85FC-5F6A7E9F4AC6

Device         Start        End    Sectors  Size Type
/dev/sdb1       2048    1050623    1048576  512M EFI System
/dev/sdb2    1050624  105908223  104857600   50G Linux filesystem
/dev/sdb3  105908224  110102527    4194304    2G Linux swap
/dev/sdb4  110102528 1953520031 1843417504  879G Linux filesystem


Disk /dev/loop0: 1.69 GiB, 1815875584 bytes, 3546632 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@EndeavourOS liveuser]# mount /dev/sdb2 /mnt
[root@EndeavourOS liveuser]# mount /dev/sdb1 /mnt/boot/efi
[root@EndeavourOS liveuser]# mount /dev/sdb4 /mnt/home

After this I chrooted and try the mkinitcpio -p linux but didn’t work. I don’t know if something is wrong or what I can do in chroot to fix my problem, I considered to do a fresh install but I don’t want to lose all my stuff. Please help me, thanks in advanced.

1 Like

What do you mean it didn’t work? How did you chroot in?

Thanks for answer so fast. I meant this:

[root@EndeavourOS liveuser]# arch-chroot /mnt
[root@EndeavourOS /]# sudo mkinitcpio -p linux
sudo: mkinitcpio: command not found
[root@EndeavourOS /]# 

I don’t know if it’s correct to use mkinitcpio -p linux to solve my problem but was something I read in archlinux forum or maybe there is other solution for my problem.

Try this instead from the chroot:

dracut-rebuild

Ok, here’s the output:

[root@EndeavourOS /]# dracut-rebuild
:: Building initramfs for linux (6.7.3-arch1-1)
dracut: Executing: /usr/bin/dracut --force --hostonly --no-hostonly-cmdline /boot/initramfs-linux.img 6.7.3-arch1-1
dracut: /lib/modules/6.7.3-arch1-1//modules.dep is missing. Did you run depmod?

What should I do next?

try pacman -S linux

This happened:

[root@EndeavourOS /]# pacman -S linux
error: failed to init transaction (unable to lock database)
error: could not lock database: File exists
  if you're sure a package manager is not already
  running, you can remove /var/lib/pacman/db.lck

That means you interrupted an update while it was running:

rm /var/lib/pacman/db.lck
pacman -Syu linux
[root@EndeavourOS /]# rm /var/lib/pacman/db.lck
[root@EndeavourOS /]# pacman -Syu linux
:: Synchronizing package databases...
 endeavouros                               22.0 KiB  16.3 KiB/s 00:01 [--------------------------------------] 100%
 core                                     129.6 KiB   174 KiB/s 00:01 [--------------------------------------] 100%
 extra                                      8.3 MiB  4.38 MiB/s 00:02 [--------------------------------------] 100%
 multilib                                 139.2 KiB   187 KiB/s 00:01 [--------------------------------------] 100%
warning: linux-6.7.3.arch1-1 is up to date -- reinstalling
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Package (11)                        Old Version          New Version         Net Change  Download Size

core/curl                           8.6.0-1              8.6.0-2               0.03 MiB       1.06 MiB
endeavouros/endeavouros-mirrorlist  24-1                 24.1-1                0.00 MiB       0.01 MiB
endeavouros/eos-rankmirrors         2.27-1               24-1                  0.00 MiB       0.02 MiB
extra/fzf                           0.45.0-1             0.46.1-1              0.00 MiB       1.30 MiB
extra/imlib2                        1.12.1-2             1.12.2-1              0.00 MiB       0.56 MiB
core/libnghttp3                                          1.1.0-2               0.23 MiB       0.07 MiB
extra/neon                          0.32.5-2             0.33.0-1              0.00 MiB       0.21 MiB
extra/python-termcolor              2.3.0-1              2.4.0-1               0.00 MiB       0.01 MiB
core/tzdata                         2023d-1              2024a-1               0.00 MiB       0.38 MiB
extra/xdg-utils                     1.2.0r28+g9b7d253-1  1.2.0+1+gaf2fe0d-1    0.00 MiB       0.06 MiB
core/linux                          6.7.3.arch1-1        6.7.3.arch1-1         0.00 MiB               

Total Download Size:     3.68 MiB
Total Installed Size:  141.07 MiB
Net Upgrade Size:        0.26 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 neon-0.33.0-1-x86_64                     210.7 KiB   372 KiB/s 00:01 [--------------------------------------] 100%
 tzdata-2024a-1-x86_64                    386.4 KiB   604 KiB/s 00:01 [--------------------------------------] 100%
 imlib2-1.12.2-1-x86_64                   570.6 KiB   848 KiB/s 00:01 [--------------------------------------] 100%
 libnghttp3-1.1.0-2-x86_64                 72.3 KiB   618 KiB/s 00:00 [--------------------------------------] 100%
 fzf-0.46.1-1-x86_64                     1332.6 KiB  1549 KiB/s 00:01 [--------------------------------------] 100%
 curl-8.6.0-2-x86_64                     1086.0 KiB   950 KiB/s 00:01 [--------------------------------------] 100%
 xdg-utils-1.2.0+1+gaf2fe0d-1-any          60.1 KiB   265 KiB/s 00:00 [--------------------------------------] 100%
 python-termcolor-2.4.0-1-any              13.4 KiB  69.0 KiB/s 00:00 [--------------------------------------] 100%
 eos-rankmirrors-24-1-any                  21.8 KiB  75.0 KiB/s 00:00 [--------------------------------------] 100%
 endeavouros-mirrorlist-24.1-1-any         13.7 KiB  31.9 KiB/s 00:00 [--------------------------------------] 100%
 Total (10/10)                              3.7 MiB  2.16 MiB/s 00:02 [--------------------------------------] 100%
(11/11) checking keys in keyring                                      [--------------------------------------] 100%
(11/11) checking package integrity                                    [--------------------------------------] 100%
(11/11) loading package files                                         [--------------------------------------] 100%
(11/11) checking for file conflicts                                   [--------------------------------------] 100%
:: Processing package changes...
( 1/11) upgrading tzdata                                              [--------------------------------------] 100%
( 2/11) installing libnghttp3                                         [--------------------------------------] 100%
( 3/11) upgrading curl                                                [--------------------------------------] 100%
( 4/11) reinstalling linux                                            [--------------------------------------] 100%
( 5/11) upgrading endeavouros-mirrorlist                              [--------------------------------------] 100%
warning: /etc/pacman.d/endeavouros-mirrorlist installed as /etc/pacman.d/endeavouros-mirrorlist.pacnew
( 6/11) upgrading xdg-utils                                           [--------------------------------------] 100%
( 7/11) upgrading eos-rankmirrors                                     [--------------------------------------] 100%
( 8/11) upgrading fzf                                                 [--------------------------------------] 100%
( 9/11) upgrading imlib2                                              [--------------------------------------] 100%
(10/11) upgrading neon                                                [--------------------------------------] 100%
(11/11) upgrading python-termcolor                                    [--------------------------------------] 100%
:: Running post-transaction hooks...
(1/6) Arming ConditionNeedsUpdate...
(2/6) Updating module dependencies...
(3/6) Updating initramfs...
:: Building initramfs for linux (6.7.3-arch1-1)
dracut: Executing: /usr/bin/dracut --force --hostonly --no-hostonly-cmdline /boot/initramfs-linux.img 6.7.3-arch1-1
dracut: dracut module 'dash' will not be installed, because command 'dash' could not be found!
dracut: dracut module 'mksh' will not be installed, because command 'mksh' could not be found!
dracut: dracut module 'systemd-pcrphase' will not be installed, because command '/usr/lib/systemd/systemd-pcrphase' could not be found!
dracut: dracut module 'busybox' will not be installed, because command 'busybox' could not be found!
dracut: dracut module 'rngd' will not be installed, because command 'rngd' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmand' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmanctl' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmand-wait-online' could not be found!
dracut: dracut module 'network-wicked' will not be installed, because command 'wicked' could not be found!
dracut: dracut module 'dmraid' will not be installed, because command 'kpartx' could not be found!
dracut: dracut module 'tpm2-tss' will not be installed, because command 'tpm2' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsi-iname' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsiadm' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsid' could not be found!
dracut: dracut module 'nvmf' will not be installed, because command 'nvme' could not be found!
dracut: dracut module 'biosdevname' will not be installed, because command 'biosdevname' could not be found!
dracut: dracut module 'memstrack' will not be installed, because command 'memstrack' could not be found!
dracut: memstrack is not available
dracut: If you need to use rd.memdebug>=4, please install memstrack and procps-ng
dracut: dracut module 'squash' will not be installed, because command 'mksquashfs' could not be found!
dracut: dracut module 'squash' will not be installed, because command 'unsquashfs' could not be found!
dracut: dracut module 'dash' will not be installed, because command 'dash' could not be found!
dracut: dracut module 'mksh' will not be installed, because command 'mksh' could not be found!
dracut: dracut module 'systemd-pcrphase' will not be installed, because command '/usr/lib/systemd/systemd-pcrphase' could not be found!
dracut: dracut module 'busybox' will not be installed, because command 'busybox' could not be found!
dracut: dracut module 'rngd' will not be installed, because command 'rngd' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmand' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmanctl' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmand-wait-online' could not be found!
dracut: dracut module 'network-wicked' will not be installed, because command 'wicked' could not be found!
dracut: dracut module 'dmraid' will not be installed, because command 'kpartx' could not be found!
dracut: dracut module 'tpm2-tss' will not be installed, because command 'tpm2' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsi-iname' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsiadm' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsid' could not be found!
dracut: dracut module 'nvmf' will not be installed, because command 'nvme' could not be found!
dracut: dracut module 'memstrack' will not be installed, because command 'memstrack' could not be found!
dracut: memstrack is not available
dracut: If you need to use rd.memdebug>=4, please install memstrack and procps-ng
dracut: dracut module 'squash' will not be installed, because command 'mksquashfs' could not be found!
dracut: dracut module 'squash' will not be installed, because command 'unsquashfs' could not be found!
dracut: *** Including module: systemd ***
dracut: *** Including module: systemd-initrd ***
dracut: *** Including module: i18n ***
dracut: *** Including module: kernel-modules ***
dracut: *** Including module: kernel-modules-extra ***
dracut: *** Including module: resume ***
dracut: *** Including module: rootfs-block ***
dracut: *** Including module: terminfo ***
dracut: *** Including module: udev-rules ***
dracut: Skipping udev rule: 40-redhat.rules
dracut: Skipping udev rule: 50-firmware.rules
dracut: Skipping udev rule: 50-udev.rules
dracut: Skipping udev rule: 91-permissions.rules
dracut: Skipping udev rule: 80-drivers-modprobe.rules
dracut: Skipping udev rule: 70-persistent-net.rules
dracut: *** Including module: dracut-systemd ***
dracut: *** Including module: usrmount ***
dracut: *** Including module: base ***
dracut: *** Including module: fs-lib ***
dracut: *** Including module: shutdown ***
dracut: *** Including modules done ***
dracut: *** Installing kernel module dependencies ***
dracut: *** Installing kernel module dependencies done ***
dracut: *** Resolving executable dependencies ***
dracut: *** Resolving executable dependencies done ***
dracut: *** Hardlinking files ***
dracut: Mode:                     real
dracut: Method:                   sha256
dracut: Files:                    780
dracut: Linked:                   2 files
dracut: Compared:                 0 xattrs
dracut: Compared:                 32 files
dracut: Saved:                    356.65 KiB
dracut: Duration:                 7.123690 seconds
dracut: *** Hardlinking files done ***
dracut: *** Generating early-microcode cpio image ***
dracut: *** Constructing GenuineIntel.bin ***
dracut: *** Store current command line parameters ***
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Creating image file '/boot/initramfs-linux.img' ***
dracut: *** Creating initramfs image file '/boot/initramfs-linux.img' done ***
:: Building fallback initramfs for linux (6.7.3-arch1-1)
dracut: Executing: /usr/bin/dracut --force --no-hostonly /boot/initramfs-linux-fallback.img 6.7.3-arch1-1
dracut: dracut module 'dash' will not be installed, because command 'dash' could not be found!
dracut: dracut module 'mksh' will not be installed, because command 'mksh' could not be found!
dracut: dracut module 'systemd-pcrphase' will not be installed, because command '/usr/lib/systemd/systemd-pcrphase' could not be found!
dracut: dracut module 'busybox' will not be installed, because command 'busybox' could not be found!
dracut: dracut module 'rngd' will not be installed, because command 'rngd' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmand' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmanctl' could not be found!
dracut: dracut module 'connman' will not be installed, because command 'connmand-wait-online' could not be found!
dracut: dracut module 'network-wicked' will not be installed, because command 'wicked' could not be found!
dracut: dracut module 'dmraid' will not be installed, because command 'kpartx' could not be found!
dracut: dracut module 'multipath' will not be installed, because command 'multipath' could not be found!
dracut: dracut module 'tpm2-tss' will not be installed, because command 'tpm2' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'dcbtool' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'fipvlan' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'lldpad' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'fcoemon' could not be found!
dracut: dracut module 'fcoe' will not be installed, because command 'fcoeadm' could not be found!
dracut: dracut module 'fcoe-uefi' will not be installed, because command 'dcbtool' could not be found!
dracut: dracut module 'fcoe-uefi' will not be installed, because command 'fipvlan' could not be found!
dracut: dracut module 'fcoe-uefi' will not be installed, because command 'lldpad' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsi-iname' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsiadm' could not be found!
dracut: dracut module 'iscsi' will not be installed, because command 'iscsid' could not be found!
dracut: dracut module 'nbd' will not be installed, because command 'nbd-client' could not be found!
dracut: dracut module 'nvmf' will not be installed, because command 'nvme' could not be found!
dracut: dracut module 'biosdevname' will not be installed, because command 'biosdevname' could not be found!
dracut: dracut module 'memstrack' will not be installed, because command 'memstrack' could not be found!
dracut: memstrack is not available
dracut: If you need to use rd.memdebug>=4, please install memstrack and procps-ng
dracut: dracut module 'squash' will not be installed, because command 'mksquashfs' could not be found!
dracut: dracut module 'squash' will not be installed, because command 'unsquashfs' could not be found!
dracut: *** Including module: systemd ***
dracut: *** Including module: systemd-initrd ***
dracut: *** Including module: modsign ***
dracut: *** Including module: i18n ***
dracut: *** Including module: btrfs ***
dracut: *** Including module: crypt ***
dracut: *** Including module: dm ***
dracut: Skipping udev rule: 64-device-mapper.rules
dracut: Skipping udev rule: 60-persistent-storage-dm.rules
dracut: Skipping udev rule: 55-dm.rules
dracut: *** Including module: kernel-modules ***
dracut: *** Including module: kernel-modules-extra ***
dracut: *** Including module: lvm ***
dracut: Skipping udev rule: 64-device-mapper.rules
dracut: Skipping udev rule: 56-lvm.rules
dracut: Skipping udev rule: 60-persistent-storage-lvm.rules
dracut: *** Including module: mdraid ***
dracut: Skipping udev rule: 64-md-raid.rules
dracut: *** Including module: nvdimm ***
dracut: *** Including module: qemu ***
dracut: *** Including module: qemu-net ***
dracut: *** Including module: btrfs-snapshot-overlay ***
dracut: *** Including module: lunmask ***
dracut: *** Including module: resume ***
dracut: *** Including module: rootfs-block ***
dracut: *** Including module: terminfo ***
dracut: *** Including module: udev-rules ***
dracut: Skipping udev rule: 40-redhat.rules
dracut: Skipping udev rule: 50-firmware.rules
dracut: Skipping udev rule: 50-udev.rules
dracut: Skipping udev rule: 91-permissions.rules
dracut: Skipping udev rule: 80-drivers-modprobe.rules
dracut: *** Including module: virtiofs ***
dracut: *** Including module: dracut-systemd ***
dracut: *** Including module: usrmount ***
dracut: *** Including module: base ***
dracut: *** Including module: fs-lib ***
dracut: *** Including module: shutdown ***
dracut: *** Including modules done ***
dracut: *** Installing kernel module dependencies ***
dracut: *** Installing kernel module dependencies done ***
dracut: *** Resolving executable dependencies ***
dracut: *** Resolving executable dependencies done ***
dracut: *** Hardlinking files ***
dracut: Mode:                     real
dracut: Method:                   sha256
dracut: Files:                    2005
dracut: Linked:                   8 files
dracut: Compared:                 0 xattrs
dracut: Compared:                 441 files
dracut: Saved:                    1.42 MiB
dracut: Duration:                 0.051283 seconds
dracut: *** Hardlinking files done ***
dracut: *** Generating early-microcode cpio image ***
dracut: *** Constructing GenuineIntel.bin ***
dracut: *** Store current command line parameters ***
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Creating image file '/boot/initramfs-linux-fallback.img' ***
dracut: *** Creating initramfs image file '/boot/initramfs-linux-fallback.img' done ***
(4/6) Hook to rank EndeavourOS mirrors after installing or upgrading the related mirrorlist package
==> eos-rankmirrors: info: fetching https://gitlab.com/endeavouros-filemirror/PKGBUILDS/-/raw/master/endeavouros-mirrorlist/endeavouros-mirrorlist ...
==> eos-rankmirrors: info: ranking EndeavourOS mirrors, please wait ...
==> Warning about https://endeavour.remi.lu/repo/$repo/$arch:
    Connection failed after 30 seconds.
    Continuing.
==> Warning about https://mirror.sjtu.edu.cn/endeavouros/repo/$repo/$arch:
    Update level is 2109/2112, some [endeavouros] packages may be outdated if this mirror is in use.
    Continuing.

==> Info: Results of ranking EndeavourOS mirrors:


==> Writing new ranked EndeavourOS mirrorlist to /etc/pacman.d/endeavouros-mirrorlist.pacnew.
==> New mirrorlist saved.

(5/6) Check if user should be informed about rebooting after certain system package upgrades.
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
(6/6) Checking which packages need to be rebuilt
fatal library error, lookup self

Ok, this happened, should I shutdown and then boot now or?

Yes, that looks fine.

Go ahead and reboot.

Do I have to unmount everything or shutting down is fine?

You can exit the chroot and then type reboot

When booting this happened:

Try booting the fallback

I tried that but there is no fallback in the bootloader advanced options

An unexpected shutdown can cause various problems that may be time consuming to solve. Hardware (=disk) failure is possible too (although it doesn’t look that way for now).

So, whatever you decide to do, if you have any personal data you don’t want to lose, I’d suggest backing up the data onto an external drive.
After that troubleshooting is much safer to do.

If troubleshooting doesn’t pay off, reinstalling the system and restoring the personal data might be the next step.

How do I troubleshoot?

With troubleshooting I meant trying the suggestions @dalto has already presented, which you have also done.