LNVHW - Load NVIDIA (driver the) Hard Way from runlevel 3 - Version 1.46

Version 1.46 of LNVHW works with openSUSE 12.2 and will validate the existence of the NVIDIA drivers and for user input. LNVHW is a bash script designed to install the nVIDIA proprietary video driver the Hard Way, which is not hard. LNVHW now supports full color with a new color engine that works in RunLevel 3. In Version 1.46, I have added the ability to run the driver install with the following options shown below and now include the ability to install nVIDIA driver patch files. After installing a Patch, please rerun LNVHW to install the newly patched driver filer.

LNVHW will blacklist the nouveau driver for you on a successful nVIDIA driver installation. If the nVIDIA driver install exits with a error code higher than 0, it will be displayed for you. To get the nVIDIA driver to want to load you must have used the kernel load command called** nomodeset** when you started openSUSE or you set the kernel option No KMS in Initrd (from YaST Sysconfig) and restarted openSUSE. Then finally, you used the kernel load option 3, to switch to run level 3 or you used the init 3 terminal command as root to unload the desktop and switch to run level 3. For more info on getting into Run Level 3, have a look at my blog on the subject below:

How to Start openSUSE 12.2 with Grub 2 into Run Level 3 - Blogs - openSUSE Forums

I have determined that you can keep the lnvhw file in the /usr/local/bin folder. Copy and past the following text into the file lnvhw (as in /usr/local/bin/lnvhw). You MUST be a root user to complete this task. The lnvhw bash script is too large to be posted here and is in SUSE Paste at the following location below:

LNVHW - Load NVIDIA (driver the) Hard Way from runlevel 3 - Version 1.46

It is possible to directly download the script from SUSE Paste using the following commands (You must delete the old version of lnvhw first). Just open up a terminal session and copy the text from any code block show here and past it after the terminal prompt and then press enter:

sudo rm /usr/local/bin/lnvhw
sudo wget -nc http://paste.opensuse.org/view/download/40288603 -O /usr/local/bin/lnvhw

Next, you need to mark the file lnvhw as executable with the following command:

sudo chmod +x /usr/local/bin/lnvhw

You can add all three commands above and run it as one. Just copy and paste the following command into a terminal session:

sudo rm /usr/local/bin/lnvhw ; sudo wget -nc http://paste.opensuse.org/view/download/40288603 -O /usr/local/bin/lnvhw  ; sudo chmod +x /usr/local/bin/lnvhw 

To use lnvhw, download the most recent nVIDIA driver to your downloads folder from Welcome to NVIDIA - World Leader in Visual Computing Technologies, restart your PC into runlevel 3, log in as root and run the terminal command:

lnvhw

You MUST edit the LNVHW bash script file and enter where you have downloaded the nvidia driver files. Since lnvhw is being placed into a system folder, you must enter the root user password in order to change/edit the following line(s):

#
# Where do you keep your nVidia driver downloads?
# Please Make Sure this name is correct - Do not include a "/" at the end...
#
nVidia_folder=**/home/username/Downloads**

Look at these lines and modify if you wish:

#
# How do you want to restart your PC when done loading the driver?
# The default is REBOOT="reboot" but can also be set for another program
# like REBOOT="fastboot" or REBOOT="pbs" are two example bash scripts.
#
REBOOT="reboot"

To edit the LNVHW bash script after it is installed, run one of the following commands:

For KDE or GNOME do Alt-F2 and then enter:

For KDE:** kdesu kwrite /usr/local/bin/lnvhw**

OR

For GNOME: **gnomesu gedit /usr/local/bin/lnvhw**

For more information on installing the nVIDIA driver the hard way, please consult the following web link:
SDB:NVIDIA the hard way - openSUSE

In order to install the nVIDIA proprietary video driver, you need to already have the driver you want down loaded in your Downloads folder and you need to be in run level mode 3. With the advent of systemd in openSUSE 12.1, run levels don’t mean the same that they used to, but the command still works as required and the lnvhw bash scripts still is able to confirm you are in the correct mode. Normally, I am reloading the nVIDIA driver because I just updated or replaced my Linux kernel, but you can just update the driver without having a kernel version change.

If you are running in a desktop and want to install the latest nVIDIA driver you have downloaded and you have not changed or updated your kernel version, then do the following:

For KDE you can use:

Alt F2: **kdesu /sbin/init 3**

For GNOME you can use:

Alt F2: **gnomesu /sbin/init 3**

In openSUSE 12.1, you may need to press enter once to get a login prompt. At the login prompt then:

login: root
password:
lnvhw
<nVIDIA driver loads>
logout
login: username
password:
sudo /sbin/init 5

If you have changed or upgraded your kernel, then you need to restart your PC so that the new kernel will be loaded and you stop at runlevel 3, not loading your desktop. A great way to do this is to use my FastBoot and asroot bash scripts (see links at the bottom of this page). Open up a terminal session and run the commands:

asroot fastboot 

The bash script asroot enters the root user password for you and fastboot brings up a menu of all of your openSUSE kernel load commands (minus any Windows entries). Enter the number**#** for the kernel you wish to use and press enter. Then enter the command A to add a kernel load option and then enter the number 3. A 3 will be added to your other existing kernel load options and then press a Y to restart your PC. Your PC will restart, but you will not load your desktop and you will end up at the terminal prompt. With openSUSE 12.1, its possible at the end you just need to press the enter key to get a login prompt. Then, follow these commands:

login: root
password:
lnvhw
<nVIDIA driver loads>
fastboot

If you have replaced the reboot command in lnvhw with fastboot, then just answer a Y for yes to reboot at the end of the bash script operation. Else, answer N for no to doing a reboot and enter the terminal command fastboot.

For anyone interested in using DKMS to automatically install the nVIDIA driver, have a look at this blog on the subject: S.A.N.D.I. - SuSE Automated NVIDIA Driver Installer

When you download/install lnvhw onto your PC, you do need to edit the text file to make sure your actual username in written into the script instead of the default, which is telling lnvhw where your NVIDIA video files are saved. You can use my SYSEdit Bash script to make this change after lnvhw has been downloaded from here. Have a look at the bash script here:

SYSEdit - System File Editor - Version 1.00 - Blogs - openSUSE Forums

Please enjoy using LNVHW and I want to hear all comments that you might have on the bash scripting file.

Thank You,

Blogs: asroot : C.F.U. : fewrup : nVIDIA : N.S.F. : S.A.K.C. : MMCHECK : S.C.L.U. : S.G.T.B. : S.K.I.M. : S.L.A.V.E. : S.L.R.C. : S.T.A.R.T. : SYSEdit

NEW!! LNVHW - Load NVIDIA (driver the) Hard Way from runlevel 3 - Version 1.20 will now blacklist the nouveau driver for you automatically if required.

Thank You,

Hi James,
I just took a look at the latest version of your script. I wonder if you could - for testing purpose - comment out the line “blacklist nouveau” from your /etc/modprobe.d/50-blacklist.conf and create the file /etc/modprobe.d/nvidia.conf with following content:

blacklist nouveau

I’m asking because the nvidia kernel module packages installed from repo includes this file. If that works this command would be enough to blacklist the nouveau driver:

echo “blacklist nouveau” > /etc/modprobe.d/nvidia.conf

No need to check. You can safely overwrite this file since it contains only this single line.

  • Don’t we have code tags here?

[QUOTE=please_try_again;bt268]Hi James,
I just took a look at the latest version of your script. I wonder if you could - for testing purpose - comment out the line “blacklist nouveau” from your /etc/modprobe.d/50-blacklist.conf and create the file /etc/modprobe.d/nvidia.conf with following content:

blacklist nouveau

I’m asking because the nvidia kernel module packages installed from repo includes this file. If that works this command would be enough to blacklist the nouveau driver:

echo “blacklist nouveau” > /etc/modprobe.d/nvidia.conf

No need to check. You can safely overwrite this file since it contains only this single line.

  • Don’t we have code tags here?[/QUOTE]

So I am aware of this fact and the nvidia.conf file, but the nVIDIA guide shows the method I am using AND, this command is not being written automatically in the manner you suggest when loading the driver the hard way. I think that it matters not as to which file it is written to or even if written to both, though you might wonder how to return to using the nouveau if blacklisted twice. So, I guess I would wonder why such a change would be important to you? And consider that since I take liberties to post your scripts encapsulated in mine, you can surely do the very same with the modifications that you suggest. I am just trying to go with what nVIDIA suggests.

As to the editor here in the blogs, I never had full control in a comment field either until I became a moderator. And no code or quotes before now for me worked. I think there are some issues as to how such capabilities are partitioned in the editor operation. Also, we keep seeing updates going down the line and little things here and there keep changing. Its like ripples in time going through the matrix around here. As always, I appreciate your suggestions and the time it takes to make them.

Thank You,

I didn’t say that it should be blacklisted twice. It would be blacklisted once in nvidia.conf. I mean, that’s how the nvidia package does.

>> So, I guess I would wonder why such a change would be important to you?

It is not. If I would talk about what is important to me, nobody would even listen. So I rather talk about what is not important.

>> I never had full control in a comment field either until I became a moderator. And no code or quotes before now for me worked.

Pfft!

>> I think that it matters not as to which file it is written to or even if written to both.

It doesn’t matter indeed. My comment was in fact about using one line of code instead of 10. Writing to another file is a side effect - or more precisely a condition.

When I used two kernels it was useful to install nvidia drivers with the -K option, why don’t use in LNVHW??
:slight_smile: ciao pla

So it is easy to modify the script to add the -K install option. For anyone who wonders what it means:

-K, --kernel-module-only
Install a kernel module only, and do not uninstall the existing driver. This is intended to be used to install kernel modules for additional kernels (in cases where you might boot between several different kernels). To use this option, you must already have a driver installed, and the version of the installed driver must match the version of this kernel module.

So you could install the driver into additional kernels, after you have installed it once and have it working, but I would not add this option in by default. But of course, you are free to add it into your copy of you wish. Its the nice freedom of having the source code which you can modify to suite your own needs.

Thank You,

LNVHW - Load NVIDIA (driver the) Hard Way from runlevel 3 - has been updated to Version 1.30 with new driver installation options. If you use lnvhw, you must download and install the latest version.

Thank You,

**LNVHW - Load NVIDIA (driver the) Hard Way from Run-level 3 has been upgraded to Version 1.40 **and now works in color using a new full color engine that works in Run-level 3 and more nVIDIA driver options have also been added.

Thank You,

LNVHW has been updated to version 1.45 with the new ability to install nVIDIA driver Patch files. Please see the following link for supported Patch file content which also works with the SANDI bash script. S.A.N.D.I. - SuSE Automated NVIDIA Driver Installer - Version 1.45 - Blogs - openSUSE Forums

Thank You,

Copy the text in the code block below into a text editor and save the text as the file: NVIDIA-295.49-302.07.patch

--- kernel/conftest.sh  2012-05-01 10:46:38.000000000 +0400
+++ kernel/conftest.sh  2012-05-04 22:19:39.463000001 +0400
@@ -512,7 +512,6 @@
             # and if it as an 'event' member.
             #
             echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
             #include <linux/pm.h>
             void conftest_pm_message_t(pm_message_t state) {
                 pm_message_t *p = &state;
--- kernel/nv-linux.h   2012-05-01 10:46:38.000000000 +0400
+++ kernel/nv-linux.h   2012-05-04 23:35:26.315000020 +0400
@@ -111,7 +111,6 @@
 #include <linux/timer.h>
 #include <asm/div64.h>              /* do_div()                         */
-#include <asm/system.h>             /* cli, sli, save_flags             */
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */
@@ -994,9 +993,19 @@
 #  define NV_IS_SUSER()                 capable(CAP_SYS_ADMIN)
 #  define NV_PCI_DEVICE_NAME(dev)       ((dev)->pretty_name)
 #  define NV_NUM_CPUS()                 num_online_cpus()
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+# include <asm/system.h>
 #  define NV_CLI()                      local_irq_disable()
 #  define NV_SAVE_FLAGS(eflags)         local_save_flags(eflags)
 #  define NV_RESTORE_FLAGS(eflags)      local_irq_restore(eflags)
+#else
+# include <asm/irqflags.h>
+# define NV_CLI()                       arch_local_irq_disable()
+# define NV_SAVE_FLAGS()                arch_local_save_flags()
+# define NV_RESTORE_FLAGS(eflags)       arch_local_irq_restore(eflags)
+#endif
+
 #  define NV_MAY_SLEEP()                (!irqs_disabled() && !in_interrupt() && !NV_IN_ATOMIC())
 #  define NV_MODULE_PARAMETER(x)        module_param(x, int, 0)
 #  define NV_MODULE_STRING_PARAMETER(x) module_param(x, charp, 0)
--- kernel/nv-pat.c     2012-04-27 22:50:12.000000000 +0400
+++ kernel/nv-pat.c     2012-05-04 23:48:45.842000011 +0400
@@ -109,7 +109,11 @@
         return;
 #endif

+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
     NV_SAVE_FLAGS(eflags);
+#else
+    NV_SAVE_FLAGS();
+#endif
     NV_CLI();
     nv_disable_caches(&cr4);

@@ -135,7 +139,11 @@
         return;
 #endif

+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
     NV_SAVE_FLAGS(eflags);
+#else
+    NV_SAVE_FLAGS();
+#endif
     NV_CLI();
     nv_disable_caches(&cr4);

For users of the new Kernel 3.4, this patch can be loaded into LNVHW to create a usable custom copy of the nVIDIA driver 295.49 or the beta 302.07 version of the nVIDIA proprietary video driver.

Links to these driver versions are here: Installing the nVIDIA Video Driver the Hard Way - Blogs - openSUSE Forums

Thank You,

I’ve the repository Nvidia driver already installed.
Do I have to remove the old driver before installing the new one?
Very good job.
Regards …

[QUOTE=PiElle;bt504]I’ve the repository Nvidia driver already installed.
Do I have to remove the old driver before installing the new one?
Very good job.
Regards …[/QUOTE]

So strictly speaking, loading a newer nVIDIA driver will replace the older one. However, if you were using the repository method before and now want to switch to the “Hard Way”, I do suggest you remove any such entries from YaST, for both the repository added and the nVIDIA packages installed. The one exception is it is OK to leave nvidia-settings package installed from YaST. Otherwise, if you have installed an older nVIDIA driver the hard way and want to install a newer nVIDIA driver the hard way, there is no need to uninstall the older driver first, it will be replaced by the new one. Only if you wish to switch back to the open source driver do you need to uninstall the nVIDIA driver that was loaded from YaST or the Hard Way. Further, you need to remove the nomodeset command from your Grub menu.lst file and you need to stop blacklisting the nouveau driver from the /etc/modprobe.d/nvidia.conf config file.

Thank You,

jdmcdaniel3, you’re brilliant! :slight_smile:
I’ve upgraded my openSUSE 12.1 installation to kernel 3.5.0-1-desktop and installed the Nvidia driver 295.59 via LNVHW.
Your script took care of everything!
Also I find your articles and blogs about kernel, drivers and scripts VERY useful!
Keep up the good work!
Best regards! rotfl!

[QUOTE=PiElle;bt513]jdmcdaniel3, you’re brilliant! :slight_smile:
I’ve upgraded my openSUSE 12.1 installation to kernel 3.5.0-1-desktop and installed the Nvidia driver 295.59 via LNVHW.
Your script took care of everything!
Also I find your articles and blogs about kernel, drivers and scripts VERY useful!
Keep up the good work!
Best regards! rotfl![/QUOTE]

You are very welcome and thanks so much for your very kind words.

Thank You,

James, I’m getting ready to install 12.2 and am reviewing my procedures, including LNVHW which I’ve had good success with in the past. In reviewing this post I found the link http://forums.opensuse.org/forums/blogs/jdmcdaniel3/how-start-opensuse-12-2-grub-2-into-run-level-3-112/ to be invalid. There’s an extra ‘forums’ in there. I found the correct post on a search.

The correct address no longer contains the word /forums in it though no one fesses up in removing/modifying the link reference. I have no idea what happened, but in our ongoing effort to provide better service to all, the correct link is as follows.

How to Start openSUSE 12.2 with Grub 2 into Run Level 3 - Blogs - openSUSE Forums

Thank You,

I am using Opensuse TW version. I do not use your script. I tried to uninstall Nvidia driver and use Nouveau yesterday. After several attempts it looks than Nvidia driver automatically set NO-KMS-IN-INITRD = yes and blacklist nouveau by creating /etc/modprobe.d/nvidia.conf file (there is a command “blacklist nouveau”) . So perhaps there is no need to do anything except running a command sh NVidia…run.

The problem for me is, that I was not able to use Nouveau driver again. I set NO-KMS-IN-INITRD = no, deleted nvidia.conf file, deleted a command “blacklist nouveau” from /etc/modprobe.d/50-blacklist.conf. Reinstalling the old kernel did not help too. Perhaps I will try it again, with a new kernel 3.7.

[QUOTE=vta_128;bt619]I am using Opensuse TW version. I do not use your script. I tried to uninstall Nvidia driver and use Nouveau yesterday. After several attempts it looks than Nvidia driver automatically set NO-KMS-IN-INITRD = yes and blacklist nouveau by creating /etc/modprobe.d/nvidia.conf file (there is a command “blacklist nouveau”) . So perhaps there is no need to do anything except running a command sh NVidia…run.

The problem for me is, that I was not able to use Nouveau driver again. I set NO-KMS-IN-INITRD = no, deleted nvidia.conf file, deleted a command “blacklist nouveau” from /etc/modprobe.d/50-blacklist.conf. Reinstalling the old kernel did not help too. Perhaps I will try it again, with a new kernel 3.7.[/QUOTE]

Your observations are right on and correct. I can freely admit in order to test the nouveau after having installed the nVIDIA proprietary video driver I have had to reinstall openSUSE. The steps you list:

  1. I set NO-KMS-IN-INITRD = no
  2. deleted nvidia.conf file
  3. deleted a command “blacklist nouveau” from /etc/modprobe.d/50-blacklist.conf

AND I add

  1. Uninstall the nVIDIA driver
  2. Remove the nomodeset command from the grub legacy menu.lst or from the default grub file for grub 2 and rebuild the grub.cfg file

Some have claimed to be successful and good for them. But, even after these steps, you may be stuck and your video system messed up. So here are three more rules.

  1. Use the nouveau if at all possible.
  2. Install the proprietary nVIDIA to add features and speed but … consider it a one-way trip.
  3. Be prepared to REINSTALL openSUSE if the nVIDIA driver does work as you desire.

Consider that if you do a custom install and reuse ALL existing partitions, formatting only the root / and DO NOT FORMAT the /home partition, you will lose no personnel data. But, you must reinstall ALL applications and redo all systems settings such as system wide fonts, fstab settings and samba settings. Always ask for help before taking on such a task if you do not understand exactly what to do.

Thank You,

Thank you very much. I forget to write - I made point 4 - uninstall the nVIDIA driver. I did not know the point 5. I am surprised that it is so difficult to go back to Nouveau. It looks better to keep the proprietary Nvidia driver. Perhaps later I give a try. Thanks.