Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initramfs with root partition using lvm and luks encryption fails to boot as its looking for a nonexistent kernel module #47

Closed
Lunarequest opened this issue Mar 9, 2021 · 27 comments

Comments

@Lunarequest
Copy link

I'm trying to install arch linux using luks with lvm and booster for the initramfs. On boot I get the following error /usr/lib/modules/5.11.4-arch1-1/luks.ko I've had similar errors with both the lts and zen kernels as well.

Any idea why I get these errors and how to fix them?

@anatol
Copy link
Owner

anatol commented Mar 9, 2021

There is no such module as luks.ko.

What is config file you use?

@Lunarequest
Copy link
Author

universal: false
strip: true
compression: zstd

@anatol
Copy link
Owner

anatol commented Mar 9, 2021

It is really weird then. Please post the full output of booster -debug. Also add booster.debug=1 to the boot parameter and share the boot output with me (e.g. using a photo camera).

@anatol
Copy link
Owner

anatol commented Mar 9, 2021

Also post your lsmod.

@Lunarequest
Copy link
Author

attached is the output of booster.debug=1, I've used a tar since github complained about the size of the mp4. I'll add the other stuff tomorrow morning since its pretty late for me and I can't figure out a way to upload the other stuff
booster-boot-debug-output.tar.gz

@anatol
Copy link
Owner

anatol commented Mar 9, 2021

I see it now. It looks like you specified luks' UUID as a root. And it is wrong. You should specify UUID of a filesystem that sits on top of LUKS partition. That top filetype should be have type like ext4, btrfs, ...

TODO: booster should provide a more helpful and actionable error message for such situation.

@Lunarequest
Copy link
Author

What's the variable I should use to pass through the fstype?

@anatol
Copy link
Owner

anatol commented Mar 10, 2021

What's the variable I should use to pass through the fstype?

Per man booster:

rootfstype=$TYPE (e.g. rootfstype=ext4). By default booster tries to detect the root filesystem type.

But booster will detect filesystem type automatically.

In your case the problem that you specified wrong root= boot parameter.

@Lunarequest
Copy link
Author

So root=/dev/mapper/device right?

@anatol
Copy link
Owner

anatol commented Mar 10, 2021

So root=/dev/mapper/device right?

I do not know. It depends on your configuration.

Post your lsblk and the boot parameters.

@Lunarequest
Copy link
Author

sorry I took so long to send these but I had some irl stuff
lsblk
IMG_20210311_140148
blkid
IMG_20210311_141217
boot options
IMG_20210311_141310

@anatol
Copy link
Owner

anatol commented Mar 11, 2021

In your bootloader config:

  1. you don't need cryptdevice parameter
  2. instead of rd.luks.uuid you need to use rd.luks.name=$UUID=cryptroot this will open a partition with this $UUID as /dev/mapper/cryptroot
  3. the partition where the LUKS resides is /dev/sda2 and its UUID is ead379...... It means the luks parameter will be rd.luks.name=ead37914-21<....>=cryptroot.
  4. you don't need rootfstype parameter, booster will it figure out automatically.

@Lunarequest
Copy link
Author

I do get a password prompt now but on entering the correct password I get
IMG_20210311_225407.jpg

@Lunarequest
Copy link
Author

Wait it kernel panicked IMG_20210311_225902.jpg

@anatol
Copy link
Owner

anatol commented Mar 11, 2021

The kernel panic is expected and the result of the timeout.

The real culprit is "Error allocating crypto tfm" that I am not sure where it comes from. Try to add debug to the boot parameters. It might provide more information about what is going on.

@anatol
Copy link
Owner

anatol commented Mar 11, 2021

The problem might be due to some extra cryptographic modules are missing in initramfs.

As a workaround for it you can try to add universal: true to your config file and regenerate the images.

@anatol
Copy link
Owner

anatol commented Mar 11, 2021

And also show me the output of sudo cryptsetup luksDump /dev/sda2 | grep -i ciph that will give more information about what cipher do you use for your LUKS device.

@Lunarequest
Copy link
Author

IMG_20210311_234138.jpg

@anatol
Copy link
Owner

anatol commented Mar 11, 2021

The ciphers look fine (these are default versions) and it should work.

Anyway try to use universal: true images.

@Lunarequest
Copy link
Author

Tried that didn't do anything different here is the output with booster.debug=1IMG_20210311_235524.jpg

@anatol
Copy link
Owner

anatol commented Mar 11, 2021

It is still the same "error allocating crypt tfm" problem. Try also adding debug boot parameter for more logs from the kernel itself.

Also post your cat /proc/crypto.

@Lunarequest
Copy link
Author

out put of cat /proc/crypto https://pastebin.com/mPeqtivH

@anatol
Copy link
Owner

anatol commented Mar 12, 2021

Thanks for sharing it. All modules used by your crypto subsystem are part of the universal booster image. I do not see how your booster unable to initialize crypto.

@Lunarequest
Copy link
Author

shall I try reinstalling?

@anatol
Copy link
Owner

anatol commented Mar 12, 2021

Try with the default config file (i.e. empty /etc/booster.yaml) and install booster-git from AUR.

@anatol
Copy link
Owner

anatol commented Oct 12, 2021

Booster 0.7 added numerous fixes for LUKS and LVM. Could you please try 0.7 and see if you still have the issue.

@Lunarequest
Copy link
Author

I'm no longer on archlinux and actually on fedora Kinonite so I can no longer test/reproduce this issue.

anatol added a commit that referenced this issue Sep 29, 2022
If a user specifies non-standard encryption like xts-camellia then
booster fails to use it, and fails with error:

[    8.853839] device-mapper: table: 254:0: crypt: Error allocating crypto tfm (-ENOENT)
[    8.854683] device-mapper: ioctl: error adding target to table
[    8.871073] booster: dm ioctl (cmd=0xc138fd09): no such file or directory

To fix it we need mimic kernel's codepath for this case. If modules for
encryption mode/block cipher are not used then it asks userspace to load
it with `modprobe crypto-$MODE`, when crypto-$MODE is an alias that
points to other modules.

To fix the issue we load the required `crypto-*` alias before setting up
a device mapper for dmcrypto.

As a result of this change 'modules' and 'modules_force_load' handles
aliases as well. So user can add `modules: cryto-camellia` to their
config.

Add an integration test for loadable crypto module.

Fixes #188
Fixes #47
anatol added a commit that referenced this issue Sep 29, 2022
If a user specifies non-standard encryption like xts-camellia then
booster fails to use it, and fails with error:

[    8.853839] device-mapper: table: 254:0: crypt: Error allocating crypto tfm (-ENOENT)
[    8.854683] device-mapper: ioctl: error adding target to table
[    8.871073] booster: dm ioctl (cmd=0xc138fd09): no such file or directory

To fix it we need mimic kernel's codepath for this case. If modules for
encryption mode/block cipher are not used then it asks userspace to load
it with `modprobe crypto-$MODE`, when crypto-$MODE is an alias that
points to other modules.

To fix the issue we load the required `crypto-*` alias before setting up
a device mapper for dmcrypto.

As a result of this change 'modules' and 'modules_force_load' handles
aliases as well. So user can add `modules: cryto-camellia` to their
config.

Add an integration test for loadable crypto module.

Fixes #188
Fixes #47
anatol added a commit that referenced this issue Oct 10, 2022
If a user specifies non-standard encryption like xts-camellia then
booster fails to use it. The error message is

[    8.853839] device-mapper: table: 254:0: crypt: Error allocating crypto tfm (-ENOENT)
[    8.854683] device-mapper: ioctl: error adding target to table
[    8.871073] booster: dm ioctl (cmd=0xc138fd09): no such file or directory

To fix it we need to mimic kernel's codepath for this case. What kernel does in case of
loadable crypto modules are not loaded - it asks userspace to load
the module with `modprobe crypto-$MODE`. `crypto-$MODE` is an alias that
points to other modules.

To fix the original issue we load the required `crypto-*` alias before setting up
a device mapper for dm-crypt.

As a result of this change 'modules' and 'modules_force_load' now handle
aliases as well. So user can add `modules: cryto-camellia` to their config.

Add an integration test for loadable crypto module.

Fixes #188
Fixes #47
anatol added a commit that referenced this issue Oct 10, 2022
If a user specifies non-standard encryption like xts-camellia then
booster fails to use it. The error message is

[    8.853839] device-mapper: table: 254:0: crypt: Error allocating crypto tfm (-ENOENT)
[    8.854683] device-mapper: ioctl: error adding target to table
[    8.871073] booster: dm ioctl (cmd=0xc138fd09): no such file or directory

To fix it we need to mimic kernel's codepath for this case. What kernel does in case of
loadable crypto modules are not loaded - it asks userspace to load
the module with `modprobe crypto-$MODE`. `crypto-$MODE` is an alias that
points to other modules.

To fix the original issue we load the required `crypto-*` alias before setting up
a device mapper for dm-crypt.

As a result of this change 'modules' and 'modules_force_load' now handle
aliases as well. So user can add `modules: cryto-camellia` to their config.

Add an integration test for loadable crypto module.

Fixes #188
Fixes #47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants