Because of the dynamic nature of my systems, I have written a PERL script that determines what disks are available and where they get mounted.
This script was developed a number of years ago and has worked pretty well for most of that time.
Originally the script was called with an entry in /etc/rc.d/boot.local. With the advent of Leap,
it was suggested that I utilize SYSTEMD for executing this tool.
With a LOT of exploration and experimentation I managed to get this functional using a SYSTEMD service.
Shortly thereafter, a kernel update broke my tool.
The only fix appeared to be to revert back to the older kernel.
This has worked for a couple of months.
However, yesterday, a NEW kernel update again broke the tool, but in a bit of a different fashion.
I utilize LUKS encrypted partitions. The problems that have been encountered both center around the password prompt when mounting.
In the first kernel change, the system would hang once the password prompt had been displayed.
No input appeared to be allowed, and a hardware reset was required.
After the second kernel update the password prompt would immediately return a fail message and continue without ever allowing any input.
I have been able to work around THIS change by adding a 5 second delay in the script BEFORE issuing the cryptsetup command.
For non-encrypted disks/partition mounts, the script works flawlessly.
Can any kind soul explain to me what I am doing wrong?
Although I THINK I have some vague understanding of SYSTEMD, I am FAR from being very knowledgeable about how to correctly utilize it.
Here is the .service file:
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. [Unit] Description=Custom setup DefaultDependencies=no Conflicts=shutdown.target After=local-fs.target Before=NetworkManager.service [Service] Type=oneshot ExecStart=/usr/bin/openvt -s -w -e -v /usr/bin/perl /etc/RR/customize.pl RemainAfterExit=no [Install] WantedBy=multi-user.target
Here are the relavant lines from the PERL script:
sleep 5; ### seems to be needed for recent kernel my $cmd = "cryptsetup luksOpen $dev edev"; `logger "customize.pl issuing=>$cmd"`; system $cmd;
The ‘sleep’ line was added to make this work with the recent kernel change.
Without it, I will see the password prompt followed by an error message, and the script will continue without waiting for input.
Other mounts of non-encrypted partitions/disks work fine with or without the delay.