nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14)
-   -   Easy nVidia driver update and installation (http://www.nvnews.net/vbulletin/showthread.php?t=132039)

AwesomeTux 04-26-09 03:51 AM

Easy nVidia driver update and installation
 
I call it "nDrivia" it is a _very_ simple shell/bash/terminal script.

Code:

# sudo chvt 1 #

echo 'NOTE: BY RUNNING THIS SHELL/BASH/TERMINAL SCRIPT, YOU AGREE THAT WE ARE NOT RESPONSIBLE FOR ANY DAMAGES, YOU AGREE THAT YOU ARE RUNNING THIS AT YOUR OWN RISK! This shell/bash/terminal script only runs the necessary commands, in their necessary order, to install nVidia Linux video card drivers, then restart GDM and the GUI (Graphical User Interface.)';
echo
sleep 8

sudo /etc/init.d/gdm stop
/etc/init.d/gdm stop
clear

cd ~/Desktop/
sudo ./NVIDIA-Linux-*-*-pkg*.run
clear

echo "Hope that did the trick for you! Let's see...";
echo
echo Restarting the Graphical User Interface!
sleep 4

/etc/init.d/gdm start
sudo /etc/init.d/gdm start
exit

Take that code, and save it as a .sh file on your Desktop, Documents, filesystem, or as I would do it in /usr/bin, so all I have to do is type in the "command" "sudo ndrivia"

Here's what'll happen. If you place it in /usr/bin. You have to have/download only ONE nVidia driver .run files on/to your Desktop. You have to press Ctrl+Alt+F1, it'll ask for your password, then type "sudo ndrivia" It'll ask for your password. Then It'll display this for 8 seconds...

Quote:

NOTE: BY RUNNING THIS SHELL/BASH/TERMINAL SCRIPT, YOU AGREE THAT WE ARE NOT RESPONSIBLE FOR ANY DAMAGES, YOU AGREE THAT YOU ARE RUNNING THIS AT YOUR OWN RISK! This shell/bash/terminal script only runs the necessary commands, in their necessary order, to install nVidia Linux video card drivers, then restart GDM and the GUI (Graphical User Interface.)
It'll then stop GDM, and run the nVidia installer. When the nVidia installer is finished, it'll display this for 4 seconds...

Quote:

Hope that did the trick for you! Let's see...

Restarting the Graphical User Interface!
It'll start GDM. And if you picked the right nVidia driver for your card(obviously) all should work.

NOTE: You might have to modify the code slightly, for example, to stop KDM, or for other KDE or Fedora/etc. things. This script is designed for GNU/Linux. And you should only have ONE nVidia driver .run file on your Desktop when running this script.

NvFuchs 04-28-09 06:26 AM

Re: Easy nVidia driver update and installation
 
Sorry, but this is a rather bad idea from so many different point of views ...

(List is not complete, but these are probably the worst issues)

First of all, the script is not dynamic at all.
As you say by yourself, it is only for gdm, plus for distributions that have a /etc/init.d/gdm

Then: You are using sudo in the file, even though

a) sudo is not available on all distributions
b) sudo probably prompts for a password for most of the actions

You say that you run this script already with sudo, so all the sudos used are nonsense anyway.

It is a security risk, as you assume that the right binaries are the first ones taken from $PATH, and you are using too much wildcards in my opinion.

You have no shebang line, so you have to tell the script which interpreter it has to use.

There are errors in the script, you start gdm twice in the worst case. (Which, depending on gdm, will even work, but create something the user doesn't want)

And, most of all: Installing the driver that way fails on the most popular distributions. Even worse, it will break up the system at least on *Ubuntu, SuSE and Fedora, as there are additional steps are necessary.

Fuchs

artem 04-28-09 01:26 PM

Re: Easy nVidia driver update and installation
 
1) Stopping GDM doesn't mean that your X session will be terminated automatically.
2) There's no need for 'exit' at the end of the script.
3) You'd better add #! /bin/bash to the beginning, as ****s said.
4) I don't really understand why you stop and start gdm twice. Normal users are not allowed to stop/start system services, as such "/etc/init.d/gdm stop|start" will not work and are unnecessary.
5) I won't recommend using this script to anyone who uses already mentioned distros (or better say any distros which have an ability of automatic updates and packet managers), because Xorg-server or/and Mesa updates will render system unstable/unusable. NVIDIA drivers do mess up with some system libraries (and there's a reason for that).

AwesomeTux 04-29-09 01:36 AM

Re: Easy nVidia driver update and installation
 
Well... FIX IT, IMPROVE IT. So we can all have a really easy way to install the latest nVidia drivers. I'm a free software advocate. Maybe the final script will be incorporated into the drivers themselves.

I'll also point out "If you can't say anything nice, don't say anything at all."

NvFuchs 04-29-09 03:14 AM

Re: Easy nVidia driver update and installation
 
Quote:

Originally Posted by AwesomeTux (Post 1994107)
Well... FIX IT, IMPROVE IT.

The idea behind it is broken, not only the script. And this is something we can't fix.

Quote:

So we can all have a really easy way to install the latest nVidia drivers.
We do have a really easy way to install the drivers: Using the packages provided by the distributions. This is, in my humble opinion, the only correct way of doing it.

If a distribution package manager does not think that the latest driver is ready for being included in the standard distribution, then he is probably right. Normal users, who would be the targeted audience for such a script, should never install it then.

If you want to help, then create packages of the latest driver. This is the correct way of handling such things.

It is almost impossible to write a bash script for that. There are hundreds of distributions out there, which handle init scripts, configurations, modules, xdm|gdm|kdm, X, ... completely different. You would have to write a one for all script, which will be almost impossible to maintain.

That's why there are packages, they take care of distribution specific stuff.


Quote:

I'm a free software advocate. Maybe the final script will be incorporated into the drivers themselves.
I don't think so. The driver installer does now include the possibility of adding distribution specific hooks, and we have package management solutions for linux.

As said, the bash script would be unmaintainable, huge and still a bad idea.

Quote:

I'll also point out "If you can't say anything nice, don't say anything at all."
Bad idea. Because that way nobody would criticize bad ideas, and all those bad ideas would be implemented (This can be applied not only to software, but also business, clubs, politics, ...). We told you _why_ it is bad, this is the important difference. This is what we call "productive criticism" here. It helps to improve things. As a free software advocate you should be aware that this kind of criticism is wide spread, just read the Kernel Mailing List as a good example.

Fuchs

AwesomeTux 04-29-09 04:51 AM

Re: Easy nVidia driver update and installation
 
Quote:

Originally Posted by NvFuchs (Post 1994130)
The idea behind it is broken, not only the script. And this is something we can't fix.



We do have a really easy way to install the drivers: Using the packages provided by the distributions. This is, in my humble opinion, the only correct way of doing it.

If a distribution package manager does not think that the latest driver is ready for being included in the standard distribution, then he is probably right. Normal users, who would be the targeted audience for such a script, should never install it then.

If you want to help, then create packages of the latest driver. This is the correct way of handling such things.

It is almost impossible to write a bash script for that. There are hundreds of distributions out there, which handle init scripts, configurations, modules, xdm|gdm|kdm, X, ... completely different. You would have to write a one for all script, which will be almost impossible to maintain.

That's why there are packages, they take care of distribution specific stuff.




I don't think so. The driver installer does now include the possibility of adding distribution specific hooks, and we have package management solutions for linux.

As said, the bash script would be unmaintainable, huge and still a bad idea.



Bad idea. Because that way nobody would criticize bad ideas, and all those bad ideas would be implemented (This can be applied not only to software, but also business, clubs, politics, ...). We told you _why_ it is bad, this is the important difference. This is what we call "productive criticism" here. It helps to improve things. As a free software advocate you should be aware that this kind of criticism is wide spread, just read the Kernel Mailing List as a good example.

Fuchs

One: It is something easily fixed. It works 100% for me as is.

Two: With the video card I have now, if I wanted to play games and/or run Compiz on Ubuntu, CentOS, Damn Small Linux, Debian, Elive, FaunOS, Fedora, Foresight, Gentoo, GoblinX, gOS, Knoppix, Linspire, Freespire, Linpus, Mint, Mandriva, openSUSE, Openwall, Paldo, Pardus, Parsix, PC/OS, PCLinuxOS, Puppy, Red Hat, Sabayon, Sidux, SimplyMEPIS, Slackware, Slax, Yoper, Zenwalk, etc., etc., I couldn't because the latest stable nVidia drivers aren't in the repositories. And having the user do without drivers ISN'T an option.

