DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jens-Michael Hoffmann <jmho@jmho.de>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] After reboot: "Command failed with code 22: Device /dev/md2 is not a valid LUKS device."
Date: Tue, 23 Apr 2013 18:08:21 +0200	[thread overview]
Message-ID: <2467145.0Six7fUZOk@slipstream> (raw)
In-Reply-To: <20130423155213.GA17675@tansi.org>

Am Dienstag, 23. April 2013, 17:52:13 schrieb Arno Wagner:
> On Tue, Apr 23, 2013 at 05:13:57PM +0200, Jens-Michael Hoffmann wrote:
> > hello,
> > 
> > the LUKS device in question was setup on top of a raid6 (/dev/md2)
> > consisting of 6 partitions (1.8TB each).
> > 
> > The LUKS device was created with
> > 
> > cryptsetup --verbose --cipher=aes-xts-plain64 --key-size=256 --verify-
> > passphrase luksFormat /dev/md2
> 
> Ok.
> 
> > Then it was opened with (probably, what I could tell from history):
> > 
> > cryptsetup -v create md2_crypt /dev/md2
> 
> That puts a plain dm-crypt mapping on top of the LUKS device.
> Open a LUKS device with "luksOpen" not with "create".
> 
> > and a XFS filesystem was created on top of it.
> 
> That now is in the plain dm-crypt container and likely
> did damage the LUKS container created before.
> 
> > I put some files on the filesystem which all seemed to work.
> > After the first reboot, the array was assembled correctly, but I could not
> > create the crypt mapping anymore:
> > 
> > root@babylon5:~# LANG=C cryptsetup -v --debug isLuks /dev/md2
> > # cryptsetup 1.4.3 processing "cryptsetup -v --debug isLuks /dev/md2"
> > # Running command isLuks.
> > # Allocating crypt device /dev/md2 context.
> > # Trying to open and read device /dev/md2.
> > # Initialising device-mapper backend, UDEV is enabled.
> > # Detected dm-crypt version 1.12.1, dm-ioctl version 4.23.1.
> > # Trying to load LUKS1 crypt type from device /dev/md2.
> > # Crypto backend (gcrypt 1.5.0) initialized.
> > # Reading LUKS header of size 1024 from device /dev/md2
> > # LUKS header not detected.
> > Device /dev/md2 is not a valid LUKS device.
> > # Releasing crypt device /dev/md2 context.
> > # Releasing device-mapper backend.
> > Command failed with code 22: Device /dev/md2 is not a valid LUKS device.
> 
> Likely something you wrtoe to the plain mapping overwrote
> the LUKS header. Open it as plain to access it.
> 
> > The data I put there was not overly important, but still it would be
> > nice if it would not be all lost.
> > 
> > Is there anything I can try? (I did not yet try cryptsetup --repair)
> 
> Don't try that. Your data is in a plain dm-crypt container,
> not in the LUKS container that was damaged. Just open it
> with "create" again. ("create" does not write anything to disk.
> IT just creates the plain mapping. No data is written to disk
> as a plain mapping does not have metadata.)

Many thanks!

"cryptsetup -v create md2_crypt /dev/md2" indeed successfully created the 
mapping and I could mount the filesystem.

Just out of curiosity: Is the cipher and key size combination (aes-xts-
plain64, 256 bit) the default or why did I have not to specify it to create 
the mapping? (IIUC the metadata of plain mappings is not stored?)


kind regards,
Jens-Michael

  reply	other threads:[~2013-04-23 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 15:13 [dm-crypt] After reboot: "Command failed with code 22: Device /dev/md2 is not a valid LUKS device." Jens-Michael Hoffmann
2013-04-23 15:52 ` Arno Wagner
2013-04-23 16:08   ` Jens-Michael Hoffmann [this message]
2013-04-23 16:18     ` Jens-Michael Hoffmann
2013-04-23 18:09       ` Arno Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2467145.0Six7fUZOk@slipstream \
    --to=jmho@jmho.de \
    --cc=dm-crypt@saout.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox