Thanks everyone for pointing me in the right direction. I managed to solve the problem with your help; short report incoming in case anyone is interested.
Simon's suggested approach worked quite nicely just right out of the box, however it didn't fix the problem. In fact, my old script still does the trick as well, but using systemd-ask-password is probably a *much* better idea instead of my crude scripting approach so thanks for that. Tom's idea of using /etc/crypttab was a good one, but sadly I did not find any way to tell it to open the TC partition as a system volume (which is exhibited by tcryptrOpen's --tcrypt-system option). In the end I wasn't able to find out which programs grabbed the tty from my script, even with the additional logging Lennart suggested. I thought it would be enough to put Before=multi-user.target but somehow that didn't work. So now I just opted for using cryptsetup.target as WantedBy, since the system is obviously in such an early state of operation then that programs will keep the tty. I also tested that cryptsetup can still be used in conjunction with this truecrypt service. Below is the unit file for truecrypt that I use now; note that the script now resides in /etc/ because this early in the boot process /home is not mounted yet, so I had to change the location. The mentioned unmount service just calls truecrypt -d, btw. Thanks everyone, it's almost 3am now and I'll be going to bed. :P Natanji ------------------- [Unit] Description=Mount Truecrypt-encrypted filesystems ConditionFileIsExecutable=/usr/bin/truecrypt Before=local-fs-pre.target DefaultDependencies=false [Service] Type=oneshot ExecStart=/usr/bin/bash /etc/truecrypt_mount RemainAfterExit=yes [Install] WantedBy=cryptsetup.target Also=truecrypt-unmount.service On 06/20/2013 09:05 PM, Lennart Poettering wrote: > On Wed, 19.06.13 14:52, Natanji (nata...@gmail.com) wrote: > >> 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? > > As others already mentioned using systemd-ask-password is probably the > better approach. That said, my guess is that something else also wants > to take possession of the tty. Have you tried to boot with > systemd.log_level=debug systemd.log_level=kmsg to see what else tries to > run when your input is taken away? > > Lennart > _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel