Getting VeraCrypt running on a custom build Kernel

Having your own compiled Linux Kernel is a nice thing for various reasons. First, you are not stuck with the (depending on your distribution possibly outdated) Kernel versions your distribution and you highly customize your experience. Some people want to have a super-fast lightweight Kernel, I'm more on the other side of the spectrum. But that's a matter of flavor.

A side-effect is that you learn a lot more about Linux - inevitably issues will arise, from not working KVM (upcoming post) because of iptable issues to VeraCrypt that cannot operate with Kernel support.

Getting your custom Kernel ready for VeraCrypt

I've encountered the following error

device-mapper: reload ioctl on veracrypt1 failed: Invalid argument
Command failed

I've started with that. ioctl based errors normally are a good indicator that something in your Kernel configuration is or missing or misconfigured.
In this case it was the missing support for crypto targets in the device mapper (I suppose).

Fortunately the Gentoo-Forums provide some very useful informations. Make sure you have configured the following options in your Kernel

Device Drivers --->
[*] Multiple devices driver support (RAID and LVM) --->
<*> Device mapper support
<*> Crypt target support
[*] Block Devices --->
<*> Loopback device support
File systems --->
<*> FUSE (Filesystem in Userspace) support
[*] Cryptographic API --->
<*> RIPEMD-160 digest algorithm
<*> SHA384 and SHA512 digest algorithms
<*> Whirlpool digest algorithms
<*> LRW support
<*> XTS support
<*> AES cipher algorithms
<*> Serpent cipher algorithm
<*> Twofish cipher algorithm

Re-build your Kernel, and everything should work fine 🙂

3 thoughts on “Getting VeraCrypt running on a custom build Kernel”

  1. Thanks!! This was such a time saver. I have been trying to piece this together for some time. I was just looking through the source code, not sure how it would all correlate to actual kernel modules. How did you determine this, trial and error?

    1. Hey Craig! It's long time ago, but I suppose it was a mixture of some experience and sophisticated/desperate googling. Fortunately at some point I found the Gentoo-Forum-Post mentioned in the Article, that finally lead to a solution.

      Anyways, I'm glad I could help someone else as well. Cheers 🙂

      1. Hi Craig,

        section "2. Convert ext4 rootfs to btrfs" I executed on a separate laptop. I just checked, and it appears, that (at least) Ubuntu dropped the support for btrfs-convert [1]. It is still available in openSuse Tumbleweed though.

        Since Ubuntu dropped this package, I'm afraid my tutorial doesn't work anymore unless you are switching to a different distribution or find another way of getting btrfs-convert.

        Sorry for the inconvenience

Leave a Reply

Your email address will not be published.