/etc/init.d/cryptdisks does not remove dead loopback device if password failed

Bug #95050 reported by Noam Meltzer
6
Affects Status Importance Assigned to Milestone
cryptsetup (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: cryptsetup

If the user failed to enter the password correctly, then a "leftover" device files are left in /dev
I attach a patch to fix this.

ProblemType: Bug
Architecture: amd64
Date: Fri Mar 23 13:34:18 2007
DistroRelease: Ubuntu 7.04
Uname: Linux meydele 2.6.20-12-generic #2 SMP Sat Mar 17 22:55:16 UTC 2007 x86_64 GNU/Linux

Revision history for this message
Noam Meltzer (tsnoam) wrote :

patch to fix problem

Revision history for this message
Noam Meltzer (tsnoam) wrote : [gutsy] patch is still needed

Hello,

Patch is still relevant to gutsy as well.
It should be applied on line 275 of /lib/cryptsetup/cryptdisks.functions

- Noam

Revision history for this message
Reinhard Tartler (siretart) wrote :

patch looks good. Needs proper review and upload.

Changed in cryptsetup:
status: New → Triaged
Revision history for this message
Reinhard Tartler (siretart) wrote :

on closer investigation, the patch doesn't look correct. At least, the losetup -d does not seem to be at the right place.
However, I have looked at that part of the ubuntu diff to debian, and simplified it.

Could you please review your patch and update it with some more comments?

Changed in cryptsetup:
status: Triaged → Incomplete
Revision history for this message
Noam Meltzer (tsnoam) wrote :

Hi,

The previous patch was created with ubuntu7.04 - I have adapted the patch for ubuntu8.04 (hardy).
Also, as for your request, I have clarified the patch with comments and more "correct" programming (which costs in an additional line of code... LOL)

Best regards,
Noam Meltzer

Revision history for this message
Reinhard Tartler (siretart) wrote : Re: [Bug 95050] Re: /etc/init.d/cryptdisks does not remove dead loopback device if password failed

okay, but where is the corresponding losetup call to the 'losetup -d'?

does cryptsetup call losetup internally?
--
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4

Revision history for this message
Noam Meltzer (tsnoam) wrote :

Hi,

It goes like this:
/etc/init.d/cryptdisks calls a function called "do_start" from /lib/cryptsetup/cryptdisks.functions

Now, I'm going to refer to the original file (before my patch):
"do_start" begins at line 428.
at line 476 it calls a function called "lo_setup".

"lo_setup" begins at line 169.
at line 186 it creates the loopback device.

back to "do_start":
at line 484 it calls a function called "do_luks".

"do_luks" begins at line 243.
at line 278 it tries to execute "luksOpen", and I believe that it's clear from here what is the problem....

Best regards,
Noam Meltzer

Revision history for this message
Reinhard Tartler (siretart) wrote :

okay, while trying to understand your patch, I've tried to apply it to the package in intrepid. There the cryptroot script was slightly changed, so that your patch doesn't apply anymore.

upon closer investigation it turns out that the case your script is handling is already handled, but in a different way. First of all, the function rm_lo_setup is used instead of directly using losetup -d. Next, the cleanup procedure does not happen in the function do_luks, but in handle_crypttab_line_start.

all in all I have to conclude the issue is fixed in intrepid. please reopen if you still experience it.

Changed in cryptsetup:
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.