start application on startup

285 views
Skip to first unread message

aforete

unread,
May 20, 2017, 2:47:19 PM5/20/17
to qubes...@googlegroups.com
Hello, I was wondering if there is a way of starting an application
automatically on starting a vm in qubes. Say I want to start thunderbird
once the 'work' vm starts up. I usually do this using a cronjob so I type
crontab -e
in a terminal in 'work' and add the line:
@reboot /usr/bin/thunderbird
I save and exit. I read the following page
https://www.qubes-os.org/doc/dom0-tools/qvm-service/
So I typed
qvm-service -e work crond
But either restarting the vm in 'Qubes vm manager' or stopping and
starting, or rebooting the laptop doesn't make thunderbird start when
'work' does.
Am I doing something wrong here? is there any other way to start
applications once a vm starts?

Unman

unread,
May 20, 2017, 6:15:27 PM5/20/17
to aforete, qubes...@googlegroups.com
I've never understood using cron for this sort of thing. If you try a
simple logging script you will see that the cron job is being triggered
on reboot. I suspect that what's happening here is that the cronjob is
triggered before the gui is set up.

You have the usual start up alternatives - try adding the command in
.profile (although I think this will get called 3 times, which may or may
not affect the target application). Or .bash_profile.
If you are concerned about the multiple system calls just use a
calling script that checks to see if the application is running and only
starts it if it isn't running.

An alternative approach would be to call the application that you want
to start with 'qvm-run -a' - this will start the qube and launch the
application. This is, of course, how the menu items work.

unman

migue...@gmail.com

unread,
May 21, 2017, 4:49:34 AM5/21/17
to qubes-users, afo...@cock.li
Hi,

On Sunday, May 21, 2017 at 4:47:19 AM UTC+10, aforete wrote:
> Am I doing something wrong here? is there any other way to start
> applications once a vm starts?

Yes, you can do the following in your AppVM:

1) make the directory /home/user/.config/autostart if it doesn't already exist

2) add a file inside that directory called (e.g) thunderbird.desktop that contains the following lines

[Desktop Entry]
Name=thunderbird
Exec=thunderbird
Type=Application

Reboot your AppVM and Thunderbird should start. Rinse and repeat for any other app.

The reason this works is that the autostart files are processed *after* the user's X session has started up.

Cheers

aforete

unread,
May 21, 2017, 6:18:51 AM5/21/17
to migue...@gmail.com, qubes-users
migue...@gmail.com:
Thanks. This worked for me. I haven't gotten around the other
suggestions in other replies, but this does everything I want it to so I
don't think it'll be necessary.

Jean-Philippe Ouellet

unread,
May 23, 2017, 2:15:19 AM5/23/17
to migue...@gmail.com, qubes-users, afo...@cock.li
In this case (graphical applications) the desktop entry may be the
better solution due to enforced startup ordering, but note also that
/rw/config/rc.local was created for similar purposes and may be a
suitable place for other per-VM "at startup" actions. See [1] and [2]
for more info.

Cheers,
Jean-Philippe

[1]: https://www.qubes-os.org/doc/config-files/
[2]: https://github.com/QubesOS/qubes-core-agent-linux/blob/9f9c3c56fce8dbbeacacf7fd765850ccf9d252d3/init/setup-rw.sh#L22-L35

cooloutac

unread,
May 23, 2017, 3:34:49 AM5/23/17
to qubes-users, migue...@gmail.com, afo...@cock.li

yes I use /rw/config/rc.local. If something like thudnerbird that need gui you can create directory ~/.config/autostart/ then put a .desktop file in there. Then put it in /rw/config/rc.local file to launch at start.

Reply all
Reply to author
Forward
0 new messages