I want to execute an interactive session on the console via systemctl on boot up.
My .service file looks something like this:
[Unit]
Description=My service.
[email protected] network-online.target
[email protected] network-online.target multi-user.target
[Service]
Type=oneshot
ExecStart=/bin/bash.bash -c '/usr/bin/nano /scripts/my_notes.txt'
Environment="TERM=xterm-256color"
Environment="SHELL=/bin/bash.bash"
StandardInput=tty-force
StandardOuput=tty
StandardError=tty
TTYPath=/dev/ttyLP0
TTYReset=yes
[Install]
WantedBy=multi-user.target
So here's where things get weird (to me). If I run this manually as root with systemctl start my_stuff.service, it opens up nano and everything works fine.
If I reboot the unit and wait, it opens up nano but arrow keys add junk to the file and don't move the cursor!
Why would this be any different then running it via systemctl "manually"?
In all cases I'm accessing the unit via serial console.
What gives? Thank you for your help!
root(UID 0). In your terminal, processes are run as$USER(UIDid -u). Early in system startup, theTERMenvironment variable has a different value ($TERMtells what kind of terminal you have, and$TERMleads to a definition of what cursor motion commands may be used).rootmanually. I'll update the post. Regarding the$TERMcomments - is there an "After=" I should be setting so this works correctly?[Unit]line before theDescriptionline? I'm sure it does, but if not none of theRequiresorAfterlines will be looked at.