Autostart VPN .desktop doesnt work

I’m trying to get my VPN running on VM start following this:

But it seems the .desktop in autostart doesn’t work. When I run ./start_vpn.desktop in terminal I get:

./start_vpn.desktop: line 1: [Desktop: command not found

Here is what’s in my .dektop-file:

[Desktop Entry]

The connect script works fine.

What’s the issue here?

A .desktop file is not meant to be executed by hand. You can add it to /usr/local/share/applications/ or ~/.local/share/applications/, it should then appear in the Application menu in the qube settings.

That’s not the issue here. The issue is, that the autostart does not work. I’m trying to autoconnect on VM startup with the my VPN.

That’s why I have my start_vpn.desktop file in /.config/autostart with a path to:

I tried ./ in terminal so that script works. The paths in the .desktop file are set correctly. When running the .desktop file from applications the VPN connects as described. The problem is that when running the same .desktop file from autostart it does not connect the VPN.

I replied to this when you mentionned you tried to execute the .desktop file, which is not meant to be executed.

As for your issue, maybe the current working directory is important in your script, and from autostart it is run from a different working directory and thus doesn’t work? Do you have anything in your logs?

Can you share the content of

nmcli con up $(nmcli con show | grep -m1 vpn | awk ‘{print $1}’)

I have followed the exact instructions from the post I’ve linked in my OP. directories, paths all the same.