Skip to content

Instantly share code, notes, and snippets.

@kennychufk
Created February 8, 2018 09:16
Show Gist options
  • Save kennychufk/2f8d8b964329d7906893d83c98313340 to your computer and use it in GitHub Desktop.
Save kennychufk/2f8d8b964329d7906893d83c98313340 to your computer and use it in GitHub Desktop.
Arch Linux troubleshooting
# Failed to boot:
# Failed to start file system check on /dev/disk/by-uuid/....
journalctl -xb
# (look at the disk label that fsck failed)
fsck /dev/sda3
#
# downloading required keys...
# error: key "9D893EC4DAAF9129" could not be looked up remotely
# error: required key missing from keyring
# error: failed to commit transaction (unexpected error)
# Errors occurred, no packages were upgraded.
# solution: update archlinux-keyring
pacman -S archlinux-keyring
# Suddenly fails to boot (Waiting 10 secs for device… You are being dropped to a recovery shell), keyboard not working
#
# problem of mkinitcpio (a Bash script used to create an initial ramdisk environment: The initial ramdisk is in essence a very small environment (early userspace) which loads various kernel modules and sets up necessary things before handing over control to init. This makes it possible to have, for example, encrypted root file systems and root file systems on a software RAID array. mkinitcpio allows for easy extension with custom hooks, has autodetection at runtime, and many other features.)
#
# the following happens after updating linux and issuing mkinitcpio:
# ==> Building image from preset: /etc/mkinitcpio.d/linux.present: 'default'
# -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.config -g /boot/initramfs-linux.img
# hexdump: /boot/vmlinuz-linux: Input/output error
# ==> ERROR: invalid kernel specified: '/boot/vmlinuz-linux'
# ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
# -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.config -g /boot/initramfs-linux-fallback.img -S autodetect
# hexdump: /boot/vmlinuz-linux: Input/output error
# ==> ERROR: invalid kernel specified: '/boot/vmlinuz-linux'
# try reinstall udev, linux, util-linux(optional) and mkinitcpio:
# may need arch-chroot into /mnt
pacman -Syy
pacman -S udev
pacman -S mkinitcpio
mkinitcpio -p linux
reboot
# avoid using virtual box because Windows may occupy the /boot partition
# may also need to delete /boot and re-run "bootctl install"
rm -rf /boot/*
bootctl install
# create /boot/loader/entries/arch.conf
# !!!!! The following may be the key step to success (reinstalling linux kernel)
# (need verification)
pacman -S linux
# Reference:
# https://bbs.archlinux.org/viewtopic.php?id=135288&p=1
# http://linuxforums.org.uk/index.php?topic=10196.0
# Failed to mount /boot
# when trying to mount manually, it gives 'mount: unknown file system type "vfat"'
# solution: reset boot partition
(boot into DVD)
gdisk /dev/sdc
(delete and add back partition 5 with the exact same partition number 5 and first and last sector. Type is "ef00" for EFI system. Enter "w" to write table to disk and exit)
mkfs.fat -F32 /dev/sdc5
(mount all partitions)
(compare old and new fstab to see if the UUID for the boot partition changes)
cat /mnt/etc/fstab
genfstab -U -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt
bootctl install
vi /boot/loader/entries/arch.conf
pacman -S linux # "mkinitcpio -p linux" may not work
exit
umount -R /mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment