How to create a Nvidia driver xzm module

Post tutorials, HOWTO's and other useful resources here.
fulalas
DEV Team
DEV Team
Posts: 775
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Re: How to create a Nvidia driver xzm module

Post#16 by fulalas » 19 Feb 2017, 03:13

Evan wrote:Something interesting i've noticed is that with a standard install of Nvidia drivers at root/text followed by init 4 straight into desktop without creating a module lets step 11 run without any errors?

I'm not sure if this is because (devel.xzm and crippled_sources.xzm) are loaded or if Porteus standard Module creation corrupts something?
Nvidia installer does everything needed in order to make sure the driver is working properly after install; it has nothing to do with devel/crippled modules. Unfortunately it doesn't last after a reboot, as Porteus resets GL libs and its symlinks, so that's why we should do some tricks. See?

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: How to create a Nvidia driver xzm module

Post#17 by Evan » 19 Feb 2017, 09:13

fulalas wrote:Nvidia installer does everything needed in order to make sure the driver is working properly after install; it has nothing to do with devel/crippled modules. Unfortunately it doesn't last after a reboot, as Porteus resets GL libs and its symlinks, so that's why we should do some tricks. See?
Yeah , all starting to make sense now..........

What about if a save.dat file is used , does it still not survive a reboot?

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: How to create a Nvidia driver xzm module

Post#18 by Evan » 19 Feb 2017, 10:31

I found out what was stopping the script from running. :)

I assume it's a firefox issue but using the select all at the top of the script code and then using copy/paste was leaving a space at the end of each line so i used Mousepad to strip trailing spaces.

The script now runs but only gets to the part about Fixing libGL symlinks and then starts spitting out errors that it can't sym link the files , i'll have to start again and copy the errors to a text file.

* Edit - Errors added *

Your changes module has been created!
nvidia-driver.xzm

Main folder cleaning...
Etc folder cleaning...
Lib folder cleaning...
Usr folder cleaning...
Fixing libGL symlinks...
cp: cannot create symbolic link 'libGL.so' to 'libGL.so.1.2.0': Operation not permitted
cp: cannot create symbolic link 'libGL.so.1' to 'libGL.so.1.2.0': Operation not permitted
cp: cannot create symbolic link 'libGLESv1_CM.so' to 'libGLESv1_CM_nvidia.so.378.13': Operation not permitted
cp: cannot create symbolic link 'libGLESv1_CM.so.1' to 'libGLESv1_CM_nvidia.so.378.13': Operation not permitted
cp: cannot create symbolic link 'libGLESv2.so' to 'libGLESv2_nvidia.so.378.13': Operation not permitted
cp: cannot create symbolic link 'libGLESv2.so.2' to 'libGLESv2_nvidia.so.378.13': Operation not permitted
Disabling nouveau...
Creating module...
Removing temp files...
Finished.

fulalas
DEV Team
DEV Team
Posts: 775
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Re: How to create a Nvidia driver xzm module

Post#19 by fulalas » 19 Feb 2017, 13:28

This is kind of hard to explain, but I'll try.

ldconfig is a program that comes with Linux and it's responsible for configuring symlinks and cache of shared libraries in the system. Every time we run it (and Porteus runs it all the time through its scripts), all shared libs are checked for any inconsistence, like dead symlinks.

Now, Nvidia driver installs some new libs but remember: Porteus already comes with Mesa drivers. So Mesa comes with the file 'libGL.1.2.0' and Nvidia driver comes with 'libGL.1.0.0', however both use 'libGL.so.1' as the symlink. When Nvidia installer ends, it simply deletes Mesa 'libGL.1.2.0' and calls ldconfig to update all symlinks (if you pay attention to the Nvidia installer process you'll notice this). The catch is that Porteus, as an always-fresh OS kind, restores Mesa driver every reboot, so we have an odd situation when both Mesa 'libGL.1.2.0' and Nvidia 'libGL.1.0.0' exist. When ldconfig is called facing this scenario, it thinks that the symlink 'libGL.so.1' should point to the newest version of libGL, which, guessing only by the name, would be the Mesa one, but that's not what we want, of course. Can you see the problem?

My solution is dirty as hell, but it works: I make a new copy of 'libGL.1.0.0' as 'libGL.1.2.0' and keep it inside Nvidia module, so every time Porteus reboots and restores Mesa libGL.1.2.0, Nvidia driver module comes just after it overwriting Mesa 'libGL.1.2.0' with my copy -- which is actually the Nvidia lib we want.

That's it. :)
----------------------

But, as you like to say, nothing is really simple when dealing with Linux, so this solution depends on your Nvidia card. With my old GTX 650 Ti the solution above works flawlessly, but with older Nvidia cards it's not enough -- and that's why there's a IF/ELSE inside my script, so the script works for both new and old Nvidia cards. But... Maybe your current machine is a new scenario that my script isn't able to deal with. Are you sure you're running as root inside text mode?

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: How to create a Nvidia driver xzm module

Post#20 by Evan » 19 Feb 2017, 13:41

Thanks for taking time to type out the symlink explanation , i understand what you are saying about portues resetting the links.

The script works apart from Fixing libGL symlinks section, posted the errors above in the previous post.

devel , crippled_sources and blacklist are in the base folder

Root/text from porteus boot screen.

Login root/toor

change to USB drive /mnt/sdd4/

Run Nvidia

Run your script.

fulalas
DEV Team
DEV Team
Posts: 775
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Re: How to create a Nvidia driver xzm module

Post#21 by fulalas » 19 Feb 2017, 13:57

OK, I think I know what's going on: you probably formated your USB stick as FAT, and this kind of partition doesn't support symlinks.

Solution 1: copy the script to some Linux folder, like /home/guest, for example, and run it from there.
Solution 2: format your USB stick as NTFS. I recommend this option once you'll soon start to use rootcopy folder (subject for another topic, hahaha) and it'll require symlinks to work properly ;)

Bogomips
Full of knowledge
Full of knowledge
Posts: 2563
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: How to create a Nvidia driver xzm module

Post#22 by Bogomips » 20 Feb 2017, 01:33

You guys seem to be making such heavy weather of it all. :wall: Immediately nvidia script finishes, just have to save-changes, I would have thought. 8)
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

fulalas
DEV Team
DEV Team
Posts: 775
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Re: How to create a Nvidia driver xzm module

Post#23 by fulalas » 20 Feb 2017, 02:05

It's not always that simple :)

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: How to create a Nvidia driver xzm module

Post#24 by Evan » 20 Feb 2017, 06:16

fulalas wrote:OK, I think I know what's going on: you probably formated your USB stick as FAT, and this kind of partition doesn't support symlinks.
You're right , just checked and its Fat32 , when i get a chance i'll change it and try again.
Bogomips wrote:You guys seem to be making such heavy weather of it all. :wall: Immediately nvidia script finishes, just have to save-changes, I would have thought. 8)
I was doing that to start with but as fulalas says you just get a load of broken symlinks and step 11 of the guide doesn't work , his script moves things around and re-links them.

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: How to create a Nvidia driver xzm module

Post#25 by Evan » 20 Feb 2017, 12:14

Ext4 partition as the temporary work space fixed all the problems , the script ran perfectly. :)

I'm pushed for time but a quick boot to desktop and everything seems to be working ok and step 11 now runs without any errors.

Thanks ever so much for taking the time to help me through this , i really do appreciate it.

fulalas
DEV Team
DEV Team
Posts: 775
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Re: How to create a Nvidia driver xzm module

Post#26 by fulalas » 20 Feb 2017, 22:41

Great news! :)

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: How to create a Nvidia driver xzm module

Post#27 by Evan » 24 Feb 2017, 06:06

fulalas wrote:format your USB stick as NTFS. I recommend this option once you'll soon start to use rootcopy folder (subject for another topic, hahaha) and it'll require symlinks to work properly ;)
Rootcopy folder looks interesting for keeping things up to date like Ublock Origin's Block list without having to make a new module , so i'll have to venture down that road at some point. :)

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: How to create a Nvidia driver xzm module

Post#28 by Evan » 25 Feb 2017, 08:14

I think you may have gone too crazy with the folder cleaning. :D

Not sure if it's because mimeinfo.cache is being removed or something else but there is panel menu icon corruption taking place.

Nvidia settings in menu doesn't have a Icon and other icons like gftp are different , pdf has lost it's icon and xzm files are no longer a blue and have a grey icon.

I've made quite a few modules the last few days playing around with stable and beta driver versions and it's exactly the same each time , the Nvidia module is added to a freshly written Cinnamon usb drive with nothing changed.

I've not had a chance to hash out sections of the script yet to find what is causing it.

fulalas
DEV Team
DEV Team
Posts: 775
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

Re: How to create a Nvidia driver xzm module

Post#29 by fulalas » 25 Feb 2017, 09:42

Hmmmm... If you reboot without loading Nvidia driver module everything went back to normal?

It's strange because I've been testing this script for at least 3 months, in 3 different machines and had no problem so far.

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: How to create a Nvidia driver xzm module

Post#30 by Evan » 25 Feb 2017, 09:53

It only happens when that module is added , but i'll go and try it without to confirm and report back in a few mins.

Post Reply