Bug#903641: Preserve numlock state during cryptdisk boot password prompt in plymouth

2018-07-27 Thread Pascal Vibet - ADACIS
Hi,

i will test your solutions.

Regards

2018-07-27 15:13 GMT+02:00 Ben Hutchings :

> Control: tag -1 moreinfo
>
> On Thu, 12 Jul 2018 15:02:20 +0200 Pascal Vibet - ADACIS 
> wrote:
> > Package: cryptsetup-initramfs
> > Version: 2:2.0.2-1ubuntu1
> >
> > Dear Maintainers, i propose you my fix to this problem.
> >
> > I'm using smartcard to decrypt luks disk, i'm using decrypt_opensc
> > script in /etc/crypttab. I want to preserve numlock state during
> > cryptdisk boot password prompt.
> >
> > I found this article:
> > https://superuser.com/questions/1062979/preserve-numlock-state-during-
> cryptdisk-boot-password-prompt-in-plymouth
> [...]
>
> If plymouth specifically changes Num Lock state, this may be a bug in
> plymouth.  However, I don't think it does.
>
> I have a theory as to what might be happening:
>
> * Each Linux virtual terminal (VT) has an independent keyboard
>   lock/LED state.  When a different VT is activated, the driver will
>   apply the lock/LED state for that VT.
> * If you boot Linux in BIOS mode, the default state of Num Lock is set
>   acccording to what the BIOS says it should be.
> * If you boot Linux some other way, like UEFI, the default state is
>   unknown and assumed to be off.
> * plymouth opens and activates a new VT.  This applies the default
>
> state.
>
> Does this system boot using the BIOS or UEFI?
>
> If it boots using UEFI, you can test this theory by doing:
>
> 1. In the boot menu, edit the kernel command line to remove "splash"
>and add "break=premount".
> 2. At the initramfs shell prompt, enter "openvt" to create a new VT.
> 3. Press Alt-F2 to activate the new VT.  Does Num Lock turn off?
> 4. Press Alt-F1 to activate the first VT.  Does Num Lock turn on or
>off?
>
> Ben.
>
> --
> Ben Hutchings
> Power corrupts.  Absolute power is kind of neat. - John Lehman
>
>


Bug#903641: Preserve numlock state during cryptdisk boot password prompt in plymouth

2018-07-27 Thread Ben Hutchings
Control: tag -1 moreinfo

On Thu, 12 Jul 2018 15:02:20 +0200 Pascal Vibet - ADACIS  
wrote:
> Package: cryptsetup-initramfs
> Version: 2:2.0.2-1ubuntu1
> 
> Dear Maintainers, i propose you my fix to this problem.
> 
> I'm using smartcard to decrypt luks disk, i'm using decrypt_opensc 
> script in /etc/crypttab. I want to preserve numlock state during 
> cryptdisk boot password prompt.
> 
> I found this article: 
> https://superuser.com/questions/1062979/preserve-numlock-state-during-cryptdisk-boot-password-prompt-in-plymouth
[...]

If plymouth specifically changes Num Lock state, this may be a bug in
plymouth.  However, I don't think it does.

I have a theory as to what might be happening:

* Each Linux virtual terminal (VT) has an independent keyboard
  lock/LED state.  When a different VT is activated, the driver will
  apply the lock/LED state for that VT.
* If you boot Linux in BIOS mode, the default state of Num Lock is set
  acccording to what the BIOS says it should be.
* If you boot Linux some other way, like UEFI, the default state is
  unknown and assumed to be off.
* plymouth opens and activates a new VT.  This applies the default
 
state.

Does this system boot using the BIOS or UEFI?

If it boots using UEFI, you can test this theory by doing:

1. In the boot menu, edit the kernel command line to remove "splash"
   and add "break=premount".
2. At the initramfs shell prompt, enter "openvt" to create a new VT.
3. Press Alt-F2 to activate the new VT.  Does Num Lock turn off?
4. Press Alt-F1 to activate the first VT.  Does Num Lock turn on or
   off?

Ben.

-- 
Ben Hutchings
Power corrupts.  Absolute power is kind of neat. - John Lehman



signature.asc
Description: This is a digitally signed message part


Bug#903641: Preserve numlock state during cryptdisk boot password prompt in plymouth

2018-07-12 Thread Pascal Vibet - ADACIS

Hi,

Le 12/07/2018 à 15:48, Guilhem Moulin a écrit :

Why only in cryptopensc and not in cryptroot?  Also /usr/bin/setleds
comes from the ‘kbd’ package which cryptsetup-initramfs doesn't depend
on (it's only a Recommends, not a hard Depends), so `copy_exec` needs to
wrapped to check for the program's existence.
Because i don't test with cryptroot. For package depends or Recommends, 
the /usr/share/initramfs-tools/hooks/cryptopensc script need 
'dpkg-architecture' program to work and it is in 'dpkg-dev' package||.


But you are right, 'setleds'  is not the goods choice to keep numlock state.
I will search a better program.

Regards

Le 12/07/2018 à 15:48, Guilhem Moulin a écrit :

Control: severity -1 minor

Hi,

On Thu, 12 Jul 2018 at 15:02:20 +0200, Pascal Vibet - ADACIS wrote:

So, i apply modifications like this:
in /usr/share/initramfs-tools/hooks/cryptopensc:
[…]
in /usr/share/initramfs-tools/scripts/local-top/cryptopensc:

Why only in cryptopensc and not in cryptroot?  Also /usr/bin/setleds
comes from the ‘kbd’ package which cryptsetup-initramfs doesn't depend
on (it's only a Recommends, not a hard Depends), so `copy_exec` needs to
wrapped to check for the program's existence.


INITTY=/dev/tty[1-8]
for tty in $INITTY ; do
     setleds -D +num < $tty
done

Does that really *preserve* the numlock state?  I'm not familiar with
setleds(1), but according to the manpage it *sets* numlock and changes
the default settings.

Cheers,




Bug#903641: Preserve numlock state during cryptdisk boot password prompt in plymouth

2018-07-12 Thread Guilhem Moulin
Control: severity -1 minor

Hi,

On Thu, 12 Jul 2018 at 15:02:20 +0200, Pascal Vibet - ADACIS wrote:
> So, i apply modifications like this:
> in /usr/share/initramfs-tools/hooks/cryptopensc:
> […]
> in /usr/share/initramfs-tools/scripts/local-top/cryptopensc:

Why only in cryptopensc and not in cryptroot?  Also /usr/bin/setleds
comes from the ‘kbd’ package which cryptsetup-initramfs doesn't depend
on (it's only a Recommends, not a hard Depends), so `copy_exec` needs to
wrapped to check for the program's existence.

>> INITTY=/dev/tty[1-8]
>> for tty in $INITTY ; do
>>    setleds -D +num < $tty
>> done

Does that really *preserve* the numlock state?  I'm not familiar with
setleds(1), but according to the manpage it *sets* numlock and changes
the default settings.

Cheers,
-- 
Guilhem.


signature.asc
Description: PGP signature


Bug#903641: Preserve numlock state during cryptdisk boot password prompt in plymouth

2018-07-12 Thread Pascal Vibet - ADACIS

Package: cryptsetup-initramfs
Version: 2:2.0.2-1ubuntu1

Dear Maintainers, i propose you my fix to this problem.

I'm using smartcard to decrypt luks disk, i'm using decrypt_opensc 
script in /etc/crypttab. I want to preserve numlock state during 
cryptdisk boot password prompt.


I found this article: 
https://superuser.com/questions/1062979/preserve-numlock-state-during-cryptdisk-boot-password-prompt-in-plymouth


So, i apply modifications like this:
in /usr/share/initramfs-tools/hooks/cryptopensc:
65a66
> copy_exec /usr/bin/setleds

in /usr/share/initramfs-tools/scripts/local-top/cryptopensc:
36a37,45
>
> if [ ! -x /usr/bin/setleds ] ; then
> exit 0
> fi
>
> INITTY=/dev/tty[1-8]
> for tty in $INITTY ; do
>    setleds -D +num < $tty
> done

I apply modifications:
update-initramfs -u -k all

So i can use my numlock in boot password prompt for my smartcard.

Cheers,