Skip to contentSkip to conversation

LUKS partition write-protected, mounting read-only

dm-crypt Serrano Pereira 3 participants 3 messages Apr 26, 2016 – Apr 27, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

When I create a LUKS partition like so:

$ cryptsetup luksFormat /root/test
$ cryptsetup open /root/test test
$ mkfs.ext4 -j /dev/mapper/test
$ mount /dev/mapper/test /mnt/files

Then I can create files in /mnt/files just fine. But when I copy /root/test to a different computer, 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?

Regards,
Serrano

#1 lore raw

Just a guess, but maybe the second machine has limited ext4 support? You could try with ext3 and see what happens.

Regards,
Arno

Quoted 27 lines · Serrano Pereira

Hello,

When I create a LUKS partition like so:

$ cryptsetup luksFormat /root/test
$ cryptsetup open /root/test test
$ mkfs.ext4 -j /dev/mapper/test
$ mount /dev/mapper/test /mnt/files

Then I can create files in /mnt/files just fine. But when I copy /root/test to a different computer, 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?

Regards,
Serrano
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 7 lines
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: [email protected]
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -- Plato

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier
#2 lore raw
In reply to Serrano Pereira
Quoted 5 lines · Serrano Pereira

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?

Quoted 1 line
$ 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.

Quoted 1 line
$ mkfs.ext4 -j /dev/mapper/test

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

Quoted 1 line
$ mount /dev/mapper/test /mnt/files

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

Quoted 3 lines

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?

Quoted 10 lines

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