2007-08-28 14:20:48

by Paul Albrecht

[permalink] [raw]
Subject: dm-crypt mount returns EINVAL

Hi,

I have recently upgraded my kernel to 2.6.21 from 2.6.20 and that has
caused a problem mounting an encrypted partition using dm-crypt.

In my init script, I use cryptsetup to create device which I use to
mount an encrypted partition. Since I changed to 2.6.21 the mount fails
returning an EINVAL status which doesn't make much sense because the
init script is unchanged and works if reverted to 2.6.20.

Any ideas? How can I debug this problem? I'm not subscribed to lkml so
please cc in your response.

Paul Albrecht


2007-08-28 15:02:18

by Satyam Sharma

[permalink] [raw]
Subject: Re: dm-crypt mount returns EINVAL

Hi Paul,


On Tue, 28 Aug 2007, Paul Albrecht wrote:

> Hi,
>
> I have recently upgraded my kernel to 2.6.21 from 2.6.20 and that has
> caused a problem mounting an encrypted partition using dm-crypt.
>
> In my init script, I use cryptsetup to create device which I use to
> mount an encrypted partition. Since I changed to 2.6.21 the mount fails
> returning an EINVAL status which doesn't make much sense because the
> init script is unchanged and works if reverted to 2.6.20.
>
> Any ideas? How can I debug this problem? I'm not subscribed to lkml so
> please cc in your response.

What was the error you got from cryptsetup()? Also, please post the
kernel's dmesg log and the .config of the 2.6.21 kernel (new one).

Also, compare the .config's of the two kernels and ensure that
CONFIG_DM_CRYPT (or possibly one of the _CRYPTO_ config options)
didn't get lost or automatically unset during the upgrade/oldconfig.


Satyam

2007-08-28 15:42:25

by Paul Albrecht

[permalink] [raw]
Subject: Re: dm-crypt mount returns EINVAL

Hi Satyam,

On Tue, 2007-08-28 at 20:45 +0530, Satyam Sharma wrote:
> Hi Paul,
>
>
> On Tue, 28 Aug 2007, Paul Albrecht wrote:
>
> > Hi,
> >
> > I have recently upgraded my kernel to 2.6.21 from 2.6.20 and that has
> > caused a problem mounting an encrypted partition using dm-crypt.
> >
> > In my init script, I use cryptsetup to create device which I use to
> > mount an encrypted partition. Since I changed to 2.6.21 the mount fails
> > returning an EINVAL status which doesn't make much sense because the
> > init script is unchanged and works if reverted to 2.6.20.
> >
> > Any ideas? How can I debug this problem? I'm not subscribed to lkml so
> > please cc in your response.
>
> What was the error you got from cryptsetup()? Also, please post the
> kernel's dmesg log and the .config of the 2.6.21 kernel (new one).
>

There's no problem with cryptsetup; it sets up the device for decryption
and returns good status.

Can't run dmesg because the problem occurs in my init script so I don't
have a usable system after the error occurs.

I can get some usable debug output via the serial console. Attached is a
copy of output from serial console for 2.6.20 and 2.6.21. I have added
straces for cryptsetup and mount commands to my init script for debug.

> Also, compare the .config's of the two kernels and ensure that
> CONFIG_DM_CRYPT (or possibly one of the _CRYPTO_ config options)
> didn't get lost or automatically unset during the upgrade/oldconfig.
>

Compared both config's and don't see any difference that would account
for the mount failure.

Paul Albrecht


Attachments:
minicom.cap.lkml (83.22 kB)
oldconfig (45.55 kB)
newconfig (45.61 kB)
Download all attachments

2007-08-28 18:55:35

by Paul Albrecht

[permalink] [raw]
Subject: Re: dm-crypt mount returns EINVAL

On Tue, 2007-08-28 at 20:45 +0530, Satyam Sharma wrote:
> Hi Paul,
>
>
> On Tue, 28 Aug 2007, Paul Albrecht wrote:
>
> > Hi,
> >
> > I have recently upgraded my kernel to 2.6.21 from 2.6.20 and that has
> > caused a problem mounting an encrypted partition using dm-crypt.
> >
> > In my init script, I use cryptsetup to create device which I use to
> > mount an encrypted partition. Since I changed to 2.6.21 the mount fails
> > returning an EINVAL status which doesn't make much sense because the
> > init script is unchanged and works if reverted to 2.6.20.
> >
> > Any ideas? How can I debug this problem? I'm not subscribed to lkml so
> > please cc in your response.
>
> What was the error you got from cryptsetup()? Also, please post the
> kernel's dmesg log and the .config of the 2.6.21 kernel (new one).
>
> Also, compare the .config's of the two kernels and ensure that
> CONFIG_DM_CRYPT (or possibly one of the _CRYPTO_ config options)
> didn't get lost or automatically unset during the upgrade/oldconfig.
>

Found the problem ... the pass phrase used in cryptsetup is incorrect
for the partition I want to decrypt. Not sure why that is because I
compute it at runtime. One of the parameters I use must have changed
from 2.6.20 to 2.6.21. I'll have to sort that out myself. Thanks
anyways!

Paul Albrecht