LE 9.2 with lvm2, luks (dm-crypt, veracrypt), ext4 encryption and some newclock5 kodi patches

  • This is how I got auto decrypt & mount working on Libreelec 11 on Raspberry Pi 5, without entering the password every time. All my hd use the same password and all use truecrypt hidden volume. Please advise if there is a better method:

    I did all these steps with my root account.

    I create a file ( /storage/myscripts/my_pwd ) and write my truecrypt password without ending newline, then I restricted access, then I restricted access ( chmod 0600 /storage/myscripts/my_pwd )

    I created /etc/crypttab file:

    then I relaunched systemctl:

    Code
    systemctl daemon-reload

    in this way I got 16 new service files in /var/run/systemd/generator/ , one for each sdd. In this way every sdd. If you open [email protected] you can read these lines:

    Code
    ExecStart=/usr/lib/systemd/systemd-cryptsetup attach 'truecryptsda1' '/dev/sda1' '/storage/myscripts/my_pwd' 'tcrypt-hidden,nofail'
    ExecStop=/usr/lib/systemd/systemd-cryptsetup detach 'truecryptsda1'

    then I created a new file, /storage/.config/udev.rules.d/99-automount.rules , with only one line:

    Code
    ACTION=="add", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="sd[a-z][0-9]", RUN+="/storage/myscripts/my_automount.sh %k"

    finally, I created /storage/myscripts/my_automount.sh

    done. Now my hidden truecrypt volumes are automount at boot or as soon as I connect to any USB port.

    Note: default Raspberry Pi 5 boot sequence is USB, sd so if you have your os on sd don't connect your truecrypt volume to a USB 3 ports (USB 2 ports are ok). Of course you can change boot sequence (be careful, there is a bug ...) or use USB 3 port after Libreelec boots.