Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a equivalent of this command; yum list kernel-headers --showduplicates on Ubuntu with apt-get, apt-cache etc. The above command lists various versions of the kernel-headers rpm available on F20/RHEL or installations.

Closet I can get using apt-cache showpkg, not sure if there is a better way ?

$ apt-cache showpkg linux-image  
Package: linux-image  
Versions:   

Reverse Depends:  
  firmware-crystalhd,linux-image  
  systemtap,linux-image  
  fiaif,linux-image  
Dependencies:  
Provides:  
Reverse Provides:  
linux-image-3.13.0-27-lowlatency 3.13.0-27.50  
linux-image-3.13.0-27-generic 3.13.0-27.50  
linux-image-3.13.0-24-lowlatency 3.13.0-24.47  
linux-image-3.13.0-24-generic 3.13.0-24.47  
linux-image-3.13.0-24-lowlatency 3.13.0-24.46  
linux-image-3.13.0-24-generic 3.13.0-24.46  

Expecting similar output:

$ yum list kernel-headers --showduplicates
Loaded plugins: langpacks, refresh-packagekit
Installed Packages
kernel-headers.x86_64 3.11.10-301.fc20 @fedora
Available Packages
kernel-headers.x86_64 3.11.10-301.fc20 fedora 
kernel-headers.x86_64 3.14.4-200.fc20 updates

This would help me simply do a downgrade or upgrade to a specific version.

share|improve this question
    
did you mean listing the version of all installed packages along with the package names? –  Avinash Raj May 29 at 11:43
    
Both installed and uninstalled, similar to the above command: –  askb May 29 at 11:45
    
Closest I could get was using`dpkg --list | grep linux-image` –  askb May 29 at 11:46
    
dpkg --list shows the details of all installed packages. –  Avinash Raj May 29 at 11:47

2 Answers 2

You have the correct command, except linux-image isn't a real package name.

$ apt-cache show linux-image
N: Can't select versions from package 'linux-image' as it is purely virtual
N: No package found

apt-cache showpkg should work for real packages, though. e.g.

$ apt-cache showpkg lyx
Package: lyx
Versions: 
2.1.0-1~trusty~ppa4 (/var/lib/apt/lists/ppa.launchpad.net_lyx-devel_release_ubuntu_dists_trusty_main_binary-amd64_Packages) (/var/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/apt/lists/ppa.launchpad.net_lyx-devel_release_ubuntu_dists_trusty_main_binary-amd64_Packages
                  MD5: 8c75d53cfd29c5b19c2172cb07b7fe9a

2.0.6-1build1 (/var/lib/apt/lists/ftp.iinet.net.au_pub_ubuntu_dists_trusty_universe_binary-amd64_Packages)

If you want to see all the versions of linux-image-like packages, you can just do a search, e.g.

$ apt-cache search linux-image | grep '^linux-image'

The problem is that the different versions of the kernel (linux-image) are in individual packages, and named independently according to the version. They are not all versions of the one package.


EDIT

This lists all available packages. To show which is installed, you can use dpkg -l. e.g.

$ dpkg -l lyx
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                           Version                      Architecture                 Description
+++-==============================================-============================-============================-==================================================================================================
ii  lyx                                            2.1.0-1~trusty~ppa4          amd64                        Document Processor

EDIT2

Another way to get information about different but similarly-named packages (e.g. linux-image*) is by using aptitude search.

$ aptitude search linux-image

You can also filter with grep using this awkward syntax to get around an aptitude bug/feature.

$ aptitude -w $COLUMNS search linux-image | grep '32 bit'

An i in the first column tells you that it's already installed. See man aptitude for the other characters.

share|improve this answer
    
the output which I get from yum clearly shows what is installed, uninstalled and available. –  askb May 29 at 12:10
    
Okay. You should probably add this to your question, since many Ubuntu users (including myself) don't know what output yum produces. I've added more info in the answer. –  Sparhawk May 29 at 13:18
    
@askb Thanks for the edit. As alluded to in my answer, I think part of the problem is that Ubuntu changes the name of each kernel depending on version, whereas Fedora uses the same name regardless of version. One advantage of the former is that you can have several versions installed at once, and rollback to an old version at grub if there are problems. In any case, the apt-cache search strategy should work. –  Sparhawk May 30 at 3:04
    
thanks for the response, with rpm based installations its possibly several version of kernel installed as long as the versions are diff, but this is normally not applicable for all packages in rpm based installation or not straight forward AFAIK. However, I am still trying to find a clean way, where I have get details of both the installed and available (in repos) pkgs on ubuntu, as far as apt-cache search idea goes, its applicable to only local packages and does not look into the repos. The closest i could get was with showpkg –  askb May 30 at 5:37
    
@askb No, apt-cache search looks in repos, not locally. AFAIK it doesn't tell you anything about locally installed packages. You need dpkg for that, as per my first edit. I've added in a second edit which is a single command applicable to kernels. –  Sparhawk May 30 at 6:09

Have you tried to to boot an old kernel, and in the terminal enter:

showpkg

and i think it might be in the boot, and all the kernel lays there, and this might work fine.

share|improve this answer
    
I'm not sure what this means. There is no /dirctory, /directory or /grub on my system, and no file called kernel-headers.list. Also, reading a local file will probably not tell you what remote versions are available. -1 (but I'll revert if you can clarify). –  Sparhawk May 30 at 3:03
    
I probably mean in /boot directory where the grub file lays. –  Michael May 30 at 9:23
    
I have no file at /boot/kernel-headers.list. However, you can derive a list of installed kernels from (e.g.) /boot/grub/grub.cfg, but again, this is only the locally installed kernels, not the remote versions in the repos. –  Sparhawk May 30 at 10:54
    
I do maybe no that it is the extension .cfg /boot –  Michael May 30 at 14:21
    
I went through all files from find /boot -name '*.cfg', but none of them contain information about remote versions of the kernel. –  Sparhawk May 31 at 0:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.