SMART: An Alternative Package Manager
by pinoc
Introduction: Smart?
Using Linux for more than 10 years, I tested a lot of distributions, for sure more than 40. As a die-hard KDE fan, I mostly worked with Red Hat and a very long time with SuSE. Though a bit sluggish, I quite liked SuSE but I was never happy with their package management system. In my opinion, things got worse when Novell took over and after the deal with Microsoft, it was only logical and time to leave SuSE for good. Looking for alternatives, I used Slackware, then fell in love with Vector Linux, played with the excellent modular Slax system, and even installed and ran Knoppix for some time, which brought me from the rpm to the deb package system. Seeing the big Ubuntu hype, I used Kubuntu for a couple of months but always felt their KDE implementation was not a high priority and needed a serious overhaul. Every distro had its pros and cons and the only application I used continuously throughout all distros was, if available, the Smart package manager. Then, in May 2007, I finally tested, immediately switched to, and fell in love with PCLinuxOS. Indeed, this distro was and still is for me, what it claims: a distro-hopper-stopper, everything "just works" the Macintosh of the Linux distros, the best KDE implementation ever, and as soon as I found Smart in the repos I felt right at home in PCLinuxOS.
This article is an informal collection of information related to the Smart package manager. Please note that the default package manager in PCLinuxOS is Synaptic and the current Smart Version 0.52 is still considered to be in development (beta), so use it at your own risk! Then again, I have used Smart for years without any issues. So what is this Smart application anyway? Here is an excerpt from the official home-page http://labix.org/smart providing a concise description:
The Smart Package Manager project has the ambitious objective of creating smart and portable algorithms for solving adequately the problem of managing software upgrading and installation. This tool works in all major distributions, and will bring notable advantages over native tools currently in use (APT, APT-RPM, YUM, URPMI, etc).
Notice that this project is not a magical bridge between every distribution on the planet. Instead, this is a software offering better package management for these distributions, even when working with their own packages. Using multiple package managers at the same time (like rpm and dpkg) is possible, even though not the software goal at this moment.
The name Smart describes the core of the program. When doing a lot of updates there may be several solutions for the installation. In contrast to other package managers Smart will not take the first possible solution but, instead, compares all options and then opts for the best one. For example, The current PCLinuxOS is from May 2007. If you do a new install and a subsequent update then there will be many new program versions available and it may be possible to install each and every one. However, in order to maintain the highest possible efficiency and stability of the system it is thinkable that some updates should not be installed, or with different dependencies than, for example, Synaptic would do.
Smart offers some interesting features (see also point 3 below):
- Support of RPM, DPKG, and Slackware packages
- Thorough dependency check (even of packages not installed but available in the repository)
- Choice of suitable packages of different sources (if available)
- High speed parallel download of packages
- Locking of selected applications
- System repair function
- GUI and command line
Installation and configuration
You can use Synaptic or apt-get to install Smart and the required dependencies. If you opt for the graphical way, start Synaptic, refresh the channels, and simply search for and install smart-suite. Alternatively, you may use the following set of commands in a root-shell:
apt-get update && apt-get install smart-suite
An optional but recommended application is called PCLinuxOS-SMART-Servicemenu. This is only one of many great programs provided by the German PCLOS user Maik3531 in his PCLinuxOS repository. It provides a very useful interaction with Smart via the service menu, and further information is provided below. You can add his repository to Synaptic by appending the following line to your /etc/apt/sources.list:
rpm http://maik3531.de pclos2007/RPM testing
Now, with the Maik3531 repo enabled, you install this service menu with the following set of commands in a root-shell:
apt-get update && apt-get install PCLinuxOS-SMART-Servicemenu
Both set of commands will automatically select and install all necessary dependencies.
Configuration of the sources:
After the installation, Smart will use the official PCLinuxOS channels including the "testing" component. Less adventurous users may wish to disable this component (see below). Please note that Smart will not automatically take over customized repo-settings of Synaptic, e.g., your P.A.S.S. (Premium Access System Server) access, so you need to do that manually. You may consult the currently available repositories in Smart with the command:
smart channel -show
Note: I have found two scripts for the conversion of repo-settings from Synaptic to Smart:
http://www30.websamba.com/texpert/aptosmart.sh.gz and
http://linux01.gwdg. e/~pbleser/files/smart/yast2-sources-to-smart.sh
Both are relatively old and I could not make them work with the current Smart Version (0.52). Hence, you must use the command line or the GUI.
Graphical User Interface (GUI) configuration:
Start Smart either from the command line in a root shell using:
smart --gui
& or via the menu:
"Start -> System -> Configuration -> Packaging -> Software Installer"
Then insert your root password. Once started, go to the menu "Edit -> Channels".
The image below shows the Smart Interface, on top of the channel window listing all channels where the active ones have a tick mark, and on top of this one the Edit Channel window showing the settings of an active channel. Please note that this contains the "testing" component and you may choose to delete this entry as it provides packages which are being tested by developers and as such, not suitable in a stable production system.
Another important remark is at the bottom of the list of channels where you will find an active entry named "rpm-sys". This entry provides information on the currently installed rpms on your system, it must always stay enabled, otherwise Smart has no info about your system! In analogy with Synaptic, all other channels are PCLinuxOS mirror servers and it is sufficient to have only one of them (the geographically closest to you) enabled, otherwise you would only download duplicate information. To add an additional channel, you select "New" in the channel window and you will get this window:
Here,you can select a path to a local directory, a CD drive, or keep the first option selected to add for example your access to P.A.S.S., or the repository of Maik3531, etc. Then you click on OK, which will open this next window, from which you need to choose the repository type. From the amount of options to choose from you get an idea of the versatility of Smart, but in the normal case and our example you would select:
apt-rpm
Another click on "OK" and the entry for the repository of Maik3531 should look like this:
Here, you can choose any meaningful entry in the fields "Alias" and "Name" and the other entries are similar to the Synaptic ones in /etc/apt/sources.list. for example:
rpm http://maik3531.de pclos2007/RPM testing
Note that they are not identical, the Synaptic entry has a space between the URL and the distribution while in Smart these twosettings are connected with a "/". This example illustrates the small differences in the syntax of Synaptic and Smart and you should now have no problems to add any other RPM-Repository.
Manual configuration:
Any information on the syntax and use of Smart can be found with the command: smart --help or, for a specific option, for example smart channel --help. To add the repository of Maik3531 or the PASS server enter the following as a one line command in a root-shell:
smart channel --add Maik3531 type=apt-rpm name=Maik3531 baseurl=http://maik3531.de/pclos2007/RPM components=testing -y;
smart channel --add TexPass type=apt-rpm name=TexPass baseurl=http://XXXX:XXXX@pclinuxfiles.com/pclinuxos/apt/pclinuxos/2007 components="mainextra nonfree kde" -y;
The "-y;" at the end of the line makes this source active. If you select more than one component, TexPass example, we use the 4 basic components main, extra, nonfree, kde - then these must be enclosed in quotes (" "), and obviously you will have to replace the XXXX:XXXX with your credentials to access Tex' P.A.S.S. Here, you could also add the component "sam", and eventually "testing". While "sam" is for access to a PCLinuxOS version using the Xfce desktop, the component "testing" means exactly what it says, so nothing for the chicken-hearted and not to be used on production systems!
Using the default configuration, Smart will download the RPMS to the folder /var/lib/smart/packages and they will be deleted after the installation. In case you want to keep these RPMS you can use the following command in a root shell:
smart config --set remove-packages=false
Adding a local folder/repository
Some people have several computers running PCLinuxOS. If you intend to install the same RPMS on the other machines it makes sense to avoid the duplicate downloading by maintaining a local folder which is synchronized with the folder /var/lib/smart/packages of the machine where you initially performed the install/update. Another reason for this approach is that in this way you can even update a machine without Internet access. If you want to have the entire content of the PCLOS repository locally available, please have a look at the excellent article by Loyed in the December 2007 issue of this magazine.
Graphic mode:
Using Konqueror, it is very easy to add a local folder with RPMS to Smart, just right-click on that folder and select: "Actions -> Add directory as Smart channel" and you are done.
Manual mode:
The corresponding one line command in a root shell is:
smart channel --add localPCLOSrpms type=rpm-dir name=LocalRPMs manual=true priority=1 path=<path to rpm folder> -y;
(replace the <path to rpm folder> with the full path including the end slash to your local folder containing the RPMS). The option priority, default value = 0, sets the preference for downloading/installing RPMS if they are available in several sources. Here, we use a value of 1 to assign the local directory a higher preference and to ensure that Smart will not download the RPMS from the online source. You may also assign a negative priority to a non PCLinuxOS source. If the same RPM name is also available in an official PCLinuxOS source, Smart will then prefer to install the official PCLinuxOS RPM.
Adding a remote repository
You can add/use/test other repositories in the same fashion. If you want to challenge the system stability and you absolutely need to find out just how well Redhat rpms work with PCLinuxOS you could add the DAG repository of Redhat Enterprise 5 with this one line command in a root shell:
smart channel --add DAG type=rpm-md priority=-2 name=DAG baseurl=http://apt.sw.be/redhat/el5/en/i386/dag/ -y;
(as you can see, I chose a negative priority because DAG is not a PCLinuxOS repository and using RPMS of other distributions should always be your last resort)
KsmartTray
KSmartTray is a very handy panel applet. Every 2 hours, it automatically checks the sources and blinks if there are updates available. You can start it as normal user from the shell with the command:
ksmarttray
or graphically via:
"Start -> System -> Configuration -> Packaging -> KsmartTray"
Of course you can use the check option at any time to look for updates and the StartSmart... option will require the root password before you can use Smart.
PCLinuxOS-SMART-Servicemenu
This is one of the many useful programs from Maik3531. A simple right click on the icon of a locally stored RPM in Konqueror or Dolphin and the PCLinuxOS service menu will pop up, allowing you to retrieve program information and/or to install or uninstall the selected RPM. In contrast to Kpackage, and thanks to the use of Smart, installing a RPM via this service menu will automatically resolve and install any dependencies, if they are available in the repositories.
Using Smart
Graphical use:
The menu "View -> TreeStyle" in the Smart window offers several options to view the packages of the sources:
- Groups - packages are grouped according to their application type (in Synaptic: Sections),
- Channels - packages are grouped depending on their origin,
- Channels & Groups - packages are grouped depending on their origin and application type,
- None - all packages are listed alphabetically.
New packages are marked with a yellow star and they can be separated via the option "View - Hide Old". These packages are only considered "new" until you, or KsmartTray, refresh the channels.
The tabs in the lower part of the Smart GUI are similar to the ones in Synaptic and are self-explanatory. The URL tab is interesting as it shows you the full path to the RPM package. The magnifying glass in the top right of the menu (or "Edit -Find") opens the search interface, which allows you to search the RPM database by name or description. You may also search for a specific program which you want to block for further updates or installation at all. This can be a very useful feature because you may not like the newer version, or the newer version is not yet stable enough, or you simply want to prevent that particular program will ever beinstalled on your system. I have found a similar option in Synaptic under Kubuntu but not in the PCLinuxOS version of Synaptic, but maybe I am just too focused on Smart.
The following image shows an example of klipoquery, another goody from the Maik3531 repository, a panel applet which will pass any string to a user selected translation service. Here, I have an older versioninstalled which I prefer. So I locked that one which now prevents the newer version for installation and automatic selection when selecting Update all:
More really cool features can be found in the menu "Edit": besides system settings like (Channels, Mirrors, Flags, Priorities) you can select the option "Fix all problems" which actually does exactly that and has helped me a lot of times after I was too curious installing the very latest, hottest, you know how it goes...
You can use one of the three "Check" options to analyze the state of all currently installed RPMS of your own system, all packages whether installed or not, and even the dependencies of the not installed packages, which must be a big help for developers and RPM packagers.
Manual use:
Below are some examples from the command line (obviously these are only A very few, Smart is extremely powerful and further information is available with the command:
man smart
Example 1: find all packages having to do with "pdf".
smart search pdf
Note: The result shows all packages (installed and not installed) where the name or the description contains "pdf" or "PDF."
Example 2: what is and what is the content of the package: ding?
smart info ding
Note: This is completely case insensitive, for example ding, DiNg, etc. provides the same result and that can be useful if parts of the application name are written in capital letters. You will get a nice overview about the version, description, and the home page of the project.
Example 3: do I have the package 'ding' installed?
smart query --installed Ding
Note: I know that this is equivalent to: "rpm -q ding" and using the latter is much faster. However, as said before, the Smart query is case insensitive, and you will get the same result using "smart query --installed DinG" but with this string the rpm command will give no result at all. Again, this can be very useful as sometimes the RPM package name is written in a different way than the actual program name of the application.
Example 4: removal and installation of a program
For example, we could remove the package ding with this command in a root shell:
smart remove ding
We could install a local RPM like this in a root shell:
smart install /data3/linux/PCLOS/install/rpms/d4x-2.5.7.1-2pclos2007.i586.rpm
and a remote RPM package with a command similar to this:
smart install ftp://someurl.com/somefile.rpm
In this way, you can install local or remote RPMS (providing the full http or ftp address) and potential dependencies will be automatically resolved using the information of the configured source channels in Smart.
Example 5: block a program version
It is sometimes useful or even necessary to block a certain program version. Once a program is blocked it will also no longer be automatically selected when performing an "Update All". The command:
smart flag -help
describes all possible details in this respect. Below is an example which will list blocked programs and adds the program HDF to that list.
smart flag --show
smart flag --set lock HDF
Example 6: fix the system
Curiosity killed the cat, and if you are somehow like me then Xorg is one of your special friends. Luckily now there is a tool called vit, and it is good to know the command video which you can execute also in runlevel 3 once your X-server has said goodbye. While that helped a couple of times to get something other than a command line on screen there is one command which I won't miss anymore: smart fix. This is just marvelous and perfectly fits the PCLinuxOS slogan "Radically Simple." By now I have installed more than 50 machines with PCLinuxOS, at friends, work, my parents, and even the local nursery where the kids are now fighting to be next to play Tuxracer or Gcompris. With some of these machines I had problems which I could not fix with apt-get but I always found information on the culprit using the set of commands:
smart update && smart check
and eventually the simple command smart fix miraculously solved any issues in an intuitive interactive process. For this and many other reasons smart-suite is the very first application which I install after the base installation.
Smart crashed and how to fix it
In the past I used Smart and it worked like a charm. Obviously, you should never use Synaptic and Smart at the same time so make sure there is always only one instance of any of the two running. Up until recently, I sometimes had a nasty Smart start up problem, rendering the Smart GUI useless. Eventually, I finally found the source of this problem which was the installation of the dpkg package. Either remove that package or, if you absolutely need it, you should ensure that this file: /var/lib/dpkg/status is present, else just create it as an empty file and Smart is back alive.
If you have another problem, you can always try to properly close Smart/KsmartTray, as root go to the directory /var/lib/smart/, backup your current config file with another name, and then delete the two files cache and config. This will bring you back to the original install situation. If that works, you can try to use your old config file again, or configure Smart from scratch, setting all channels and settings anew as you did before. But I hope this will never be necessary, and now, be smart and have fun with Smart!
Additional information
Official home page:
http://labix.org/smart
Wikipedia:
http://en.wikipedia.org/wiki/Smart_Pack ge_Manager
Linux Magazine:
http://w3.linux-magazine.cm/issue/73/Smart_Package_Manager.pdf