LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 12:48 PM   #1
m_yates
Senior Member
 
Registered: Aug 2003
Location: Upstate
Distribution: Debian, Mint, Mythbuntu
Posts: 1,249

Rep: Reputation: 101Reputation: 101
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, 01:53 PM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
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 ButterflyMelissa; 06-27-2013 at 01:55 PM.
 
Old 06-28-2013, 03:21 AM   #3
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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, 04:20 AM   #4
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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, 06:06 AM   #5
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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



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 03:50 PM
LXer: NVIDIA Publishes Open-Source 2D Driver Code LXer Syndicated Linux News 0 11-27-2012 09:50 AM
help with installing wireless driver(chipset realtek 8188CE)on debian wheezy chui1989 Linux - Hardware 3 09-28-2012 12:16 AM
[SOLVED] installing nvidia driver I get: ./nvidia-installer can't find lord_didger Debian 18 02-25-2011 12:48 PM
help editing xf86config for nvidia geforce mx440 after installing nvidia driver linguist Linux - Newbie 11 06-13-2006 06:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration