[pkg-cryptsetup-devel] Bug#628038: during shutdown, cannot mount root filesystem read-only

jdietrch at fastmail.fm jdietrch at fastmail.fm
Thu May 26 15:08:28 UTC 2011


Package: cryptsetup
Version: 2:1.1.3-4squeeze2
Severity: normal

After installing and setting up cryptsetup, I noticed that the root
filesystem wasn't getting mounted read-only on shutdown anymore, thus
causing it to be unclean on the next startup.

Specifically, one of the last messages printed to the screen during the
shutdown sequence was now this:
Mounting root filesystem read-only...mount: / is busy
Failed

Then when the system was starting up again, fsck.reiserfs reported
"Filesystem is NOT clean".

This was very repeatable, so I did some investigation.

I have just one device in my crypttab:
# <target name> <source device>         <key file>      <options>
name    /name.enc_vol    none   
precheck=un_blkid,check=blkid,cipher=aes-cbc-essiv:sha256,size=256,hash=ripemd160

So I was surprised to discover *two* loopback devices configured:

saturn:/home/jdietrch# losetup -a
/dev/loop0: [0801]:15801 (/name.enc_vol)
/dev/loop1: [0801]:15801 (/name.enc_vol)
saturn:/home/jdietrch# 

Further investigation revealed the reason: The function
handle_crypptab_line_start() checks to make sure the target device
doesn't exist. If it does exist, the function exits with "return 0". But
it doesn't remove the loopback device that was set up earlier in the
function. So I added a call rm_lo_setup just before the "return 0" and
now I only have one loopback device as expected:

saturn:/home/jdietrch# losetup -a
/dev/loop0: [0801]:15801 (/name.enc_vol)
saturn:/home/jdietrch# 

Also, the message at the end of the shutdown sequence now says this:
Mounting root filesystem read-only...done

And when the system starts up again, fsck.reiserfs reports that the
"Filesystem is clean"

Here is the change I made as a patch:

--- cryptdisks.functions.original       2011-03-11 04:05:53.000000000
-0500
+++ cryptdisks.functions        2011-05-26 10:46:18.000000000 -0400
@@ -556,6 +556,7 @@
 	# Make sure that target device doesn't exist
 	if [ -b "/dev/mapper/${dst}_unformatted" ] || [ -b
 	"/dev/mapper/$dst" ]; then
 		device_msg "$dst" "running"
+               rm_lo_setup
 		return 0
 	fi
 
I don't know if this is the correct or best way to fix problem noted at
the beginning of this message, but in any case cryptsetup shouldn't
prevent the system from shutting down cleanly.

In case it matters, my system is running up-to-date squeeze.

Let me know if you need any more information, or if there is anything
else I can do to help.

Thanks,
James Dietrich







More information about the pkg-cryptsetup-devel mailing list