LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 06-27-2013, 01:48 PM   #1
m_yates
Senior Member
 
Registered: Aug 2003
Location: Upstate
Distribution: Debian, Mint, Mythbuntu
Posts: 1,176

Rep: Reputation: 54
Installing Nvidia driver in Wheezy...Can someone explain this code?


I'm setting up a Mythtv box at home using Debian Wheezy and I wanted the Nvidia drivers for VDPAU. In the past, I have installed Nvidia drivers manually downloaded from the Nvidia web site. This time, I found the following line of code from the Debian wiki:

Code:
aptitude -r install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') nvidia-kernel-dkms
To my surprise, this worked in one step. Upon reboot, the Nouveau driver was blacklisted and the Nvidia driver was installed and working.

I'm posting this with the hope that I can learn something, because I don't understand what the code above is doing. It seems I will never progress from being a newbie. I understand that the command is to install linux-headers for the currently installed kernel. What I don't understand is what the sed command is doing? Can someone break it down?
 
Old 06-27-2013, 02:53 PM   #2
Thor_2.0
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,220
Blog Entries: 23

Rep: Reputation: 279Reputation: 279Reputation: 279
If you'd type in
Quote:
uname -r
you get the version of your kernel, the sed command filters out the type...

And example

Quote:
uname -r
gives 3.2.0-48-generic
the line

Quote:
uname -r|sed 's,[^-]*-[^-]*-,,'
returns "generic" - the type of kernel I use here...

Sed has a lot more to offer as some tutorials indicate...

Thor

Last edited by Thor_2.0; 06-27-2013 at 02:55 PM.
 
Old 06-28-2013, 04:21 AM   #3
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 1,382

Rep: Reputation: Disabled
what uname -r returns and how useful it is really depends on the distro. With most Debian kernels, this would have worked just as well:

Code:
# aptitude -r install linux-headers-$(uname -r) nvidia-kernel-dkms
Or even
Code:
# aptitude -r install linux-headers-`uname -r` nvidia-kernel-dkms
 
Old 06-28-2013, 05:20 AM   #4
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,508

Rep: Reputation: 800Reputation: 800Reputation: 800Reputation: 800Reputation: 800Reputation: 800Reputation: 800
Quote:
Originally Posted by cynwulf View Post
what uname -r returns and how useful it is really depends on the distro. With most Debian kernels, this would have worked just as well:

Code:
# aptitude -r install linux-headers-$(uname -r) nvidia-kernel-dkms
Or even
Code:
# aptitude -r install linux-headers-`uname -r` nvidia-kernel-dkms
Might the method suggested by the wiki be advantageous because it installs the metapackage rather than the package for the specific kernel installed at that point in time? I have to say I don't want to go through the hassle of testing it but I wondered whether installing the package specific to the installed kernel may mean it is not updated when the kernel is?
 
1 members found this post helpful.
Old 06-29-2013, 07:06 AM   #5
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 1,382

Rep: Reputation: Disabled
Quote:
Originally Posted by 273 View Post
Might the method suggested by the wiki be advantageous because it installs the metapackage rather than the package for the specific kernel installed at that point in time? I have to say I don't want to go through the hassle of testing it but I wondered whether installing the package specific to the installed kernel may mean it is not updated when the kernel is?
You're absolutely right. I keep forgetting about the meta packages as I always run off my own kernels.

Code:
$ uname -r|sed 's,[^-]*-[^-]*-,,'
smp
Code:
$ uname -r
3.9.8-686-smp
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Debian Wheezy, laptop, Nvidia Driver installation, GeForce GT 540M Balazs Linux - Software 3 03-31-2013 04:50 PM
LXer: NVIDIA Publishes Open-Source 2D Driver Code LXer Syndicated Linux News 0 11-27-2012 10:50 AM
help with installing wireless driver(chipset realtek 8188CE)on debian wheezy chui1989 Linux - Hardware 3 09-28-2012 01:16 AM
[SOLVED] installing nvidia driver I get: ./nvidia-installer can't find lord_didger Debian 18 02-25-2011 01:48 PM
help editing xf86config for nvidia geforce mx440 after installing nvidia driver linguist Linux - Newbie 11 06-13-2006 07:31 AM


All times are GMT -5. The time now is 03:20 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration