August 19, 2009

Slackware Linux Tip-of-the-day: Slackware Security Updates/slackpkg

In Slackware there is a simplified method for installing the necessary security updates for the official Slackware packages, that tool is slackpkg.  This tool is used to talk to a Slackware mirror and install remove, update packages and clean obsolete packages from your system. 

The options for Slackpkg are (this was extracted from the official --help document): 

slackpkg - version 2.80.2

Usage:  

        slackpkg update [gpg]           download and update files and package indexes               

        slackpkg check-updates          check if there is any news on Slackware's ChangeLog.txt     

        slackpkg install package        download and install packages download and upgrade packages 

        slackpkg reinstall package      same as install, but for packages already installed                 

        slackpkg remove package         remove installed packages         

        slackpkg clean-system           remove all packages which are not present in the official Slackware package set. Good to keep the house in order                           

        slackpkg upgrade-all            sync all packages installed in your machine with the selected mirror. This is the correct way to upgrade all of  your machine.                         

        slackpkg install-new            install packages which are added to the official Slackware package set.  Run this if you are upgrading to another Slackware version or using current.

        slackpkg blacklist              Blacklist a package. Blacklisted packages cannot be upgraded, installed, or reinstalled by slackpkg

        slackpkg download               Only download (do not install) a package

        slackpkg info package           Show package information  (works with only ONE package)

        slackpkg search file            Search for a specific file in the entire package collection

        slackpkg new-config             Search for new configuration files and ask to user what to do with them.

        slackpkg generate-template      Create a template with all official Slackware packages installed in your machine.

        slackpkg install-template       Install selected template.

        slackpkg remove-template        Remove selected template. Be careful.

You can see more information about slackpkg usage and some examples in slackpkg's manpage. You can use partial package names (such as x11 instead x11-devel, x11-docs, etc), or even Slackware series (such as n,ap,xap,etc) when searching for packages.

-----------------------------------------------------------------------------------------------------------------------------------------------

 This application is installed by default on all slackware installations and can be used for maintenance of stable or current systems.

The steps to use this tool are outlined below.

  1. The first step to use this tool is to choose a mirror to use, for this you edit /etc/slackpkg/mirrors and comment out the line that lists your chosen server.
  2. Next you update the gpg key using the command "slackpkg update gpg", this grabs the official Slackware pgp key so that the application and verify the integrity of the packages you are attempting to install.
  3. Next you want to update your files and package indexes using the command "slackpkg update". If you have any non-official packages installed you will want to blacklist them so that slackpkg will not interfere with the use of those applications and so it won't continually ask to remove the packages.  You do this with the command "slackpkg blacklist {pkgname1} {pkgname2}"  an clean example of this command is "slackpkg blacklist openoffice.org yakuake". 
  4. To successfully run the update functions you would want to run the following command in order: slackpkg update, slackpkg upgrade-all, slackpkg install-new, slackpkg clean system. These command are pretty self explanatory, update the changelog, update all packages that have upgrades available (this prompts a menu allowing you to deselect specific packages), install new packages (this also directs you to a menu) and clean system which removes packages that are no longer part of the official Slackware package tree.   

If configuration files are planned to be overwritten the application prompts you to choose to Overwrite, Do Nothing or Prompt for each, I personally prompt for each config file to make sure that I am not overwriting a file that I have modified.  Please keep in mind that when a new version of an application is released the config options may have changed, so you choose to do nothing then the associated application may not work, it is always best to backup your original config files, overwrite the files and manually merge the two to guarantee that the functionality is maintained.

To simplify the  use of this tool I have added the line 

alias UPDATE="sudo slackpkg update;sudo slackpkg upgrade-all;sudo slackpkg install-new;sudo slackpkg clean-system" 

to my .bashrc file which allows me to run all necessary upate function from a single command. 

If you have any questions please post them as a new discussion in the group, reply to this blog post or ask in the Linux.com Forum.   

Click Here!