Foreign distro: startx

Hello, trying to get startx working on debian. Need to have debian installed for work, but I’d like to do everything I can (well, package management-wise at least) with Nix if possible.

It took me a while to find, but it looks like startx is provided by xorg.xinit; my currently installed x-related packages are:

    xorg.xinit
    xorg.xf86inputevdev
    xorg.xf86inputsynaptics
    xorg.xf86inputlibinput
    xorg.xf86videointel
    xorg.xf86videoati
    xorg.xf86videonouveau

The problem: when I start X it says

No input driver specified, ignoring this device

for every input device in the logs. When X starts I have no input (mouse, keyboard, telekinesis, etc).

I’m 90% sure the issue is indicated in the .xorg.log file where it says

ModulePath set to "/nix/store/...xorg-server-1.20.7/lib/xorg/modules/"

That path contains video modules, drivers/, and extensions/ but not input modules.

~/.nix-profile/lib/xorg/modules has an input/ directory with all the input modules.

So I think what I’m supposed to do is get X and the profile modules directory to come to a mutual understanding. However reading the X man page (on the internet) it says the -modulepath argument can only be specified when running as root, and I’m guessing (?) it only checks the global /etc for xorg.conf files. Specifying my user profile in a system-wide config seems fairly messy.

I could install x with debian and use nix for everything else but I’m worried I’d have to go and align lots of other configs in that case (ex: fonts).

How this is handled in NixOS? Any idea what I could try going forward here?

Tried making /etc/X11/xorg.conf with modulepath set to the module directories but this didn’t work. I noticed in the logs the “system conf path” is pointing to /nix/store/...xorg-server-1.20.7/share/X11 which contains all the config files which are also needed to load the input device modules.

The “system conf path” seems to be hardcoded. X11 documentation says it will always look for that stuff at /etc/X11/xorg.conf.d unless overridden (as root) using the -configdir parameter. I’m guessing the X11 docs are incomplete here, and that it’s based on PREFIX which is the above store directory…

That doesn’t explain how startx would work on a normal NixOS system though - the needed xorg.conf.d files won’t be in the xorgserver xorg.conf.d directory. I guess the piece that’s missing for me is how does Nix as a convention deal with software that is programmed to look for config files in PREFIX/etc? Could x11 be the only software that forbids user config directory overrides?

I’m pretty sure what’s written in Using X without a Display Manager - NixOS Wiki doesn’t work - it seems to be copying files to the home directory and using -configdir but the X docs say this won’t work as a regular user, and trying it X still uses the /nix/store system config dir path (as expected).

https://www.reddit.com/r/NixOS/comments/22bzca/xinit_startx_instead_of_a_login_manager/cgmiagu/ seems to have similar issues with no solution.

https://www.reddit.com/r/NixOS/comments/eqs5ji/startx_no_keyboard_or_mouse_exwm/ claims to have gotten it working, but short of NixOS magic I’m skeptical.

1 Like

While unfortunately I can be of absolutely no help here, as I came to the same conclusion regarding the NixOS Wiki page and just gave up at that point, I‘d like to publicly appreciate how well you documented your effort. People will be able to pick up from here even in case this thread won’t see any progress. Thank you, this alone is an incredibly valuable contribution to the project and the community.

1 Like

Wondering if you canrun Debian in a docker image or a VM…

That’s actually a good idea haha, I felt like this would (probably? :sweat_smile:) be more in line with the spirit of the rule… but maybe not.

So I ended up installing X through debian directly, and everything else with Nix. I think this isn’t going to work either though. Additional details: Optimus (?) laptop with intel/nvidia graphics, installed bumblebee-nvidia since bbswitch with nouveau simply didn’t work (high temperatures, fan constantly on while doing nothing).

So anyways, I installed picom, glxinfo, alacritty, etc with Nix and nothing that uses GLX will work.

Video card drivers loaded correctly:

