All of lore.kernel.org
 help / color / mirror / Atom feed
* crypt-cleanup.sh question
@ 2010-10-26 12:11 Mr Dash Four
       [not found] ` <4CC6C571.8010406-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Mr Dash Four @ 2010-10-26 12:11 UTC (permalink / raw)
  To: initramfs

What is the rationale behind closing all /dev/mapper/luks-* devices 
which are not 'busy' in this shell script? Why would they have to be 
'busy' (I presume already mapped) to be left open?

I am asking this because when the smartcard module opens a LUKS drive 
(not root - '/') - this drive later to be mapped from the actual root 
/etc/fstab file as '/dev/mapper/luks-XXX /some/directory' - this 
operation does not succeed and I presume crypt-cleanup.sh closes it up 
before the actual root can get it and therefore it cannot be mapped.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: crypt-cleanup.sh question
       [not found] ` <4CC6C571.8010406-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2010-10-26 14:37   ` Mr Dash Four
       [not found]     ` <4CC7F15C.7090600@redhat.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Mr Dash Four @ 2010-10-26 14:37 UTC (permalink / raw)
  To: initramfs


> What is the rationale behind closing all /dev/mapper/luks-* devices 
> which are not 'busy' in this shell script? Why would they have to be 
> 'busy' (I presume already mapped) to be left open?
>
> I am asking this because when the smartcard module opens a LUKS drive 
> (not root - '/') - this drive later to be mapped from the actual root 
> /etc/fstab file as '/dev/mapper/luks-XXX /some/directory' - this 
> operation does not succeed and I presume crypt-cleanup.sh closes it up 
> before the actual root can get it and therefore it cannot be mapped.
Further to the above, I was able to verify that the above script is 
indeed to blame for closing LUKS partitions. The only 'busy' partition 
at the time crypt-cleanup.sh runs is the root (/sysroot) so I don't see 
how a LUKS partition (other than root) specified at the kernel command 
line could be opened, unless I am missing something obvious...

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: crypt-cleanup.sh question
       [not found]       ` <4CC7F15C.7090600-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-10-27 12:07         ` Mr Dash Four
       [not found]           ` <4CC815E4.4060705-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Mr Dash Four @ 2010-10-27 12:07 UTC (permalink / raw)
  To: Harald Hoyer, initramfs


>>> What is the rationale behind closing all /dev/mapper/luks-* devices 
>>> which are
>>> not 'busy' in this shell script? Why would they have to be 'busy' (I 
>>> presume
>>> already mapped) to be left open?
>>>
>>> I am asking this because when the smartcard module opens a LUKS 
>>> drive (not
>>> root - '/') - this drive later to be mapped from the actual root 
>>> /etc/fstab
>>> file as '/dev/mapper/luks-XXX /some/directory' - this operation does 
>>> not
>>> succeed and I presume crypt-cleanup.sh closes it up before the 
>>> actual root can
>>> get it and therefore it cannot be mapped.
>> Further to the above, I was able to verify that the above script is 
>> indeed to
>> blame for closing LUKS partitions. The only 'busy' partition at the time
>> crypt-cleanup.sh runs is the root (/sysroot) so I don't see how a 
>> LUKS partition
>> (other than root) specified at the kernel command line could be 
>> opened, unless I
>> am missing something obvious...
>
> So, what's the problem? You get real root and can do everything on the 
> real system afterwards...
Well, 'the problem' as you put it, is that when I open a LUKS partition 
within initramfs (which isn't root!) the crypt-cleanup.sh script in the 
crypt module closes it before switching the real root and therefore that 
partition is no longer available and cannot be mapped.

The same goes if I use the crypt module itself - it asks me for a 
password, opens the required partition and then promptly closes that 
same partition before switching root.

My original query (and the reason for starting this thread) is what is 
the rationale behind this - why not leave the LUKS partitions which were 
open within initramfs to stay open so that they could be mapped by the 
userspace tools/the kernel itself?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: crypt-cleanup.sh question
       [not found]           ` <4CC815E4.4060705-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2010-10-27 13:08             ` Harald Hoyer
       [not found]               ` <4CC82448.80403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Harald Hoyer @ 2010-10-27 13:08 UTC (permalink / raw)
  To: Mr Dash Four; +Cc: initramfs

On 10/27/2010 02:07 PM, Mr Dash Four wrote:
>
>>>> What is the rationale behind closing all /dev/mapper/luks-* devices which are
>>>> not 'busy' in this shell script? Why would they have to be 'busy' (I presume
>>>> already mapped) to be left open?
>>>>
>>>> I am asking this because when the smartcard module opens a LUKS drive (not
>>>> root - '/') - this drive later to be mapped from the actual root /etc/fstab
>>>> file as '/dev/mapper/luks-XXX /some/directory' - this operation does not
>>>> succeed and I presume crypt-cleanup.sh closes it up before the actual root can
>>>> get it and therefore it cannot be mapped.
>>> Further to the above, I was able to verify that the above script is indeed to
>>> blame for closing LUKS partitions. The only 'busy' partition at the time
>>> crypt-cleanup.sh runs is the root (/sysroot) so I don't see how a LUKS partition
>>> (other than root) specified at the kernel command line could be opened, unless I
>>> am missing something obvious...
>>
>> So, what's the problem? You get real root and can do everything on the real
>> system afterwards...
> Well, 'the problem' as you put it, is that when I open a LUKS partition within
> initramfs (which isn't root!) the crypt-cleanup.sh script in the crypt module
> closes it before switching the real root and therefore that partition is no
> longer available and cannot be mapped.
>
> The same goes if I use the crypt module itself - it asks me for a password,
> opens the required partition and then promptly closes that same partition before
> switching root.
>
> My original query (and the reason for starting this thread) is what is the
> rationale behind this - why not leave the LUKS partitions which were open within
> initramfs to stay open so that they could be mapped by the userspace tools/the
> kernel itself?
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

Hmm, maybe this could do it:


diff --git a/modules.d/90crypt/crypt-cleanup.sh b/modules.d/90crypt/crypt-cleanup.sh
index e9fc6ba..4722425 100755
--- a/modules.d/90crypt/crypt-cleanup.sh
+++ b/modules.d/90crypt/crypt-cleanup.sh
@@ -4,6 +4,11 @@
  # close everything which is not busy
  rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1

+if getargs rd_LUKS_UUID || getarg rd_NO_LUKS; then
+    # do not clean up, if we did not autoassemble
+    exit 0
+fi
+
  while true; do
      local do_break="y"
      for i in /dev/mapper/luks-*; do

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: crypt-cleanup.sh question
       [not found]               ` <4CC82448.80403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-10-27 13:17                 ` Mr Dash Four
       [not found]                   ` <4CC82652.3090500-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Mr Dash Four @ 2010-10-27 13:17 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs


> Hmm, maybe this could do it:
>
>
> diff --git a/modules.d/90crypt/crypt-cleanup.sh 
> b/modules.d/90crypt/crypt-cleanup.sh
> index e9fc6ba..4722425 100755
> --- a/modules.d/90crypt/crypt-cleanup.sh
> +++ b/modules.d/90crypt/crypt-cleanup.sh
> @@ -4,6 +4,11 @@
>  # close everything which is not busy
>  rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
>
> +if getargs rd_LUKS_UUID || getarg rd_NO_LUKS; then
> +    # do not clean up, if we did not autoassemble
> +    exit 0
> +fi
> +
>  while true; do
>      local do_break="y"
>      for i in /dev/mapper/luks-*; do
That is good, but I have a better idea (currently implementing it - will 
post the patch later today) - keep open only the partitions specified 
via rd_LUKS_UUID and close everything else. Close everything if 
rd_NO_LUKS is used (there shouldn't be any LUKS partitions open if that 
parameter was used, but you can't be too careful!). How's that?

On a side note: I thought rd_LUKS_UUID, rd_LUKS_KEYPATH, rd_LUKS_KEYDEV 
and rd_NO_LUKS are sort of 'deprecated' in favour of the new rd.luks.* 
format - is that not the case?

Another query - is there any particular reason why all rd_LUKS_UUID need 
to be mapped to luks-UUID? I'd rather be able to choose a more 
meaningful name than the 'standard' luks-UUID - just a thought.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: crypt-cleanup.sh question
       [not found]                   ` <4CC82652.3090500-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2010-10-27 13:37                     ` Harald Hoyer
       [not found]                       ` <4CC82B0B.30208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Harald Hoyer @ 2010-10-27 13:37 UTC (permalink / raw)
  To: Mr Dash Four; +Cc: initramfs

On 10/27/2010 03:17 PM, Mr Dash Four wrote:
>
>> Hmm, maybe this could do it:
>>
>>
>> diff --git a/modules.d/90crypt/crypt-cleanup.sh
>> b/modules.d/90crypt/crypt-cleanup.sh
>> index e9fc6ba..4722425 100755
>> --- a/modules.d/90crypt/crypt-cleanup.sh
>> +++ b/modules.d/90crypt/crypt-cleanup.sh
>> @@ -4,6 +4,11 @@
>> # close everything which is not busy
>> rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
>>
>> +if getargs rd_LUKS_UUID || getarg rd_NO_LUKS; then
>> + # do not clean up, if we did not autoassemble
>> + exit 0
>> +fi
>> +
>> while true; do
>> local do_break="y"
>> for i in /dev/mapper/luks-*; do
> That is good, but I have a better idea (currently implementing it - will post
> the patch later today) - keep open only the partitions specified via
> rd_LUKS_UUID and close everything else. Close everything if rd_NO_LUKS is used
> (there shouldn't be any LUKS partitions open if that parameter was used, but you
> can't be too careful!). How's that?
>
> On a side note: I thought rd_LUKS_UUID, rd_LUKS_KEYPATH, rd_LUKS_KEYDEV and
> rd_NO_LUKS are sort of 'deprecated' in favour of the new rd.luks.* format - is
> that not the case?

yes, they will be.

> Another query - is there any particular reason why all rd_LUKS_UUID need to be
> mapped to luks-UUID? I'd rather be able to choose a more meaningful name than
> the 'standard' luks-UUID - just a thought.

hmm, yes/no... I like meaningful symlinks :)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: crypt-cleanup.sh question
       [not found]                       ` <4CC82B0B.30208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-10-27 14:16                         ` Mr Dash Four
       [not found]                           ` <4CC83425.2010706-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Mr Dash Four @ 2010-10-27 14:16 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs


>> On a side note: I thought rd_LUKS_UUID, rd_LUKS_KEYPATH, 
>> rd_LUKS_KEYDEV and
>> rd_NO_LUKS are sort of 'deprecated' in favour of the new rd.luks.* 
>> format - is
>> that not the case?
>
> yes, they will be.
When is this planned?

>> Another query - is there any particular reason why all rd_LUKS_UUID 
>> need to be
>> mapped to luks-UUID? I'd rather be able to choose a more meaningful 
>> name than
>> the 'standard' luks-UUID - just a thought.
>
> hmm, yes/no... I like meaningful symlinks :)
OK, how about "luks-<meaningful_name>" then? ;-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: crypt-cleanup.sh question
       [not found]                           ` <4CC83425.2010706-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2010-10-27 14:27                             ` Amadeusz Żołnowski
  2010-10-27 15:08                             ` Harald Hoyer
  1 sibling, 0 replies; 9+ messages in thread
From: Amadeusz Żołnowski @ 2010-10-27 14:27 UTC (permalink / raw)
  To: initramfs

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

Excerpts from Mr Dash Four's message of Wed Oct 27 16:16:05 +0200 2010:
> 
> >> On a side note: I thought rd_LUKS_UUID, rd_LUKS_KEYPATH, 
> >> rd_LUKS_KEYDEV and
> >> rd_NO_LUKS are sort of 'deprecated' in favour of the new rd.luks.* 
> >> format - is
> >> that not the case?
> >
> > yes, they will be.
> When is this planned?

I'm improving my patch at the moment, so I hope - soon. :-)
--
Amadeusz Żołnowski

PGP key fpr: C700 CEDE 0C18 212E 49DA  4653 F013 4531 E1DB FAB5

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: crypt-cleanup.sh question
       [not found]                           ` <4CC83425.2010706-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  2010-10-27 14:27                             ` Amadeusz Żołnowski
@ 2010-10-27 15:08                             ` Harald Hoyer
  1 sibling, 0 replies; 9+ messages in thread
From: Harald Hoyer @ 2010-10-27 15:08 UTC (permalink / raw)
  To: Mr Dash Four; +Cc: initramfs

On 10/27/2010 04:16 PM, Mr Dash Four wrote:
>
>>> On a side note: I thought rd_LUKS_UUID, rd_LUKS_KEYPATH, rd_LUKS_KEYDEV and
>>> rd_NO_LUKS are sort of 'deprecated' in favour of the new rd.luks.* format - is
>>> that not the case?
>>
>> yes, they will be.
> When is this planned?

I am working on it for the rest of dracut.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-10-27 15:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26 12:11 crypt-cleanup.sh question Mr Dash Four
     [not found] ` <4CC6C571.8010406-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2010-10-26 14:37   ` Mr Dash Four
     [not found]     ` <4CC7F15C.7090600@redhat.com>
     [not found]       ` <4CC7F15C.7090600-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-27 12:07         ` Mr Dash Four
     [not found]           ` <4CC815E4.4060705-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2010-10-27 13:08             ` Harald Hoyer
     [not found]               ` <4CC82448.80403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-27 13:17                 ` Mr Dash Four
     [not found]                   ` <4CC82652.3090500-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2010-10-27 13:37                     ` Harald Hoyer
     [not found]                       ` <4CC82B0B.30208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-27 14:16                         ` Mr Dash Four
     [not found]                           ` <4CC83425.2010706-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2010-10-27 14:27                             ` Amadeusz Żołnowski
2010-10-27 15:08                             ` Harald Hoyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.