Three: The terminology behind "If you can't say anything nice, don't say anything at all" is "Only products that receive positive review are worthy of existence" so, not enough positive opinions or attention at all, the product or in this case feature isn't included.

NvFuchs 04-29-09 05:27 AM

Re: Easy nVidia driver update and installation
 
Quote:

Originally Posted by AwesomeTux (Post 1994148)
One: It is something easily fixed. It works 100% for me as is.

On your system, your distribution, yes.

I can give you at least 3 popular distributions where it won't work, plus mine (which is Gentoo, I don't count it as too popular)

Let's see what has to be adapted only for gentoo: sudo is not part of a "normal" gentoo installation (if such a thing even exists). Neither /etc/init.d/gdm nor /etc/init.d/kdm exist.

The manual installation might screw up the libraries, as usually with gentoo you have them in a special place, and by using eselect you can choose which ones to use.

Now just multiply those changes (because the amount of work needed is probably +/- the same) by distributions available, and you see the problem.

Quote:

Two: With the video card I have now, if I wanted to play games and/or run Compiz on Ubuntu, CentOS, Damn Small Linux, Debian, Elive, FaunOS, Fedora, Foresight, Gentoo, GoblinX, gOS, Knoppix, Linspire, Freespire, Linpus, Mint, Mandriva, openSUSE, Openwall, Paldo, Pardus, Parsix, PC/OS, PCLinuxOS, Puppy, Red Hat, Sabayon, Sidux, SimplyMEPIS, Slackware, Slax, Yoper, Zenwalk, etc., etc., I couldn't because the latest stable nVidia drivers aren't in the repositories. And having the user do without drivers ISN'T an option.
For gentoo: they are (and it is easy to write a ebuild for the short time where they are not). For the others: create packages for them. You can't have a one-for-all script, so the best option is packages.

If you have too much time at hand, just install half of the distributions you just mentioned in virtual machines and look at the adaptions needed for your script. Then you might see the problem.

Quote:

Three: The terminology behind "If you can't say anything nice, don't say anything at all" is "Only products that receive positive review are worthy of existence" so, not enough positive opinions or attention at all, the product or in this case feature isn't included.
So you prefer to shut people up instead of hearing productive criticism, noted. You will forget about your script if you don't receive (enough) positive feedback here: noted.

Fuchs

AwesomeTux 04-29-09 06:10 AM

Re: Easy nVidia driver update and installation
 
Quote:

Originally Posted by NvFuchs (Post 1994153)
On your system, your distribution, yes.

I can give you at least 3 popular distributions where it won't work, plus mine (which is Gentoo, I don't count it as too popular)

Let's see what has to be adapted only for gentoo: sudo is not part of a "normal" gentoo installation (if such a thing even exists). Neither /etc/init.d/gdm nor /etc/init.d/kdm exist.

The manual installation might screw up the libraries, as usually with gentoo you have them in a special place, and by using eselect you can choose which ones to use.

Now just multiply those changes (because the amount of work needed is probably +/- the same) by distributions available, and you see the problem.



For gentoo: they are (and it is easy to write a ebuild for the short time where they are not). For the others: create packages for them. You can't have a one-for-all script, so the best option is packages.

If you have too much time at hand, just install half of the distributions you just mentioned in virtual machines and look at the adaptions needed for your script. Then you might see the problem.

All that yammer is bull****. It is a _very_ easy thing to accomplish. It'll just take so much longer if I have to do it alone.

Quote:

So you prefer to shut people up instead of hearing productive criticism, noted. You will forget about your script if you don't receive (enough) positive feedback here: noted.
And I will continue to use this script, but I won't post it again or recommend it to someone if people (elsewhere not just here) don't think it's a good start to a good idea. There seems to be an abundance of people like you here. Who are just as corrupt as nVidia is.

DeiF 04-29-09 07:15 AM

Re: Easy nVidia driver update and installation
 
This script won't work for me (using openSuSE).

