You are not logged in.

#1 2024-03-17 03:13:44

lepire
Member
Registered: 2024-03-17
Posts: 6

Xorg server in systemd-nspawn container - no devices detected

I am trying to start an Xorg server in a rootless container spawned with systemd-nspawn. However xstart -- :1 fails with error 'No devices detected'.
I suspect this is due to the error "systemd-logind: failed to take device /dev/dri/card1: Operation not permitted".

I have done a bunch of googling and tried a few suggested fixes, but have been unable to resolve this issue. In case it is relevant, I am running Wayland as my main display server on tty1.

My .nspawn config which I cobbled together from a bunch of different sources looks like the below:

[Exec]
Boot=true
PrivateUsers=0
Capability=all


[Service]
DeviceAllow=/dev/dri/card0 rw
DeviceAllow=/dev/dri/card1 rw
DeviceAllow=/dev/shm rw
DeviceAllow=char-drm rw
DeviceAllow=/dev/dri rw

[Files]
Bind=/dev/input
Bind=/dev/shm
Bind=/dev/dri

[Network]
VirtualEthernet=no

Logs

Xorg log
dmesg
journalctl

Offline

#2 2024-03-17 08:43:09

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Xorg server in systemd-nspawn container - no devices detected

(==) Using config file: "/etc/X11/xorg.conf"
…
(**) |   |-->Device "card1"

