Skip to content

Instantly share code, notes, and snippets.

@nikescar
Created April 23, 2026 01:50
Show Gist options
  • Select an option

  • Save nikescar/12fcd17bb3620ab19cbdc793f3295bce to your computer and use it in GitHub Desktop.

Select an option

Save nikescar/12fcd17bb3620ab19cbdc793f3295bce to your computer and use it in GitHub Desktop.
xorgfix.md

Xorg/JWM fix summary

Problem

startx was failing for two separate reasons:

  1. ~/.xinitrc was broken:
    • malformed test expression in the xsession.* loop
    • wrong JWM path (bin/jwm instead of /usr/local/bin/jwm)
  2. Xorg was crashing on this laptop during GPU auto-probe with the Intel/DRM path.

What I changed

1. Fixed ~/.xinitrc

  • corrected the shell syntax in the xsession.* loader
  • fixed quoting for resource/modmap loading
  • changed JWM launch to the installed path
  • added:
    • xsetroot -cursor_name left_ptr
    • xset s off -dpms
    • xterm -geometry 100x30+40+40 &
    • exec dbus-launch --exit-with-session /usr/local/bin/jwm

This makes the session easier to use and gives a visible terminal immediately after startx.

2. Forced a fallback Xorg path

Created /usr/local/etc/X11/xorg.conf with:

  • DontZap set to false so Ctrl+Alt+Backspace works
  • first tried an explicit scfb fallback to avoid the Xorg GPU auto-probe crash

That made X start, but the framebuffer output was wrong on this panel: only a thin strip at the top of the screen updated correctly while the rest stayed black/stale.

3. Installed extra package during diagnosis

  • installed xf86-video-intel

That did not solve the crash by itself, but it is now present on the system.

4. Rebuilt the graphics stack from ports

To get off the broken scfb fallback, I rebuilt:

  • graphics/libdrm
  • graphics/gpu-firmware-kmod
  • graphics/drm-66-kmod
  • x11-servers/xorg-server

I also fetched the exact matching FreeBSD source tree for the running kernel commit:

  • kernel build commit: 2434fcfd0dd0

This was required because drm-66-kmod could not be rebuilt without /usr/src/sys/conf/kern.opts.mk.

5. Switched Xorg to the final modesetting config

After the rebuild, /usr/local/etc/X11/xorg.conf was switched to a modesetting OutputClass configuration:

  • MatchDriver "drm"
  • Driver "modesetting"
  • PrimaryGPU true
  • AccelMethod none
  • SWcursor true

This is the configuration now used successfully after reboot.

Current status

  • ~/.xinitrc is fixed and starts JWM plus an xterm
  • the graphics stack has been rebuilt from ports against matching kernel sources
  • the active Xorg config uses modesetting through an OutputClass match on the DRM driver
  • after reboot, startx works and JWM starts correctly

Important note

Before reboot, tests still showed:

  • /dev/dri/card0: failed to query DRM version
  • Xorg crashing when trying the real DRM/modesetting path

That is consistent with the system still running the previously loaded DRM kernel module in memory, even though a freshly rebuilt one now exists on disk.

After reboot, the rebuilt DRM module was loaded and the prepared modesetting configuration worked correctly.

Files changed

  • /root/.xinitrc
  • /usr/local/etc/X11/xorg.conf
  • /root/xorgfix.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment