NVIDIA 340.108 / 390.157 legacy drivers: Debian-based patchset, complete package set, mhwd integration and live ISOs

Hi all,

This is an update on the NVIDIA 340.108 legacy driver revival for
Manjaro, and — alongside it — the 390.157 branch, both now built
on top of the Debian patchset.

:warning: CRITICAL — read this before downloading any ISO

There are two different XLibre variants in play:

  • legacy ABI XLibre (xlibre-xserver-legacyabi) — required by
    the 340.108 driver. It cannot run modern NVIDIA drivers.
  • normal XLibre (xlibre-xserver) — required by 390 / 470 /
    580 / latest
    NVIDIA drivers. It cannot load the 340.108 X
    driver module.

Note about Xorg: this split only affects XLibre. If you use
plain xorg-xserver instead of XLibre, there is no ABI split —
the same server works with all NVIDIA driver generations
(340 / 390 / 470 / 580 / latest). In theory the 340.108 driver
should load and work on plain Xorg without any additional handling.

This has never been tested by us. The ISOs and all the hardware
tests in this thread use XLibre. If you try plain xorg-xserver
with any of these drivers, please report back — we are curious
whether it “just works”.

Because of this, the ISOs are split into two stacks:

Stack Contains XLibre variant
legacy340 only nvidia-340xx-* legacy ABI
modern nvidia-390xx-*, nvidia-470xx-*, nvidia-580xx-*, nvidia-* (latest) normal

If you boot a 340-only ISO with a modern GPU, the kernel module
will load, nvidia-smi may work, but OpenGL will silently fall
back to Mesa llvmpipe (software rendering)
— because the normal
XLibre ABI is missing. You can verify this with:

glxinfo | grep -i renderer

If it says llvmpipe, you are on software rendering.

If you want to use a modern GPU with a 340-only ISO, the fix is
to replace xlibre-xserver-legacyabi with xlibre-xserver on the
installed system. That is all we will say about that — figure out
the details yourself.

Patchset base

Both nvidia-340xx-utils and nvidia-390xx-utils are built on top
of the Debian patchset instead of the Arch/Manjaro one.

  • Upstream base: salsa.debian.org/nvidia-graphics-driver,
    branches 340xx/main and 390xx/main, maintained by
    Andreas Beckmann (anbe@debian.org).
  • Manjaro adaptation / fork: maintained by
    Gyöngyösi Gábor (@megvadulthangya on GitHub / Manjaro forum).

Practical consequences:

  • The Debian patchset base is 1:1 transferable back to Debian.
  • The Manjaro-specific parts on top of that base (follow-up patches
    for kernels beyond 6.19, mhwd integration, packaging, build
    testing, CVE backports) are maintained in the fork under
    github.com/megvadulthangya.

Scope

  • 340.108: revived for Manjaro. Not available in the official
    repos — this is a community effort.
  • 390.157: still available in the official Manjaro repos.
    The Debian-based patchset + our follow-up patches are also
    available for it here, as an alternative to the official build.

Kernel support

Both drivers build successfully on the following kernels:

  • 6.1.x / 6.1-rt
  • 6.6.x / 6.6-rt
  • 6.12.x / 6.12-rt
  • 6.18.x
  • 7.1.x
  • 7.2.x
  • 7.3.x-rc

The follow-up patches for the 6.18 – 7.3 range:

Patch Purpose
kernel-6.18-workqueue-flush.patch flush_scheduled_work() → no-op / flush_workqueue(system_wq) on 6.18+
kernel-6.18-prime-fence-flush.patch Direct flush_scheduled_work() in nvidia-drm-prime-fence.c
kernel-7.0-screen_info.patch screen_info → sysfb_primary_display.screen on 6.20+
kernel-7.2.patch drm_atomic_state → drm_atomic_commit rename, strncpy → strscpy
kernel-7.3-acpi.patch struct acpi_driver removal (7.3+), stub nv_acpi_init/nv_acpi_uninit
vma-lock-7.0-plus.patch VMA lock API changes (VMA_LOCK_OFFSET, __is_vma_write_locked)
fixup-warnings.patch -Wunused-result on refcount_sub_and_test

Security backports

Currently 3 CVE patches from the 390.157 release are ported to 340.108:

Patch CVE
cve-2022-34670-nv-h-IS-OFFSET.patch CVE-2022-34670, 34677, 34680, 42257, 42258, 42259 (integer overflow / truncation)
cve-2022-34674-vma-size.patch CVE-2022-34674 (VMA size validation)
cve-2022-34670-nv-c-usage-count-overflow.patch Hardening (usage_count overflow)

More CVE backports are WIP: the plan is to harvest source-level
security fixes from the 470 branch, then port them down to 390, then
to 340.

What is available now

Package set:

  • nvidia-340xx-utils
  • opencl-nvidia-340xx
  • lib32-nvidia-340xx-utils
  • lib32-opencl-nvidia-340xx
  • nvidia-340xx-dkms
  • nvidia-340xx-settings (legacy settings tool)
  • mhwd-nvidia-340xx
  • mhwd-db fork with video-nvidia-340xx and
    hybrid-intel-nvidia-340xx-bumblebee profiles
  • Per-kernel prebuilt module packages for current Manjaro kernels
  • Meta packages for linux and linux-lts
  • nvidia-driver-assistant integration

Same package set exists for nvidia-390xx-*.

Test ISOs

:warning: Important: the ISOs are split into two stacks because of
the legacy-ABI XLibre requirement of the 340.108 driver (see the
CRITICAL section at the top). Use the one that matches your GPU
generation.

Awesome WM

Xfce + Compiz

The ISOs ship kernel 6.18.

Desktop environment notes

  • The 340-only ISOs are built with legacy-ABI XLibre
    (xlibre-xserver-legacyabi) — see the CRITICAL section at the top.
  • The modern ISOs are built with normal XLibre
    (xlibre-xserver).
  • Wayland has never been tested for the 340xx branch. The 340.108
    driver has no atomic modesetting and no modern Wayland/EGLStreams
    support, so Wayland is expected to be broken or fallback to
    software rendering.
  • Use Xorg/XLibre sessions only.

Real hardware tests

GeForce 210 (GT218) — 340xx

Thanks to a prohardver.hu community member:

  • GPU: NVIDIA GeForce 210 (GT218)
  • Kernel: 6.18.45-1-MANJARO
  • Environment: Manjaro live ISO, Xfce + Compiz
  • mhwd profile: video-nvidia-340xx automatically selected
  • Kernel module: loaded
  • nvidia-settings: starts, reports driver 340.108
  • nvidia-smi: reports the GeForce 210 correctly
  • OpenGL: hardware renderer (NVIDIA)

NVS 295 — 340xx

GeForce GTS 450 (GF106) — 390xx

CUDA

Two CUDA sample packages are available, both containing Debian 8
built CUDA-sample binaries:

  • cuda60
  • cuda65

Both tested on NVS 295.
(You can build anything gcc48 is available in the repo)

Tested on GTS450

  • ‘cuda91’
    (You can build the samples or anything, gcc6 available in the repo)

Repositories

340xx branch

390xx branch

Build testing suite (WIP)

I’m also working on a GitHub Action based testing suite that:

  • Builds nvidia-340xx-utils and nvidia-390xx-utils from their
    respective repos.
  • Builds the corresponding nvidia-340xx and nvidia-390xx kernel
    module packages (separate repos).
  • Builds the official Manjaro flat PKGBUILDs and extracts the
    make.log from every driver build in one go.
  • Produces normalized harvest reports for LLM triage.

The companion tool is harvest-nvidia-logs — a Python 3.10+
script that walks a diag tree of DKMS make.log files, splits them
into errors / warnings / known objdump noise / suspicious lines,
normalizes each warning to a stable signature, and emits a single
INDEX.md telling you which warning, if fixed once, unblocks the
most builds.

(Keep in mind: these results represent the state of the NVIDIA
packages on code.manjaro.org. I am not sure whether the Manjaro
team builds from there or not.)

This is mostly useful for packagers — @philm in particular — but
anyone maintaining a legacy NVIDIA branch on Manjaro may find it
helpful.

Next steps

  • :white_check_mark: Publish a short guide on which repositories need to be forked
    and included to spin a 340xx-enabled ISO automatically.
  • :construction: Build an Xfce variant of the 340xx live ISO (currently only
    Awesome WM exists).
  • :construction: More CVE backports from 470 → 390 → 340.

Thanks to everyone who can help test this museum-class driver…!

2 Likes

All the kernel module PKGBUILDs are in subgroups for each kernel version; i.e., packages/extra/linux618-extramodules/nvidia-390xx/.

Each mhwd-db profile has a MHWDCONFIG; i.e., for nvidia-390xx.

1 Like

Thank you very much, @Yochanan That’s extremely helpful.

I’ll start by checking packages/extra/linux618-extramodules/nvidia-390xx/ (and the other kernel version subgroups) to adapt them for 340xx. I’ll also look into the mhwd-db profiles and the MHWDCONFIG entries for nvidia-390xx to understand how to create the equivalent 340xx profiles.

Really appreciate the quick and precise pointers!

*Update:
I manage to get it work builds almost all of the current kernels in manjaro… but not in 6.1 or 6.1 rt …
All other is ok.
After testing this… in vmware becouse kernel headers are already there i try to remove nvidia-340xx-dkms nvidia-340xx-utils mhwd-db mhwd then install back the nvidia-390xx-dkms nvidia-390xx-utils mhwd-db mhwd …

I tryed with what comes from the unstable repo, and tryed from my repo… both only build the nvidia kernel module on 7.2 only … What should happened? :facepalm:

thank you for try to fixing it @philm but looks like is not fixed yet!

When i ported from 470 to 390, was tested on 618 and 72

1 Like

I need to study how to do this. I have been using llvmpipe too long.

@deroberts1 To avoid misunderstanding: this project is not a general “how to port the driver” guide. The goal is to bring legacy NVIDIA 340.108 support back into my own Manjaro spins (XFCE/Compiz, AwesomeWM), so very old NVIDIA cards can work out of the box via mhwd. Right now this is still work in progress — I have not yet put it into any ISO. Once the packages are ready in my repo, the built ISOs will be uploaded to my SourceForge profile:

That page is only for the ISOs, not the package repo. No ETA, because it is a lot of work and I don’t always have time for it.

For people building their own Manjaro, the PKGBUILD and patches are available in the GitHub repo, but I won’t be able to give individual build/install support here.