Get rid of that file and xf86-video-intel (you don't want that w/ a TigerLake anyway)

Offline

#3 2024-03-17 14:29:32

lepire
Member
Registered: 2024-03-17
Posts: 6

Re: Xorg server in systemd-nspawn container - no devices detected

Thanks for your reply.

I have removed xf86-video-intel. /etc/X11/xorg.conf is empty save for a device section to ensure Card1 is used instead of Card0.
I only have an integrated graphics card, but ~50% of the time on boot this gets assigned as Card1 instead of Card0 in dev/dri.

Removing /etc/X11/xorg.conf causes file/directory not found errors when Xorg attempts to access /dev/dri/Card0.

Updated Xorg log after removing xf86-video-intel driver:

[   850.367] 
X.Org X Server 1.21.1.11
X Protocol Version 11, Revision 0
[   850.367] Current Operating System: Linux ArchX11 6.7.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 08 Mar 2024 01:59:01 +0000 x86_64
[   850.367] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=43a7ea0e-8e7f-41dc-951d-e4fb56a03523 rw loglevel=3 quiet apparmor=1 security=apparmor
[   850.367]  
[   850.367] Current version of pixman: 0.43.4
[   850.367] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[   850.367] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[   850.367] (==) Log file: "/var/log/Xorg.1.log", Time: Sun Mar 17 10:23:11 2024
[   850.368] (==) Using config file: "/etc/X11/xorg.conf"
[   850.368] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[   850.368] (==) No Layout section.  Using the first Screen section.
[   850.368] (==) No screen section available. Using defaults.
[   850.368] (**) |-->Screen "Default Screen Section" (0)
[   850.368] (**) |   |-->Monitor "<default monitor>"
[   850.368] (==) No device specified for screen "Default Screen Section".
	Using the first device section listed.
[   850.368] (**) |   |-->Device "Card1"
[   850.368] (==) No monitor specified for screen "Default Screen Section".
	Using a default monitor configuration.
[   850.368] (==) Automatically adding devices
[   850.368] (==) Automatically enabling devices
[   850.368] (==) Automatically adding GPU devices
[   850.368] (==) Automatically binding GPU devices
[   850.368] (==) Max clients allowed: 256, resource mask: 0x1fffff
[   850.368] (WW) The directory "/usr/share/fonts/misc" does not exist.
[   850.368] 	Entry deleted from font path.
[   850.368] (WW) The directory "/usr/share/fonts/TTF" does not exist.
[   850.368] 	Entry deleted from font path.
[   850.368] (WW) The directory "/usr/share/fonts/OTF" does not exist.
[   850.368] 	Entry deleted from font path.
[   850.368] (WW) The directory "/usr/share/fonts/Type1" does not exist.
[   850.368] 	Entry deleted from font path.
[   850.368] (==) FontPath set to:
	/usr/share/fonts/100dpi,
	/usr/share/fonts/75dpi
[   850.368] (==) ModulePath set to "/usr/lib/xorg/modules"
[   850.368] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[   850.368] (II) Module ABI versions:
[   850.368] 	X.Org ANSI C Emulation: 0.4
[   850.368] 	X.Org Video Driver: 25.2
[   850.368] 	X.Org XInput driver : 24.4
[   850.368] 	X.Org Server Extension : 10.0
[   850.369] (II) systemd-logind: took control of session /org/freedesktop/login1/session/_35
[   850.370] (II) xfree86: Adding drm device (/dev/dri/card1)
[   850.370] (II) Platform probe for /sys/devices/pci0000:00/0000:00:02.0/drm/card1
[   850.370] (EE) systemd-logind: failed to take device /dev/dri/card1: Operation not permitted
[   850.373] (--) PCI:*(0@0:2:0) 8086:9a49:1028:0a5c rev 1, Mem @ 0x6078000000/16777216, 0x4000000000/268435456, I/O @ 0x00003000/64, BIOS @ 0x????????/131072
[   850.373] (WW) Open ACPI failed (/var/run/acpid.socket) (No such file or directory)
[   850.373] (II) LoadModule: "glx"
[   850.373] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[   850.374] (II) Module glx: vendor="X.Org Foundation"
[   850.374] 	compiled for 1.21.1.11, module version = 1.0.0
[   850.374] 	ABI class: X.Org Server Extension, version 10.0
[   850.374] (==) Matched intel as autoconfigured driver 0
[   850.374] (==) Matched modesetting as autoconfigured driver 1
[   850.374] (==) Matched fbdev as autoconfigured driver 2
[   850.374] (==) Matched vesa as autoconfigured driver 3
[   850.374] (==) Assigned the driver to the xf86ConfigLayout
[   850.374] (II) LoadModule: "intel"
[   850.374] (WW) Warning, couldn't open module intel
[   850.374] (EE) Failed to load module "intel" (module does not exist, 0)
[   850.374] (II) LoadModule: "modesetting"
[   850.374] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[   850.374] (II) Module modesetting: vendor="X.Org Foundation"
[   850.374] 	compiled for 1.21.1.11, module version = 1.21.1
[   850.374] 	Module class: X.Org Video Driver
[   850.374] 	ABI class: X.Org Video Driver, version 25.2
[   850.374] (II) LoadModule: "fbdev"
[   850.374] (WW) Warning, couldn't open module fbdev
[   850.374] (EE) Failed to load module "fbdev" (module does not exist, 0)
[   850.374] (II) LoadModule: "vesa"
[   850.374] (II) Loading /usr/lib/xorg/modules/drivers/vesa_drv.so
[   850.374] (II) Module vesa: vendor="X.Org Foundation"
[   850.374] 	compiled for 1.21.1.4, module version = 2.6.0
[   850.374] 	Module class: X.Org Video Driver
[   850.374] 	ABI class: X.Org Video Driver, version 25.2
[   850.374] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[   850.374] (II) VESA: driver for VESA chipsets: vesa
[   850.374] (EE) open /dev/dri/card0: No such file or directory
[   850.374] (WW) Falling back to old probe method for modesetting
[   850.374] (EE) open /dev/dri/card0: No such file or directory
[   850.374] vesa: Refusing to run, Framebuffer or dri device present
[   850.374] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[   850.374] (EE) Screen 0 deleted because of no matching config section.
[   850.374] (II) UnloadModule: "modesetting"
[   850.374] (EE) Device(s) detected, but none match those in the config file.
[   850.374] (EE) 
Fatal server error:
[   850.374] (EE) no screens found(EE) 
[   850.374] (EE) 
Please consult the The X.Org Foundation support 
	at http://wiki.x.org
 for help. 
[   850.374] (EE) Please also check the log file at "/var/log/Xorg.1.log" for additional information.
[   850.374] (EE) 
[   850.374] (EE) Server terminated with error (1). Closing log file.

Offline

#4 2024-03-17 15:27:52

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Xorg server in systemd-nspawn container - no devices detected

I only have an integrated graphics card, but ~50% of the time on boot this gets assigned as Card1 instead of Card0 in dev/dri.

That's the simpledrm device, add "initcall_blacklist=simpledrm_platform_driver_init" to the https://wiki.archlinux.org/title/Kernel_parameters
Also consider https://wiki.archlinux.org/title/Kernel … _KMS_start
Then clear the config.

And, likely, remove xf86-video-vesa (you don't want to use that, so let's first see whether it works w/o)

Offline

#5 2024-03-17 18:12:50

lepire
Member
Registered: 2024-03-17
Posts: 6

Re: Xorg server in systemd-nspawn container - no devices detected

Ok, done and done - thanks again for your time.

New Xorg Log:

X.Org X Server 1.21.1.11
X Protocol Version 11, Revision 0
Current Operating System: Linux ArchX11 6.8.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 16 Mar 2024 17:15:35 +0000 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=43a7ea0e-8e7f-41dc-951d-e4fb56a03523 rw loglevel=3 quiet apparmor=1 security=apparmor initcall_blacklist=simpledrm_platform_driver_init
 
Current version of pixman: 0.43.4
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Sun Mar 17 14:11:50 2024
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE) 
Fatal server error:
(EE) no screens found(EE) 
(EE) 
Please consult the The X.Org Foundation support 
	at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/var/log/Xorg.1.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
Couldn't get a file descriptor referring to the console.
[test@ArchX11 ~]$ cat /var/log/Xorg.1.log
[   265.338] 
X.Org X Server 1.21.1.11
X Protocol Version 11, Revision 0
[   265.338] Current Operating System: Linux ArchX11 6.8.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 16 Mar 2024 17:15:35 +0000 x86_64
[   265.338] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=43a7ea0e-8e7f-41dc-951d-e4fb56a03523 rw loglevel=3 quiet apparmor=1 security=apparmor initcall_blacklist=simpledrm_platform_driver_init
[   265.338]  
[   265.338] Current version of pixman: 0.43.4
[   265.338] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[   265.338] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[   265.338] (==) Log file: "/var/log/Xorg.1.log", Time: Sun Mar 17 14:11:50 2024
[   265.338] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[   265.338] (==) No Layout section.  Using the first Screen section.
[   265.338] (==) No screen section available. Using defaults.
[   265.338] (**) |-->Screen "Default Screen Section" (0)
[   265.338] (**) |   |-->Monitor "<default monitor>"
[   265.338] (==) No monitor specified for screen "Default Screen Section".
	Using a default monitor configuration.
[   265.338] (==) Automatically adding devices
[   265.338] (==) Automatically enabling devices
[   265.338] (==) Automatically adding GPU devices
[   265.338] (==) Automatically binding GPU devices
[   265.338] (==) Max clients allowed: 256, resource mask: 0x1fffff
[   265.338] (WW) The directory "/usr/share/fonts/misc" does not exist.
[   265.338] 	Entry deleted from font path.
[   265.338] (WW) The directory "/usr/share/fonts/TTF" does not exist.
[   265.338] 	Entry deleted from font path.
[   265.338] (WW) The directory "/usr/share/fonts/OTF" does not exist.
[   265.338] 	Entry deleted from font path.
[   265.338] (WW) The directory "/usr/share/fonts/Type1" does not exist.
[   265.338] 	Entry deleted from font path.
[   265.338] (==) FontPath set to:
	/usr/share/fonts/100dpi,
	/usr/share/fonts/75dpi
[   265.338] (==) ModulePath set to "/usr/lib/xorg/modules"
[   265.338] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[   265.338] (II) Module ABI versions:
[   265.338] 	X.Org ANSI C Emulation: 0.4
[   265.338] 	X.Org Video Driver: 25.2
[   265.338] 	X.Org XInput driver : 24.4
[   265.338] 	X.Org Server Extension : 10.0
[   265.339] (II) systemd-logind: took control of session /org/freedesktop/login1/session/_37
[   265.340] (II) xfree86: Adding drm device (/dev/dri/card0)
[   265.340] (II) Platform probe for /sys/devices/pci0000:00/0000:00:02.0/drm/card0
[   265.340] (EE) systemd-logind: failed to take device /dev/dri/card0: Operation not permitted
[   265.342] (--) PCI:*(0@0:2:0) 8086:9a49:1028:0a5c rev 1, Mem @ 0x6078000000/16777216, 0x4000000000/268435456, I/O @ 0x00003000/64, BIOS @ 0x????????/131072
[   265.342] (WW) Open ACPI failed (/var/run/acpid.socket) (No such file or directory)
[   265.342] (II) LoadModule: "glx"
[   265.342] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[   265.343] (II) Module glx: vendor="X.Org Foundation"
[   265.343] 	compiled for 1.21.1.11, module version = 1.0.0
[   265.343] 	ABI class: X.Org Server Extension, version 10.0
[   265.343] (==) Matched intel as autoconfigured driver 0
[   265.343] (==) Matched modesetting as autoconfigured driver 1
[   265.343] (==) Matched fbdev as autoconfigured driver 2
[   265.343] (==) Matched vesa as autoconfigured driver 3
[   265.343] (==) Assigned the driver to the xf86ConfigLayout
[   265.343] (II) LoadModule: "intel"
[   265.343] (WW) Warning, couldn't open module intel
[   265.343] (EE) Failed to load module "intel" (module does not exist, 0)
[   265.343] (II) LoadModule: "modesetting"
[   265.343] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[   265.343] (II) Module modesetting: vendor="X.Org Foundation"
[   265.343] 	compiled for 1.21.1.11, module version = 1.21.1
[   265.343] 	Module class: X.Org Video Driver
[   265.343] 	ABI class: X.Org Video Driver, version 25.2
[   265.343] (II) LoadModule: "fbdev"
[   265.343] (WW) Warning, couldn't open module fbdev
[   265.343] (EE) Failed to load module "fbdev" (module does not exist, 0)
[   265.343] (II) LoadModule: "vesa"
[   265.343] (WW) Warning, couldn't open module vesa
[   265.343] (EE) Failed to load module "vesa" (module does not exist, 0)
[   265.343] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[   265.343] (EE) open /dev/dri/card0: Operation not permitted
[   265.343] (WW) Falling back to old probe method for modesetting
[   265.343] (EE) open /dev/dri/card0: Operation not permitted
[   265.343] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[   265.343] (EE) Screen 0 deleted because of no matching config section.
[   265.343] (II) UnloadModule: "modesetting"
[   265.343] (EE) Device(s) detected, but none match those in the config file.
[   265.343] (EE) 
Fatal server error:
[   265.343] (EE) no screens found(EE) 
[   265.343] (EE) 
Please consult the The X.Org Foundation support 
	at http://wiki.x.org
 for help. 
[   265.343] (EE) Please also check the log file at "/var/log/Xorg.1.log" for additional information.
[   265.343] (EE) 
[   265.344] (EE) Server terminated with error (1). Closing log file.

Offline

#6 2024-03-17 23:13:15

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Xorg server in systemd-nspawn container - no devices detected

https://github.com/systemd/systemd/issu … -442133688
[edit:you have most/all of that, though…
edit #2: https://unix.stackexchange.com/question … -and-gpgpu ]
Otherwise you might have to go g/ the vesa driver - nt that it's ayn of my business, but to avoid chasing an https://en.wikipedia.org/wiki/XY_problem - why are you trying to nspawn the X11 server?

Last edited by seth (2024-03-17 23:18:10)

Offline

#7 2024-03-18 13:56:51

lepire
Member
Registered: 2024-03-17
Posts: 6

Re: Xorg server in systemd-nspawn container - no devices detected

I might just be being stubborn at this point. I want to spawn an XOrg Server + Compositor/WM combo in a separate tty/vt to debug some X11 specific code for a project I am working on. Since I run Wayland on the same machine, I wanted to isolate all X11 stuff in a container. nspawn seemed like a relatively light-weight option.

Offline

#8 2024-03-18 15:04:50

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Xorg server in systemd-nspawn container - no devices detected

For "XOrg Server + Compositor/WM" VESA is no option, can you run the containered X11 as root (just so we're not looking at the wrong end of the permission issues)?
Resp.

stat /dev/dri/card0 # likely available to the video group
id # where you could add yourself

Offline

#9 2024-03-19 20:27:24

lepire
Member
Registered: 2024-03-17
Posts: 6

Re: Xorg server in systemd-nspawn container - no devices detected

Apologies for my delay replying. Same error in the Xorg log if I run as root.

Stat:

  File: /dev/dri/card0
  Size: 0         	Blocks: 0          IO Block: 4096   character special file
Device: 0,5	Inode: 165         Links: 1     Device type: 226,0
Access: (0660/crw-rw----)  Uid: (    0/    root)   Gid: (  985/   video)
Access: 2024-03-19 16:23:28.783672543 -0400
Modify: 2024-03-19 16:23:28.783672543 -0400
Change: 2024-03-19 16:23:28.783672543 -0400
 Birth: 2024-03-19 11:56:05.893333342 -0400

id:

uid=1000(test) gid=1000(test) groups=1000(test),985(video),998(wheel)

Offline

#10 2024-03-19 21:11:04

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Xorg server in systemd-nspawn container - no devices detected

https://stackoverflow.com/questions/477 … privileges hmm
Does your config work when there's no other display server (wayland) running?

Offline

#11 2024-03-20 20:19:17

lepire
Member
Registered: 2024-03-17
Posts: 6

Re: Xorg server in systemd-nspawn container - no devices detected

No dice unfortunately. Appreciate your time here, but might have to give up for the time being!

Offline

Board footer

Powered by FluxBB