DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Christensen <dpchrist@holgerdanske.com>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] LUKS partition write-protected, mounting read-only
Date: Tue, 26 Apr 2016 21:18:17 -0700	[thread overview]
Message-ID: <57203D89.40808@holgerdanske.com> (raw)
In-Reply-To: <571FEDEE.7030904@gmail.com>

On 04/26/2016 03:38 PM, Serrano Pereira wrote:
> Hello,
>
> When I create a LUKS partition like so:
>
> $ cryptsetup luksFormat /root/test

I typically put a LUKS container into a partition on a HDD, SSD, USB 
flash drive, etc. -- e.g. /dev/sdb1.


Is /root/test a file (?).  How did you create it?


> $ cryptsetup open /root/test test

Note that 'test' is a user-space command and/or a shell built-in. It's 
best to avoid using that word for *anything*.


My 'man cryptsetup' doesn't show any 'open' action.  Did you cut/paste 
the above from a console session?  If not, please post exact console 
sessions with commands and output.  Entering things by hand from memory 
invites Murphy's Law.


> $ mkfs.ext4 -j /dev/mapper/test

Why the '-j' option (ext3 journal)?


> $ mount /dev/mapper/test /mnt/files

I assume /mnt/files already existed when you ran the above command?

>
> Then I can create files in /mnt/files just fine. But when I copy
> /root/test to a different computer,

Did you unmount the file system and close the LUKS container before 
copying /root/test to the other machine?


> and then do:
>
> $ cryptsetup open /root/test test
> Enter passphrase for /root/test:
> mount: /dev/mapper/test is write-protected, mounting read-only
> $ mount /dev/mapper/test /mnt/files
>
> As you can see, the device is mounted read-only. I cannot write any
> files to the LUKS partition. Why is this so? How can I write to the
> partition on another computer?

As root, please run these commands on the computer with the source LUKS 
device (file) and post the console session:

     uname -a

     umount /mnt/test

     cryptsetup --version

     cryptsetup luksClose test

     ls -l /root/test

     cryptsetup luksDump /root/test

     cryptsetup luksOpen /root/test test

     ls -l /dev/mapper/test

     fsck /dev/mapper/test

     ls -ld /mnt/files

     mount /dev/mapper/test /mnt/files

     mount | grep '/mnt/files'

     ls -ld /mnt/files

     echo 'hello, world!' > /mnt/files/hello.txt


Then repeat for the computer with the copy.


We're looking for error messages.


If you don't understand the above commands, RTFM each one.  If a command 
is broken, fix it.


Hopefully, that will provide enough clues to figure out what's going on.


David

      parent reply	other threads:[~2016-04-27  4:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26 22:38 [dm-crypt] LUKS partition write-protected, mounting read-only Serrano Pereira
2016-04-27  0:44 ` Arno Wagner
2016-04-27  4:18 ` David Christensen [this message]

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=57203D89.40808@holgerdanske.com \
    --to=dpchrist@holgerdanske.com \
    --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