[systemd-devel] Text input on startup (tty-force) disabling after a few seconds

Natanji natanji at gmail.com
Wed Jun 19 05:52:47 PDT 2013


Hi everyone,
I'm somewhat new to systemd and have a problem. I would like to run a
custom script with systemd on startup that will ask me for a password
and mount a Truecrypt volume with it. The script and unit file I wrote
can be found below.

Now, this setup does work *somewhat* - basically it will ask me for my
Truecrypt password on startup and do the mounting as it should. But when
I wait a few seconds during startup, entering the password no longer
works. I just have a few seconds after the password prompt appearing to
enter it; if I wait 5-10 seconds nothing will happen anymore.

That seems like weird and unintended behaviour to me. Is this a bug, or
can you point me in the right direction about what I'm doing wrong if I
want some sort of keyboard interaction during system startup with
systemd? I mean, that is a useful and sometimes needed feature, right?



Unit file:
-----------
[Unit]
Description=Mount Truecrypt-encrypted filesystems
ConditionFileIsExecutable=/usr/bin/truecrypt
Requires=truecrypt-unmount.service
Before=display-manager.service

[Service]
Type=oneshot
ExecStart=/etc/mount_truecrypt
StandardInput=tty-force
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

/etc/mount_truecrypt:
-----------
#!/bin/bash
sudo echo Please enter the password to mount your TrueCrypt volumes...
stty -echo
read password
stty echo
echo C:
echo $password | sudo truecrypt -t -k ""
--fs-options="rw,exec,users,async,uid=root,gid=users,umask=077,noatime"
--mount-options=system --protect-hidden=no /dev/sda1 /media/C > /dev/null
echo ...done.


More information about the systemd-devel mailing list