Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4504

General programming discussion • Start LED before LUKS password entry

$
0
0
Hey guys, i'm new to this forum and i'm not quite shure if this is the right section for this post.

I'm having a problem to start a systemd service during the boot progress before the luks password entry appears.
The goal is to light up a LED when the system is ready for typing in the luks password of /dev/md0. root is not encrypted, but /dev/md0 is and i configured fstab and crypttap in a way that i have to type in the password during the boot progress.

Sice this pi is not connected to a monitor it would be a cool solution in my opinion to light up this LED when the password entry is ready. And turn it off again when the pw is correct.

I got so far, that i connected a LED to GPIO pin 17 and wrote a very simpe script /opt/led-on.sh, only containing a simple line 'gpioset gpiochip4 17=1'. Next i created a systemd service /etc/systemd/system/led-ctrl.service:

Code:

[Unit]Description=Control LED before disk decryptionDefaultDependencies=noBefore=cryptsetup-pre.target[Service]Type=oneshotExecStart=/path/to/led_on.shExecStop=/path/to/led_off.shRemainAfterExit=true[Install]WantedBy=cryptsetup-pre.target
And it works so far, but way to late in the boot progress, the led lights up "long" after i typed in the password. I tried other services, like 'Before=sysinit.target', but nothing changes, the led light up always at the same time way to late.

What am i missing here?

Statistics: Posted by crabler — Wed Jul 31, 2024 1:25 am — Replies 2 — Views 38



Viewing all articles
Browse latest Browse all 4504

Trending Articles