Add nvidia driver rolling package

Manjaro is a semi-rolling distribution because it has periodic sets of updates so it makes sense that drivers and kernels are also not rolling so they do not break when used in the sets of updates. I think the only way to get a true rolling package is to use a true rolling distribution.

I wrote a little script from scratch that would work in a pacman hook:

Are you looking for something like that?

Nice thanks for your effort,
but

this is not exactly what I’m looking for.

I want to be able to automatically update the nvidia driver, without having to uninstall packages and install new ones.
The package should stay the same, only the driver version contained should update. This way there are no package operations needed.
This would have the pros of:

  • Not needing to uninstall everything depending on nvidia
  • Not having to download a newer build of the older driver branch before switching to the new driver branch

My best idea for a solution is to have one “video-nvidia” mhwd profile, which uses one package per kernel (“linuxXX-nvidia”) which stays always installed and gets updated always to the newest driver.
This way we won’t have to uninstall stuff and reinstall it after. The installed package list will stay the same, only the version of the one package itself changes.
So just like it was in the old days, when there were not all the different nvidia driver versions in the repo but just one at a time (and per supported gpus).

Example:
Currently we have packages like
linux59-nvidia-450xx
linux59-nvidia-455xx

Now there would be an additional mhwd profile and package:
linux59-nvidia // (or maybe linux59-nvidia-latest)

This package would contain currently driver version 455.
But when for example driver 460 comes out, this exact package (linux59-nvidia) would become driver 460. Without changing its name. Without having to uninstall an old package and install a new one. It would stay the same, but contain the newer driver.
This would be optimal.

2 Likes

this cannot be apply because :

  • many laptop use older nvidia version
  • each compilation kernel require a passe for each driver nvidia

what will be done if latest goes for 440 series to 450 series ?
see
[Stable Update] 2020-08-22 - Kernels, Deepin, KDE-git, Firefox, Pamac, Nvidia 450, KDE Apps 20.08
https://forum.manjaro.org/t/stable-update-2020-08-28-kernels-systemd-pam-pambase-kde-git-deepin-pamac-nvidia-450-66-libreoffice-7-0/
how many help we get since 440 series to 450 series may go wrong ?

It can. We already have proven it in the past, when Manjaro used this exact approach.
Also Arch does the same and some other distros. So it is definitely possible.

Yeah, fine. They can continue to do so. There would be only an additional mhwd profile + package. I’m not talking about removing the existing one. So no harm is done here.

Yes, this is already the case for all the different driver versions and mhwd profiles which are currently in the repo. Adding one more shouldn’t be a problem.

Users using the mhwd profile for latest nvidia driver would get updated from 440 to 450 series.
This will keep their systems fully functional, since using older driver versions often break things because they are not compatible in combination with all the other new packages (cuda, ffmpeg nvenc, others using nvidia apis…)

Well, people can ask here in the forum. But I doubt this will happen often. Nvidia driver are usually well tested in my experience.
At least people have usually more problems when staying on older version compared to the latest anyway.
But in case they do have problems, they can just stay on the older version, as this new profile I suggest is only an addition to the existing ones.

@philm @aragorn @megavolt
we have found a candidate for testing hybrid cards

2 Likes

Ok understand… what you are looking for is then exclude mhwd and use a meta package like arch. Using a config “latest-yx” is not really useful in mhwd. That means extra packages that need to be managed and therefore extra work.

Anyway… the packages are already there. The script i mention above do what you expect, but it doesn’t overwrite it, but rather remove the old ones and install the new ones. I see no real benefit of your idea now… only a preference.

I still prefer the mhwd profile over a metapackage or pacman hook.

The downsides of just a metapackage:

  • There is no mhwd support. Updating the kernel means having to manually uninstall the metapackage for the driver first, update kernel with mhwd, afterwards installing the metapackage manually again for the new kernel. This are the manual steps I wan’t to avoid.

The downsides of the pacman hook:

  • On system update, it will first install the newest version of the old (currently installed) nvidia driver branch before downloading and installing the newer driver branch.
    This means we have to download unnecessary packages which will get uninstalled soon after installation again.
    If you have a fast internet connection this may be fine. But as in some locations in Germany here, I would really like to avoid any unnecessary downloads.
  • It needs to uninstall the old driver version first (before installing the new one), which is not possible if you have packages installed depending on nvidia (for example cuda and nvtop).
    So we have to manually uninstall and remember those packages to be able to update the driver, then afterwards manually install these packages again.
    These manual steps is what I try to avoid and the reason why I started this forum thread.

What I want is a fully automatic driver update. Without manual steps or unnecessary downloads.

You may say these manual steps are easy.
Well to that I can say yes, maybe for me. I know how to handle metapackages and update the driver. Maybe only noobs won’t.
But since I have to do this on multiple machines it is really annoying. So it should be fully automatic.

The goal here is that only running normal system updates is enough to keep nvidia driver up to date.
No unnecessary downloads, no manual package uninstalls/installs.
As far as I know, this is currently only possible with an additional (rolling) mhwd profile.

Both points are eligible and yes i understand this view. I believe that can be done in 2 pacman hocks in theory.

Lets say:

  1. a new mhwd profile will be installed: nvidia-450 is installed… new one is nvidia-455
  2. If the hock detects a newer profile before upgrading it will delete the current driver
  3. Then after installing the new profile, mhwd will with a second hook install the new driver
  4. dependencies like cuda or nvtop need then to be installed with “–asexplicit” so that it won’t bother, that can also be done with the first hock

I see also here: README.md · master · Applications / mhwd · GitLab that a similar idea is on the todolist:

  • don’t remove packages on reinstallation…

Feel free to contribute there :wink:

just my first thoughts… guess this won’t be possible because you have to do system updates first to update mhwd for the new profile of the new driver to be even available to install. So detecting new nvidia drivers before system update is not possible.

Second thing is:
Will this be installable in an easy way for everyone? How do you tell noobs on how to install pacman hooks?
Also, how will they be updated, in case somthing in the logic changes?

I would still prefer an official, obvious way. Like another mhwd profile for a rolling driver.
Especially since I’m not the only one struggling with this.
See threads / quotes like this:

ok let’t get more productive. So you expect something like this, right?

The MHWDCONFIG looks like this for 455xx:

$ cat /var/lib/mhwd/db/pci/graphic_drivers/nvidia-latest/MHWDCONFIG 
# mhwd Driver Config

NAME="video-nvidia-latest"
INFO="Closed source NVIDIA drivers for linux."
VERSION="2020.10.04"
FREEDRIVER="false"
PRIORITY="10"

CLASSIDS="0300 0302"
VENDORIDS="10de"
DEVICEIDS=">/var/lib/mhwd/ids/pci/nvidia-latest.ids"

# Conflicts
CONFLICTS="nvidia-340xx-utils nvidia-390xx-utils nvidia-418xx-utils nvidia-430xx-utils nvidia-435xx-utils nvidia-440xx-utils nvidia-450xx-utils"
CONFLICTS_64="lib32-nvidia-340xx-utils lib32-nvidia-390xx-utils lib32-nvidia-418xx-utils lib32-nvidia-430xx-utils lib32-nvidia-435xx-utils lib32-nvidia-440xx-utils lib32-nvidia-450xx-utils"
CONKMOD="nvidia-340xx nvidia-390xx nvidia-418xx nvidia-430xx nvidia-435xx nvidia-440xx nvidia-450xx"

# Conflicts with other mhwd configs
MHWDCONFLICTS="video*nvidia-*"

# Dependencies
DEPENDS="nvidia-455xx-utils"
DEPENDS_64="lib32-nvidia-455xx-utils"
DEPKMOD="nvidia-455xx"

XORGFILE="/etc/X11/mhwd.d/nvidia.conf"
MHWDGPU_BLCKLSTNVIDIA="/etc/modprobe.d/mhwd-gpu.conf"
MHWDGPU_MODLDNVIDIA="/etc/modules-load.d/mhwd-gpu.conf"