$ dmesg
...
[    2.123823] fb: switching to inteldrmfb from EFI VGA
[    2.138516] fbcon: inteldrmfb (fb0) is primary device
[    3.262031] i915 0000:00:02.0: fb0: inteldrmfb frame buffer device
...
[   17.072904] nvidia: loading out-of-tree module taints kernel.
[   17.072909] nvidia: module license 'NVIDIA' taints kernel.
[   17.081844] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[   17.087777] nvidia-nvlink: Nvlink Core is being initialized, major device number 240
[   17.087951] nvidia 0000:01:00.0: enabling device (0006 -> 0007)
[   17.088030] nvidia 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
[   17.128817] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  418.74  Wed May  1 11:49:41 CDT 2019
...
~$ cat /var/log/Xorg.0.log | grep 'gl\|GL'
[    18.662] (II) LoadModule: "glx"
[    18.663] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    18.673] (II) Module glx: vendor="X.Org Foundation"
[    18.681] (II) Loading sub module "glamoregl"
[    18.681] (II) LoadModule: "glamoregl"
[    18.681] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[    18.686] (II) Module glamoregl: vendor="X.Org Foundation"
[    18.730] (II) modeset(0): glamor X acceleration enabled on Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)
[    18.730] (II) modeset(0): glamor initialized
[    18.754] (II) Initializing extension GLX
[    18.758] (II) AIGLX: Loaded and initialized i965
[    18.758] (II) GLX: Initialized DRI2 GL provider for screen 0

Visual reported correctly with xdpyinfo:

$ xdpyinfo | grep 'GL\|DRI'
    DRI2
    DRI3
    GLX
~$ systemctl status bumblebeed.service
● bumblebeed.service - Bumblebee C Daemon
   Loaded: loaded (/lib/systemd/system/bumblebeed.service; disabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/bumblebeed.service.d
           └─override.conf
   Active: active (running) since Sat 2020-03-28 15:03:00 JST; 40min ago
  Process: 1259 ExecStartPre=/bin/sleep 5 (code=exited, status=0/SUCCESS)
 Main PID: 1260 (bumblebeed)
    Tasks: 1 (limit: 4915)
   Memory: 27.4M
   CGroup: /system.slice/bumblebeed.service
           └─1260 /usr/sbin/bumblebeed

(override just adds a sleep before starting…)

However:

$ glxinfo
name of display: :0
Error: couldn't find RGB GLX visual or fbconfig

$ glxgears
Error: couldn't get an RGB, Double-buffered visual
$ picom
[ 03/28/20 15:45:00.804 glx_has_extension ERROR ] Failed get GLX extension list.
[ 03/28/20 15:45:00.804 glx_has_extension ERROR ] Failed get GLX extension list.
[ 03/28/20 15:45:00.804 glx_has_extension ERROR ] Failed get GLX extension list.
[ 03/28/20 15:45:00.804 glx_has_extension ERROR ] Failed get GLX extension list.
[ 03/28/20 15:45:00.804 glx_has_extension ERROR ] Failed get GLX extension list.
[ 03/28/20 15:45:00.804 glx_has_extension ERROR ] Failed get GLX extension list.
[ 03/28/20 15:45:00.804 glx_has_extension ERROR ] Failed get GLX extension list.
[ 03/28/20 15:45:00.804 glx_has_extension ERROR ] Failed get GLX extension list.
[ 03/28/20 15:45:00.826 paint_bind_tex ERROR ] Failed to find appropriate FBConfig for X pixmap
[ 03/28/20 15:45:00.826 paint_one ERROR ] Failed to bind texture for window 0x00800084.
Segmentation fault

These should work - the intel video also supports glx and there are no reported problems.

Since optimus feels like a massive hack I wasn’t expecting this to run, but:

~$ optirun glxgears
glxgears: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

I thought the issues with non-optirun might be related to libglx.so + related libraries which aren’t managed traditionally with optimus. Like, maybe it’s using a different libglx.so file for a driver that isn’t loaded on my system, whereas xdpyinfo which was installed with apt-get was.

I installed mesa-utils (for glxgears) with apt-get this time, and ran:

~$ /usr/bin/glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
1205 frames in 5.0 seconds = 240.932 FPS

So that appears to be the case.

Also, not directly X related but it seems chromium won’t work when installed with Nix on a foreign distro? It complains of a sandbox directory issue.

It’s going to be way too confusing managing some software with apt-get and some with Nix here, so I’m afraid I’m going to have to drop Nix at this point.

Can’t edit now, but this should say “which should contain all the config files” - the issue is that the hard coded config directory also needs to be merged with the config directories installing various X deps.