"/etc/init.d/gdm" doesn't exist. Would work probably with "/etc/init.d/xdm", but then it would kick the user from the graphical interface, which is bad.

"~/Desktop" is not where my desktop is, it's in "~/Escritorio". I rename every English directory in my "/home" to Spanish to match the rest of my desktop language. Then I change the default location in KDE4 SystemSettings.

Also, I don't put my downloaded files in the desktop, as I find more convenient to put them in "~/Documents/Downloads" (translated to Spanish, of course).

And I'm not sure if this line would install one or all the downloaded NVIDIA drivers in the directory. I usually have plenty of them to compare between versions.
"sudo ./NVIDIA-Linux-*-*-pkg*.run"


The ideal example of installation would be this:
  • User downloads the driver from NVIDIA's site. The user knows where the file is (desktop, download folder, etc)
  • User clicks on the file.
  • A nice installation dialog appears. The user is prompted with the root password. The installation begins.
  • The dialog prompts the user to reboot the graphical interface: "Pess here to reboot GUI"
  • The desktop flashes for a bit and then the user logs in again with all working.

Anything more complicated than this (for the users) is not worth the effort, as distros usually have an easy way to install the NVIDIA driver.

The drivers listed in the forum are all beta drivers anyway (even the "stable" ones).

AaronP 04-29-09 12:59 PM

Re: Easy nVidia driver update and installation
 
Quote:

Originally Posted by DeiF (Post 1994176)
The ideal example of installation would be this:
  • User downloads the driver from NVIDIA's site. The user knows where the file is (desktop, download folder, etc)
  • User clicks on the file.
  • A nice installation dialog appears. The user is prompted with the root password. The installation begins.
  • The dialog prompts the user to reboot the graphical interface: "Pess here to reboot GUI"
  • The desktop flashes for a bit and then the user logs in again with all working.

This is, unfortunately, not possible for nvidia-installer to do. For the same reasons mentioned here, there is no reliable way of shutting down the X server, performing some installation steps, and then starting it up again from a script (or program like nvidia-installer) that will work on all Linux distributions. This is one of the reasons that nvidia-installer insists on the X server being stopped first.

That said, I'm considering relaxing that restriction and allowing nvidia-installer to run while X is running if it can successfully unload the nvidia.ko kernel module, for example, if you're using the nv or vesa drivers and there are no OpenGL or CUDA applications running. If you'd like to give that a try, you can pass the --no-x-check option to the installer. Please note that it will fail if it can't unload the kernel module, so if the driver is still in use, that's expected. Distribution-provided packages have an advantage here because they know that their kernel modules will work with the installed kernel. nvidia-installer doesn't have that luxury and must test-load the module to make sure it works.

If installing the nvidia driver while X is running with a different driver proves reliable, then I'll look at what it would take to add a graphical installer front-end.

mooninite 04-29-09 02:35 PM

Re: Easy nVidia driver update and installation
 
AaronP,

Could you build something into the nvidia module that allows temporary suspension of resources of the module? It could "suspend" the X session long enough to allow access to the card resources required by the new module, load/unload the new module, then let the old module resume the session. This is done without unloading the original nvidia.ko from the kernel.

I imagine the screen would go black for 1-2 seconds during this process.

AaronP 04-29-09 02:55 PM

Re: Easy nVidia driver update and installation
 
Quote:

Originally Posted by mooninite (Post 1994586)
AaronP,

Could you build something into the nvidia module that allows temporary suspension of resources of the module? It could "suspend" the X session long enough to allow access to the card resources required by the new module, load/unload the new module, then let the old module resume the session. This is done without unloading the original nvidia.ko from the kernel.

I imagine the screen would go black for 1-2 seconds during this process.

I actually thought about that for a while, and the answer is not really -- we could probably test-load the module with a different name, but one of the things it tests is whether the device probe routine is called correctly, and that wouldn't work. Also, even if we could suspend things for a while, there's no way to unhook and replace the X driver in a running X server so you'd still have to completely restart the X server anyway. Finally, while a VT switch will work to clear out the X driver and direct-rendering OpenGL and VDPAU clients, there's nothing similar that would work for CUDA apps, so having any of those running would still prevent the kernel module from being unloaded.


All times are GMT -5. The time now is 09:22 AM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.