fix_screen_flickering()
{
	sed -i /'Section "Device"'/,/'EndSection'/s/'EndSection'/"\tOption \"RegistryDwords\" \"PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefault=0x2; PowerMizerDefaultAC=0x1\"\nEndSection"/g "${XORGFILE}"
}

post_install()
{
	nvidia-xconfig -o "${XORGFILE}" --composite &>/dev/null
	MHWD_ADD_BACKSPACE "${XORGFILE}"

	# Remove logo
	sed -i /'Section "Device"'/,/'EndSection'/s/'EndSection'/"\tOption \"NoLogo\" \"1\"\nEndSection"/g "${XORGFILE}"

	# Fix screen flickering for some nvidia devices
	MHWD_FUNC_ON_MATCH 0300 10de "0400 0401 0402 0403 0407 0409 0425" fix_screen_flickering

	mhwd-gpu --setmod nvidia --setxorg "${XORGFILE}"

	# Without this 'glxgears' don't work in live-session
	MODULES_LOAD="/etc/modules-load.d"
	echo "nvidia-drm" >> "${MODULES_LOAD}/mhwd-gpu.conf"
	if [ ! "$(pgrep X)" ];	then
		modprobe nvidia-drm
	fi
}



post_remove()
{
	if [ -e "${XORGFILE}" ]; then
		rm "${XORGFILE}"
	fi

	if [ -f "${MHWDGPU_BLCKLSTNVIDIA}" ]; then
		sed -i '/^blacklist nouveau/d' "${MHWDGPU_BLCKLSTNVIDIA}"
		sed -i '/^blacklist ttm/d' "${MHWDGPU_BLCKLSTNVIDIA}"
		sed -i '/^blacklist drm_kms_helper/d' "${MHWDGPU_BLCKLSTNVIDIA}"
		sed -i '/^blacklist drm/d' "${MHWDGPU_BLCKLSTNVIDIA}"
	fi

	if [ -f "${MHWDGPU_MODLDNVIDIA}" ]; then
		sed -i '/^nvidia/d' "${MHWDGPU_MODLDNVIDIA}"
	fi

	mhwd-gpu --check
}

This is the mhwd database:

$ cat /var/lib/mhwd/ids/pci/nvidia-latest.ids
# List generated by mhwd. Do not edit manually.
0fc0 0fc1 0fc2 0fc6 0fc8 0fc9 0ff3 0ff9 0ffa 0ffd 0ffe 0fff 1001 1004 1005 1007 1008 100a 100c 1021 1022 1023 1024 1026 1027 1028 1029 102a 102d 103a 103c 1180 1183 1184 1185 1187 1188 1189 118a 118e 118f 1193 1194 1195 11b4 11ba 11c0 11c2 11c3 11c4 11c5 11c6 11c8 11cb 11fa 1280 1281 1282 1284 1286 1287 1288 1289 128b 1340 1341 1344 1346 1347 1348 1349 134b 134d 134e 134f 137b 1380 1381 1382 1390 1391 1392 1393 1398 1399 139a 139b 139c 139d 13b0 13b1 13b2 13b3 13b4 13b6 13b9 13ba 13bb 13bc 13c0 13c2 13d7 13d8 13d9 13da 13f0 13f1 13f2 13f3 13f8 13f9 13fa 13fb 1401 1402 1406 1407 1427 1430 1431 1436 15f0 15f7 15f8 15f9 1617 1618 1619 161a 1667 174d 174e 179c 17c2 17c8 17f0 17f1 17fd 1b00 1b02 1b06 1b30 1b38 1b80 1b81 1b82 1b83 1b84 1b87 1ba0 1ba1 1ba2 1bb0 1bb1 1bb3 1bb4 1bb5 1bb6 1bb7 1bb8 1bb9 1bbb 1bc7 1be0 1be1 1c02 1c03 1c04 1c06 1c07 1c09 1c20 1c21 1c22 1c23 1c30 1c31 1c60 1c61 1c62 1c81 1c82 1c83 1c8c 1c8d 1c8f 1c90 1c91 1c92 1c94 1c96 1cb1 1cb2 1cb3 1cb6 1cba 1cbb 1cbc 1cbd 1cfa 1cfb 1d01 1d10 1d11 1d12 1d13 1d16 1d33 1d34 1d52 1d81 1db1 1db3 1db4 1db5 1db6 1db7 1db8 1dba 1df0 1df2 1df5 1df6 1e02 1e04 1e07 1e30 1e36 1e81 1e82 1e84 1e87 1e89 1e90 1e91 1e93 1eb0 1eb1 1eb5 1eb6 1eb8 1ec2 1ec7 1ed0 1ed1 1ed3 1ef5 1f02 1f06 1f07 1f08 1f09 1f0a 1f10 1f11 1f12 1f14 1f15 1f36 1f42 1f47 1f50 1f51 1f54 1f55 1f76 1f82 1f91 1f95 1f96 1f97 1f98 1f99 1f9c 1fb8 1fb9 1ff9 20b0 2182 2184 2187 2188 2191 2192 21c4 21d1 2204 2206 1140 11a0 11b60

Et voila… that is mhwd with video-nvidia-latest :smiley:

Now the maintainer needs to fill this everytime with the latest driver… but this wont be updated to next version… it will stuck on 455… now create a meta package with the 455xx driver with a name video-nvidia-latest.

If you need this i can create a AUR package at least… xD

PS: The conflicts needs an update… at least some meta packages must be added in my opinion.

2 Likes

Yes this is a really good solution. Thank you a lot!

Of course, it could be uploaded as an AUR package.
But:

  1. this will conflict with the different Manjaro branches. When do you update the package? You would have to maintain 4 different packages for this, keeping each timely in sync with the current repo states.
  2. it may be no good solution for noobs. Not everyone know how to (and wants to) enable the AUR
  3. It will not be able to automatically update from a root script with just pacman, since aur builders need a non-root user and usually interaction and a quick look at the PKGBUILD

So because of this reasons, I think it would be a great idea to include this in the official repos!
@philm what do you think?

… there won’t be a nvidia-latest profile nor package from my end.

Seems this is a circle back from the nvidia package that was in the repositories some time in the past I do not understand why it is a big ask to implement something that already existed before.

2 Likes

Funny reactions to that answer :rofl: He just says, that he personally wouldn’t implement the config and I myself don’t need that. I am happy with mhwd and how it works now. But that doesn’t mean that someone else could contribute one:

Soo don’t be lazy and create a nice a patch, if you really think that it is worth the time @anon36603275 @squart :slight_smile:

Yeah partly you are right.
The problems are:

  1. not every user wishing for a feature automatically has the knowledge and skills to implement it. Guess it would be much easier for those who already worked with and created mhwd.
  2. even if a user would make a patch, it is not a single time contribution. Someone would have to maintain it alongside the driver. Besides that, we not even have write access to some place where to maintain.
  3. someone would have to build, sign and upload it to the repos. Normal users are not able to do this.
  4. the answer didn’t sound very interested, so it would not be worth it, if the patch would be just ignored anyway.

So we first need someone from the Manjaro team who is interested in this. If there are only users, we can’t do much about it alone.

Just remove all Manjaro Nvidia packages like linux59-nvidia-455xx and install nvidia-dkms from Arch and check it for the updates from time to time.

However, despite the fact that it is a working approach atm, there might be issues with it in the future.

Update:
I started to make a mhwd profile + packages for a rolling nvidia driver.
You can find the repo here:

I haven’t tested it with mhwd yet, but the packages do build.

I guess only the kernel modules are missing currently. I’m not sure if I can use the already existing ones (in DEPKMOD in the mhwd profile?).

If someone wants to help, just create a PR or give me some feedback if you can test it.

Also I have written Phil a pm to see if and how we can possibly get this officially integrated.

2 Likes

Update:
Looks like we have a new chance to get a rolling nvidia driver again.
If you want it please vote for it here:

2 Likes