How to re-install a boot for a desired partition

From my knowledge, the partition for our os is split into two, an fat32 for booting and ext4 for the system. Due to my curiosity into tweaking stuffs, I had accidentally wipe out the fat32 one (the partition is still there, but most of content gone) , while the other luckily remained.


/dev/n...p5 for fat32 and /dev/n..p6 for ext4

Now while I still can enter the systemd-boot menu at BIOS screen, theres only remaining option for “reboot to firmware”.

image

Is there anyway to restore or reinstall the boot thing back?

Thank you in advance!


Some useful info
-Spec:

  • Desktop: Plasma KDE
  • Kernal version: 6.2.2-arch1-1
  • Installed using systemd-boot

-The ext4 is still quite fine (i guess?). I can still chroot it using my USB live image.
-Disk info from some commands
[root@EndeavourOS /] → chroot from usb img to ext4
[liveuser@eos-2023.03.06 Desktop] → user from usb img

[root@EndeavourOS /]# cat etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=C1C5-6D90                            /efi           vfat    defaults,noatime 0 2
UUID=d221b4d9-18ca-4c6e-9823-abb132e51d58 /              ext4    defaults,noatime 0 1
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

[liveuser@eos-2023.03.06 Desktop]$ lsblk -f
NAME        FSTYPE FSVER   LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0       squash 4.0                                                            0   100% /run/archiso/airootfs
sda         iso966 Joliet  EOS_202303  2023-03-06-14-54-40-00                              
├─sda1      iso966 Joliet  EOS_202303  2023-03-06-14-54-40-00                     0   100% /run/archiso/bootmnt
└─sda2      vfat   FAT16   ARCHISO_EFI 065A-7263                                           
nvme0n1                                                                                    
├─nvme0n1p1 vfat   FAT32               286F-EE5E                                           
├─nvme0n1p2                                                                                
├─nvme0n1p3 ntfs                       01D88A4E7F018D80                                    
├─nvme0n1p4 ntfs           Data        01D9627505955A30                      104.2G    59% /run/media/liveuser/Data
├─nvme0n1p5 vfat   FAT32               C1C5-6D90                             997.9M     0% /mnt/efi
└─nvme0n1p6 ext4   1.0     endeavouros d221b4d9-18ca-4c6e-9823-abb132e51d58   31.4G    30% /mnt

[liveuser@eos-2023.03.06 Desktop]$ sudo efibootmgr
BootCurrent: 0002
Timeout: 2 seconds
BootOrder: 0001,0000,0004,0002,0003
Boot0000* Windows Boot Manager	HD(1,GPT,e2ed644a-4ecd-4ce4-a097-568936b86c6a,0x800,0x32000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d0000002c000100000010000000040000007fff0400
Boot0001* Manjaro	HD(1,GPT,e2ed644a-4ecd-4ce4-a097-568936b86c6a,0x800,0x32000)/File(\EFI\MANJARO\GRUBX64.EFI)
Boot0002* UEFI:  USB FLASH DRIVE PMAP	PciRoot(0x0)/Pci(0x14,0x0)/USB(2,0)/CDROM(1,0x39b780,0x39298)0000424f
Boot0003* UEFI:  USB FLASH DRIVE PMAP, Partition 2	PciRoot(0x0)/Pci(0x14,0x0)/USB(2,0)/HD(2,MBR,0x81367d46,0x39b780,0x39000)0000424f
Boot0004* Linux Boot Manager	HD(5,GPT,2ba9a6a7-5f14-cd4b-b6e0-e1daf9a6eeb1,0x3548a800,0x1f4000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)

[liveuser@eos-2023.03.06 Desktop]$ bootctl
Couldn't find EFI system partition. It is recommended to mount it to /boot or /efi.
Alternatively, use --esp-path= to specify path to mount point.
System:
      Firmware: UEFI 2.70 (American Megatrends 5.17)
 Firmware Arch: x64
   Secure Boot: disabled (disabled)
  TPM2 Support: yes
  Boot into FW: supported

Current Boot Loader:
      Product: systemd-boot 253.1-1-arch
     Features: ✓ Boot counting
               ✓ Menu timeout control
               ✓ One-shot menu timeout control
               ✓ Default entry control
               ✓ One-shot entry control
               ✓ Support for XBOOTLDR partition
               ✓ Support for passing random seed to OS
               ✓ Load drop-in drivers
               ✓ Support Type #1 sort-key field
               ✓ Support @saved pseudo-entry
               ✓ Support Type #1 devicetree field
               ✗ Boot loader sets ESP information
          ESP: n/a
         File: └─/EFI/BOOT/BOOTX64.EFI

Random Seed:
 System Token: set

Boot Loaders Listed in EFI Variables:
        Title: Manjaro
           ID: 0x0001
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/e2ed644a-4ecd-4ce4-a097-568936b86c6a
         File: └─/EFI/MANJARO/GRUBX64.EFI

        Title: Windows Boot Manager
           ID: 0x0000
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/e2ed644a-4ecd-4ce4-a097-568936b86c6a
         File: └─/EFI/MICROSOFT/BOOT/BOOTMGFW.EFI

        Title: Linux Boot Manager
           ID: 0x0004
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/2ba9a6a7-5f14-cd4b-b6e0-e1daf9a6eeb1
         File: └─/EFI/SYSTEMD/SYSTEMD-BOOTX64.EFI

Try chrooting in and running reinstall-kernels

2 Likes

@dalto
Here is the result

[root@EndeavourOS /]# reinstall-kernels
bash: reinstall-kernels: command not found

Did you uninstall the package kernel-install-for-dracut?

Sounds like it wasnt in my package list

[root@EndeavourOS /]# yay -R kernel-install-for-dracut
 -> Avoid running yay as root/sudo.
error: target not found: kernel-install-for-dracut
 -> exit status 1

Base on this website, I was trying on both kernel-install-for-dracut and kernel-install-mkinitcpio and got this result

[root@EndeavourOS /]# yay -S kernel-install-mkinitcpio
 -> Avoid running yay as root/sudo.
:: Checking for conflicts...
:: Checking for inner conflicts...
 -> Package conflicts found:
 -> Installing kernel-install-mkinitcpio will remove: dracut
 -> Conflicting packages will have to be confirmed manually
[Aur:1]  kernel-install-mkinitcpio-1.3-1

:: (0/1) Downloaded PKGBUILD: kernel-install-mkinitcpio
 -> error fetching kernel-install-mkinitcpio: System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down 
	 context: exit status 1
[root@EndeavourOS /]# yay -S kernel-install-for-dracut
 -> Avoid running yay as root/sudo.
resolving dependencies...
looking for conflicting packages...
:: kernel-install-for-dracut and mkinitcpio are in conflict. Remove mkinitcpio? [y/N] n
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
:: kernel-install-for-dracut and mkinitcpio are in conflict
 -> error installing repo packages

Did you switch to mkinitcpio? Is that why you removed kernel-install-for-dracut?

For the record, removing that package would absolutely cause the issue you are seeing.

Nope i didn’t know about any of this in the first place :v .
What should I do next?

Your system wouldn’t normally have mkinitcpio installed in this situation so you must have done something…

Either way, install kernel-install-for-dracut and allow it to remove mkinitcpio

Then run reinstall-kernels from inside the chroot.

Yea maybe I did messed up something without knowing it :)) worth a lesson.
Here is the result

[root@EndeavourOS /]# yay -S kernel-install-for-dracut
 -> Avoid running yay as root/sudo.
resolving dependencies...
looking for conflicting packages...
:: kernel-install-for-dracut and mkinitcpio are in conflict. Remove mkinitcpio? [y/N] y

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

mkinitcpio                             35.2-1                     -0.14 MiB               
endeavouros/kernel-install-for-dracut               1.7-5          0.02 MiB       0.02 MiB

Total Download Size:    0.02 MiB
Total Installed Size:   0.02 MiB
Net Upgrade Size:      -0.12 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 kernel-install-for-dracut-1.7-5-any       15.4 KiB  64.2 KiB/s 00:00 [--------------------------------------] 100%
(1/1) checking keys in keyring                                        [--------------------------------------] 100%
(1/1) checking package integrity                                      [--------------------------------------] 100%
(1/1) loading package files                                           [--------------------------------------] 100%
(1/1) checking for file conflicts                                     [--------------------------------------] 100%
:: Running pre-transaction hooks...
(1/1) Removing linux initcpios...
:: Processing package changes...
(1/1) removing mkinitcpio                                             [--------------------------------------] 100%
(1/1) installing kernel-install-for-dracut                            [--------------------------------------] 100%
:: Running post-transaction hooks...
(1/2) Reloading system manager configuration...
  Skipped: Running in chroot.
(2/2) Arming ConditionNeedsUpdate...
[root@EndeavourOS /]# sudo reinstall-kernels
Installing kernel 6.2.8-arch1-1
dracut: Executing: /usr/bin/dracut --hostonly --no-hostonly-cmdline -f /efi/d22d42dfdabf4b5b9b3c235979ca7c6e/6.2.8-arch1-1/initrd 6.2.8-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 'busybox' will not be installed, because command 'busybox' could not be found!
dracut: dracut module 'dbus-broker' will not be installed, because command 'dbus-broker' could not be found!
dracut: dracut module 'rngd' will not be installed, because command 'rngd' 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 '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 'busybox' will not be installed, because command 'busybox' could not be found!
dracut: dracut module 'dbus-broker' will not be installed, because command 'dbus-broker' could not be found!
dracut: dracut module 'rngd' will not be installed, because command 'rngd' 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: *** 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: 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:                    773
dracut: Linked:                   2 files
dracut: Compared:                 0 xattrs
dracut: Compared:                 40 files
dracut: Saved:                    356.65 KiB
dracut: Duration:                 0.005071 seconds
dracut: *** Hardlinking files done ***
dracut: *** Generating early-microcode cpio image ***
dracut: *** Using microcode found in '/boot/intel-ucode.img' ***
dracut: *** Store current command line parameters ***
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Creating image file '/efi/d22d42dfdabf4b5b9b3c235979ca7c6e/6.2.8-arch1-1/initrd' ***
dracut: *** Creating initramfs image file '/efi/d22d42dfdabf4b5b9b3c235979ca7c6e/6.2.8-arch1-1/initrd' done ***
dracut: Executing: /usr/bin/dracut --no-hostonly --force /efi/d22d42dfdabf4b5b9b3c235979ca7c6e/6.2.8-arch1-1/initrd-fallback 6.2.8-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 'busybox' will not be installed, because command 'busybox' could not be found!
dracut: dracut module 'dbus-broker' will not be installed, because command 'dbus-broker' could not be found!
dracut: dracut module 'rngd' will not be installed, because command 'rngd' 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: *** 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: 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: 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:                    1979
dracut: Linked:                   8 files
dracut: Compared:                 0 xattrs
dracut: Compared:                 446 files
dracut: Saved:                    1.42 MiB
dracut: Duration:                 0.013674 seconds
dracut: *** Hardlinking files done ***
dracut: *** Generating early-microcode cpio image ***
dracut: *** Constructing AuthenticAMD.bin ***
dracut: *** Using microcode found in '/boot/intel-ucode.img' ***
dracut: *** Store current command line parameters ***
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Creating image file '/efi/d22d42dfdabf4b5b9b3c235979ca7c6e/6.2.8-arch1-1/initrd-fallback' ***
dracut: *** Creating initramfs image file '/efi/d22d42dfdabf4b5b9b3c235979ca7c6e/6.2.8-arch1-1/initrd-fallback' done ***

Looks fine. Now try exiting the chroot and rebooting.

Thank you very much! Finally got it back to normal :))

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.