All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Error while unlocking encrypted BCacheFS: Required key not available
@ 2024-01-16 17:59 George Hilliard
  2024-01-16 18:20 ` Martin Steigerwald
  2024-02-10 18:34 ` Martin Steigerwald
  0 siblings, 2 replies; 11+ messages in thread
From: George Hilliard @ 2024-01-16 17:59 UTC (permalink / raw)
  To: kent.overstreet; +Cc: linux-bcachefs, lkml, martin

> The keyring stuff has been a perpetual utter headache.
>
> I've been debating rewriting that stuff to just pass a memfd handle as a
> mount option and rip out keyring usage...
>
> alternately - now that we're pretty much always mounting via the mount
> helper, perhaps it would be a little bit less fragile if the mount
> helper was adding the key to the keyring - that might be worth checking.

I am hitting this exact issue with the same exact baffling behavior (bcachefs
format, keyctl list, bcachefs mount -> fails). I'm on Arch with Linux
6.7.0-arch3-1
and bcachefs-tools 3:1.4.1-1.

Some other folks have found similar problems with other uses of keyctl, see [1].
It appears systemd segments each system service into its own kernel keyring.
Presumably the one bcachefs-tools is writing into, is not the one the kernel is
reading during mount.

The workaround for users is to run:

    keyctl link @u @s

just before running `bcachefs mount`.

I am not enough of an expert with kernel keyrings to know whether the kernel
code, systemd, Arch's packaging, or something else is at fault here.

- George

[1]: https://github.com/NixOS/nixpkgs/issues/32279

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Error while unlocking encrypted BCacheFS: Required key not available
@ 2024-01-07 11:22 Martin Steigerwald
  2024-01-07 11:27 ` Martin Steigerwald
  0 siblings, 1 reply; 11+ messages in thread
From: Martin Steigerwald @ 2024-01-07 11:22 UTC (permalink / raw)
  To: linux-bcachefs

Hi!

Kernel 6.7.0-rc8 with BCacheFS new year fixes. Compliled with Debian gcc 
13.2.0-9.

BCacheFS tools 1.3.3 – according to bcachefs version – from Debian package 
bcachefs-tools 24+really1.3.4-2.

Linux kernel keyutils from Debian package keyutils 1.6.3-2+b2. (Not sure 
whether really required.)

Created BCacheFS on external 4 TB SSD:

% mkfs.bcachefs -L […] --data_checksum xxhash --metadata_checksum xxhash 
--compression=lz4 --encrypted /dev/sda1

(also tried without xxhash, no difference)


Unlock attempt with incorrect passphrase:

% bcachefs unlock /dev/sda1
Enter passphrase: 
incorrect passphrase

Unlock attempt with correct passphrase does not yield error message 
"incorrect passphrase". Key seems to be available:

% grep bcachefs /proc/keys
1b9e7153 I--Q---  1 perm 3f010000  0  0 user   bcachefs:[… UUID …]: 32

UUID matches filesystem.


Still I get:

% LANG=en mount /dev/sda1 /mnt/zeit
mount: /mnt/zeit: mount(2) system call failed: Required key not available.
       dmesg(1) may have more information after failed mount system call.

% dmesg | tail -1
[105441.695035] bcachefs ([…]): error requesting encryption key: ENOKEY


Why? And how to fix it?

I found

error requesting encryption key #93 

https://github.com/koverstreet/bcachefs/issues/93

But I am not sure whether it applies to my situation.

I use Devuan with elogind. Do I need that pam related configuration change 
from comment

https://github.com/koverstreet/bcachefs/issues/93#issuecomment-609430340

?

I do not like to do it in case it is not required.

Best,
-- 
Martin



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-10 18:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 17:59 Error while unlocking encrypted BCacheFS: Required key not available George Hilliard
2024-01-16 18:20 ` Martin Steigerwald
2024-02-10 18:34 ` Martin Steigerwald
  -- strict thread matches above, loose matches on Subject: below --
2024-01-07 11:22 Martin Steigerwald
2024-01-07 11:27 ` Martin Steigerwald
2024-01-10  2:13   ` AP
2024-01-10 14:18     ` Martin Steigerwald
2024-01-10 19:13       ` Kent Overstreet
2024-01-11 11:58         ` Martin Steigerwald
2024-01-11 16:35           ` Kent Overstreet
2024-01-11 18:23             ` Martin Steigerwald

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.