Hi,
We are testing i.MX8 with below environment.
Weston startup automatically as root user.
We would like to startup Weston as non-root user because we don't use root user.
How can I startup Weston as non-root user?
[Environment]
Evaluation Kit : 8MMINILPD4-EVK (Connect HDMI cable, USB keyboard and USB mouse.)
Linux for i.MX : Linux 5.4.70_2.3.0 (Download "L5.4.70-2.3.0_images_MX8MMEVK.zip" and flash "imx-image-full-imx8mmevk.wic" to SD card.)
Any help would be appreciated.
Thank you.
Best regards,
解決済! 解決策の投稿を見る。
We can start up weston as non-root user.
Our solution is as below.
-------------------------------------------------
1. Add video group to open /dev/fb0.
# usermod -aG video user123
2. Change weston environment variable if necessary.
file:/etc/default/weston
HOME=/home/user123/ --> before:root , after:user123
QT_QPA_PLATFORM=wayland
3. Change udev rules file.
file:/etc/udev/rules.d/71-weston-drm.rules
ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="weston@user123.service"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="weston@user123.service"
--> before: weston@root.service , after: weston@user123.service
-------------------------------------------------
Also, we can execute some Qt app on weston as non-root user.
Thank you.
BR
systemctl status weston@root.service
[[0;1;31m*[[0m weston@root.service - CONFIG4 Wayland Service
Loaded: loaded (/lib/systemd/system/weston@.service; disabled; vendor preset: disabled)
Active: [[0;1;31mfailed[[0m (Result: exit-code) since Sun 2020-09-20 10:16:08 UTC; 1min 1s ago
Process: 248 ExecStart=/usr/bin/weston --log=${XDG_RUNTIME_DIR}/weston.log --tty=2 [[0;1;31m(code=exited, status=1/FAILURE)[[0m
Main PID: 248 (code=exited, status=1/FAILURE)
Sep 20 10:16:08 imx8dxconfig4 systemd[1]: Started CONFIG4 Wayland Service.
Sep 20 10:16:08 imx8dxconfig4 weston[248]: Internal warning: debug scope 'drm-backend' has not been destroyed.
Sep 20 10:16:08 imx8dxconfig4 systemd[1]: [[0;1;39m[[0;1;31m[[0;1;39mweston@root.service: Main process exited, code=exited, status=1/FAILURE[[0m
Sep 20 10:16:08 imx8dxconfig4 systemd[1]: [[0;1;38;5;185m[[0;1;39m[[0;1;38;5;185mweston@root.service: Failed with result 'exit-code'.[[0m
I am using kernel version 5.10.9
I want to run weston@.service but it is running weston@root.service
weston service is getting fail
root@imx8dxconfig4:/usr/bin# ./weston
Date: 2020-09-20 UTC
[10:30:28.389] weston 9.0.0
https://wayland.freedesktop.org
Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
Build: rel_imx_5.4.70_2.3.2_rc1+
[10:30:28.389] Command line: ./weston
[10:30:28.389] OS: Linux, 5.10.9-1.0.0+gf20955cdcce7, #1 SMP PREEMPT Tue Mar 9 02:17:18 UTC 2021, aarch64
[10:30:28.390] Using config file '/etc/xdg/weston/weston.ini'
[10:30:28.390] Output repaint window is 16 ms maximum.
[10:30:28.390] Loading module '/usr/lib/libweston-9/drm-backend.so'
[10:30:28.398] initializing drm backend
[10:30:28.399] logind: not running in a systemd session
[10:30:28.399] logind: cannot setup systemd-logind helper (-61), using legacy fallback
[10:30:28.399] <stdin> not a vt
[10:30:28.399] if running weston from ssh, use --tty to specify a tty
[10:30:28.399] fatal: drm backend should be run using weston-launch binary, or your system should provide the logind D-Bus API.
[10:30:28.399] fatal: failed to create compositor backend
Internal warning: debug scope 'drm-backend' has not been destroyed.
Weston service is not getting started
Any help would be appreciated
Hi tan-k
Actually, wetson has this patch:
https://patchwork.openembedded.org/patch/165039/
BR
Zhiming
We can start up weston as non-root user.
Our solution is as below.
-------------------------------------------------
1. Add video group to open /dev/fb0.
# usermod -aG video user123
2. Change weston environment variable if necessary.
file:/etc/default/weston
HOME=/home/user123/ --> before:root , after:user123
QT_QPA_PLATFORM=wayland
3. Change udev rules file.
file:/etc/udev/rules.d/71-weston-drm.rules
ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="weston@user123.service"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="weston@user123.service"
--> before: weston@root.service , after: weston@user123.service
-------------------------------------------------
Also, we can execute some Qt app on weston as non-root user.
Thank you.
BR
We referred to https://community.nxp.com/t5/i-MX-Processors/Weston-Start-as-non-root-user/m-p/1229676.
We tried to execute the bellow command.
sudo -E weston-launch -t /dev/tty7 -u user123 &
However, we still cannot launch weston.
~~~
imx8mmevk:~$ sudo -E weston-launch -t /dev/tty7 -u test
Date: 2021-04-02 UTC
[06:49:40.766] weston 9.0.0
https://wayland.freedesktop.org
Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
Build: 9.0.0-34-ga1823f20+
[06:49:40.766] Command line: /usr/bin/weston
[06:49:40.766] OS: Linux, 5.4.70-2.3.0+g4f2631b022d8, #1 SMP PREEMPT Wed Dec 16 10:53:09 UTC 2020, aarch64
[06:49:40.766] Using config file '/etc/xdg/weston/weston.ini'
[06:49:40.766] Output repaint window is 16 ms maximum.
[06:49:40.767] Loading module '/usr/lib/libweston-9/drm-backend.so'
[06:49:40.772] initializing drm backend
[06:49:40.773] logind: failed to get session seat
[06:49:40.773] logind: cannot setup systemd-logind helper (-61), using legacy fallback
[06:49:40.778] using /dev/dri/card1
[06:49:40.778] DRM: supports atomic modesetting
[06:49:40.778] DRM: does not support GBM modifiers
[06:49:40.778] DRM: supports picture aspect ratio
[06:49:40.778] Loading module '/usr/lib/libweston-9/g2d-renderer.so'
[ 1] Failed to open device: No such file or directory, Try again...
[ 2] Failed to open device: No such file or directory, Try again...
[ 3] Failed to open device: No such file or directory, Try again...
[ 4] Failed to open device: No such file or directory, Try again...
[ 5] _OpenDevice(1249): FATAL: Failed to open device, errno=No such file or directory.
~~~
Is anyone have this solutions?
BR
Hi,
Thank you for your information!
We confirmed this patch then we found this patch is already applied.
So, we changed "/etc/udev/rules.d/71-weston-drm.rules" as below.
We changed from "root" to "test". "test" is our user.
--------------------------------------
ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="weston@test.service"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="weston@test.service"
--------------------------------------
However, weston cannot start.
--------------------------------------
root@imx8mmevk:~# systemctl status weston@test.service
* weston@test.service - Weston Wayland Compositor (on tty7)
Loaded: loaded (/lib/systemd/system/weston@.service; static; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2021-03-25 04:35:35 UTC; 9s ago
Process: 696 ExecStartPre=/usr/bin/chvt 7 (code=exited, status=0/SUCCESS)
Process: 729 ExecStart=/usr/bin/weston --log=${XDG_RUNTIME_DIR}/weston.log $OPTARGS (code=exited, status=1/FAILURE)
Main PID: 729 (code=exited, status=1/FAILURE)
Mar 25 04:35:29 imx8mmevk systemd[1]: Starting Weston Wayland Compositor (on tty7)...
Mar 25 04:35:29 imx8mmevk systemd[1]: Started Weston Wayland Compositor (on tty7).
Mar 25 04:35:35 imx8mmevk systemd[1]: weston@test.service: Main process exited, code=exited, status=1/FAILURE
Mar 25 04:35:35 imx8mmevk systemd[1]: weston@test.service: Failed with result 'exit-code'.
--------------------------------------
Is Our procedure incorrect?
Could you please let us know how to change weston user?
BR