Weston - Start as non-root-user

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Weston - Start as non-root-user

11,023 Views
MicMoba
Contributor V

Is it possible to run weston as a non-root-user? Or run weston as root-user and start applications as non-root-user?

Currently weston is running with drm-backend as root user, starting as systemd-service.

Once weston is started I can see a desktop-shell on my screen. Then I can start a simple qt-application as root-user. But I can't start that qt-application as non-root-user because the application failed to create wl_display (Permission denied).

I figgured out that it has someting to do with the owner of wayland-0.lock. If I change the owner of wayland-0 to the non-root-user I was able to start the qt-application.

But step-by-step

1. XDG_RUNTIME_DIR variable:

For wayland/weston it is neccessary to set the environment variable XDG_RUNTIME_DIR to a folder. This folder should have the permissions 0700. This environment variable is set in a shell script called weston.sh in /etc/profile.d/. In my understanding this script is only called when a user login, isn't it.

On the other hand the service manager has its own environment. That means that the XDG_RUNTIME_DIR variable should set in the service by Environmet= or by EnvironmentFile=.

2. weston-start

I disabled the weston.service by removing it from /lib/systemd/system/ and tried to start weston manually as non-root-user by the weston-start script. In main the script sets the XDG_RUNTIME_DIR variable and call openvt with weston-launch as command. I got the error message "Couldn't get a file descriptor referring to the console". Openvt creates a new virtual console where weston can assign to. My investigations showed that I only can call openvt as root-user. For example (as non-root-user logged in) sudo openvt weston-start. But in this case weston starts as root again and I am not able to start a qt-application as (non-root-user).

 

Is it possible to start weston on a i.MX 8MP as non-root-user?
In my opinion not becaus the backend (drm-backend) and openvt needs root access.

Is it possible to start weston as root-user and run qt-applications non-root-user?
I think no because wayland-0.lock belongs to the root-user und because of that a non-root-user can have access to it.

Is there a way maybe to start weston as root-user and enable non-root-user to communicate with the display-server?

 

Thanks

 

 

 

Labels (1)
0 Kudos
Reply
3 Replies

11,003 Views
b36401
NXP Employee
NXP Employee

You can refer to this thread regarding to running Weston non-root:
https://lists.freedesktop.org/archives/wayland-devel/2013-January/006871.html

0 Kudos
Reply

10,979 Views
MicMoba
Contributor V

Hi,

the link descripe that it is not possible to run weston as root and start applications as non-root. That is clear so far. Furthermore there is a hint not to run weston as root. That is also clear.

Then Kristian suggested to use weston-launch because similar to the raspberry pi we need root access for ther graphic device. 

But how works weston-launch? I am not able to use ist. 

The weston service is started as root with weston-start as parameter of ExecStart

ExecStart=/usr/bin/weston-start -v -e -- $OPTARGS

 

0 Kudos
Reply

10,973 Views
MicMoba
Contributor V

I figgured out that I can do the following as non-root-user:

sudo -E weston-launch -t /dev/tty7 -u user123 &

This will start weston in the virtual terminal tty7 and then I am able to start a qt-application as user123

 

 

0 Kudos
Reply