2013/6/19 Natanji <nata...@gmail.com>: > 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.
It might be a bug in the tty-force handling, but this is not a usecase for tty-force, you would be better of using systemd-ask-password I sugest you drop the StandardInput=tty-force from the service file and use this as /etc/mount_truecrypt #!/bin/sh systemd-ask-password "Please enter the password to mount your TrueCrypt volumes..." | 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 # that is one line, but gmail will probably break it _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel