Useful commands

Support for 4 GB memory <-- included in configuration management

Use Case: Because there is limited space on the Skolelinux/Debian-Edu CD only one Linux kernel is included, i.e. the lowest common denominator. That means a kernel working at as many as possible different types of hardware is included.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

You can find out the type of kernel running with the command uname -a. The command can be used later to ensure that you have upgraded to the required core. Then it may look like this:

tjener:~# uname  -a
Linux tjener.intern 2.6.8-2-386 #1 Thu May 19 17:40:50 JST 2005 i686 GNU/Linux

Here runs a 386-core, which should work on just about all of the PCs. But it is not optimal for dual core processors or more than 940MB.

If you want a kernel for new servers with plenty of memory and multiple processors, you can download and install it afterwards. Debian's package system makes that easy.

Look at Section 8.9 for a more detailed description of apt-get and dpkg.

smp is the keyword to look for when you want a Linux kernel with support for more RAM than 940MB of memory and dual processors. The acronym stands for Symmetric Multi-Processors. The command is run from a shell which lists the number of cores ready for installation:

apt-cache search kernel-image | grep smp

. At the time this is written the following is listed:

kernel-image-2.4-686-smp - Linux kernel image for version 2.4 on PPro/Celeron/PII/PIII/P4 SMP
kernel-image-2.4-k7-smp - Linux kernel image for version 2.4 on AMD K7 SMP
kernel-image-2.4.27-2-686-smp - Linux kernel image for version 2.4.27 on PPro/Celeron/PII/PIII/P4 SMP
kernel-image-2.4.27-2-k7-smp - Linux kernel image for version 2.4.27 on AMD K7 SMP
kernel-image-2.6-686-smp - Linux kernel image for version 2.6 on PPro/Celeron/PII/PIII/P4 SMP.
kernel-image-2.6-amd64-k8-smp - Linux kernel image for version 2.6 on AMD64 SMP systems
kernel-image-2.6-em64t-p4-smp - Linux kernel image for version 2.6 on Intel EM64T SMP systems
kernel-image-2.6-k7-smp - Linux kernel image for version 2.6 on AMD K7 SMP.
kernel-image-2.6.8-11-amd64-k8-smp - Linux kernel image for version 2.6.8 on AMD64 SMP systems
kernel-image-2.6.8-11-em64t-p4-smp - Linux kernel image for version 2.6.8 on Intel EM64T SMP systems
kernel-image-2.6.8-2-686-smp - Linux kernel image for version 2.6.8 on PPro/Celeron/PII/PIII/P4 SMP.
kernel-image-2.6.8-2-k7-smp - Linux kernel image for version 2.6.8 on AMD K7 SMP.

There is no need to specify a specific kernel version like 2.4.27 or 2.6.8. Just use 2.4 or 2.6. This boils down to

kernel-image-2.4-686-smp - Linux kernel image for version 2.4 on PPro/Celeron/PII/PIII/P4 SMP
kernel-image-2.4-k7-smp - Linux kernel image for version 2.4 on AMD K7 SMP
kernel-image-2.6-686-smp - Linux kernel image for version 2.6 on PPro/Celeron/PII/PIII/P4 SMP.
kernel-image-2.6-amd64-k8-smp - Linux kernel image for version 2.6 on AMD64 SMP systems
kernel-image-2.6-em64t-p4-smp - Linux kernel image for version 2.6 on Intel EM64T SMP systems
kernel-image-2.6-k7-smp - Linux kernel image for version 2.6 on AMD K7 SMP.

Now you just need to know what kind of processor you have eg. 686 (Intel), k7 (AMD) AMD64 or EM64T

As soon as which kernel fit the machine best it can be installed using the command

apt-get install kernel-image-2.6-<your processor type>-smp

If the machine contain an Intel Xeon one can use

apt-get install kernel-image-2.6-686-smp

If a 2.4 kernel is used

apt-get install kernel-image-2.4-<your processor type>-smp

With an AMD Athlon(TM) MP 2000 it is possible to use

apt-get install kernel-image-2.6-k7-smp

When you install the new kernel, you may see something like this:

tjener:~# apt-get update
tjener:~# apt-get install kernel-image-2.6-686-smp
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  kernel-image-2.6.8-2-686-smp
Suggested packages:
  lilo kernel-doc-2.6.8 kernel-source-2.6.8
Recommended packages:
  irqbalance
The following NEW packages will be installed:
  kernel-image-2.6-686-smp kernel-image-2.6.8-2-686-smp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 15.3MB of archives.
After unpacking 44.9MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ftp.debian.org sarge/main kernel-image-2.6.8-2-686-smp 2.6.8-16 [15.3MB]
Get:2 http://ftp.debian.org sarge/main kernel-image-2.6-686-smp 101 [2154B]
Fetched 15.3MB in 1m13s (208kB/s)
Selecting previously deselected package kernel-image-2.6.8-2-686-smp.
(Reading database ... 80762 files and directories currently installed.)
Unpacking kernel-image-2.6.8-2-686-smp (from .../kernel-image-2.6.8-2-686-smp_2.6.8-16_i386.deb) ...
Selecting previously deselected package kernel-image-2.6-686-smp.
Unpacking kernel-image-2.6-686-smp (from .../kernel-image-2.6-686-smp_101_i386.deb) ...
Setting up kernel-image-2.6.8-2-686-smp (2.6.8-16) ...
File descriptor 3 left open
File descriptor 4 left open
File descriptor 5 left open
File descriptor 6 left open
File descriptor 7 left open
    Finding all volume groups
    Finding volume group "vg_data"
    Finding volume group "vg_system"
Searching for GRUB installation directory ... found: /boot/grub .
Testing for an existing GRUB menu.list file... found: /boot/grub/menu.lst .
Searching for splash image... none found, skipping...
Found kernel: /boot/vmlinuz-2.6.8-2-686-smp
Found kernel: /boot/vmlinuz-2.6.8-2-386
Updating /boot/grub/menu.lst ... done
Setting up kernel-image-2.6-686-smp (101) ...

As shown, you were asked to install kernel-image-2.6-686-smp, and it automatically translated to install kernel-image-2.6.8-2-686-smp. It was also suggested to install some other packages that might be useful.

Reboot the machine with the command: shutdown -r now

Exception handling

To activate a new kernel the machine need to be rebooted.

Building the kernel for a Skolelinux / Debian-Edu machine, is the only time you ever need a restart. When installing other programs there is no need for a restart.

Verification

When running the command uname -a after installation, the following is displayed

tjener:~# uname  -a
Linux tjener.intern 2.6.8-2-686-smp #1 SMP Thu May 19 17:27:55 JST 2005 i686 GNU/Linux

After the installation of the smp kernel and after the reboot, you can run the command free and cat /proc/cpuinfo. Then you can see if the new kernel uses all memory and both processors.

ltspserver00:~# free
             total       used       free     shared    buffers     cached
Mem:       4074752    4045556      29196          0     339248    2327780
-/+ buffers/cache:    1378528    2696224
Swap:      1835000       5852    1829148

Here is a shortened printing with the unnecessary printing removed .

ltspserver00:~# cat /proc/cpuinfo
processor       : 0
vendor_id       : !GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Xeon(TM) CPU 2.66GHz

processor       : 1
vendor_id       : !GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Xeon(TM) CPU 2.66GHz

processor       : 2
vendor_id       : !GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Xeon(TM) CPU 2.66GHz

processor       : 3
vendor_id       : !GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Xeon(TM) CPU 2.66GHz

Update the configuration database

Administrating packages (apt-get)

Use case: Installing new programs or update programs

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

To install packages one needs to tell from where they should be fetched. In other words, which package archive to use.

One can specify package archives in the file /etc/apt/sources.list

You can work with package management on the command line. There is more graphical applications like for example KPackage 7 or Webmin 12

This section provides a quick introduction to using the command line for administrating packages.

This is the content of a file with references to package repositories on the Internet or from a CD ROM:

#deb file:///cdrom/ sarge main local

deb cdrom:[Debian GNU/Linux edu _Sarge_ - Unofficial i386 Binary-1 (20050808)]/ unstable contrib local main non-free

 1. deb http://security.debian.org/ stable/updates main contrib non-free
 1.deb http://security.debian.org/ sarge/updates main contrib non-free
   1. Use (by uncommenting) either http or ftp, NOT both
   1. http based apt source: ----------------
 1. deb http://ftp.debian.org/debian/ sarge main contrib non-free
 1. deb http://non-us.debian.org/debian-non-US/ sarge/non-US main contrib non-free
 1. deb http://ftp.skolelinux.no/skolelinux/ sarge local
   1. ftp based apt source: -----------------
 1. deb ftp://ftp.debian.org/debian/ sarge main contrib non-free
 1. deb ftp://non-us.debian.org/debian-non-US/ sarge/non-US main contrib non-free
 1. deb ftp://ftp.skolelinux.no/skolelinux/ sarge local

