Launch terminal and application at appVM startup

how to autorun terminal and vpn‑application to start when appVM started? I tried adding commands to /rw/config/rc.local, but it didn’t work. adding .desktop file to ~/.config/autostart didn’t work too. I couldn’t find a solution on the forum through search. help please. need guide

What did you put in rc.local?

What .desktop file did you add there?

1 Like

commands for app - xfce4-terminal and vpn-command

I created files in xfce-settings (Session and Startup). I wrote defoult terminal commands and bin - didn’t work

@solene your guides awesome. please create guide for autorun gui-apps after appVM starting

When it comes to rc.local, you’re running into two issues:

  1. rc.local executes before the GUI is initialised
  2. rc.local runs all commands as root, not as user.

The “correct” way of starting GUI apps on Qube start would most probably be through .config/autostart and I don’t know why it doesn’t work. A systemd user service could also work.

If you really want to use rc.local, this workaround will work, but you may run into issues with dbus or other DE-specific env variables not being there. Regardless, putting this in rc.local should work for most uncomplicated apps:

while ! pgrep -P $(pgrep -x qubes-session) -x sleep >/dev/null 2>&1              
do                                                                               
    sleep 0.5                                                                    
done                                                                             
DISPLAY=:0 sudo -u user xfce4-terminal -e "bash -c '/bin/ls; read'"              

Replace xfce4-terminal -e "bash -c '/bin/ls; read'" with whatever you want to execute.

2 Likes

Copy or create a symbolic link of the program .desktop file in ~/.config/autorun, you can find them in /usr/share/applications/

It’s not really Qubes Os specific by the way.

This doesn’t really work for me on fedora-42-xfce

user@test ~ % ll .config/autorun 
lrwxrwxrwx. user user 35 B Sat Jan 24 22:29:44 2026  vlc.desktop@ ⇒ /usr/share/applications/vlc.desktop

EDIT: Linking it to ~/.config/autostart does work.

user@test ~ % ll ~/.config/autostart
lrwxrwxrwx. user user 35 B Sat Jan 24 22:32:07 2026  vlc.desktop@ ⇒ /usr/share/applications/vlc.desktop
1 Like

My bad! Good you found the good path, thanks for sharing

1 Like

@Atrate thank you! work!

Is there any difference between app qubes and templates?
I’ve put a symbolic link of /usr/share/applications/xfce4-terminal into ~/.config/autostart - nothing happens …

Yes, a huge one. The appvms do not inherite the user directory of the template, so copying the file here can’t work. Copying them in /etc/xdg/autostart/ should work though. It’s the system wide way to set the autostart, which apply to all users (but we have just one) and this will be inherited.

More infor XDG Autostart - ArchWiki

2 Likes

Nice, it works in the template, but now all depending app vms start it, too.

I’m searching a place for autostarting apps only when booting the template, NOT in the depending app vms.

Any idea for this? (I know checking for the qubes name before starting the app, but that’s unhandy when needing different apps from time to time.)

Then the first location you used is the right one, it will only start in the template and not in the appvms using it.

2 Likes

If you are using the standard Xfce desktop system that comes by default in Qubes then you can just use the Session and Startup application to manage what starts whenever you launch that specific AppVM.

This works for Dom0 as well as any Xfce derived AppVM. This will automatically edit the ~./config/autostart when you add a new entry. It also allows you to temporally turn off an entry while making it easy to re-enable that entry later just by clicking the checkbox. You can also save and restore sessions too.

To add a custom entry, just click the + sign at the bottom and enter in the path to the command you want to run, give it a name for the display list, and choose “on login”. The next time you start that AppVM (or Dom0) those applications will automatically start. There is no need to create a desktop file for the app as it will be properly linked in the ~/.config/autostart directory for you.

1 Like

qvm-run $qube $command in a shortcut in the form of a panel icon works for me.