QtWebEngine cannot run as root or no-sandbox
-
Hello,
I am kind of new to this whole thing and I am trying to build an i.mx8 system with EGLFS and Qt to display essentially a browser. I have everything running and i can run a normal qt5 (5.12) widgets app with no issues. The problem is when i try to run a QtWebEngine application i get an error stating something like this:
ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported
So tried running with the --no-sandbox flag and then i get this:
QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync. If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1 Trace/breakpoint trap
No other info on the Trace/breakpoint trap : /
So i figured okay i'll try creating a new non-root user and running as that. My system is a busybox system and i did adduser and created a new one. Then i tried to run my application and got an error saying it could not find /dev/fb0 so i went back to root and chmod 777 /dev/fb0 but then i see this:
QStandardPaths: runtime directory '/tmp/runtime-root' is not owned by UID 1001, but a directory permissions 0700 owned by UID 0 GID 1001 QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync. If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1 [ 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. [ 6] Failed to open device: No such file or directory, Try again... [ 7] Failed to open device: No such file or directory, Try again... [ 8] Failed to open device: No such file or directory, Try again... [ 9] Failed to open device: No such file or directory, Try again... [ 10] _OpenDevice(1249): FATAL: Failed to open device, errno=No such file or directory.
These are the same errors i see if i forget to load the galcore.ko module for imx-gpu-viv stuff, but the module is loaded i guess it must be some other permissions issue???
I have been googling and trying things for several hours now and have just hit a wall... I am hoping someone can point me in the right direction because i don't really know what do next here : /
I appreciate any advice!!!
-
Alright i figured it out! I don't know why i didn't build QT in debug mode to begin with but just slipped my mind... Anyways i rebuild the whole thing in DEBUG mode and then i got a MUCH better error output:
QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync. If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1 [636:649:0118/130831.434403:FATAL:udev_loader.cc(38)] Check failed: false. #0 0xffff99fb014c <unknown> #1 0xffff99db42dc <unknown> #2 0xffff99df2408 <unknown> #3 0xffff96652f24 <unknown> #4 0xffff9664f63c <unknown> #5 0xffff966511a4 <unknown> #6 0xffff968d80c8 <unknown> #7 0xffff968d9de0 <unknown> #8 0xffff968d9a4c <unknown> #9 0xffff968d93d4 <unknown> #10 0xffff968d8e48 <unknown> #11 0xffff9578e008 <unknown> #12 0xffff99db4bfc <unknown> #13 0xffff99e14b90 <unknown> #14 0xffff99e14cc8 <unknown> #15 0xffff99e14fa4 <unknown> #16 0xffff99fe3284 <unknown> #17 0xffff99e144c8 <unknown> #18 0xffff99e7afdc <unknown> #19 0xffff99f388cc <unknown> #20 0xffff98acbc1c <unknown> #21 0xffff98acb8a8 <unknown> #22 0xffff99f38ef8 <unknown> #23 0xffff99fd4920 <unknown> #24 0xffff92b632ac <unknown> #25 0xffff92bc7b9c <unknown> Received signal 6 #0 0xffff99fb014c <unknown> #1 0xffff99db42dc <unknown> #2 0xffff99faf1ec <unknown> #3 0xffffa3732604 ([vdso]+0x603) #4 0xffff92b64de0 <unknown> #5 0xffff92b2277c raise #6 0xffff92b0ff1c abort #7 0xffff99fae990 <unknown> #8 0xffff99fae9b8 <unknown> #9 0xffff99df2808 <unknown> #10 0xffff96652f24 <unknown> #11 0xffff9664f63c <unknown> #12 0xffff966511a4 <unknown> #13 0xffff968d80c8 <unknown> #14 0xffff968d9de0 <unknown> #15 0xffff968d9a4c <unknown> #16 0xffff968d93d4 <unknown> #17 0xffff968d8e48 <unknown> #18 0xffff9578e008 <unknown> #19 0xffff99db4bfc <unknown> #20 0xffff99e14b90 <unknown> #21 0xffff99e14cc8 <unknown> #22 0xffff99e14fa4 <unknown> #23 0xffff99fe3284 <unknown> #24 0xffff99e144c8 <unknown> #25 0xffff99e7afdc <unknown> #26 0xffff99f388cc <unknown> #27 0xffff98acbc1c <unknown> #28 0xffff98acb8a8 <unknown> #29 0xffff99f38ef8 <unknown> #30 0xffff99fd4920 <unknown> #31 0xffff92b632ac <unknown> #32 0xffff92bc7b9c <unknown> [end of stack trace] Calling _exit(1). Core file will not be generated.
It seems Chromium is trying to use udev dynamically BUT i am running a busybox system with NO udev, so makes sense. There didn't seem to be any sort of configuration option in QT5 itself to disable chromium's udev that i could find BUT the version of chromium used had that option so i had to patch the QTWebEngine config file linux.pri:
diff --git a/qtwebengine/src/core/config/linux.pri b/qtwebengine/src/core/config/linux.pri index eaecab3c9..e4392aa78 100644 --- a/qtwebengine/src/core/config/linux.pri +++ b/qtwebengine/src/core/config/linux.pri @@ -12,7 +12,7 @@ gn_args += \ use_gio=false \ use_gnome_keyring=false \ linux_use_bundled_binutils=false \ - use_udev=true \ + use_udev=false \ use_bundled_fontconfig=false \ use_sysroot=false \ enable_session_service=false \
I then rebuilt and it's now working wonderfully!!!! At least from my minimal testing haha, i have a website displaying from my app!
-
I did figure out how to get the permissions set correctly for my other user to allow it run BUT it gets the same error as when i run it as root with --no-sandbox : /.
I ran with gdb attached and see this:
Thread 4 "Chrome_IOThread" received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 692.711]
I'll keep digging see if i can find any more clues.... Or maybe i'll just build Weston and try using that instead...
-
Alright i figured it out! I don't know why i didn't build QT in debug mode to begin with but just slipped my mind... Anyways i rebuild the whole thing in DEBUG mode and then i got a MUCH better error output:
QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync. If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1 [636:649:0118/130831.434403:FATAL:udev_loader.cc(38)] Check failed: false. #0 0xffff99fb014c <unknown> #1 0xffff99db42dc <unknown> #2 0xffff99df2408 <unknown> #3 0xffff96652f24 <unknown> #4 0xffff9664f63c <unknown> #5 0xffff966511a4 <unknown> #6 0xffff968d80c8 <unknown> #7 0xffff968d9de0 <unknown> #8 0xffff968d9a4c <unknown> #9 0xffff968d93d4 <unknown> #10 0xffff968d8e48 <unknown> #11 0xffff9578e008 <unknown> #12 0xffff99db4bfc <unknown> #13 0xffff99e14b90 <unknown> #14 0xffff99e14cc8 <unknown> #15 0xffff99e14fa4 <unknown> #16 0xffff99fe3284 <unknown> #17 0xffff99e144c8 <unknown> #18 0xffff99e7afdc <unknown> #19 0xffff99f388cc <unknown> #20 0xffff98acbc1c <unknown> #21 0xffff98acb8a8 <unknown> #22 0xffff99f38ef8 <unknown> #23 0xffff99fd4920 <unknown> #24 0xffff92b632ac <unknown> #25 0xffff92bc7b9c <unknown> Received signal 6 #0 0xffff99fb014c <unknown> #1 0xffff99db42dc <unknown> #2 0xffff99faf1ec <unknown> #3 0xffffa3732604 ([vdso]+0x603) #4 0xffff92b64de0 <unknown> #5 0xffff92b2277c raise #6 0xffff92b0ff1c abort #7 0xffff99fae990 <unknown> #8 0xffff99fae9b8 <unknown> #9 0xffff99df2808 <unknown> #10 0xffff96652f24 <unknown> #11 0xffff9664f63c <unknown> #12 0xffff966511a4 <unknown> #13 0xffff968d80c8 <unknown> #14 0xffff968d9de0 <unknown> #15 0xffff968d9a4c <unknown> #16 0xffff968d93d4 <unknown> #17 0xffff968d8e48 <unknown> #18 0xffff9578e008 <unknown> #19 0xffff99db4bfc <unknown> #20 0xffff99e14b90 <unknown> #21 0xffff99e14cc8 <unknown> #22 0xffff99e14fa4 <unknown> #23 0xffff99fe3284 <unknown> #24 0xffff99e144c8 <unknown> #25 0xffff99e7afdc <unknown> #26 0xffff99f388cc <unknown> #27 0xffff98acbc1c <unknown> #28 0xffff98acb8a8 <unknown> #29 0xffff99f38ef8 <unknown> #30 0xffff99fd4920 <unknown> #31 0xffff92b632ac <unknown> #32 0xffff92bc7b9c <unknown> [end of stack trace] Calling _exit(1). Core file will not be generated.
It seems Chromium is trying to use udev dynamically BUT i am running a busybox system with NO udev, so makes sense. There didn't seem to be any sort of configuration option in QT5 itself to disable chromium's udev that i could find BUT the version of chromium used had that option so i had to patch the QTWebEngine config file linux.pri:
diff --git a/qtwebengine/src/core/config/linux.pri b/qtwebengine/src/core/config/linux.pri index eaecab3c9..e4392aa78 100644 --- a/qtwebengine/src/core/config/linux.pri +++ b/qtwebengine/src/core/config/linux.pri @@ -12,7 +12,7 @@ gn_args += \ use_gio=false \ use_gnome_keyring=false \ linux_use_bundled_binutils=false \ - use_udev=true \ + use_udev=false \ use_bundled_fontconfig=false \ use_sysroot=false \ enable_session_service=false \
I then rebuilt and it's now working wonderfully!!!! At least from my minimal testing haha, i have a website displaying from my app!