TechFRP Search

Custom Search

Monday, December 20, 2010

Remove Extra Kernel Entries from Ubuntu

     Have you ever wondered how to remove extra kernel entries from Ubuntu after a kernel upgrade? That's what were going to talk about today. Ubuntu Update Manager is a great utility for keeping your system up to date with the latest in patches including upgrades of your Linux Kernel. It does this automatically for you without any further work on your part. It even goes so far as to leave the old Kernels in place if you would like to go back to them at some point. Over time though this can begin to take up space and if you use the Grub boot loader, can make your start screens very messy.

     To clean these Old kernel entries off of your hard drive and unclutter Grub's boot loader menu we'll need to go into the Synaptic Package Manager. The Synaptic Package Manager is your repository of all applications installed on your PC. From here you can add and remove applications from your PC.

     Go to the Menu called System and then Administration and finally click on Synaptic Package Manager.

     You'll be prompted for administrator "sudo" credentials. Enter your password.

     In this example we are going to remove the Linux kernel for version 2.6.32-25. To do this we'll need to find three packages to remove for version 2.6.32-25. Do not remove any other versions or any other package files than the ones for the version you want removed as it could be very bad.

     The three packages are:


     In Synaptic Package Manager enter the version number of the kernel you want to remove. In this case we'll enter "2.6.32-25". The following should be displayed.

     The three packages that make up the kernel are displayed and to further clarify I've highlighted in yellow. The Green squares also indicate that the packages are currently installed.

    To remove these packages click on the Green squares for each of the packages and select "Mark fo Removal" from the popup menu. Clicking the package "linux-headers-2.6.32-25" will also mark the "linux-headers-" for removal as well.

     Once all three packages have been marked for removal it will look like this.

     This is your last chance to make sure that the correct versions have been selected. Once you are ready simply click the "Apply" button and the 2.6.32-25 kernel will be removed. You'll be prompted to confirm, again. When ready click "Apply" again.

     If everything was successful you'll get the following screen.

     That's it. The old Linux Kernel has now been removed from you system freeing up disk space. The nice thing is that the removal of the Kernel from Synaptic Package Manager will automatically remove the entries from the Grub Boot Loader. When you reboot, Grub will now look like this.

     That's all there is to it. Just replace the kernel version number with the one you want to remove and follow the steps above.  As always, these steps have been tested in my lab setup and work correctly in my environment. If they don't work for you or you encounter problems with your PC, I take no responsibility for any problems you may encounter. That being said if you follow the steps outlined above you shouldn't encounter any problems.

     If you found this tip helpful, let me know, leave a comment. Thanks.

Friday, December 10, 2010

Change Grub Default OS in Ubuntu

     If you have Multiple Operating systems installed on your PC with Ubuntu/Linux then you're probably at least aware of the Grub Boot Loader. Grub, included with Ubuntu, automatically checks during installation for an Operating System already installed. If there is one, then Grub is automatically configured to allow you to choose which operating system to boot when you start your PC. It is a good tool and it does it's job well.

     After all Operating Systems are detected and you've rebooted you'll notice the Grub Boot Loader as the first thing after your hardware's load screens. Here's a sample of what it looks like below.

     In this example I don't have multiple operating systems installed but I do have Multiple Linux Kernels that you can choose to boot just like you would an Operating System. The Highlighted entry is the default instance created when Ubuntu was installed. You can see at the bottom that a Timer is counting down from 10 seconds. If you don't choose a different entry from the list within that time it will automatically start the default instance, in this case, Ubuntu with Linux Kernel 2.6.32-26.

     The great thing about Grub is that it is very customizable. One of the features you can customize is the Default OS entry. If for example I wanted to boot Ubuntu with Linux Kernel 2.6.32-25 instead by default, I can do this by changing the Grub.cfg file. Linux Kernel 2.6.32-25 could easily be Windows XP or Windows 7 if those operating systems had been detected during install.

     A word of advice before we begin. It is good practice whenever making changes to configuration files of any kind to make a copy of the file before you begin. Whether it's through Nautilus or at a command line copy the Grub.cfg file to a backup location for reference and possible replacement if for any reasons things don't go as planned.

     Now to change the default OS selection we need to go in and edit Grub.cfg which is located under /Boot/Grub. There are several ways you can do this, the quickest is to open a terminal and enter the following:

     The Gedit graphical word editor will popup with the Grub.cfg file loaded. Change the line Highlighted below to the Sequential number in the listed order starting with "0" that you want to boot by default. In this example to boot the Linux Kernel 2.6.32-25 counting from "0" would be "2" for the 3rd item listed.

Unedited Grub.cfg file set to "0"

When updated it should look like this:

Click Save and close Gedit.

     When you reboot your PC the next boot up should now have the 3rd option from the top highlighted as the default OS to boot.

     As I said earlier the Linux Kernel 2.6.32-25 entry could just as easily be Windows XP, Vista or 7. The key thing to remember here is that the numbering begins at "0" not "1". As long as you count correctly from the top when assigning the number in the Grub.cfg file then you can't miss.

     To undo any of these changes simply reverse what you did and assign "0" again in the Grub.cfg file. Easy Peasy, hopefully. As always, these steps have been tested in my lab setup and work correctly in my environment. If they don't work for you or you encounter problems with your PC after, I take no responsibility for any problems you may encounter. That being said, you really shouldn't experience any issues with this so long as you follow the steps outlined above.

     Next Week we'll look at how to remove extra Kernels from your system and the Grub loader.

    Until then, I hope you found this tip helpful. If you did, please let me know, leave a comment.

Wednesday, December 1, 2010

TIP: How to Force and Lock Version Control in Ubuntu

     Last week we discussed how to Stop Adobe Air from Auto Updating and causing conflicts with the Ubuntu authorized version of Adobe Air. The latest version from Adobe is and the Ubuntu authorized version is Now, if you want to do the reverse, which is Stop Ubuntu from forcing version you need to make changes in the Synaptic Package Manager to "Force" the version you want.

     Forcing the version you want in Synaptic Package Manager is actually very easy but as they warn, forcing a particular version of any application may cause file dependency errors down the road. As with all work like this, a word of warning, you make these changes at your Own risk. All of these steps have been tested in my lab and work correctly, if you encounter problems with any of this, I am not responsible. Thanks for understanding.

    Now, to make this change, Open the Synaptic Package Manager in Ubuntu by going to the System menu and selecting Synaptic Package Manager. You will be prompted for your password to run, enter when prompted. In the Search Window of Synaptic enter "adobe" and you should see the "Adobe Air" entry. If not already selected, Highlight the "Adobe Air" line now so you are making changes to the correct application package.

     You can see here that the Installed Version differs from the Latest Version. This is why Ubuntu keeps trying to re-install with an older version.  

     Now click on the "Package" menu item at the top of the window and Select "Force Version...".

     You'll see the current Ubuntu Authorized version of 2.04 (lucid) listed in the drop down. Click on the Drop down Arrows and you will see the two versions that you can choose from. These are the two installed versions of Adobe Air.

     To force version 2.5.1 as the authorized version select it from the drop down choices, then click the button labelled "Force Version". You'll see the following in Synaptic.

    Forcing the Version is applicable when you have 2 different versions of an application installed and need to tell Ubuntu which Version of the Application you want to actively use. In this case we told Ubuntu to Actively use version 2.5.1 over version 2.04.

    To finalize this you now need to "Lock" the version in place. Highlight "Adobe Air" and go to the "Package" menu item. Find "Lock Version" and click it.

     This will prevent the Update Manager from refreshing this item back to the 2.04 version.

     If successful you'll see the result above for "Adobe Air". The lock is what actually prevents Ubuntu from attempting to continually "upgrade" Adobe Air to an older version. Keep in mind though that if Ubuntu Authorizes a newer version than you have Locked you won't be notified that the update is available.

     To reverse the Locked and Forced Version, go back to the "Package" menu item at the top again, making sure that "Adobe Air" is highlighted and select "Lock Version" again. This will reset the Lock and the Latest Version entry will return to 2.04 resetting it all back to default.

    Remember that Forcing and Locking the version will prevent Dependencies from updating as per Ubuntu's update manager and down the road could cause problems. In the short term though it will prevent the Update cycle that Adobe and Ubuntu will battle over. 

I hope you found this tip useful. If you did let me know, leave a comment.