I need rc.local to open a terminal upon AppVM startup so the user an enter a login credential into a script for an autostarted application. Currently rc.local contains the absolute path to a startup_handler.sh script, which runs <terminal> -e /path/to/python_script.py. Both rc.local and startup_handler.sh are marked executable, and the python script is also executable and has the #!/usr/bin/env python3 shebang.
I have used echo "<script name> ran at $(date)" >> /home/user/date.log in both rc.local and startup_handler.sh, and date.log shows that both scripts are run at boot.
The terminal in startup_handler.sh never opens, however.
Trying Different Terminals
xterm produces an error in the journal corresponding to the time rc.local runs:
misc-post.sh[560]: xterm: Xt error: Can't open display: :0
Even though adding set to rc.local shows that DISPLAY is set to :0 before startup_handler.sh runs, adding export DISPLAY=:0 to rc.local (set then showed _=DISPLAY=:0) does not mitigate the error.
alacritty produces a libegl warning: dri2: failed to authenticate error in the journal, and does so even when I open it after boot through dom0.
gnome-terminal produces a Failed to parse arguments: Cannot open display: error in the journal.
qubes-run-terminal fails.
I could use some other autostart method, like a .desktop file or even a systemd service, but I’d much rather keep things minimal.
Where should I begin debugging the “lack of a display”? Calling sleep 10 before the terminal opens doesn’t help. I tried using zenity, but that has a similar Gtk-WARNING **: 22:53:42.254: cannot open display: in the journal.
The qubes-misc-post systemd service runs rc.local. Examining the service indicates it isn’t started After the qubes-gui-agent service. Editing /usr/lib/systemd/system/qubes-misc-post.service in the TemplateVM as such doesn’t mitigate the display errors:
After=network-pre.target qubes-mount-dirs.service qubes-network.service qubes-firewall.service qubes-gui-agent.service