Note that the lines without hashtag (#) can be used as reference to the package archive. The example shows that one only gets packets from the CD ROM used during installation. Other archives are not activated. When doing this, one should open for security upgrades. So you can try other archives for more packages.

As a start it should look something like this:

#deb file:///cdrom/ sarge main local

 1.deb cdrom:[Debian GNU/Linux edu _Sarge_ - Unofficial i386 Binary-1 (20050808)]/ unstable contrib local main non-free

 1.deb http://security.debian.org/ stable/updates main contrib non-free
deb http://security.debian.org/ sarge/updates main contrib non-free
   1. Use (by uncommenting) either http or ftp, NOT both
   1. http based apt source: ----------------
deb http://ftp.debian.org/debian/ sarge main contrib non-free
deb http://non-us.debian.org/debian-non-US/ sarge/non-US main contrib non-free
deb http://ftp.skolelinux.no/skolelinux/ sarge local
   1. ftp based apt source: -----------------
 1. deb ftp://ftp.debian.org/debian/ sarge main contrib non-free
 1. deb ftp://non-us.debian.org/debian-non-US/ sarge/non-US main contrib non-free
 1. deb ftp://ftp.skolelinux.no/skolelinux/ sarge local

Note that there is a # sign in front of the line containing "deb: cdrom". There is no need to load packages from a CD-ROM when one can get everything from the Internet.

If you add a new line to this file, you must update the database with information about what that is available.

See chapter 13 for other lines to add as package sources.

Exception handling

Links to package archives have a specific form. Failure to follow this gives error messages when updating, asking to correct the error.

The comment sign (#) is also in place in front of several lines in the file. The technique of "commenting out" is typical for most configuration files in Linux. Other symbols to be used is the semicolon (;) and double slashes (//). But here, the hashtag is in force, and when removed, what is written on the line is operative.

Update the package archive

Use case: Update the package repository with a summary of updated programs.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

The selection of available packages is constantly updated. The most common is new security updates. New versions of the software can also be posted. Therefore, one must update the package archives. This is done with the following command

tjener:~# apt-get update
Get:1 http://ftp.skolelinux.no sarge/local Packages [17.4kB]
Ign http://ftp.skolelinux.no sarge/local Release
Get:2 http://non-us.debian.org sarge/non-US/main Packages [20B]
Get:3 http://non-us.debian.org sarge/non-US/main Release [102B]
Get:4 http://non-us.debian.org sarge/non-US/contrib Packages [20B]
Get:5 http://non-us.debian.org sarge/non-US/contrib Release [105B]
Get:6 http://non-us.debian.org sarge/non-US/non-free Packages [20B]
Get:7 http://non-us.debian.org sarge/non-US/non-free Release [106B]
Get:8 http://ftp.debian.org sarge/main Packages [3347kB]
Get:9 http://security.debian.org sarge/updates/main Packages [155kB]
Get:10 http://security.debian.org sarge/updates/main Release [110B]
Get:11 http://security.debian.org sarge/updates/contrib Packages [538B]
Get:12 http://security.debian.org sarge/updates/contrib Release [113B]
Get:13 http://security.debian.org sarge/updates/non-free Packages [20B]
Get:14 http://security.debian.org sarge/updates/non-free Release [114B]
Get:15 http://ftp.debian.org sarge/main Release [95B]
Get:16 http://ftp.debian.org sarge/contrib Packages [56.2kB]
Get:17 http://ftp.debian.org sarge/contrib Release [98B]
Get:18 http://ftp.debian.org sarge/non-free Packages [58.4kB]
Get:19 http://ftp.debian.org sarge/non-free Release [99B]
Fetched 3635kB in 23s (157kB/s)
Reading Package Lists... Done

This command must be executed before an upgrade or before adding new packages.

Exception handling

Verification

Update to new packages

Use case: Updating the installed packages to a newer version if one is available

Author: Klaus Ade Johnstad

Co-author: Knut Yrvin

All installed packages can be upgraded to newer versions using the command

apt-get upgrade

tjener:~# apt-get upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be upgraded:
  apache apache-common apache2-utils bsdutils cfengine cfengine-doc courier-authdaemon courier-base courier-imap courier-imap-ssl courier-ldap
  courier-ssl cpio debian-edu-config debian-edu-install education-common education-main-server education-networked education-tasks libapr0 libice6
  libmysqlclient12 libpam-ldap libpcre3 libsensors3 libsm6 libsnmp-base libsnmp5 libssl0.9.7 libungif4g libx11-6 libxext6 libxft1 libxi6 libxmu6 libxmuu1
  libxp6 libxpm4 libxrandr2 libxt6 libxtrap6 libxtst6 localization-config lynx mount mysql-common ntp ntp-refclock ntp-server ntpdate openssl python2.3
  slbackup snmp squid squid-common tcpdump util-linux xdebconfigurator xfree86-common xlibs xlibs-data
62 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.7MB of archives.
After unpacking 225kB disk space will be freed.
Do you want to continue? [Y/n]

Just press Enter or 'Y' and Enter. The packages will be downloaded and installed automatically. One will get a change log when the upgrade begins.

Once you have upgraded, you can delete the packages downloaded in the directory/var/cache/apt/archives/. Use the command

apt-get clean

to clear the archive. This should be done occasionally. Otherwise /var becomes full.

Warning

Sometimes it's OK to see what is going to happen before upgrading. If judging whether it is necessary to download several large packages, maybe you need to wait until there is more bandwidth available. If you run

apt-get upgrade --simulate

if one will simulate what will happen, without it actually happens. Is it too much information on the screen, one can run

apt-get upgrade --simulate | more

If it looks good, one can run the command again without the --simulate parameter

It is also possible to use aptitude dist-upgrade in combination with apt-get upgrade.

Exception handling

Sometimes you will get a message about changes affecting packages to upgrade or install, as in here

kdeaddons (4:3.1.0-4) unstable; urgency=low

  * Rebuilt against libvorbis0a (closes: #184713).
  * Removed alpha compile flags.
  * Fresh admin/ sync.

 -- Ben Burton <bab@debian.org>  Sun, 16 Mar 2003 16:00:19 +1100

kdeaddons (4:3.1.0-2) unstable; urgency=low

  * First KDE3 upload to debian!
  * Applied Ewald Snel's patch for xine support.
  * Rolled the epoch to aid upgrades from the unofficial repository on
    ftp.kde.org.. *sigh*

Use Space on the keyboard to browse through the message. Then you will see

quanta (1:3.0pr1-1) unstable; urgency=low

  * New upstream release.
  * Built for KDE3.

 -- Ben Burton <benb@acm.org>  Wed,  4 Sep 2002 10:36:12 +1000

(END)

Press the q key to quit and you get

Fetched 60.2MB in 11m24s (87.9kB/s)
Reading changelogs... Done
apt-listchanges: Do you want to continue? [Y/n]?

To continue you need to press Y for Yes.

Verification

Summary of installed packages

Use case: Want a summary of installed packages

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

To get a summary of the installed packages run this command

dpkg --list | more

Note that when the first letters in the list is "ii" it mean the package is fully installed.

To get the status of one particular package one can use grep to search for it:

tjener:~# dpkg --list | grep apache
ii  apache         1.3.33-6       versatile, high-performance HTTP server
ii  apache-common  1.3.33-6       support files for all Apache webservers
ii  apache2-utils  2.0.54-4       utility programs for webservers

Find the name of a particular package

Use case: Often it is hard to remember the name of a package.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

To find a particular package one can use a search term with this command:

apt-cache search <package name>

Try this if there is too much text on the screen

apt-cache search <package name>|more

The two symbols < and > must not be used. They are only used in this example.

tjener:~# apt-cache search apache
apache - versatile, high-performance HTTP server
apache-common - support files for all Apache webservers
apache-dbg - debug versions of the Apache webservers
apache-dev - development kit for the Apache webserver
apache-doc - documentation for the Apache webserver
apache-perl - versatile, high-performance HTTP server with Perl support
apache-ssl - versatile, high-performance HTTP server with SSL support
apache-utils - utility programs for webservers (transitional package)

As the screen dump show there are a lot more related to apache than the packages already installed.

Show available information about packages

User case: Want to get information about the package. There may be dependencies to other packages etc..

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

The command

apt-cache showpkg <package name>

and

<apt-cache policy <package name>

gives details about the package.

tjener:~# apt-cache showpkg kdissert
Package: kdissert
Versions:
0.3.8-1(/var/lib/apt/lists/ftp.debian.org_debian_dists_sarge_main_binary-i386_Packages)

Reverse Depends:
Dependencies:
0.3.8-1 - kdelibs4 (2 4:3.3.2-4.0.2) libc6 (2 2.3.2.ds1-4) libgcc1 (2 1:3.4.1-3) libqt3c102-mt (2 3:3.3.3) libstdc++5 (2 1:3.3.4-1)
Provides:
0.3.8-1 -
Reverse Provides:
tjener:~# apt-cache policy  kdissert
kdissert:
  Installed: (none)
  Candidate: 0.3.8-1
  Version Table:
     0.3.8-1 0
        500 http://ftp.debian.org sarge/main Packages

So one notices that the package kdissert is not installed, but available for installation in version 0.3.8-1 from `http://ftp.debian.org sarge/main`

Installation of packages

Use case: Want to install a program or a program package.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

When you have found the package to be installed, run the command

apt-get install <package name>

If you want to see what happened during the installation you should run a simulation first with the command

apt-get install <package name> --simulate

tjener:~# apt-get install  aterm --simulate
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
  aterm
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst aterm (0.4.2-11 Debian:3.1r0/stable)
Conf aterm (0.4.2-11 Debian:3.1r0/stable)
tjener:~# apt-get install  aterm
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
  aterm
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 91.6kB of archives.
After unpacking 287kB of additional disk space will be used.
Get:1 http://ftp.debian.org sarge/main aterm 0.4.2-11 [91.6kB]
Fetched 91.6kB in 1s (71.0kB/s)
Selecting previously deselected package aterm.
(Reading database ... 32924 files and directories currently installed.)
Unpacking aterm (from .../aterm_0.4.2-11_i386.deb) ...
Setting up aterm (0.4.2-11) ... 

Removal of installed packages

Use case: Wants to remove certain packages that will not be used.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

To find a specific package to be removed, use the commands listed above.

When you have found the name of the package run the command

apt-get remove <package name>

If you want to see what happens when you remove the package, you may simulate this with the command

apt-get remove <package name> --simulate

tjener:~# apt-get remove  aterm --simulate
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
  aterm
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Remv aterm (0.4.2-11 Debian:3.1r0/stable)
tjener:~# apt-get remove  aterm
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
  aterm
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives.
After unpacking 287kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 32936 files and directories currently installed.)
Removing aterm ...

Install a specific package version

User case: Want a specific version of a package. It can for example be a previous release of a program.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

When installing a package with the command

apt-get install <package name>

then the newest package is installed. Sometimes an older version instead of the newest version is wanted.

apt-get install <package name>=older_version_number

To get an older version of the Webmin backup module one can run

apt-cache showpkg webmin-slbackup

to get a summary of the available version

tjener:~#  apt-cache policy webmin-slbackup
webmin-slbackup:
  Installed: 0.0.10-1
  Candidate: 0.0.10-1
  Version Table:
 *** 0.0.10-1 0
        500 http://ftp.skolelinux.no sarge/local Packages
        100 /var/lib/dpkg/status
     0.0.9-1 0
        500 http://ftp.debian.org sarge/main Packages

Here one can see that there are two versions available. Both 0.0.9-1 and 0.0.10-1

If the 0.0.9-1 version of the program is wanted it can be installed using the following command

apt-get install webmin-slbackup=0.0.9-1

tjener:~# apt-get install webmin-slbackup=0.0.9-1 --simulate
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be DOWNGRADED:
  webmin-slbackup
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Inst webmin-slbackup [0.0.10-1] (0.0.9-1 Debian:3.1r0/stable)
Conf webmin-slbackup (0.0.9-1 Debian:3.1r0/stable)
tjener:~# apt-get install webmin-slbackup=0.0.9-1
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be DOWNGRADED:
  webmin-slbackup
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 22.0kB of archives.
After unpacking 131kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ftp.debian.org sarge/main webmin-slbackup 0.0.9-1 [22.0kB]
Fetched 22.0kB in 0s (23.6kB/s)
dpkg - warning: downgrading webmin-slbackup from 0.0.10-1 to 0.0.9-1.
(Reading database ... 32924 files and directories currently installed.)
Preparing to replace webmin-slbackup 0.0.10-1 (using .../webmin-slbackup_0.0.9-1_all.deb) ...
Unpacking replacement webmin-slbackup ...
Setting up webmin-slbackup (0.0.9-1) ...

Install a package using dpkg

User case: Sometimes it is needed to download a package from other places, not located in a Debian web archive. Opera browser is such a package.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

Download the package from the home page of the creators of the program. This could for example be Opera. The program is installed using the following command:

dpkg -i <full path to the package>

. If you first want to simulate this try

dpkg --no-act -i <full path to package>

tjener:~# dpkg --install --no-act opera_8.51-20051114.5-sharedqt_en_sarge_i386.deb
Selecting previously deselected package opera.
(Reading database ... 32924 files and directories currently installed.)
Unpacking opera (from opera_8.51-20051114.5-shared-qt_en_sarge_i386.deb) ...
tjener:~# dpkg --install  opera_8.51-20051114.5-shared-qt_en_sarge_i386.deb
Selecting previously deselected package opera.
(Reading database ... 32924 files and directories currently installed.)
Unpacking opera (from opera_8.51-20051114.5-shared-qt_en_sarge_i386.deb) ...
dpkg: dependency problems prevent configuration of opera:
 opera depends on libqt3c102-mt; however:
  Package libqt3c102-mt is not installed.
dpkg: error processing opera (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 opera

dpkg requires more manipulations than apt-get because it does not handle package dependencies. This means you may need to run apt-get immediately afterwards with additional parameter. For example, it helps to run apt-get --fix-broken to tidy up

tjener:~# apt-get install --fix-broken --simulate
Reading Package Lists... Done
Building Dependency Tree... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libaudio2 liblcms1 libmng1 libqt3c102-mt libxcursor1 libxft2
Suggested packages:
  nas liblcms-utils libqt3c102-mt-psql libqt3c102-mt-mysql libqt3c102-mt-odbc
The following NEW packages will be installed:
  libaudio2 liblcms1 libmng1 libqt3c102-mt libxcursor1 libxft2
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Inst libaudio2 (1.7-2 Debian:3.1r0/stable) [opera ]
Inst liblcms1 (1.13-1 Debian:3.1r0/stable) [opera ]
Inst libmng1 (1.0.8-1 Debian:3.1r0/stable) [opera ]
Inst libxcursor1 (1.1.3-1 Debian:3.1r0/stable) [opera ]
Inst libxft2 (2.1.7-1 Debian:3.1r0/stable) [opera ]
Inst libqt3c102-mt (3:3.3.4-3 Debian:3.1r0/stable)
Conf libaudio2 (1.7-2 Debian:3.1r0/stable)
Conf liblcms1 (1.13-1 Debian:3.1r0/stable)
Conf libmng1 (1.0.8-1 Debian:3.1r0/stable)
Conf libxcursor1 (1.1.3-1 Debian:3.1r0/stable)
Conf libxft2 (2.1.7-1 Debian:3.1r0/stable)
Conf libqt3c102-mt (3:3.3.4-3 Debian:3.1r0/stable)
Conf opera (8.51-20051114.5 )
tjener:~# apt-get install --fix-broken
Reading Package Lists... Done
Building Dependency Tree... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libaudio2 liblcms1 libmng1 libqt3c102-mt libxcursor1 libxft2
Suggested packages:
  nas liblcms-utils libqt3c102-mt-psql libqt3c102-mt-mysql libqt3c102-mt-odbc
The following NEW packages will be installed:
  libaudio2 liblcms1 libmng1 libqt3c102-mt libxcursor1 libxft2
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 3489kB of archives.
After unpacking 8753kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ftp.debian.org sarge/main libaudio2 1.7-2 [71.5kB]
Get:2 http://ftp.debian.org sarge/main liblcms1 1.13-1 [123kB]
Get:3 http://ftp.debian.org sarge/main libmng1 1.0.8-1 [171kB]
Get:4 http://ftp.debian.org sarge/main libxcursor1 1.1.3-1 [23.7kB]
Get:5 http://ftp.debian.org sarge/main libxft2 2.1.7-1 [54.4kB]
Get:6 http://ftp.debian.org sarge/main libqt3c102-mt 3:3.3.4-3 [3045kB]
Fetched 3489kB in 16s (212kB/s)
Selecting previously deselected package libaudio2.
(Reading database ... 33027 files and directories currently installed.)
Unpacking libaudio2 (from .../libaudio2_1.7-2_i386.deb) ...
Selecting previously deselected package liblcms1.
Unpacking liblcms1 (from .../liblcms1_1.13-1_i386.deb) ...
Selecting previously deselected package libmng1.
Unpacking libmng1 (from .../libmng1_1.0.8-1_i386.deb) ...
Selecting previously deselected package libxcursor1.
Unpacking libxcursor1 (from .../libxcursor1_1.1.3-1_i386.deb) ...
Selecting previously deselected package libxft2.
Unpacking libxft2 (from .../libxft2_2.1.7-1_i386.deb) ...
Selecting previously deselected package libqt3c102-mt.
Unpacking libqt3c102-mt (from .../libqt3c102-mt_3%3a3.3.4-3_i386.deb) ...
Setting up libaudio2 (1.7-2) ...

Setting up liblcms1 (1.13-1) ...

Setting up libmng1 (1.0.8-1) ...

Setting up libxcursor1 (1.1.3-1) ...

Setting up libxft2 (2.1.7-1) ...

Setting up libqt3c102-mt (3.3.4-3) ...

Setting up opera (8.51-20051114.5) ...

Armed with different commands from earlier in this chapter, we can now confirm that Opera is already installed

tjener:~# apt-cache policy opera
opera:
  Installed: 8.51-20051114.5
  Candidate: 8.51-20051114.5
  Version Table:
 *** 8.51-20051114.5 0
        100 /var/lib/dpkg/status
tjener:~# dpkg --list|grep opera

ii opera 8.51-20051114. The Opera Web Browser

Search through files in a package

Use case: Want to find a program name or file in a package

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

You get an overview with the command

dpkg --listfiles <package name>

tjener:~# dpkg --listfiles opera
/usr/bin
/usr/bin/opera
.
.
.
/etc
/etc/opera6rc
/etc/opera6rc.fixed

Find which package a file came from

User case: Want to find the package a file came from.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

dpkg --search <filename>

This can look like this

tjener:~# dpkg --search /etc/opera6rc.fixed
opera: /etc/opera6rc.fixed

Unpackaging files from a package without installing the package

Use case: Perhaps an important system file was deleted by accident, and there is no backup.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

When using the command

dpkg --search <filename>

Warning: Never unpack packages in the root directory

if one finds which package a file came from. One can extract the package to get back the systemfile like shown later.

First you need to fetch the deb package in question. This can be done by placing it in the /tmp directory. Use this command to unpack the files in this directory

dpkg --vextract <package name> /tmp

. Then the required directories will be created in /tmp and the files are placed there.

dpkg --vextract <package name> /tmp

Make your own package mirror

Use case: Some packages are often installed. For others it is useful to avoid downloading them from the Internet.

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

The apt-get command makes it easy to install packages from the Internet. But apt-get will use significant network capacity when programs are downloaded from Debian archives on the Internet. Because of that, it is possible to tell apt-get to use a local package repository. This way it is possible to install already downloaded packages simply by using apt-get. This provides quick installation.

mkdir /var/www/dpkg

cp /var/cache/apt/archives/*.deb /var/www/dpkg

cd /var/www/

dpkg-scanpackages dpkg /dev/null | gzip -9c > dpkg/Packages.gz

After that, add a new line to the file /etc/apt/sources.list:

deb file:///var/www dpkg/

And then the command apt-get update must be executed as usual to update the packages in the database.

Secure login to the firewall (ssh)

Use case: Some times it is required to log into Coyote Linux when no web browser is available. Perhaps the command line is preferred? Then ssh can be used to connect to Coyote Linux.

If you are logged into a machine in a Skolelinux / Debian Edu network you can use

ssh -l root 10.0.2.1

to log in on Coyote Linux

If you are outside a Skolelinux / Debian Edu network, the value 10.0.2.1 can be replaced with the appropriate value for the network card with the WAN in. In this case it might be ssh -l root 192.168.1.10

Here you will meet the same options present as when logged into the Coyote Linux web administration. This is presented in a text based menu.

               Coyote Linux Gateway -- Configuration Menu


  1) Edit main configuration file         2) Change system password
  3) Edit rc.local script file            4) Custom firewall rules file
  5) Edit firewall configuration          6) Edit port forward configuration

  c) Show running configuration           f) Reload firewall
  r) Reboot system                        w) Write configuration to disk

  q) quit                                 e) Exit
  ----------------------------------------------------------------------------
  Selection:

The options will be approximately the same as those provided when logged into Coyote Linux for web administration. See section 3.7 for a quick description of the menu choices.

When selecting q) quit you will end up on the command line in Coyote Linux. If you need to get back to the main menu in Coyote Linux, write menu and press Enter.

If you see this when you try to log into Coyote Linux

klaus@tjener:~$ ssh 10.0.2.1 -l root
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
34:b7:a3:9b:06:4c:e2:30:1b:0d:03:45:7b:22:b7:dd.
Please contact your system administrator.
Add correct host key in /skole/tjener/home0/klaus/.ssh/known_hosts to get rid of this message.
Offending key in /skole/tjener/home0/klaus/.ssh/known_hosts:27
RSA host key for 10.0.2.1 has changed and you have requested strict checking.
Host key verification failed.

This is most likely because one logged in earlier into another machine with the IP address 10.0.2.1, or because the network card in Coyote Linux has been changed. It could also be an attack from an unknown man in the middle. The solution is to remove the key, in this case line number 27 in the /skole/tjener/home0/klaus/.ssh/known_hosts file.

Exception handling

Verification

Update the configuration database

Status summary for the firewall (Coyote)

Use case: Which commands can be used to get the menu or to get an overview of the status of the firewall?

Main author: Klaus Ade Johnstad

Useful commands in Coyote Linux

Useful to figure out if the network is working. The command checks if there is a connection to the Skolelinux / Debian Edu main server.

coyote# ping -c5 10.0.2.2
PING 10.0.2.2 (10.0.2.2): 56 data bytes
64 bytes from 10.0.2.2: icmp_seq=0 ttl=64 time=0.9 ms
64 bytes from 10.0.2.2: icmp_seq=1 ttl=64 time=0.5 ms

This command gives the duration since the last reboot for Coyote Linux.

   coyote# uptime\n  2:37pm  up 80 days,  7:55, load average: 0.00, 0.00, 0.00

This command displays information about the Linux kernel running on the machine. It lists things like memory, processor and network card. If there is too much output from dmesg you can send the output through a so called pager program like "more" and use Space to read everything, dmesg|more

Show extra information about the network cards.

coyote# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:FC:F8:D2:44
          inet addr:10.0.2.1  Bcast:10.0.3.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:314723 errors:0 dropped:0 overruns:0 frame:0
          TX packets:312105 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:53700845 (51.2 !MiB)  TX bytes:277496136 (264.6 !MiB)
          Interrupt:11 Base address:0x7000

eth1      Link encap:Ethernet  HWaddr 00:E0:18:A8:B1:BA
          inet addr:192.168.100.133  Bcast:192.168.100.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:307395 errors:0 dropped:0 overruns:0 frame:0
          TX packets:281202 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:272404311 (259.7 !MiB)  TX bytes:47880640 (45.6 !MiB)
          Interrupt:10 Base address:0xb800 Memory:e3000000-e3000038

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:14565 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14565 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1290756 (1.2 !MiB)  TX bytes:1290756 (1.2 !MiB)

This command lists up driver modules. This is useful to see which modules are used by network cards.

coyote# lsmod
Module                  Size  Used by
eepro100               17516   1
3c59x                  24408   1
mii                     1852   0 [eepro100]
ip_nat_quake3           1608   0 (unused)
ip_nat_mms              2448   0 (unused)
ip_nat_h323             2044   0 (unused)
ip_nat_amanda           1020   0 (unused)

This is a list showing that the driver modules for the network card are loaded. For Intel pro100 the module is named eepro100 and for 3Com the module is named 3c59x (which is valid for cards with type names 3c590, 3c595, 3c900, 3c905). See section 3.12

Is useful to figure out where the Internet packages move. If there are problems, it is useful to see the path the Internet packages use.

Another command giving information about the state of the network cards.

Coyote running configuration display utility.

Internet    (eth1): UP
LAN network (eth0): UP

-------------Internet configuration--------------
IP Address   192.168.100.133 (Static)
Netmask      255.255.255.0
Gateway      192.168.100.2
----------------LAN configuration----------------
IP Address   10.0.2.1
Netmask      255.255.254.0
Broadcast    10.0.3.255
----------------DNS configuration----------------
domain localdomain
nameserver 213.184.200.1
nameserver 213.184.200.2
-------------------------------------------------
10:51am up 7 days, 20:53, load average: 0.00, 0.00, 0.00

Press enter to return to system menu.

The command is used to see how much memory is available and how much is used. This machine has 32 MB memory.

coyote# free
              total         used         free       shared      buffers
  Mem:        30860         6004        24856            0            0
 Swap:            0            0            0
Total:        30860         6004        24856

This command starts the Coyote Linux menu

               Coyote Linux Gateway -- Configuration Menu


  1) Edit main configuration file         2) Change system password
  3) Edit rc.local script file            4) Custom firewall rules file
  5) Edit firewall configuration          6) Edit port forward configuration

  c) Show running configuration           f) Reload firewall
  r) Reboot system                        w) Write configuration to disk

coyote#reboot

This command does a reboot of Coyote Linux

coyote#halt

Here is Coyote Linux turned off

Next

Use case:

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

Exception handling

Verification

Update the configuration database

Last

Use case:

Author: Klaus Ade Johnstad.

Co-author: Knut Yrvin

Exception handling

Verification

Update the configuration database