can not run chromium-x11 with myuser user in xwayland on imx8 maaxboard (imx8mqevk)

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

can not run chromium-x11 with myuser user in xwayland on imx8 maaxboard (imx8mqevk)

Jump to solution
3,007 Views
gonewithwind-peter
Senior Contributor I

Hi 

my yocto image I built works well in  imx8 maaxboard porting from imx8mqevk.

in root user:

chromium --no-sandbox 

it works.

but I use another user myuser, it can start up:

error output as below:

export DISPLAY=:0;sudo -u myuser chromium 

No protocol specified

(chromium:3670): Gtk-WARNING **: cannot open display: 0

--------------------

in my local.conf for myuser I add as below same as before I added in rapberry pi 4

EXTRA_USERS_PARAMS = "usermod -P ${ROOT_PASSWORD} root;"
57 EXTRA_USERS_PARAMS += "useradd -P ${ROOT_PASSWORD} myuser;"
58 EXTRA_USERS_PARAMS += "usermod -G sudo myuser;"

any idea?

Thanks.

0 Kudos
Reply
1 Solution
2,864 Views
gonewithwind-peter
Senior Contributor I
I fixed the issue in yocto.
add  DISTRO_FEATURES_append = " xorg-server-xwayland" in con/local.conf
add xhost command
run  command:  xhost +SI:localuser:myuser   before run chromium    ##myuser in my non-root user
Please for ref.

View solution in original post

0 Kudos
Reply
7 Replies
2,865 Views
gonewithwind-peter
Senior Contributor I
I fixed the issue in yocto.
add  DISTRO_FEATURES_append = " xorg-server-xwayland" in con/local.conf
add xhost command
run  command:  xhost +SI:localuser:myuser   before run chromium    ##myuser in my non-root user
Please for ref.
0 Kudos
Reply
1,543 Views
gonewithwind-peter
Senior Contributor I
Hi J*h*,
 
I am sorry ,I did that X11 in maaxboard  (yocto sumo)  long time ago, because it could not support our hdmi lcd, we did not use it again.
so I only can tell some ideas I can remmeber:
and I got technical info from nxp before, the standard  imx-yocto-bsp  COULD  NOT support chromium-x11(in X11), it only supported chromium-ozone-wayland(wayland).  so later  we used chromium-ozone-wayland(wayland) in maaxboard yocto zeus.
 
but at that time, I did not know that the standard  imx-yocto-bsp  CAN NOT support chromium-x11. It was interesting I passed my building (later I use the standard  imx-yocto-bsp  sumo and zeus   ,I Could not pass)
How I did that ?
I remember I did like that: 
 
 
 because at that time there was not  yocto  project for maaxboard. so I  ONLY use https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-sumo -m. structure (in that structure, at time time ,it supported x11) and added my kernel, uboot ... in it.
 
so  x11  passed builing.
 the following is a port of local.conf
 
MACHINE ??= 'imx8mqevk'
DISTRO ?= 'fsl-imx-xwayland'
PARALLEL_MAKE ?= "-j 16"
BB_NUMBER_THREADS ?= "16"
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
IMAGE_INSTALL_append = " rng-tools"
#IMAGE_INSTALL_append +=" chromium-ozone-wayland"
DISTRO_FEATURES_append = " xorg-server-xwayland"
DISTRO_FEATURES_remove = " zeroconf"
#CORE_IMAGE_EXTRA_INSTALL += " chromium-ozone-wayland"
CORE_IMAGE_EXTRA_INSTALL += "chromium-x11"
#2G
IMAGE_ROOTFS_EXTRA_SPACE = "2097152"
IMAGE_FEATURES += "ssh-server-openssh package-management hwcodecs splash dev-pkgs"
DISTRO_FEATURES_append = " pam"
 
IMAGE_INSTALL_append += " gnupg atftp atftpd ntp ntpdate fping xauth xhost "
EXTRA_IMAGE_FEATURES ?= "tools-debug tools-profile debug-tweaks eclipse-debug tools-sdk dev-pkgs"
IMAGE_INSTALL_append += " \
        tcf-agent \
        openssh-sftp-server \
        gdbserver \
        net-tools \
        "
IMAGE_INSTALL_append += " \
        i2c-tools e2fsprogs-resize2fs imx-test \
        bash bc cpio gawk tree rsync ldd vim nano \
        diffutils coreutils findutils iputils \
        git git-perltools libwebsockets libwebsockets-dev vlan tcpdump ruby-dev \
        "
...
you can see  CORE_IMAGE_EXTRA_INSTALL += "chromium-x11" ,  ... xauth xhost "    are still in it. I still use the image but I do NOT use it to display, I changed to raspberry pi4 (can support x11) for display.
 
and for display, you can write a auto script with the below command line: (for my current application, I changed to p4 to display ,so I comment it)
 
 
 
#export  XDG_CONFIG_HOME="/tmp/chromium"
#export  CHROME_CONFIG_HOME="/tmp/chromium"
#export DISPLAY=:0
#/usr/bin/xhost +SI:localuser:myuser
#/usr/bin/sudo -u myuser /usr/bin/chromium  --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --start-fullscreen --kiosk --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &
 
that's it.
 
in summary my email:
in sumo yocto structure , it could support  in x11 with chromium-x11 before.
after yocto zues ,  as I knew before , nxp dId  not support x11, only support chromium-ozone-wayland(wayland).  I tried in zues, COULD not pass building . so I had to use chromium-ozone-wayland (anyway, now we changed to pi4)
so my port of local.conf that below:
 
MACHINE ??= 'maaxboard-ddr4-2g-sdcard'
DISTRO ?= 'fsl-imx-wayland-lite'
PARALLEL_MAKE ?= "-j 16"
BB_NUMBER_THREADS ?= "16"
#PACKAGE_CLASSES ?= 'package_rpm'
PACKAGE_CLASSES ?= "package_ipk"
CORE_IMAGE_EXTRA_INSTALL += " chromium-ozone-wayland"
 
 
 
therefore ,
if you can pass x11 building( it seems you can,I did can not in zeus before ), you add  IMAGE_INSTALL_append += "  xauth xhost "  in local.conf and run chrome in script:
 
export  XDG_CONFIG_HOME="/tmp/chromium"
export  CHROME_CONFIG_HOME="/tmp/chromium"
export DISPLAY=:0
/usr/bin/xhost +SI:localuser:myuser
/usr/bin/sudo -u myuser /usr/bin/chromium  --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --start-fullscreen --kiosk --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &
 
 
 
 
if x11 not, you have to  chromium-ozone-wayland(wayland) , you have to create a service chromium.service  at /etc/systemd/system and link (ln -s ) to  to   /etc/systemd/system/multi-user.target.wants
 
 
 
 cat chromium.service
 
[Unit]
Description=launch chromium
 
[Service]
User=root
Environment=DISPLAY=:0
Environment=XDG_RUNTIME_DIR="/run/user/0"
Type=oneshot
ExecStart=/bin/sleep 9
ExecStart=/home/myuser/mouse.out &
ExecStart=/usr/bin/chromium --no-sandbox --disable-infobars --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --start-fullscreen --kiosk --no-first-run --incognito http://localhost:3300/iframe.html &
 
[Install]
WantedBy=multi-user.target
 
 
good luck.
0 Kudos
Reply
2,864 Views
gonewithwind-peter
Senior Contributor I

strace sudo -u myuser chromium

error: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

...

faccessat(AT_FDCWD, 0xffffe4c2d758, X_OK) = 0
newfstatat(AT_FDCWD, 0xffffe4c2d758, 0xffffe4c2d6d8, 0) = 0
write(2, 0xffffe4c2ee85, 4sudo) = 4
write(2, 0xffffbbccc7f0, 2: ) = 2
write(2, 0xffffe4c2aa30, 133effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?) = 133
write(2, 0xffffbbcb3503, 1
) = 1
exit_group(1) = ?
+++ exited with 1 +++

0 Kudos
Reply
2,865 Views
b36401
NXP Employee
NXP Employee

Please try to use "ssh -X" instead of "sudo -u" for proper X forwarding.

0 Kudos
Reply
2,865 Views
gonewithwind-peter
Senior Contributor I

Thank you.

I do not understand why use  ssh -X ?  but I tried, error:

-sh-4.4# export DISPLAY=:0;ssh -X myuser chromium
ssh: Could not resolve hostname myuser: Name or service not known

0 Kudos
Reply
2,865 Views
gonewithwind-peter
Senior Contributor I

~$  export DISPLAY=:0;sudo -u myuser chromium
myuser is not in the sudoers file. This incident will be reported.

0 Kudos
Reply
2,865 Views
gonewithwind-peter
Senior Contributor I

two kinds error, sometimes ,the error is different, I do not know why:

in myuser;

error 1:

~$  export DISPLAY=:0;sudo -u myuser chromium
myuser is not in the sudoers file. This incident will be reported.

error 2:~$ export DISPLAY=:0;sudo -u myuser chromium
No protocol specified

(chromium:3763): Gtk-WARNING **: cannot open display: :0

0 Kudos
Reply