0

I would like to start a program whenever openvpn establishes the VPN tunnel, but it always returns the following when the program is supposed to start.

qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Tue Mar 30 11:10:56 2021 WARNING: Failed running command (--route-up): external program did not exit normally

Executing the same script from konsole works without errors. In this example I have tried starting qbittorrent, but the same error appears when trying to run konsole.

The script is the following

#!/bin/bash

qbittorrent & disown

In my openvpn .conf file I have added the following lines

script-security 2
route-up "/etc/openvpn/up_script"

and I have also tried using --up instead of --route-up to no avail. I have also tried to run the program as a user via sudo -u.

I am running Kubuntu 20.04 in a VBox

Help would be greatly appreciated.

EDIT: Running the program via the following script works but the themes and styles aren't inherited from the user profile.

#!/bin/bash

xhost +
export DISPLAY=:0
sudo -u USER_NAME qbittorrent & disown
xhost -

EDIT 2: To inherit the themes and styles from the user profile, its just important to run sudo with -i option and to set the environmental variable KDE_FULL_SESSION=true, more on this here

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.