Friday, September 1, 2017

Arch Linux not loading Kernel Modules with Cryptsetup/LUKS

You are likely to encounter this error when logging to an Arch Linux System just after a kernel update with a Cryptsetup and LUKS encrypted partition. Upon successful encryption password input to the Window Manager all the hardware inputs are unresponsive and nothing can be done unless switching back to the tty screen. Cryptsetup is utility used to conveniently setup disk encryption based on DMCrypt kernel module and LUKS is the standard for Linux hard disk encryption.



To tackle this issue one needs a live Arch Linux CD/USB flash drive with no fear of data loss. The following command steps shows how to go about it and getting back to the Window Manager.

Boot up the Linux system with the Live USB/CD to this prompt:
root@archiso~#

Unlock the encrypted partition:
cryptsetup luks0pen /dev/sda2 cryptroot

Create a directory to mount the decrypted partition to:
mkdir /mnt/arch

Mount the decrypted partition to the folder created above:
mount /dev/mapper/cryptroot /mnt/arch

Change the working directory to the one created:
cd /mnt/arch

Mount the file systems: 
mount -t proc proc proc/
mount -t sysfs sys sys
mount -o bind /dev dev/

Mount the boot partition:
mount /dev/sda1 boot/

Connect the box to the internet:
sudo wifi-menu

Change the root directory from the current LiveCD or USB to the Linux box:
chroot . /bin/bash

Update the box:
pacman -Syu && mkinitcpio -p linux

Exit the environment and unmount the partition :
exit
unmount

Reboot the system, remove the LiveCD/USB flash drive and you are good to go.

To avoid the issue in future; when updating the kernel; one has to remember to use the mkinitcpio -p linux command argument after updating the system or simply:
pacman -Syu && mkinitcpio -p linux

Mkinitcpio creates 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.


References
https://wiki.archlinux.org/index.php/mkinitcpio
https://www.reddit.com/r/archlinux/comments/3ejvn0/whats_mkinitcpio_and_is_it_needed_when_installing/

[root@e13olf]# exit

5 comments:

  1. Wow, wonderful blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is fantastic, let alone the content! iphone device template

    ReplyDelete
  2. awesome issues here. I’m very satisfied to peer your post. Thanks a lot and i am having a look forward to touch you. Will you kindly drop me a e-mail? iphone device template

    ReplyDelete
  3. I got what you intend, thanks for putting up. Woh I am glad to find this website through google. ipad psd

    ReplyDelete
  4. An impressive share, I just given this onto a colleague who was doing a little evaluation on this. And he in reality bought me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I really feel strongly about it and love studying extra on this topic. If potential, as you develop into expertise, would you mind updating your weblog with extra particulars? It’s extremely useful for me. Huge thumb up for this weblog submit! android mockup psd

    ReplyDelete
  5. I ran across your site last week and started to follow your posts consistently. I haven’t commented on any kind of blog site just yet but I was considering to start soon. It’s truly exciting to actually contribute to an article even if it’s only a blog. I really don’t know exactly what to write other than I really loved reading through a couple of of your articles. Great articles for sure. I will keep visiting your blog regularly. I learned a lot from you. Thanks! top development companies

    ReplyDelete