-   Linux - Newbie (
-   -   How to Install Nvidia Driver (

ryan20fun 05-30-2011 05:44 AM

How to Install Nvidia Driver
Hi All.
as you should know (from where im posting this) that im an Absolute noob at Ubuntu (ive been using Windows a Lot and wanted to see how hard it would be to include Ubuntu in my App / Game Dev)

now onto the question.
ive downloaded the Nvidia Drivers from there site and followed a Tutorial on how to install it, But i run into this error:
ERROR: nvidia-installer must be run as root

what should i do ?
where is this "root"
and forgive me if this has been asked, but i could not find a question / article / tutorial that got me past this error.

so Many Thanks in Advance.

TobiSGD 05-30-2011 07:14 AM

Since you are a newbie I would strongly recommend to install the driver from Ubuntu's repositories. You can use Ubuntu's driver installer for that. If you use the driver from the website you can run into serious troubles when updating the system.

To your question, in Ubuntu the root is user is disabled by default. If you want to execute a command as root user you have to put the command sudo in front of it, like this

sudo <Your-Command-Here>
You will be asked for your password, be aware that the password will not show up while typing and the cursor will not move. This is normal, just type your password and press Enter.

rylan76 05-30-2011 07:19 AM


"root" is the most privileged account available on your system. It is the "super user" the user who can do "anything" - delete any file, read any file, and execute any system maintenance task.

The Nvidia installer needs to be run "as root" because it needs to change and modify aspects of the system that, because they are critical to system operation, are only accessible to the root user - e. g. the most powerful user.

I've found that the best way to install the Nvidia "run" files for updating my Nvidia graphics driver is the following. I'm using Fedora, but the basics should remain the same for your distro. (Make sure you save .run file in your home folder, so you know where to get hold of it WITHOUT having the GUI (graphics mode) active.)


Make SURE you have your kernel source available!!! I'm not sure how you do this under Ubuntu, or where you get a hold of it, but you MUST have a "kernel-devel" pacakge installed that is for the kernel you are currently running! If you do NOT have this, you might have trouble installing the new Nvidia driver, or you might not be able to do an upgrade at all since the driver NEEDS your current kernel source to be available to compile against - if you're going to do this by hand, which is what I'm describing here...)

1. Open a terminal

Usually, if you're on the desktop of your system, there is a way to "open a terminal". What this means is that you need to find the icon of a terminal emulator program, like xterm or Konsole. These are usually to be found under "utilities" or "system tools". Look in your installation's menu and click on the relevant icon for the relevant terminal emulator.

2. You should now get a display or screen where you can type commands. The first thing to do is to type


Doing this will "turn you into" the root user. Note that you will need to provide your "root password" which you chose during installation of Ubuntu (I think.) Hope you remember what it is - type it in at the "Password:" prompt you should now see.

3. Once you've typed in the password you should get a new prompt that has a "#" at the end. On my system, when I'm root, it looks like this:


[root@stefanlinux ~]#
and when I'm a normal (non-root) user it looks like this:


[stefan@stefanlinux php]$
Note that, in my case "$" denotes I'm a normal user, "#" denotes I'm root - most likely your setup will do this too to let you know "who" you are while using the terminal.

4. What you now need to do is switch your system out of "GUI" mode to text mode, so that, in text mode, you can install the NVidia driver. To do this, at the # prompt you now have, type


vi /etc/inittab
and press enter.

5. BE CAREFUL: What you are now going to do is sensitive and if you make a mistake you can potentially make your Linux install completely unusable.

6. You should see something similar to this:


# inittab is only used by upstart for the default runlevel.
# System initialization is started by /etc/event.d/rcS
# Individual runlevels are started by /etc/event.d/rc[0-6]
# Ctrl-Alt-Delete is handled by /etc/event.d/control-alt-delete
# Terminal gettys (tty[1-6]) are handled by /etc/event.d/tty[1-6] and
# /etc/event.d/serial
# For information on how to write upstart event handlers, or how
# upstart works, see init(8), initctl(8), and events(5).
# Default runlevel. The runlevels used are:
#  0 - halt (Do NOT set initdefault to this)
#  1 - Single user mode
#  2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#  3 - Full multiuser mode
#  4 - unused
#  5 - X11
#  6 - reboot (Do NOT set initdefault to this)

7. Press the down arrow until the cursor is on the line that says:


8. Press the letter A on your keyboard. You'll note that very bottom line of the terminal window now should say "-- INSERT --" - this means you can now edit that line's text.

9. Place the cursor on the "5" in the line


and change the 5 to a 3, like so:


10. Press escape (ESC). Then type


to WRITE and QUIT the file.

11. What you've now done is change the runlevel of your system for the next boot. E. g. if you now reboot, you WON'T just go to the graphical desktop you now have, you'll go to TEXT MODE. That is what "id:3:initdefault" means - it means "start up in text mode, with no GUI active."

12. Now, reboot your system. Since you're root, at the "#" prompt, you should be able to just type "reboot":


[root@stefanlinux ~]# reboot
13. Your GUI should now shutdown and the system should reboot. If you dual-boot, select your Linux install when GRUB or Lilo comes up. Don't be alarmed if the system starts up in text mode, this is what you want.

14. Log in as root at the prompt. E. g. type "root" at the prompt, then the root password (e. g. the same one you used when typing "su" just now.

15. At the # prompt (See? it is the same one you saw when you typed "su" just a few moments ago, inside your terminal emulator) go to your home directory, where you saved the .run file (see the start of the reply above.)

E. g., on my system, to get to my home folder I'd do:


[root@stefanlinux ~]# cd /home/stefan/
16. Now you need to make the .run file executable, if it isn't already. In your home folder do


chmod a+x
and obviously, press ENTER (note you can just type the NV of "NVIDIA" (case sensitive) and press TAB and it should auto-compelete)

17. Once you've done the above, type the name of the .run file and press enter. This will start up the Nvidia installer itself.

18. Follow the onscreen prompts. The installer will check for an existing "kernel interface" for your kernel, if it finds one, great. If not, follow the prompts and allow it to compile a new kernel interface against your kernel. This is where the kernel source referred to above comes in - if it is in a standard location (as your kernel-source package hopefully installs, it should be) the installer will find it, but you might need to type the full path to the source if it cannot - I've got no idea where Ubuntu puts kernel sources if installed via the Ubuntu package management facilities).

19. Once the procedure is complete, the installer should report success.

20. Once you're back in the text terminal, again edit the /etc/inittab file as detailed above. Only now, change the "3" in the line



back to a 5, like so:


and wq! the file.

21. Again type reboot. You've now switched back from "boot into text mode" (3) to "boot into GUI mode" (5).

22. Hopefully, when your system now starts up, it will be in GUI mode with the new Nvidia driver active...

ryan20fun 05-30-2011 07:26 AM

ok, will try that.

oh, i should have mentioned that i have downloaded and installed Ubuntu 11.X through the wubi under windows XP.

i also looked at the Additional Drivers Window, but it wanted to download the drivers and i dont have a fast internet connection spped (192BKs)

TobiSGD 05-30-2011 07:52 AM

@rylan76: Your HowTo will not work on Ubuntu for several reasons.

To your points:
2. Will not work, Ubuntu has not an activated root account by default.

4.-12. Will not work, Ubuntu is (like the most Debian based distros) using runlevel 2 by default. If you want to stop X from starting you have to do that by disabling the display-manager' startup.

The rest of your HowTo is for that reasons not really applicable.

As I said before, for a newbie I recommend strongly to let the driver installer install the drivers, or you will run into serious problems when the kernel or X is updated.

deto86 05-30-2011 08:17 AM

In Ubuntu, there is not a specific account as "root" but you can run command as a root(i mean, having the same permissions as root ) by prefixing "sudo" followed by your command i.e

sudo <your_command>
.It will ask you for the password.
Or else,you can run all commands as a root.In order to login as a root you can use

sudo su
Then make that nvidia binary executible which you have downloaded from the nvidia site.
This can be done by running

chmod +x
Then execute it by running

It will do the rest.Run


if it doesn't showed up during installation.

is optional since

will configure yr graphics card

ryan20fun 05-30-2011 12:55 PM


Originally Posted by deto86 (Post 4370925)
In Ubuntu, there is not a specific account as "root" but you can run command as a root(i mean, having the same permissions as root ) by prefixing "sudo" followed by your command i.e .It will ask you for the password.
Or else,you can run all commands as a root.In order to login as a root you can use .
Then make that nvidia binary executible which you have downloaded from the nvidia site.
This can be done by running
Then execute it by running
It will do the rest.Run and if it doesn't showed up during installation. is optional since will configure yr graphics card

what directory should i put the drivers under ?
because i tried the home folder and desktop but it keeps saying that no such command exits.
and i tried draging the run file to the console window but the best i can get it to do is have the same error as what i posted in my first post.
is there a simple script or something i can run that will install the drivers ?

deto86 05-30-2011 01:12 PM

There is no restriction of using any directory unless you have permission of that particular directory to access especially /root directory.
If you downloaded under desktop directory then you can use

cd /home/abc/Desktop
where abc is your user name.Then you can followed the above commands starting from

sudo su
Above method which I have explained can be used for almost all linux distros.
The above link explains about installing nvidia-driver in Ubuntu only.Try out if it works

John VV 05-30-2011 01:15 PM

what directory should i put the drivers under ?

the installer will put it where it belongs

BUT I WOULD RECOMMEND using the driver in the ubuntu repo

for the .run you MUST reinstall it for EVERY AND ALL kernel ,X11,and mesa updates
basicaly for EVERY major update you will have to reinstall
your system will boot ONLY into TEXT ONLY
there will be NO GUI TO USE TO REINSTALL THE .run

ryan20fun 05-30-2011 01:19 PM

nope, not working
this is what i did:
administrator@ubuntu:~$ cd /home/administrator/desktop
bash: cd: /home/administrator/desktop: No such file or directory
administrator@ubuntu:~$ sudo su
[sudo] password for administrator:
root@ubuntu:/home/administrator# command not found
root@ubuntu:/home/administrator# sudo
sudo: command not found
root@ubuntu:/home/administrator# chmod +x
root@ubuntu:/home/administrator# sudo su
Unknown id:

so what am i doing wrong ?

i take it that in the additional drivers window:
when i click the activate button it will download and install the driver ?
if so, i could just leave my PC overnight to do that.

repo 05-30-2011 01:20 PM


administrator@ubuntu:~$ cd /home/administrator/desktop
It's Desktop, with capital D

Kind regards

ryan20fun 05-30-2011 01:43 PM

nope still not working, do i have to do anything special to get it to install ?
because ive tried all sorts of stuff in the terminal window and the best i can get is
ERROR: nvidia-installer must be run as root
and that is from the nvidia .run file

repo 05-30-2011 01:57 PM


ERROR: nvidia-installer must be run as root
In the terminal type:

cd /home/administrator/Desktop
sudo ./

Kind regards

John VV 05-30-2011 02:17 PM

for the .run if you REALLY want to use it
copy it to /
that way it is easy to find ( you need to be root to copy it there )
when you dl'ed it in ff it automatically dl'ed it to Downloads - in your home folder

cd ~/Downloads
cp *.run /
telinit 3 /* or 2 for a debain based distro */

relogin as root in the text only screen

cd /
sh *.run

fallow the onscreen instructions
then repeat EVERY TIME you have a kernel update
but there will be NO gui to use
only the text only terminal

deto86 05-30-2011 10:26 PM

Did you follow the link of webupd8? I think it configure my nvidia card on other PC.Most of the Ubuntu user installed the driver for their nvidia card through third-party repo instead of downloading from nvidia official site and the configure.
And after installationfrom their respective repo,you need to activate this additional driver in System->Preference/Administration(I'm not remembering exactly) after a reboot

In Ubuntu there is no point in running "telinit" as Ubuntu doesn't have "/etc/inittab" file.So fix runlevel

All times are GMT -5. The time now is 10:01 PM.