Tag Archives: Linux

Enabel super user log in on Ubuntu 14.04 LTS

In order to maintain higher security level and keep the user from accidental breakage of the system the root user log in is disabled by default. To enable it, open a terminal window and type:

sudo passwd root

you will be prompted to enter the root user password. When done press enter.

That’s it. Now you can work from the command line like super user.

Screenshot-root@home: -home-vpaskov

Using the rpm command – part1

This article will show you how you can use the rpm command to preform various package management task , such as installing, removing, querying the rpm database, etc…

1. Installing, removing and updating packages

1.1. Installing packages
Package installation is done using rpm -i (or –install). The basic usage of the command is as follows:

rpm -i <package name>

for example to install htop – An Interactive text-mode Process Viewer for Linux, one wold obtain the rpm package of htop and install it as follows:

rpm -i htop-0.9-11.1.x86_64.rpm

Optionally the the -i option can take ftp or http address of the rpm package. In wich case rpm will download the package prior to installation.

Additional interesting rpm -i options are described in the table below. They can be passed after the -i argument, for example:

rpm -i <option> <package name>

NOTE: For a full list of options review the rpm man page, by typing man rpm.

Install-specific Options
Option Description Usage example
-h –hash If you add -h, RPM will print fifty hash marks (“#”) as the install proceeds. rpm -ih htop-0.9-11.1.x86_64.rpm
-v Provides additional output during the installation of a package. Combine this option with -h for nice output. rpm -iv htop-0.9-11.1.x86_64.rpm
–test Do not install the package, simply check for and report potential conflicts. rpm -i –test htop-0.9-11.1.x86_64.rpm
–excludedocs Don’t install any files which are marked as documentation (which includes man pages and texinfo documents). rpm -i –excludedocs htop-0.9-11.1.x86_64.rpm
–replacepkgs Replace a package with a new copy of itself.This option is normally used if the installed package has been damaged somehow and needs to be fixed up. rpm -i –replacepkgs htop-0.9-11.1.x86_64.rpm
–force Installs a package by ignoring conflicts with other packages and missing dependencies. rpm -i –replacepkgs htop-0.9-11.1.x86_64.rpm

Don’t check mount file systems for sufficient disk space before installing this package.

rpm -i –ignoresize htop-0.9-11.1.x86_64.rpm
–ignorearch Allow installation or upgrading even if the architectures of the binary package and host don’t match.
–nodeps Don’t do a dependency check before installing or upgrading a package. Note that this will probably leave the package broken after installation. rpm -i –nodeps htop-0.9-11.1.x86_64.rpm
–ignoreos Allow installation or upgrading even if the operating systems of the binary package and host don’t match.

1.2 Upgrading packages

Package upgrade is preformed using rpm -U (or –upgrade). The basic usage of the command is as follows:

rpm -U <package name>

for example: if we want to upgrade our htop package to a newer version we would download the newer version of the package (for example 1.0) and issue the following command:

rpm -U htop-1.0.1-bla-bla.rpm

During execution the rpm -U command preforms two distinct operations:

  1. Installs the desired package
  2. Erases all older versions of the package, if any exists

As the -i option -U can take ftp or http address of the rpm package. In wich case rpm will download the package prior to upgrade.

rpm -U is a combination of two commands rpm -i – used for installing packages (see a bought) and the rpm -e command used for deleting(erasing) packages (see below). The additional rpm -i options described in section 1.1. Installing packages are relevant for the rpm -U command. As stated before, refer to the manual page of rpm for additional command line options.

1.3 Removing packages (erasing)

In rpm the process of removing packages from the system is called erasing. It’s preformed using the rpm -e (–erase) command. The basic usage of rpm -e is shown below:

rpm -e <package1> <package2> <package N>

If we want to remove the htop package from the system we will type:

rpm -e htop

RPM preforms number of steps during package removal:

  • It checks the RPM database to make sure that no other packages depend on the package being erased.
  • It executes a pre-uninstall script defined by the package (if one exists).
  • It checks to see if any of the package’s config files have been modified. If so, it saves copies of them.
  • It reviews the RPM database to find every file listed as being part of the package, and if they do not belong to another package, deletes them.
  • It executes a post-uninstall script defined by the package (if one exists).
  • It removes all traces of the package (and the files belonging to it) from the RPM database.

Additional rpm -e options are described in the table below. They can be passed after the -e argument, for example:

rpm -e <option> <package name>

NOTE: For a full list of options review the rpm man page, by typing man rpm.

Erase-specific Options

Option Description Usage example
–test Preform erase tests only.This option is useful if you want to see what will happen if you remove a package from your system.

rpm -e –test htop

–noscripts Do not execute pre- and post-uninstall scripts.In most cases this option will result in unusable package. rpm -e –noscripts htop


Do not check dependencies. If other packages depends on this particular package, using this option will break them. rpm -e –nodeps htop

2. Retrieving information for packages

In recent days the most useful future or the rpm command are the querying capabilities.By querying capabilities I mean things like retrieving information about a package, such as installed files, dependencies etc, all stored in the rpm database.

Querying the database is done using the rpm -q “query arguments” command. We will look at this “query arguments” one by one.

2.1. Obtaining general information about a package
General information(or package summary) about installed rpm package is obtained using the rpm -qi command. For example if we want to retrieve general information about the htop package we would type:

rpm -qi htop

This will result in output like this:

Name        : htop                         Relocations: (not relocatable)
Version     : 0.9                               Vendor: openSUSE
Release     : 11.1                          Build Date: Sat 19 Feb 2011 06:45:05 AM EET
Install Date: Wed 20 Jul 2011 02:50:36 PM EEST      Build Host: build22
Group       : System/Monitoring             Source RPM: htop-0.9-11.1.src.rpm
Size        : 151367                           License: GPLv2+
Signature   : RSA/8, Sat 19 Feb 2011 06:45:09 AM EET, Key ID b88b2fd43dbdc284
Packager    : http://bugs.opensuse.org
URL         : http://htop.sourceforge.net
Summary     : An Interactive text-mode Process Viewer for Linux
Description :
htop is an interactive text-mode process viewer for Linux. It aims to
be a better 'top' and requires ncurses. It is tested with Linux 2.6,
but is also reported to work (and was originally developed) with the

2.4 series.
Hisham H. Muhammad
Distribution: openSUSE 11.4

2.2. Listing files that belongs to a package
To list files that belongs to a package one would use the rpm -ql command. For example if we want to retrieve the files that belong to the htop package:

rpm -ql htop

This will result in output like this:




rpm -qc command on the other hand will list only the configuration files that belongs to a package. For example if we want to list the configuration files that belongs to tomcat6 we would type:

rpm -qc tomcat6

This will result in output like this:





rpm -qd will list only the package documentation files.

rpm -qs will display the state(modified or not) of each file in the package. Each file in the package may have one of the following states:

  1. normal – A file in the normal state has not been modified by installing another package on the system.
  2. replaced — Files in the replaced state have been modified by installing another package on the system.
  3. not installed – A file classified as not installed, is not installed :)

Here is the result of executing rpm -qs against tomcat6 package:

normal        /etc/init.d/tomcat6
normal        /etc/logrotate.d/tomcat6
normal        /etc/tomcat6
normal        /etc/tomcat6/Catalina
normal        /etc/tomcat6/catalina.policy
normal        /etc/tomcat6/catalina.properties
normal        /etc/tomcat6/context.xml
normal        /etc/tomcat6/logging.properties
normal        /etc/tomcat6/server.xml
normal        /etc/tomcat6/tomcat-users.xml
normal        /etc/tomcat6/tomcat6.conf
normal        /etc/tomcat6/web.xml

Normal at the start of the line is the state.

2.3. Finding which package provides a file
To find which package provides a file one would use the rpm -qf command. For example if we want to view which package provides htop binary:

rpm -qf /usr/bin/htop

Result of the command should looks like this:


rpm -qf requires the exact file path (in our example /usr/bin/htop). One neat trick, if you don’t know where the file is located is to use the the which command (show a full path of a shell command) in combination with rpm -lf. For example:

rpm -qf $(which htop)

2.4. Querying all installed packages
If you want to review all packages that are installed on a system, rpm -qa is your friend. For example if I execute rpm -qa on my openSUSE box the result will looks like this:

oziris:/home/paskov # rpm -qa

The result of rpm -qa will be quite long so you may want to redirect it to a file or use more.

rpm -qa >> install_list #redirects the output to a file
rpm -qa | more #uses the more pager


This concludes part one of ‘Using the rpm command’ series. In the following articles we will look at more querying capabilities, and ways to format the output of rpm -q command. Also how to develop applications that make use of librpm.

Heroes III on GNU/Linux

UPDATED: 18.07.2014

I’m long time fan of Heroes Of Might and magic series. Especially Heroes III. Today I decided to spend some time playing it on my OpenSUSE box.

This article is not about running Heroes III under Wine, it’s about installing the GNU/Linux version produced by Loki Software years ago, under modern GNU/Linux distribution.


1. Get a copy of the game. Since Loki is no more, the game cannot be ordered from them, but there are chances that some copies are still available on eBay or other online store. Google “Heroes III Linux”, for other ways of obtaining the software.

2. Download the latest patch (1.3.1) from here.

3. Install the game.

This step requires “root” privileges on the system. Open a terminal and become super user by typing



sudo -i

hitting the Return key and providing you password.

NOTE: You may install the game as your normal every day user. It will be installed in your home directory, and only playable by you, or the users from the “users” group. Depends on how your system is configured.

If you are installing from CD, mount it


to the mount point and run

sh setup.sh

This will start the game installation process. Follow the onscreen instructions.

If during the execution of the a bought command you get error message like the one below:

This installation doesn’t support glibc-2.1 on x86_64 Please contact Loki Technical Support at support@lokigames.com

you are trying to install the game on a 64-bit GNU/Linux distribution. To start the setup program type:

linux32 sh setup.sh

During the setup process you will be asked what part’s of the game you want installed on your hard drive and witch one the game should look for on the CD. I recommend full game installation. This can be achieved by answering Y on the following questions:

Install Base Install? [Y/n] Y
Install Scenarios? [N/y] Y
Install Sounds and Graphics? [N/y] Y
Install Music? [N/y] Y
Install Videos? [N/y] Y

4. Applying the patch.

The patch downloaded in step 2, is the latest patch for the Linux version of Heroes III. It fixes some game play bugs like playing the game on full screen. To install the patch:

4.1 Open a terminal, and go to the folder containing the file heroes3-1.3.1a-unified-x86.run. Become a super user (see step 3) and type

chmod +x heroes3-1.3.1a-unified-x86.run

After executing the a bough commands you probably will get the following error:

Verifying archive integrity...OK
Uncompressing Heroes of Might and Magic III 1.3.1a Update......................................tar: A lone zero block at 12620

./update.sh: line 56: loki_patch: command not found
The program returned an error code (1)

As the error message says the loki_patch command is not found. To overcome this problem, download loki_patch from here and save it in the directory where you downloaded heroes3-1.3.1a-unified-x86.run.

Make it executable by typing:

chmod +x loki_patch

Now it’s time to extract our HoM III update. Run the following command:

./heroes3-1.3.1a-unified-x86.run --keep

The installer will fail with the error mentioned previously, but passing the –keep parameter to the patch executable, forced the installer to keep the update files. Type ls to see the directory listing. You should have a directory called heroes3-1.3.1a-unified-x86. Our task is to replace the loki_patch version contained within the update with the one we have downloaded. Execute the following sequence of commands to replace loki_patch and start the update process.

cp loki_patch heroes3-1.3.1a-unified-x86/bin/Linux/x86/loki_patch
chmod +x heroes3-1.3.1a-unified-x86/bin/Linux/x86/loki_patch
chmod +x heroes3-1.3.1a-unified-x86/update.sh

For 64-bit GNU/Linux distro run:

linux32 ./heroes3-1.3.1a-unified-x86/update.sh

Follow the onscreen instructions. Close your root session by typing exit.

The game is now installed and patched to the latest version available.

NOTE: If during the installation of the patch you get ERROR: No matching delta for /usr/local/games/Heroes3/heroes3.dynamic don’t worry, the patch is installed. You can verify it by executing heroes3 -v. The output should says:

Heroes of Might &amp; Magic III 1.3.1a

Type heroes3 and press enter to start playing. Type heroes3 –help, to view the available command line options, or review them below.

Heroes 3 command line options.

# heroes3 --help
Linux version by Loki Software, Inc.
Support - FAQ: http://faqs.lokigames.com/
          Web: http://fenris.lokigames.com/

          E-mail: support@lokigames.com
          Phone:  1-714-508-2140 (9-5 PM US Pacific Time)

Usage: heroes3 [options]
     [-h | --help]           Display this help message
     [-v | --version]        Display the game version
     [-f | --fullscreen]     Run the game fullscreen
     [-w | --windowed]       Run the game in a window
     [-s | --nosound]        Do not access the soundcard
     [-c | --nocdrom]        Do not access the CD-ROM
     [-u | --update]         Run the Loki auto-update tool
     [-q | --qagent]         Run the Loki QAgent support tool
     [-x | --x11cursor]      Use the X11 hardware mouse cursor
     [-l | --logging]        Enable logging

You can use the HEROES3_DATA environment variable to force the
Heroes III installation directory

NOTE: -u | –update and -q | –qagent does not work!

5. Known problems with the game.

There are some known problems with the game on modern GNU/Linux distributions as follows:

* No sound.

When starting the game you may see the following error:

Couldn't open audio:

The solution to this problem varies from distribution to distribution. Please consult your distro community. In some cases the sound just works.

* Random game crashes.

Sometimes the game may crash. It’s useful to start the game with the -l option, to enable logging. The log files are stored under ./home/<username>/.loki/heroes3.

6. Adding custom maps

Custom maps can be installed by copying them to .loki/heroes3/maps (available only for the current user) or in <game installation folder>/maps (available for all the users).

NOTE: <game installation folder>, by the means of this tutorial is /usr/local/games/Heroes3.

Happy adventuring :) . Tutorials about installing other Loki Software products will be available soon.