Beruflich Dokumente
Kultur Dokumente
Graham Williams
ii
The procedures and applications presented in this book have been included
for their instructional value. They have been tested but are not guaranteed
for any particular purpose. The publisher does not offer any warranties or
representations, nor does it accept any liabilities with respect to the programs
and applications.
This book is a work in progress (and probably will always be so!). Please
send me comments, suggestions, updates, criticisms.
Copyright
c 2003-2004 by Graham Williams
Permission is granted to copy and distribute this book but not for commer-
cial gain with the exception that this document may be included with any
distribution of Debian GNU/Linux, without limitation.
Contents
Preface xxix
1 Advocacy 1
1.1 Linux Adopters . . . . . . . . . . . . . . . . . . . . . . . . . . 1
3 Distributions 19
3.1 Debian GNU/Linux Distributions . . . . . . . . . . . . . . . . 20
3.2 Advantages of the Debian Distribution . . . . . . . . . . . . . 21
iii
iv CONTENTS
4 Installation 35
4.1 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.1.1 LiveCD Install . . . . . . . . . . . . . . . . . . . . . . 36
4.1.2 Quick Debian Install . . . . . . . . . . . . . . . . . . . 36
4.2 Hardware Compatibility . . . . . . . . . . . . . . . . . . . . . 39
4.3 Getting the Installation Media . . . . . . . . . . . . . . . . . . 40
4.3.1 Floppy Distribution . . . . . . . . . . . . . . . . . . . . 40
4.3.2 CD-ROM Distribution . . . . . . . . . . . . . . . . . . 41
4.3.3 LiveCD Distributions . . . . . . . . . . . . . . . . . . . 41
CONTENTS v
4.4 Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.4.1 SPARCStation Boot . . . . . . . . . . . . . . . . . . . 42
4.4.2 BIOS Not Supporting CD-ROM . . . . . . . . . . . . . 43
4.5 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.5.1 Debian Install . . . . . . . . . . . . . . . . . . . . . . . 43
4.5.2 PGI Install . . . . . . . . . . . . . . . . . . . . . . . . 43
4.6 Base Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.6.1 Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.6.2 Partitions . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.6.3 Configure Devices . . . . . . . . . . . . . . . . . . . . . 45
4.6.4 Networking . . . . . . . . . . . . . . . . . . . . . . . . 45
4.6.5 Time Zone . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.6.6 Floppy Boot Disk . . . . . . . . . . . . . . . . . . . . . 46
4.6.7 Reboot and User Accounts . . . . . . . . . . . . . . . . 46
4.6.8 Package Selections . . . . . . . . . . . . . . . . . . . . 46
4.6.9 EMail: Setup Exim . . . . . . . . . . . . . . . . . . . . 46
4.7 Installing Packages . . . . . . . . . . . . . . . . . . . . . . . . 47
4.7.1 Update To Newest Distribution . . . . . . . . . . . . . 47
4.7.2 Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.7.3 New Packages . . . . . . . . . . . . . . . . . . . . . . . 48
4.8 Kernel Upgrade: 2.2 to 2.4 . . . . . . . . . . . . . . . . . . . . 50
4.9 Initial Configurations . . . . . . . . . . . . . . . . . . . . . . . 51
4.10 Target Machines . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.10.1 Optima Super Vizon II 3600 Customised (Bartok) . . . 51
4.10.2 ASL (Cargo) . . . . . . . . . . . . . . . . . . . . . . . 58
4.10.3 Custom (Wayfare) . . . . . . . . . . . . . . . . . . . . 60
vi CONTENTS
7 Audio 163
10 Backup 171
10.1 Backup To Other Computers . . . . . . . . . . . . . . . . . . . 171
10.2 Legato NetWorker . . . . . . . . . . . . . . . . . . . . . . . . 173
12 Booting 179
12.1 Lilo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
12.1.1 Large Disks . . . . . . . . . . . . . . . . . . . . . . . . 180
12.1.2 Kernel Images . . . . . . . . . . . . . . . . . . . . . . . 180
12.2 GRUB: The Grand Unified Boot Loader . . . . . . . . . . . . 181
12.3 Secure Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
12.4 Dual Boot: Multiple Operating Systems . . . . . . . . . . . . 183
12.4.1 Dual Boot with MS-Windows/NT . . . . . . . . . . . . 183
12.4.2 Boot NT from LILO . . . . . . . . . . . . . . . . . . . 185
12.5 MS-Windows/NT or MS-Windows/2000 . . . . . . . . . . . . 185
12.6 The Booting From Floppy Alternative . . . . . . . . . . . . . 186
13 Cameras 189
13.1 Setup of HP Photosmart 320 . . . . . . . . . . . . . . . . . . . 189
13.2 Accessing Photos . . . . . . . . . . . . . . . . . . . . . . . . . 189
14 CD-ROM 191
14.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
14.1.1 CD Writer as a SCSI Device . . . . . . . . . . . . . . . 193
14.1.2 Docking Station CD-ROM . . . . . . . . . . . . . . . . 195
14.1.3 LG CED-8080B Problems . . . . . . . . . . . . . . . . 195
14.1.4 cdrecord Problem: Cannot . . . Bytes on /dev/zero . . . 196
x CONTENTS
15 Chinese 211
18 Commercial 221
18.1 Corel WPO Office Alternative . . . . . . . . . . . . . . . . . . 221
19 Configuration 223
19.1 System Configuration in /etc . . . . . . . . . . . . . . . . . . . 223
22 Desktop 235
23.6.5 FS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
23.6.6 GRAFCET . . . . . . . . . . . . . . . . . . . . . . . . 252
23.6.7 Ladder . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
23.6.8 Networks . . . . . . . . . . . . . . . . . . . . . . . . . 253
23.6.9 Pneumatic/Hydraulic . . . . . . . . . . . . . . . . . . . 253
23.6.10 SADT . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
23.6.11 Sybase . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
23.6.12 UML . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
23.7 Walkthrough: Creating Your Own Shapes . . . . . . . . . . . 255
23.7.1 Simple Example . . . . . . . . . . . . . . . . . . . . . . 255
23.7.2 Shape Elements . . . . . . . . . . . . . . . . . . . . . . 256
23.7.3 SVG Support . . . . . . . . . . . . . . . . . . . . . . . 258
23.7.4 Sheet Elements . . . . . . . . . . . . . . . . . . . . . . 258
23.7.5 Installing New Sheets . . . . . . . . . . . . . . . . . . . 258
23.8 Reference: The dia Save Format . . . . . . . . . . . . . . . . . 258
23.9 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 258
25 Disks 263
25.1 New Disk Setup . . . . . . . . . . . . . . . . . . . . . . . . . . 263
25.2 Ext2 to Ext3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
25.3 Disk Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 263
26 Documentation 267
26.1 Debian doc-central . . . . . . . . . . . . . . . . . . . . . . . . 267
xiv CONTENTS
27 Email 269
27.1 Setting up EMail . . . . . . . . . . . . . . . . . . . . . . . . . 269
27.1.1 Exim . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
27.2 Retrieving and Filtering Email . . . . . . . . . . . . . . . . . . 270
27.2.1 Fetchmail: Collect Mail from Remote Hosts . . . . . . 270
27.2.2 Procmail to Filter and Split Email . . . . . . . . . . . 272
27.2.3 IMAP: Mail Server . . . . . . . . . . . . . . . . . . . . 273
27.2.4 POP Mail Server . . . . . . . . . . . . . . . . . . . . . 273
27.3 Reading Email . . . . . . . . . . . . . . . . . . . . . . . . . . 274
27.3.1 Mutt . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
27.3.2 Gnus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
27.4 Email Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
27.4.1 Grepmail: Search mail archives . . . . . . . . . . . . . 275
27.4.2 EMail Attachments . . . . . . . . . . . . . . . . . . . . 276
27.4.3 MS-TNEF attachments . . . . . . . . . . . . . . . . . . 276
27.4.4 Uuencode and Uudecode in Mail . . . . . . . . . . . . 276
27.4.5 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . . 276
27.5 Spam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
27.6 Viruses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
27.7 SMTP Direct . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
31 Firewalls 285
31.1 IPMASQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
31.2 IPCHAINS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
41 Graphics 353
41.1 Graphics Editors . . . . . . . . . . . . . . . . . . . . . . . . . 353
41.1.1 Xfig: Vector Graphics Editor . . . . . . . . . . . . . . 354
41.2 Common Operations . . . . . . . . . . . . . . . . . . . . . . . 355
41.2.1 Charts and Plots . . . . . . . . . . . . . . . . . . . . . 355
41.2.2 Screen Capture . . . . . . . . . . . . . . . . . . . . . . 356
xviii CONTENTS
44 ImageMagick 365
46 Java 373
46.1 Install Sun Java . . . . . . . . . . . . . . . . . . . . . . . . . . 373
46.2 Java Alternatives . . . . . . . . . . . . . . . . . . . . . . . . . 374
46.3 Mozilla Java Plugin . . . . . . . . . . . . . . . . . . . . . . . . 374
50 Keyboard 391
50.1 Mapping a Key . . . . . . . . . . . . . . . . . . . . . . . . . . 391
52 LaTeX 395
52.1 LaTeX Documentation . . . . . . . . . . . . . . . . . . . . . . 395
52.2 Generating LaTeX . . . . . . . . . . . . . . . . . . . . . . . . 395
52.3 Creating LaTeX Documents . . . . . . . . . . . . . . . . . . . 396
52.3.1 Using LyX . . . . . . . . . . . . . . . . . . . . . . . . . 396
52.3.2 Using Emacs . . . . . . . . . . . . . . . . . . . . . . . 396
52.4 Processing a LaTeX Document . . . . . . . . . . . . . . . . . 396
52.5 LaTeX Tips and Tricks . . . . . . . . . . . . . . . . . . . . . . 397
52.5.1 Bibliography Starts on a New Page . . . . . . . . . . . 397
52.6 TeX Capacity Exceeded . . . . . . . . . . . . . . . . . . . . . 397
53 Login 399
53.1 All Capitals Login . . . . . . . . . . . . . . . . . . . . . . . . 399
53.2 Login Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
xx CONTENTS
55 Modems 405
55.1 Silence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
55.2 No Dial Tone . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
55.3 Chat Script Giving up Too Early . . . . . . . . . . . . . . . . 406
56 MSWindows 407
56.1 Wine: Emultaing MS-Windows . . . . . . . . . . . . . . . . . 407
56.2 Citrix: MSWindows Under Linux . . . . . . . . . . . . . . . . 407
56.2.1 Screenshot . . . . . . . . . . . . . . . . . . . . . . . . . 408
56.2.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . 408
57 Music 411
58 MySQL 413
58.0.3 MySQL Root Password . . . . . . . . . . . . . . . . . . 414
58.0.4 Creating New Database . . . . . . . . . . . . . . . . . 414
58.0.5 Create a New User . . . . . . . . . . . . . . . . . . . . 416
58.0.6 Remote Host Access . . . . . . . . . . . . . . . . . . . 417
58.0.7 Remote User Permissions . . . . . . . . . . . . . . . . . 417
58.0.8 Basic MySQL . . . . . . . . . . . . . . . . . . . . . . . 418
60 Networks 425
60.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
60.2 Network Configuration . . . . . . . . . . . . . . . . . . . . . . 426
60.2.1 Graphical Tools . . . . . . . . . . . . . . . . . . . . . . 426
60.2.2 Manual Setup . . . . . . . . . . . . . . . . . . . . . . . 426
60.2.3 Neighborhood Table Overflow . . . . . . . . . . . . . . 427
60.2.4 Example Configurations . . . . . . . . . . . . . . . . . 427
60.3 Wireless Network . . . . . . . . . . . . . . . . . . . . . . . . . 429
60.4 Domain Name Searching . . . . . . . . . . . . . . . . . . . . . 430
60.5 Hostname Changes . . . . . . . . . . . . . . . . . . . . . . . . 431
60.6 Ports and Services . . . . . . . . . . . . . . . . . . . . . . . . 431
60.7 Getting the Cabling Right . . . . . . . . . . . . . . . . . . . . 433
60.8 IP Forwarding: Home Networks . . . . . . . . . . . . . . . . . 433
60.9 Multiple Ethernet Cards . . . . . . . . . . . . . . . . . . . . . 436
63 OpenOffice 443
63.1 OpenOffice Writer . . . . . . . . . . . . . . . . . . . . . . . . 443
63.2 Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
xxii CONTENTS
65 Partitions 449
65.1 Sample Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
65.2 Suggested Partitioning . . . . . . . . . . . . . . . . . . . . . . 450
65.3 Repartitioning MS-Windows . . . . . . . . . . . . . . . . . . . 452
66 Passwords 455
66.1 Password File Sharing . . . . . . . . . . . . . . . . . . . . . . 455
66.1.1 Using rdist . . . . . . . . . . . . . . . . . . . . . . . . . 456
66.1.2 Simple tar . . . . . . . . . . . . . . . . . . . . . . . . . 456
66.1.3 Using NIS . . . . . . . . . . . . . . . . . . . . . . . . . 457
68 Presentations 461
68.1 Beamer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
68.2 Prosper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
68.3 OpenOffice Impress . . . . . . . . . . . . . . . . . . . . . . . . 461
68.4 KPresenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
69 Printing 463
69.1 CUPS - Common Unix Printing System . . . . . . . . . . . . 463
CONTENTS xxiii
70 Python 469
70.1 Python Documentation . . . . . . . . . . . . . . . . . . . . . . 469
70.2 Python and R: Python Interfaces to R . . . . . . . . . . . . . 470
70.2.1 Installing RSPython . . . . . . . . . . . . . . . . . . . 470
70.2.2 Installing RPy . . . . . . . . . . . . . . . . . . . . . . . 471
73 Samba 483
74 Scanning 485
74.1 Setup HP PSC 2210 . . . . . . . . . . . . . . . . . . . . . . . 485
74.2 Scanning Setup . . . . . . . . . . . . . . . . . . . . . . . . . . 486
75 Science 487
75.1 Chemistry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
75.1.1 Periodic Tables . . . . . . . . . . . . . . . . . . . . . . 487
xxiv CONTENTS
76 Security 489
77 Sketch 503
79 Spell 511
84 Swap 529
85 Themes 531
85.1 Enlightenment . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
86 USB 533
86.1 Mass Storage Devices . . . . . . . . . . . . . . . . . . . . . . . 534
86.1.1 HP Photosmart 320 . . . . . . . . . . . . . . . . . . . . 535
86.2 Mass Storage Devices (DVD Writer) . . . . . . . . . . . . . . 535
86.3 USB Printer: HP LaserJet 1200 . . . . . . . . . . . . . . . . . 537
xxvi CONTENTS
87 Video 539
87.1 Viewing Video . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
87.2 DVD Videos . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
87.2.1 Xine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
87.2.2 Ogle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
87.2.3 DVD Sound Track . . . . . . . . . . . . . . . . . . . . 540
87.3 Video Backups . . . . . . . . . . . . . . . . . . . . . . . . . . 542
87.3.1 Using The dvdrip GUI . . . . . . . . . . . . . . . . . . 542
87.3.2 Command Line Tools . . . . . . . . . . . . . . . . . . . 543
87.4 DVD-AUDIO . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
87.5 Video from Photos . . . . . . . . . . . . . . . . . . . . . . . . 545
87.6 nVidia Video Driver . . . . . . . . . . . . . . . . . . . . . . . 546
87.6.1 Compiling the Driver . . . . . . . . . . . . . . . . . . . 546
91 XML 571
91.1 XSLT Processors . . . . . . . . . . . . . . . . . . . . . . . . . 571
xxviii CONTENTS
Preface
xxix
xxx Preface
There are many ways of obtaining GNU/Linux and we only cover the most
common approaches. Chapter 4 provides an overview of installing Debian
with detailed examples for a number of hardware platforms. Chapter 5 is a
brief introduction to some of the essential GNU/Linux utilities that you are
likely to come across soon. The Debian packaging system used to manage
(and take all of the hard work out of maintaining) packages is described in
Chapter 3.4. Setting up the X Window System is covered in Chapter 90. By
this stage you will have a system ready to take full advantage of. On a more
technical level Chapter 49 shows how simple it is to compile your own kernel
to suit your hardware requirements.
All of the major classes of desktop tools are covered, including word pro-
cessing, spreadsheets, personal information management, graphics, databases
and, of course, games. Also included are chapters covering some of the tools
for developers, including emacs and glade. The aim is to set you well on the
road to using these tools at a level that is sufficient for many users. Of course,
each tool itself deserves, and often has available for it, a book or extensive
manuals.
The administration chapters cover very many different topics that let you
tune your GNU/Linux system to suit your needs. Not everything here is
relevant to everybody, but it brings together many recipes for many of the
typical tasks that users sometimes need to know about, again without going
into exhaustive detail (which is available elsewhere if you need it or are
interested).
So sit back and enjoy the freedom of free software and become part of the
community that is making computers and the applications they run a benefit
to society world wide, rather than a costly privilege.
Typography
Screen shots from the Galeon web browser are based on Galeon at 700x600.
What’s In A Name
xxxi
The phrase Microsoft Windows (and less informatively just Windows) usu-
ally refers to the whole of the popular operating systems, irrespective of which
version of Microsoft Windows is being run, unless the version is important.
But Microsoft Windows is just one of many windowing systems available,
and indeed, Microsoft Windows came on to the screen rather later than the
pioneering Apple Macintosh windowing system and the Unix windowing sys-
tems. We will simply refer to all varieties of Microsoft’s windowing systems
(Windows 95/98/NT/2000/XP) as MS-Windows. If the particular version
is important it will be referred to as MS-Windows/XP, for example.
We use the phrase GNU/Linux to refer to the GNU environment and the
GNU and other applications running in that environment on top of the Linux
operating system kernel. Similarly, GNU/Hurd refers to the GNU environ-
ment and the GNU and other applications running in that environment on
top of the GNU Hurd operating system kernel.
Debian is a complete distribution which includes many applications based
around a particular choice of operating system kernel (usually either GNU/Linux
or GNU/Hurd). Where the particular kernel is not important we will refer
to whole system as Debian.
The common windowing system used in Debian is a separate, but integral,
component that we will refer to as the X Window System.
Screen Shots
Through out the document screen shots are presented using a variety of
Gnome and KDE themes. The theme specifies what things look like inside
the windows that an application displays, and now also tend to specify what
the window frame looks like—that is, the area immediately surrounding the
application’s window. There is an endless variety of themes to suit your
own preferences. Some favourites include the E-efm-GTK+ Gnome theme and
the QN-X11 and Crux Sawfish themes. Refer to the discussion of themes in
Chapter 85 for details, if interested.
About This Book
retain the copyright attributions and you are required to give appropriate
attribution for any material you use from the book.
Also, by taking a copy, or even simply using the book, you should feel obliged
to contribute to the book in some way, by sending corrections, comments, up-
dates, suggestions, or even whole new chapters, to me at
Citations
Debian Weekly News pointed to this book in their 8th July 2003 edition.
Chapter 1
Advocacy
Why bother with open source software when Microsoft has the market sewn
up? The cost of GNU/Linux (it is freely available to whoever wants it) is not
always the primary issue! Usability, reliability, security, and developerability
are often just as, and for different users even more, important issues.
GNU/Linux offers a value proposition that money can not buy. The in-
vestment in GNU/Linux is really an investment in human beings working
to bring a better and coordinated solution to the organisation. A solution
that in the long run delivers more for less, without the traditional tie-in of
proprietary systems.
We begin with a review of major decisions by governments and organisations
the world over, then review some of the key benefits.
The Swiss taxation office distribute a CDROM with the open source office
suite called Open Office. On the CDROM is an Open Office version of the
Tax form. Tax payers fill in the form and lodge their returns electronically.
In June 2003, at the Net World Order conference, held at the CeBIT trade
show in New York City, and sponsored by the Business Council for the United
Nations, Bruno Lanvin from the World Bank said
1
2 Advocacy
are now using Linux, which looks to become the No. 1 operating
system in China and India soon.
As of October, 2003, many local governments in Germany are taking the step
toward GNU/Linux
Usability
Usability has been a problem for GNU/Linux for a long time. It has not
been comparable to the ease of use of the MS-Windows system in terms
of being a common desktop environment. As we demonstrate in this book
though this issue has been well addressed and the time is now right for Debian
GNU/Linux on the desktop.
Reliability
GNU/Linux is a very stable operating system and system crashes are virtu-
ally unknown. GNU/Linux, like Unix before it, is designed to be a multi-user,
shared system. Simply because one user of the system runs an application
that crashes, other users of the same system should not be affected. Also,
most GNU/Linux applications have been in open development for many years
with many developers working on and looking over the code. Bugs of course
are not unknown, but they are usually quickly fixed within GNU/Linux,
leading to a very reliable system.
Security
Any one can scan the GNU/Linux code for vulnerabilities (and for ineffi-
ciencies and bugs) and as they are discovered the solutions quickly become
available for all to access. Of course, the unscrupulous can also scan the code
for opportunities to attack a system, unlike proprietary code where only a few
have access to the source code. But would you prefer security by obscurity
or security by peer review? It is a choice!
Developerability
A brief review of the history of Unix will place in context much of the ter-
minology and philosophy of this operating system. Terms like Linux, GNU,
Unix, Gnome, Free Software, and Open Source Software get bandied around,
often with little understanding and usually with much misunderstanding.
While the kernel is crucial, it is the larger suite of software that sits on top
of the kernel that provides the functional operating system. Most of the
software applications at this level come from the GNU Project. These tools
include the command line utilities like ls, cp, find, bash, and the com-
pilers like gcc. This collection of applications is usually considered to be
the actual operating system and hence we refer to the operating system as
GNU/Linux in recognition of the GNU software coupled with the Linux ker-
nel. GNU/HURD is an alternative operating system using the GNU software
with the HURD kernel being developed by the GNU Project.
5
6 History: Unix, GNU, Gnome
might refer to as the end user level of the operating system. This is typically
a graphical user interface (GUI) aiming to provide an intuitive, easy to use
system for both the general, non-technical user and the power user. Such an
interface is typically an application that sits on top of and makes considerable
use of the operating system. For GNU/Linux this is the X Window System.
In this chapter we briefly review the history of Unix, GNU Software, the
GNU/Linux Operating System, Gnome, and Free and Open Source Software
and Documentation.
2.1 Unix
GNU/Linux is fashioned on Unix. Unix dates from 1969 when Ken Thomp-
son at Bell Telephone Laboratories initiated work on this new operating
system. Others involved in the project included Dennis Ritchie and Brian
Kernighan. The name Unix is a pun on an alternative operating system
of the time called MULTICS (MULTiplexed Information and Computing
Service). MULTICS was developed by The Massachusetts Institute of Tech-
nology, General Electric and Bell Labs. Unix was originally spelt UNICS, an
acronym for UNiplexed Information and Computing Service!
Some of the basic ideas introduced by Multics and then Unix were the tree
structured file system, a program for command interpretation (called the
shell), the structure and nature of text files and the semantics of I/O op-
erations. Some of the philosophy that rose with the development of Unix
included the desire to write programs that performed one task and to do it
well, to write programs that worked together to perform larger tasks, and
to write programs that communicated with each other using text from one
program to the other.
The advantages of Unix were quickly identified by many and quite a few va-
rieties of Unix emerged over time. Sun Microsystems have pioneered many of
2.1 Unix 7
the developments in Unix, followed by such greats as the old Digital Equip-
ment Corporation (DEC, which was swallowed by Compaq, which was swal-
lowed by Hewlett-Packard), Silicon Graphics Incorporated (SGI), Interna-
tional Business Machines (IBM), and Hewlett-Packard (HP). A variety of
flavours have existed, including SunOS, Solaris, Ultrix, Irix, BSD, System V,
HPUX, and so on. Although computer programs written for one version of
Unix could sometimes be ported to other versions, it was not always an easy
task. The diversity of Unix implementations (more so than the proprietary
nature of most of them) made it difficult for Unix to become a commodity
operating system. The GNU project worked hard to free software develop-
ment from nuances of each of the different Unix versions through providing a
common programming language environment (GNU C) and a sophisticated
packaging tool (autoconf and automake) to carefully hide the differences.
GNU/Linux has now become the most popular Unix variant and all the ma-
jor Unix players support GNU/Linux in some way.
A particularly touted feature of Unix comes from a tools philosophy where
complex tasks are performed by bringing together a collection of simpler
tools. This is contrasted with the philosophy of providing monolithic ap-
plications that in one fell swoop solve all your problems, supposedly. The
reality is often different.
Most operating systems supply a collection of basic utility programs for man-
aging your files (things like arranging your files into folders, trashing files,
and copying files from one place to another). Large applications then provide
the word processing, spreadsheet, and web browsing functionality.
Unix places less emphasis on the monolithic applications. Instead, tools
provide simple functionality, focusing on doing well what they are designed
to do. They simply pass their results on to another tool once they’re done.
Unix pipes provide the mechanism for doing this: one tool pipes its output
on to another tool. This allows complex actions to be performed by piping
together a collection of simpler commands.
A typical example is to determine the number of users logged on to your
system:
> who | wc -l
The who command will list, one per line, each user logged on. The wc
command will count the number of characters, words, and lines that it comes
8 History: Unix, GNU, Gnome
across, with the -l option only counting the number of lines. (GNU tools,
like Unix, introduce options with the minus sign.)
For various reasons though this tools philosophy was often overlooked when
large monolithic applications arose that did not adhere to the philosophy—
they did not share components. Common tools such as Netscape, ghostview,
Acrobat, FrameMaker, and Star Office essentially share very little. Compare
that with the Microsoft community where, for example, an application like
Internet Explorer is component-based. This is now changing in the GNU
world with the operating system software and the Gnome project encouraging
component-based architectures.
Another feature of Unix is that Unix applications tend to use open file formats
allowing a variety of tools to collaborate to work on those open formats.
Indeed, this has been a key in recent developments to remove the strangle-
hold of Microsoft proprietary formats. Rather than electronic document
storage providing a longer term solution to the archival of documents, it
is delivering an even shorter lifetime than paper-based archives! How can
that be so? The formats created by proprietary software are often binary
and not fully publicly specified. How many packages today can read old
Word Perfect and Microsoft Word documents? The standardisation on open
formats, often text-based formats like XML that allow anyone to read them,
provides a solution to this problem.
And finally, the much touted stability. There is very little doubt that GNU
and Linux are extremely stable. The habit of rebooting your computer ev-
ery time you come back to it is something Microsoft seems to encourage
because of it’s notorious instability and tendency for the operating system
not to carefully manage its use of memory. Also, install a new package un-
der MS-Windows and chances are you need to reboot the computer. Most
Unix users rarely need to reboot their machine. Check the uptime and you
will generally find the machine has not been rebooted for months or years.
Installing packages invariably does not require rebooting. Indeed, the only
2.2 GNU 9
2.2 GNU
The GNU Project1 was begun in 1984 by Richard Stallman of MIT with
the aim to develop a complete free (meaning free for everyone to look at, to
learn from, and to build upon) software operating system. In 1989 he codified
the terms under which this free software was released, producing the GNU
Public License (GPL) which is the basis on which much of the GNU/Linux
operating system is released. The license is often referred to as the copyleft
license in contrast to the restrictive practise of copyright.
By 1991 when Linus Torvalds wrote his Linux kernel GNU provided the
operating system. By combining the GNU operating system with the Linux
kernel the seeds for this most popular free operating system were sown.
Many users installed the GNU tools on many different computers as replace-
ments for vendor supplied tools. This provided these users with a consistency
across the many different platforms they used. The tools even eventually ap-
peared under MS-Windows, providing a Unix-like environment on a very
different operating system.2
The tools developed by the GNU project include such essential utilities as
the GNU file management utilities and the GNU text file processing utilities.
The GNU file management utilities include fundamental command line tools
like ls (to list information about files/documents), mkdir (to create new
directories/folders), mv (to move directories and files around), rm (to remove
files), and many more. The GNU text file processing commands include cat
(to concatenate files together), head (to preview the top few lines of a file),
sort (to sort the contents of a file), and wc (to count the number of lines,
words, and bytes in a file).
The toolkits developed by the GNU project are comprehensive. The following
table lists just some of the 200 or more packages that you can obtain freely
from http://www.gnu.org/software/software.html:
Package Description
aspell An interactive spell checker that suggests ‘near misses’ to re-
place unrecognised words.
1
GNU stands for the recursive “GNU is Not Unix.”
2
http://www.cygwin.com
10 History: Unix, GNU, Gnome
Package Description
awk A powerful yet simple pattern-based scripting language.
bash The Bourne Again SHell is compatible with the traditional
Unix sh and offers many extensions found in csh and ksh. It
is similar in concept to DOS.
binutils Consists of programs used to assemble, link, and manipulate
binary and object files. It is used in conjunction with a com-
piler and various libraries to build programs for Linux.
chess A state-of-the-art chess-playing program.
cvs The Concurrent Versioning System used for version control
and management of software projects.
emacs An extensible, customisable real-time display editor and com-
puting environment. This editor is widely used by developers
and is more than just an editor. Emacs is capable of read-
ing email, of providing integrated development environments,
and spreadsheets, to name just a few.
enscript An ASCII file formatter generating PostScript for printing of
text documents on PostScript printers.
fileutils File management utilities.
findutils The ‘find’ utility is frequently used both interactively and
in shell scripts to find files which match certain criteria and
perform arbitrary operations on them.
gcc A free compiler collection for C, C++, Objective C and other
languages. This compiler is used widely, on multiple plat-
forms, including MS-Windows.
gdb A source-level debugger for C, C++ and Fortran.
ghostscript An interpreter for the Postscript and PDF graphics languages.
gimp A sophisticated graphical image manipulation application.
gnome The GNU desktop which provides a consistent graphical user
interface for common applications including everything from
spreadsheets to mail clients, and more.
gnumeric A spreadsheet.
gphoto A graphical application for retrieving, organising, and pub-
lishing images in various graphics formats, from a range of
supported digital cameras.
gnupg A complete implementation of the OpenPGP Internet stan-
dard for providing pretty good protection through encryption.
gtk+ A GUI toolkit for the X Window System. All Gnome packages
use this toolkit for their consistent look and feel.
gzip GNU’s program for compressing and decompressing files.
2.3 Linux 11
Package Description
kde An alternative, and very popular desktop which provides a
consistent graphical user interface for common applications
including everything from spreadsheets to mail clients, and
more.
less A display paginator similar to ‘more’ and ‘pg’, but with var-
ious features (such as the ability to scroll backwards) that
most pagers lack.
mtools Programs to allow Unix systems to read, write, and manipu-
late files on a DOS file system (typically a diskette).
r A system for statistical computation and graphics.
shellutils Useful command line utilities including ‘basename’, ‘date’,
‘dirname’, ‘echo’, ‘groups’, ‘hostname’, ‘printf’, ‘pwd’, ‘un-
ame’, ‘uptime’, ‘users’, ‘who’, and ‘whoami’.
tar An archive utility.
textutils A set of utilities for manipulating text.
time A utility to report on the time taken to execute other pro-
grams.
wget A non-interactive web browser to retrieve files from the In-
ternet using HTTP and FTP. See Chapter 88.3 for details.
Many of these GNU tools are command line tools but a growing number
of them are now also GUI-based, including Gnome, KDE, The Gimp, and
Gnumeric.
2.3 Linux
Unix was popular because, originally, the source code was practically free.
For various reasons the Unix license began to forbid the Universities from
using the source code in their teaching. This lead Andy Tannenbaum to
write MINIX which then inspired Linus Torvalds to write the Linux kernel
for his Intel 386.
Unix has a long heritage and the new GNU/Linux has the luxury of learning
from the success and failings of both Unix and MS-Windows. Of particular
importance is the component-based architecture that facilitates the sharing of
components among many applications. These are the focus of much modern
development for GNU/Linux. Gnome, for example, uses Bonobo (built on
12 History: Unix, GNU, Gnome
2.4 Gnome
Unix lead to the development of the GNU Project which needed a kernel
that was supplied by Linux to produce the GNU/Linux Operating System.
GNU/Linux and Unix are generally criticised for being hard to use for the
common user—all those command line tools and all that fiddling with config-
urations placed them back in the MS-DOS days. The demand is for modern
intuitive interfaces similar to those pioneered by the Macintosh back in 1984.
Unix has had graphical user interfaces for a long time. The problem was that
Unix was provided by multiple vendors and those vendors had difficulty agree-
ing on a common way of doing things in the graphical user interface. There
were systems like NeWS, OpenWindows, Display PostScript, and the X Win-
dow System. There was also a multitude of windowing systems available for
the X Window System, including CDE, Motif, OpenLook, etc. They offered
tremendous flexibility which lead to great diversity! And great confusion.
Developers could chose different toolkits and get very different behaviours.
Different ways of interacting with applications lead to much confusion and
certainly no consistency: different ways of moving to the next text field;
different defaults for keyboard shortcuts; different mechanisms for cut and
paste between applications; etc. Apple, with the Macintosh, had a lot of con-
trol on how things should be done and developed guidelines for developers to
do things the right way. Later, Microsoft with MS-Windows/95 and beyond
also dictated standards for others to follow. This meant that once the user
had learnt the nuances of the interface they were “set for life.”
2.5 Free and Open Source Software 13
There is much confusion over the terms free software and open source. They
are not the same thing. Open source software is not necessarily free software.
Indeed, some open source software places considerable restrictions on what
you can do with the source code, thus rendering it non-free. GNU software is
open source software that is also free in the sense of freedom. This software
allows everyone to redistribute and modify the software, without restriction.
We contrast open and free software with proprietary software that we have
become familiar with—the software that we buy on trust from a vendor, trust
that it will work, but for which the vendor disowns any responsibility. When
you find it has bugs and is not fit for purpose you must buy the next version
to get something that works for you.
Proprietary applications for word processing, spreadsheets, presentations,
Web browsing and so on abound. In general they work pretty well today,
providing sophisticated functionality. However, probably because of their
proprietary nature, they generally do not work well together, particularly
products from different vendors. There is little motivation for vendors to
14 History: Unix, GNU, Gnome
make it easy for you to move away from their product to a competitors
product.
What makes this situation rather sad is that each of these proprietary appli-
cations have a lot of functionality in common. Today we have a pretty good
understanding of the common features we require in a product: open and
save files, cut and paste, spell checking, etc. They all provide this, often over
and over again. There will always be opportunity to innovate and do things
in different and possibly better ways, but why are we wasting resources on
the most basic of operations instead of innovating with new functionality?
This has been addressed on the major modern platforms by sharing toolkits.
But sharing of more substantial functionality has been slower to develop.
Free software demands that the user be granted four kinds of freedom: free-
dom to run the program, for any purpose; freedom to study how the program
works, and adapt it to your own needs; freedom to redistribute copies so you
can help your neighbour; and freedom to improve the program, and release
your improvements to the public, so that the whole community benefits. A
pre-condition for this is the availability of the entire source code, so that
along with the freedom comes the responsibility to share your “discoveries”
with others.
Free software open source projects still need to be structured. Usually they
are conducted under the watchful eye of a project leader, commonly referred
to as the maintainer. Anyone can contribute to the project and decisions
are often discussed openly and decided by consensus after discussion of the
technical merits. Sometimes the project leader will need to cast the ‘deciding
vote’.
2.7 Freedom
The free software world aims to share their knowledge and software in order
for all to gain towards a common goal. The proprietary software world aims
to hoard their software, to hide their discoveries, to let others go through the
discovery process themselves rather than to innovate from the shoulders of
those who went before them.
Stallman characterises the view of the proprietary vendors as: “If you share
with your neighbour, you are a pirate. If you want any changes, beg us to
make them.”. If I enjoyed a piece of music or a novel, should I be inhibited
from lending the CD or the book to my neighbour?
Eric Raymond, in his “Musings on Linux and Open Source” in the book
“The Cathedral and the Bazaar” makes compelling arguments for Free and
16 History: Unix, GNU, Gnome
2.8.1 Books
excellent guide to many aspects of the Linux operating system. Also available
from http://www.icon.co.za/~psheer/book/.
18 History: Unix, GNU, Gnome
2.8.2 Internet
For the GNU perspective on many of the issues mentioned here refer to http:
//www.gnu.org/philosophy/free-software-for-freedom.html. This ar-
ticle, titled Why “Free Software” is better than “Open Source” is written by
Richard Stallman and is an essential read on the topic. It explains why the
use of the term “Open Source” is not strong enough in the context of “Free
Software.”
Freshmeat (http://freshmeat.net/) is an index of a large collection of
GNU/Linux packages with up-to-date information on their status and links
to their home pages and related locations. The index can be searched or
browsed. Most of the GNU/Linux tools are included.
Gnome (http://gnome.org/) is the framework and associated toolkit used
by many of the graphical applications introduced in this book. The Gnome
web site includes a list of many of the major Gnome applications.
Linux Today (http://linuxtoday.org/) is a news service providing updates
on developments related to GNU/Linux. It has a good selection of articles
usually updated several times a day, and does not overwhelm the reader
with news. Summaries are presented with links to slightly more detailed
summaries, with links to the complete articles, wherever they appear on the
Internet. Slashdot (http://slashdot.org/) is another news service with a
Linux bent.
Chapter 3
Distributions
When you purchase a computer the chances are that it comes with MS-
Windows pre-installed. The version of MS-Windows has been tuned and set
up by the manufacturer or retailer to run well on the particular configuration
you have purchased. Drivers for the particular devices, such as audio, video,
and CD-ROM, will have been included in the installation. The computer is
ready to turn on and get started in MS-Windows. It will just work (usually)!
To run GNU/Linux instead of MS-Windows (or in addition to MS-Windows)
you need to install the system yourself. This entails obtaining a distribution
of GNU/Linux, installing it, and configuring the device drivers to suit your
particular setup. So some extra effort is usually required to get GNU/Linux
up and running.
The GNU/Linux Operating System is built upon the foundation that is the
Linux kernel. To install GNU/Linux on your PC you could start with in-
stalling the Linux kernel and then compiling and installing the GNU tools
and other essential software that you need. But this approach is not for the
light hearted. Luckily this is not the usual manner of installing a GNU/Linux
system!
Many people have put a lot of effort into packaging things together into dis-
tributions so that installing GNU/Linux is a more straightforward exercise.
GNU/Linux distributions typically provide the whole system as a collection
of packages from which you choose those that you want install. Some pack-
ages are mandatory, and form the base installation. Other packages are then
installed as you need them.
Until pre-installed GNU/Linux systems become more common chances are
19
20 Distributions
you will need to install a distribution yourself. The process is not trivial
but it is straightforward. In Chapter 4 we will highlight the steps with just
enough detail to get you through the installation process. In this chapter
we review the options available in selecting a distribution of GNU/Linux to
install.
Demo Linux This is a CD based GNU/Linux that allows one to run GNU/Linux
without installation or disk partitioning. See http://www.demolinux.
org/.
Gibraltar The Gibraltar project produces a Debian-based firewall/router
that runs entirely off of a bootable CD-ROM. See http://gibraltar.
vianova.at/.
Knoppix The Knoppix distribution, based on Debian, allows one to run
Debian without installing it! Just boot from the CD-ROM and Debian
will run from there. If you decide to then install Debian, you can
do so from the Knoppix CD-ROM. Knoppix works on most but not
all hardware, trying its best to automatically identify hardware and
set things up appropriately. See http://www.knopper.net/knoppix/
index-en.html.
Libranet Linux by Libranet packages commonly used applications onto an
easy to install CD and includes, for example, Gnome. See http://www.
libranet.com.
3.2 Advantages of the Debian Distribution 21
currently over 870 active Debian developers. New work developed for
Debian is available for all of the other Linux distributions to copy as
soon as it’s uploaded to the Debian servers.
• Debian deals with dependencies and will identify the required packages
and install them and then install the package you want.
• Multiple packages can Provide the same functionality (e.g., email, web
server, editor). A package might thus specify that it depends on a web
server, but not which particular web server (assuming it works with
any web server).
• Debian does not overwrite your config files nor does the packaging sys-
tem touch /usr/local except perhaps to ensure appropriate directories
exist for local (non-Debian) installed data and utilities.
• RedHat uses a binary database for its package data while Debian (dpkg)
uses text files. Debian is more robust (if a single file gets corrupted it’s
less of a problem) and it is possible to fix or modify things by hand
using a normal text editor if needed. (Debian’s apt-get uses a mixed
approach: it uses the same text files as dpkg but uses a binary cache
to also get the advantages of a binary database.
• RedHat packages rarely fix upstream (i.e., original source of packages)
file locations to be standards compliant but instead just place files
whereever the upstream package happens to put them. Many upstream
developers do not know about or conform to the standards. A minor
example, the openssh rpms create /usr/libexec for the sftpd daemons,
but libexec is a BSD standard and the Linux standard1 says such things
should go in /usr/lib/¡program¿ or /usr/sbin.
• Generally speaking, Debian packages must be created by “qualified”
developers (and there are thousands of them) who are committed to
following Debian’s strict policies requiring such things as FHS com-
pliance and never overwriting config files without permission. Only
packages from these developers become part of the Debian archives.
• Debian runs on more hardware platforms than any other distribution.
• The Debian packaging philosophy is to keep packages in small chunks
so that the user can choose what to install with a little more control.
Debian has a carefully planned and controlled release program and has a
number of releases available at any time. The releases have code names
(originally from the Toy Story movies), release names, and versions. This
may sound complicated, but it is actually quite simple and effective. The
officially released and current version of Debian is referred to as the stable
release. This release is regularly highlighted as the most stable GNU/Linux
distribution available.
There are three ways of referring to a particular release: name (e.g., woody),
state (e.g., stable), and number (e.g., 2.2). The name and number refer to
the same static release with a number only being issued when the release
is finalised (i.e., it becomes stable). The state (stable, testing, or unstable)
shifts from release to release, and a given release will cycle through these
states. The special name sid always refers to unstable.
The release names come from the Toy Story movies (bo, hamm, slink, potato,
woody, sid, . . . ).
The unstable release is where new packages and updates to old packages
appear. You access this distribution if you want the latest and greatest, and
are comfortable with the occasional glitch.
For those who want the latest and greatest but not the risk the testing release
lags behind the unstable release by a few weeks to include only packages that
don’t appear to have any problems.
When a new release is being prepared it evolves from the unstable release
through the testing release onto the frozen release. A frozen release goes
through a thorough testing phase to ensure all packages in the distribution
work together and there are no outstanding bug reports. This process can
take six months or more.
26 Distributions
Once this testing is complete the release is then renamed as stable and may
remain the current stable for up to eighteen months. The stable release is
just that, stable. It is often regarded as the most stable distribution of
GNU/Linux available. Packages in this release are not the most recently
available and sometimes thought to be quite out of date, but that is the cost
of rock solid stability.
In summary, the stable release is best suited to production servers, while the
adventurous power user can run ’unstable’ on a desktop with only the rare
mess up.
An advantage of this system is that a user can track either a specific release
(slink, potato, woody, sid) or a state (stable, testing, unstable) simply by
specifying the appropriate name in /etc/apt/sources.list.
The fact that the states can change quite dramatically (e.g., when a new sta-
ble release is made) is a little problematical as people may suddenly find that
their system wants to upgrade everything to a new release. One suggestion
is to choose the release name and stay with that until you decide yourself to
upgrade.
Thus, to stay with a given release use the release name. To keep up-to-date
with a stable system then use the stable release. To be at the bleeding edge
and relatively stable then use testing. To live at the absolute bleeding edge
use unstable.
Version Name Testing Frozen Stable
bo
2.0 hamm
2.1 slink 1998/11/03 1999/03/10
2.2 potato 2000/01/16 2000/08/22
3.0 woody 2001/08
sid
There are over 75 Debian mirrors world-wide and over 7300 packages available
for unstable which you can browse at http://www.debian.org/Packages/
unstable/allpackages.html. Check for a mirror near you by trying http:
3.5 Debian Releases 27
(If you are familiar with Debian slink or earlier, you will notice that the
format of the non-US entry changed starting with potato.)
Finally, if you want to go the “commercial” (and sometimes less hassle) CD-
ROM distribution path a nice looking one based on Debian is Libranet.
The apt-setup command will run a simple interface to help set up your
/etc/apt/sources.list.
Another key benefit of Debian is that the distribution is packaged for multiple
architectures, including Alpha, ARM, HP PA-RISC, Intel x86, Intel IA-64,
Motorola 680x0, MIPS, MIPS (DEC), PowerPC, IBM S/390, and SPARC!
That’s quite a choice.
And even more interestingly, Debian is not tied to the Linux kernel! There’s
also a “Linux-free” Debian called Debian/Hurd (hurd-i386) and, surprisingly
there is even discussion of a Debian/Cygwin which runs Debian packages on
legacy MS-Windows platforms via the Cygwin compatibility toolkit. Now
that will be something to see!
Debian distributions are based on over 4400 packages. Your task is to select
those you wish to install! This is made easier with task packages which are
virtual packages that depend on a collection of other packages. Selecting
one of these task packages results in that collection of other packages being
28 Distributions
installed. An example is the task-tex package that will install the TEX and
LATEX packages and related utilities.
Task packages are presented to the user on an initial install. As the name
indicates a task package is intended to deliniate a specific task you might
use a computer for, like a web server, an X workstation, or perhaps an X
workstation using Gnome or KDE.
Individual packages are installed and updated using http://www.debian.
org/Packages/stable/base/dpkg.html dselect (with a basic GUI), or http:
//www.debian.org/Packages/stable/base/dpkg.html dpkg (for manual
installation of deb files), or http://www.debian.org/Packages/stable/
admin/apt.html apt-get (for automatic download and install, including in-
stallation of other required packages).
Using dselect is at first confusing but allows you to easily update and install
new packages with an ease that leaves you confident that all difficulties have
been carefully hidden through extensive dependency and consistency check-
ing. If network connection is interrupted, the downloads will be resumed from
where they got to. The dselect learning curve will pay dividends. My instal-
lation has always been left in a consistent and stable state after installing
packages from the Debian archives on the Internet.
As you gain confidence and know what you are after, move on to apt-get if
you prefer a command-line interface. This takes care of dependency checking
automatically (unlike dpkg) and will retrieve the required packages from the
Debian archives.
Each individual package can Suggest, Recommend, and Depend on other
packages. A subtle difference between dselect and apt-get is that the latter
ignores Suggest and Recommend dependencies whereas dselect will offer
Suggested packages for the user’s attention and will select Recommended
packages automatically.
• Access the archives using the apt access method. You will be offered
the chance to edit the file /etc/apt/sources.list but I always answer
3.7 Debian on CD 29
• Select any packages you want to install. This will also highlight any
packages that dselect thinks you probably should install, including de-
pendencies and security updates.
• Install will then figure out what has to be done and tells you what it
will need to download. You can tell it to go ahead or if you get cold
feet you can pull out here and go back and change your selections. If
you go ahead the packages are pulled from the Net and installed.
• Config is mostly a null operation for me. It seems to just double check
things.
Simple. The Select stage can be a little confusing when you get conflicts so
read the help screens carefully.
Once you’ve got things going with dselect you may find the convenience of
the command line based wajig useful.
3.7 Debian on CD
You don’t need to install Debian GNU/Linux from CD-ROM. You can obtain
all of the Debian packages from the international network of Debian mirrors
by simply using the Debian package tools (often based around the apt-get
package and including those that provide more user-friendly interfaces to
apt-get including capt, gnome-apt, and aptitude).
Of course, if you do not have ready access to the Internet you may want
to burn your own CD image of the distribution (assuming you have enough
30 Distributions
The recipe presented here uses a Solaris host (but can be any other Unix or
MS-Windows host) with good Internet access. You will need to install ncftp
version 2.4.3 (don’t use the more experimental version 3beta of ncftp as it
has a different behaviour that does not work with the Debian tools discussed
here—this may of course be fixed in more recent releases.) You will also need
wget. These are both freely available on the Internet (check freshmeat.net).
There are a smaller number of Debian hosts on the Internet that do maintain
CD images. These hosts are often not local and the amount of bandwidth
required to download the images from these smaller number of mirrors is
quite significant.
Nonetheless, today you may find local Debian hosts mirroring the CD images
also. If that is the case then it is easier to simply download the actual images
rather than building the images as described in the rest of this chapter.
In Australia, for example, the primary Debian mirror also mirrors the CD
images (from http://cdimage.debian.org/cd-images/. So for those in .au
and .nz it is perhaps easiest to simply download one of the following:
3.7 Debian on CD 31
Then burn the image to CD using whatever tools you have at your disposal.
For release 3 there are 7 CDs. The NONUS alternative (which contains items
that can not be exported directly from the US) is only relevant to the first
CD.
If you don’t have good access to a well connected CD image host then it
is best to follow the following recipe to build the CD images. It is quite
straightforward.
The first step is to obtain the appropriate Debian tools to build the CD image.
Again, recall that the scenario here is to build the image on a Solaris machine,
but the procedure should be similar for any GNU/Linux or Unix machine.
The pseudo-image-kit package can be obtained from a number of locations
listed at http://cdimage.debian.org/~costar/pseudo-image-kit/. We
use one of these locations here:
The last operation here changes the location at which the script make-
pseudo-image expects to find the installed version of the bash shell. Under
GNU/Linux it is /bin/sh but under Solaris it may be installed in /usr/
local/bin/bash.
The next step is to obtain a list of files that will make up the contents of the
CD. This is obtained from an appropriate CD image archive. For the binary
distribution of Debian (2.2) there are three CDs. We download the list of
contents for each:
32 Distributions
Now download from a local server the actual packages that will make up the
contents of the CD-ROM:
This takes quite a while! The end product is a file called pseudo-image. All
the other pseudo-image* files can be removed (they’re used to keep track of
where things were up to in case the download is interrupted).
This download is called the pseudo image because it’s an approximation of
the real image! It’s pretty close, but not yet guaranteed perfect. It is a
simple process to now turn it into an official image:
This uses rsync to synchronise your CD-ROM image with the official one.
When this is complete you can burn this CD-ROM image directly to CD-
ROM. Most CD-ROM burning software supports burning iso images directly.
Some other useful rsync commands allow you to hunt around the directory
structure of an rsync server. Some useful commands are:
List contents of the rsync server’s root directory
You can tell apt-get to obtain packages from a selection of CD-ROMs with
the following:
# apt-cdrom add
When converting from RedHat to Debian all of the configuration files in /etc
should be kept (e.g., burn them to CD-RW). Both distributions use many of
the same configuration files, although sometimes they are in slightly different
places.
Another approach is to create a parted boot disk (or use a Knoppix CD—
knoppix has parted installed) and then create a new partition on your ma-
chine onto which you install Debian. This allows you to keep a functioning
RedHat install while you set up Debian. Once you have the Debian instal-
lation up to scratch you can wipe the RedHat partition and reclaim it for
34 Distributions
use in Debian (perhaps as /var, /usr). Otherwise delete the partition with
parted and enlarge your Debian partition.
Chapter 4
Installation
35
36 Installation
are not connected to the Internet then you will be installing a full system
from CD-ROM. This will leave you with a complete system ready for most
tasks.
It is quite reasonable to want to skip all the details and to simply get started
with GNU/Linux. In this section we will get you up and running with
GNU/Linux real soon! There are two alternatives. The first will use a
LiveCD and is good for a quick test that things will work on your system.
The second, recommended, approach will do a standard Debian install.
Booting from CD
First, download (or otherwise obtain) the ISO disk image and burn it to a
blank CD:
package or two but are usually quickly fixed.
4.1 Quick Start 37
Place the CD into the CD drive and turn the computer on. Ensure your
computer has booting from CD-ROM enabled (this is a function of the BIOS
so you made need to go into the BIOS setup program at boot time). You
will be asked to press Enter to boot Debian—do so.
First, download (or otherwise obtain) the floppy disk boot image and write
it to a floppy disk:
Place the Floppy into the Floppy drive and turn the computer on. Ensure
your computer has booting from Floppy enabled (this is a function of the
BIOS so you made need to go into the BIOS setup program at boot time).
You will be asked to press Enter to boot Debian–do so. This will stop with
a request for a root floppy or a USB stick.
Now obtain the USB image and the CD ISO image to be placed on the USB
stick (see http://d-i.pascal.at/ for further information):
Then plug the USB stick into the new machine and press Enter to continue.
System Install
Choose, for example, English (USA). If there is no DHCP on the local net-
work set up a static network (e.g., IP=105.229.8.158, NetMask=255.255.255.192,
38 Installation
Account Configuration
Set up a basic system with ssh, wajig, emacs21, less, most, zile:
# cp /etc/apt/sources.list /etc/apt/sources.list.original
# scp ktw:/etc/apt/sources.list /etc/apt/sources.list
# wajig update
# wajig dist-upgrade
Set up, for the user account, ssh for access to remote accounts if you like, to
avoid repeatedly typing a password:
4.2 Hardware Compatibility 39
Applications
Install ntpdate and ntp to set the system clock accurately from a reliable
server (e.g., ntp.ktware.com).
Get X Windows working with the graphics card by installing x-window-system
gnome gdm gdm-themes
Now populate your machine with other applications using tasksel to install
groups of packages. I also like to add in xmms vrms.
made available by the manufacture available and open source drivers may
be hard to come by. This is only likely though for very recent new cards
or very specialised cards (like Gigabit Ethernet). Any PCI Ethernet or Fast
Ethernet NIC should work out of the box with GNU/Linux.
Modems that indentify themselves as Windows only or designed for Windows
are so-called software modems which rely on the CPU doing some of the
work for them. Some of these will not work with GNU/Linux. However, all
external modems work with GNU/Linux.
For graphics cards, avoid the absolute latest releases until you’ve checked
their driver status under GNU/Linux (check with the retailer or vendor).
For example, for nvidia graphics cards the NVidia Gnu/Linux binary driver
web site has a README that lists the supported cards, which generally includes
everything but the absolute latest top-of-the-line cards (support for which is
generally only a matter of time).
There is an excellent web site for checking GNU/Linux compatibility for
printers (http://www.linuxprinting.org). Generally, most Epson and HP
inkjet printers are well supported.
There is a similar web site to check for CD recorder compatibility. In general,
any ATA CD-RW and DVD-RW/-RAM/+RW drive should work just fine
with GNU/Linux since they are controlled by the ATAPI driver.
A collection of floppy disks (sixteen for Debian 2.2, for example) is re-
quired to begin the floppy-disk installation. The raw floppy disk images can
be retrieved from http://ftp.debian.org/debian/dists/stable/main/
4.3 Getting the Installation Media 41
4.4 Boot
Boot from the suitable bootable CD-ROM. This might be one of the net-
work installer single CD-ROMs from Progeny or Debian, or disk 1 of the De-
bian CD-ROM set (e.g., it might be called the Debian GNU/Linux Binary1
(nonUS) CD-ROM) or even the Rescue floppy disk. For different hardware
boot from the appropriate media—for example for a SPARCStation boot
from the Sparc CD-ROM.
ok boot cdrom
At the boot prompt choose s (SCSI) and the system then boots from the
CD-ROM. To boot single user simply use boot -s.
4.5 Installation 43
On some older machines, like Prefect (Section 4.10.17), the BIOS cannot boot
direct from CD-ROM so the machine needs to be booted from floppy disk
using MS-Windows Millenium Startup floppy. This recognises the CD-ROM
drive as drive D:. So simply run the BOOT command on the CD-ROM:
DOS> D:
> CD INSTALL
> BOOT
4.5 Installation
For Debian 3.0 choose to install the 2.4.18 kernel, at the boot prompt enter:
boot: bf24
Some advantages:
Some caveats:
The default for PGI is to use DHCP (an automated mechanism for obtaining
an IP address from a DHCP server) to automatically obtain network infor-
mation. If you don’t have a DHCP server available then tell the installer
using the nodhcp option:
The PGI install process proceeds to running gnome-tasksel. You can choose
not to run this, or else select the tasks you would like installed and leave it
to do so from the Progeny archive.
Once completed update the installation with defaults for gdm.conf and apt’s
/etc/apt/sources.list. Your are then ready to ensure all appropriate
packages are installed. Install synaptic to select further packages (after a
dist-upgrade).
4.6.1 Keyboard
Choose qwerty/us.
4.6.2 Partitions
Partitioning of hard drive(s) can be tricky for the new user. The Debian
Installer provides options to partition your disk in a number of ways. It
recommends a simple, single partition, which is a good choice, unless you
know what you are doing. For a fuller discussion of Disk Partitioning see
Chapter 65.
4.6 Base Install 45
This section of the install essentially identifies modules that you want to
be loaded whenever the machine is booted. The modules you identify will
be listed in /etc/modules. You can always add the modules there yourself
later. If using a pre-3.0 Debian install be sure to add a network module (or
else ppp if you are connected via a modem through an ISP) so that Debian
knows to set up the network.
4.6.4 Networking
During an install you will be asked whether to try DHCP to obtain your
network information from a DHCP server. This (usually) requires that you
identify your host as a host that your DHCP server knows or relies on the
DHCP server allocating the next available IP address. Do so just to see if
there is a DHCP server available to you.
If a DHCP server is not available then you will be prompted for appropriate
network information.
Generally you need the following, where some sample addresses are supplied:
IP 155.229.8.165
Netmask 255.255.255.192
Gateway 155.229.8.190
Domain ktware.com
DNS 183.44.72.1
# netstat -n
# ifconfig -a
46 Installation
Generally choose GMT for a GNU/Linux only machine and NO GMT for
dual boot machines.
Once the base system is installed you are asked to reboot the system. Remove
the floppy disk and CD-ROM and reboot the machine. Keep the floppy in
if this is how you plan to boot into Linux (otherwise you are probably using
LILO to book directly into Linux).
You will be asked to enter a password for the root account and to create a
user account. Do so. In general it is best to log in as a user then use the
su command to set the user to be root as needed (e.g., to install packages or
modify files in /etc).
The default email server for Debian is exim. This can be set up in one
of several ways, depending on how you will access your email. The exim
configurator will list the options.
4.7 Installing Packages 47
Generally, for a networked machine (e.g., Altrop (Section 4.10.20)) that is not
acting as a mail server, but using a remote smarthost (SMTP server) to send
email, yet still delivering email locally (which is obtained using fetchmail, for
example, from an IMAP server), you will choose option 2.
Add the local server (I add a local mirror plus an Australian mirror at aarnet)
and the US server to /etc/apt/sources.list:
4.7.2 Upgrade
g++ g77 galeon galeon-common gaspell gawk gcc gconf-editor gcvs gdm
gedit gettext-el gimp gkdebconf gkrellm gkrellm-gnome gkrellm-volume
gkrellmms glabels glade-gnome gnome-applets gnome-audio
gnome-commander gnome-common gnome-control-center gnome-core
gnome-games gnome-gv gnome-help gnome-help-data gnome-media
gnome-office gnome-panel gnome-pim gnome-session gnome-spell
gnome-terminal gnome-users-guide gnome-utils gnumeric-doc gnumeric-gda
gnumeric-python gnuplot gpaint grep grip groff groff-x11 gs
gs-pdfencrypt gsfonts gsfonts-x11 gthumb gtimer gtk-engines-begtk
gtk-engines-cleanice gtk-engines-cleanice2 gtk-engines-eazel
4.7 Installing Packages 49
openoffice.org
qemacs
ucf unzip
50 Installation
vim
initrd=/initrd.img
You are reminded of this on each upgrade. This message can be turned off
by adding the following line to /etc/kernel-img.conf:
do_initrd=Yes
My initial configuration involves making the gdm login screen looking nicer
by adding my own graphic, turning off the title bar, editing the welcome
message, and adding the System menu. The relevant lines in /etc/gdm/
gdm.conf are:
TitleBar=false
Logo=/usr/local/share/pixmaps/tux.jpg
SystemMenu=true
Welcome=Togaware Australia\n\nWelcome to %n\n\nDebian GNU/%s %r %m
Bartok (Section 4.10.1) is a custom built dual processor server with an inex-
pensive 20GB IDE hard disk (for Debian GNU/Linux install) and a 136GB
SCSI RAID disk (made up of 4 disks).
Debian GNU/Linux 2.2r2 was originally installed (kernel-image-2.2.18pre21)
from CD-ROM (4 December 2001). The SCSI RAID disk (Adaptec 2100s)
was not supported by the installed kernel thus Debian was first installed
on the IDE drive. A driver for the SCSI RAID was then obtained from
52 Installation
Adaptec (dpt i2o.o) and installed after Debian was upgraded to unstable and
running with kernel-image-2.2.19. A compile of kernel-source-2.4.16 produced
a dpt i2o.o suitable for use with kernel-image-2.4.16-686-smp. On 26 March
2003 a standard kernel-image-2.4.20-686-smp was installed to provide up to
date support for USB, adding a USB Printer. This was upgraded to kernel-
image-2.4.25-1-686-smp on 23 March 2004. The SMP kernels supports the
dual processors and 4GB high memory.
Originally there were occasional I/O errors with the dpt i2o driver for the
Adaptec. Others (e.g., Ian Millsom) reported that the driver in the earlier
2.4 kernels were buggy and indeed Ian had a 2.2.19pre17 kernel patched
for the driver. However, running under kernel versions 2.4.16, 2.4.20, and
2.4.25 there have been no further problems. (The 2.4.16 kernel was compiled
with options p3, high memory, and SMP and the later kernels were standard
Debian kernels with SMP and HIMEM).
Original partitioning was 4GB for / and the rest for /home. After a couple
of years of use the 4GB for / became inadequate and things like /usr/share
started moving to other places!
A new install was performed (24 March 2004) with the beta3 Debian Installer
booting from CD-ROM. A default boot froze very quickly just after:
Bartok Specifications
The IDE disk was originally partitioned into three: one for swap (2GB as
/dev/hda3), one for / (4GB as /dev/hda1) and the rest for /home (14GB as
/dev/hda2. Aftera year or two of use the / partition was full! Generally, use
the whole disk for / as is recommended by the Debian Installer.
The second install (23 March 2004) followed the standard path, but with
noapic.
The Adaptec PCI Ultra 160 Single Channel RAID Controller, also known as
the Adaptec 2100s, was an interesting challenge as drivers for this were not
available on the install media. Thus initially it was not possible to install
Linux. The initial boot with Debian GNU/Linx V2.2r2 CD-ROM failed
because the disks were not found!
After the Configure Keyboard step in the Debian install process there is
an opportunity to Preload Essential Modules from Floppy. This allows the
54 Installation
loading of modules that are required for particular devices that are otherwise
not provided in the kernel.
So the first attempt at installing Linux obtained the appropriate module/driver
from Adaptec by downloading dptdriver-2.4.tgz from linux.adaptec.
com. This gzipped tape archive generates /usr/adaptec/i2o_driver/:
The drivers for various versions of the kernel are then contained in dpt i2o prebuilt.cgz.
This is a gzipped cpio archive. To extract the archive:
$ mkdir tmp
$ cd tmp
$ gunzip < ../dpt_i2o_prebuilt.cgz | cpio --extract
The kernel installed was 2.2.18pre21 but there is not a corresponding dpt i2o.
The 2.2.18 version had undefined symbols and the machine froze. The 2.2.19
version worked. This was then copied onto a floppy for Debian to load:
$ mount /floppy
$ mkdir /floppy/boot
$ cp dpt_i2o.2.2.19 /floppy/boot/dpt_i2o.o
$ umount /floppy
Once dpt_i2o is installed you can create and initialise the disk partitions on
the RAID:
Later when configuring drivers and devices you can also add modules from
floppy, but they must now be in /floppy/lib/modules/scsi/dpt_i2o.o,
for example.
Now we come unstuck because we create a boot floppy yet there is no way
to install the RAID driver on the kernel on this boot floppy, so next reboot
the RAID is no longer available and the boot hangs with a Kernel Panic and
a message about block-major-8 and not being able to mount the root fs.
4.10 Target Machines 55
# mkdir /raid
# mount /raid
Also add dpt i2o to /etc/modules so that the RAID is available when the
machine boots.
1. dpt_i2o provided by the kernel (2.4.14 on with CONFIG SCSI DPT I2O=m)
With the new kernels the initrd (initial ram disk) is the default, so it is
worth moving to this. It requires changes to your /etc/lilo.conf to include
initrd lines. For example:
image=/boot/vmlinuz-2.4.16-p3hmsmp
label=2.4.16-p3hmsmp
read-only
initrd=/boot/initrd.img-2.4.16-p3hmsmp
append="noapic"
Note also that with the dual processor card in this machine (ASUS CUV4X-
DLS) the noapic option was required, otherwise there is a problem with
running out of IRQs and the boot hangs after the following message:
Cargo Specification
The beta3 release of the Debian Installer with a boot floppy and USB Flash
disk for the netinst image were used.
Boot from the Floppy. When asked, insert the USB memory stick and con-
tinue. There is no DHCP on the local network so a static network was
4.10 Target Machines 59
configured.
Configure the time zone as Australia/ACT. Add Root and User accounts.
For apt choose HTTP. Don’t do any task selection for now. No specific
exim4 options need be selected - set up as a local system.
Install ssh and then copy a master sources.list file, followed by apt-get
update (the CD is no longer required) and then apt-get install wajig to
get things going:
# mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig
# scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list
> apt-get update
> apt-get install wajig
> wajig update
> wajig dist-upgrade
60 Installation
This is a purpose built desktop used for development. It has a 1GHz Pentium
3 processors, 512MB memory, 20GB of disk and Rage M3 video.
A test run used Gnoppix to test basic Linux functionality. All was okay with
X running at 1152x864 75Hz.
The base install (2 Mar 2004) was with the beta2 Debian Installer, which
was under development for the next stable release of Debian. A partition of
12GB was used for / and 1GB for swap. (The rest was for a pre-installed
Windows2000 system, drives C and D using about 7GB there.)
Wayfare Specification
The beta2 release of the Debian Installer (Netinst) was downloaded as an ISO
image from http://www.debian.org/devel/debian-installer/. The ac-
4.10 Target Machines 61
search ktware.com
Install ssh and then copy a master sources.list file, followed by apt-get
update (the CD is no longer required) and then apt-get install wajig to
get things going:
# mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig
# scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list
> apt-get update
> apt-get install wajig
> wajig update
> wajig dist-upgrade
The configuration should be fine (finding /dev/hda3 as the Linux boot). For
convenience, add the following to /etc/kernel-img.conf:
postinst_hook = /sbin/update-grub
postrm_hook = /sbin/update-grub
Install kernel-image-2.4.25-1-686.
Install ntpdate to set the system clock accurately from a reliable server (e.g.,
ntp.ktware.com).
Get X Windows working with the Rage card by installing x-window-system
gnome gdm gdm-themes cinepaint xine-ui. I’ve chosen a 1280x1024 resolution
for display on a Dell flat panel.
Install openoffice.org xmms apache
Run tasksel to install groups of packages.
Install vrms! And any other packages as appropriate.
4.10 Target Machines 63
This is a laptop used for developing and delivering presentations and for note
taking and working whilst travelling. It has a 1GHz Pentium 3 processors,
512MB memory, 18GB of disk and Rage M3 video.
The base install (27 Feb 2004) was with the beta2 Debian Installer, which
was under development for the next stable release of Debian. A partition of
12GB was used for / and 1GB for swap. (The rest was for a pre-installed
Windows2000 system, drives C and D using about 7GB there.)
Inci Specification
The beta release of the Debian Installer, identified as Sarge i386 Netinst
and dated 26 Feb 2004, was downloaded as an ISO image from wgethttp://
gluck.debian.org/cdimage/testing/daily/i386/current/sarge-i386-netinst.
iso. This failed to install GRUB - it simply froze. Reverting to the beta2
64 Installation
# mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig
# scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list
> apt-get update
> apt-get install wajig
> wajig update
> wajig dist-upgrade
Now the setup begins. Install emacs21 less most zile python-glade2 python-
gnome2.
The resolv.conf didn’t include my usual search line so it was added:
search ktware.com
Set up, for the user account, ssh for access to remote accounts if you like, to
avoid repeatedly typing a password:
postinst_hook = /sbin/update-grub
postrm_hook = /sbin/update-grub
Install kernel-image-2.4.24-1-686.
Install ntpdate to set the system clock accurately from a reliable server (e.g.,
ntp.ktware.com).
Get X Windows working with the Rage card by installing x-window-system
gnome gdm gdm-themes cinepaint xine-ui.
Install openoffice.org xmms apache
Run tasksel to install groups of packages.
Install vrms.
I’ve chosen a 1024x768 resolution. This is not so nice since it can handle
1400x1050, but it does make plugging into data projectors easier. How-
ever, the screen goes into a funny mode which can be fixed by Fn-F7 (com-
press/uncompress). The chosen ranges are 30-100 kHz for hsync and 50-160
Hz for vsync. Simply use wajig reconfigure xserver-xfree86 to force choice of
1024x768 when required.
66 Installation
This is a web server with 2GHz Pentium 4 processor, 256MB memory, 80GB
of disk and 64MB NVIVIA GeFOrce2 with TV-OUT.
The base install was with the beta 3 Debian Installer (15 March 2004), which
was under development for the next stable release of Debian. A partition of
10GB was used for /, and 70GB for /home and 1GB for swap.
Friends Specification
The beta3 release of the Debian Installer, identified as Sarge i386 Netinst and
dated 15 March 2004, was downloaded as an ISO image from http://gluck.
debian.org/cdimage/testing/sarge_d-i/i386/beta3/sarge-i386-netinst.
iso
Boot from CD-ROM. For the Debian install choose English (USA). There is
no DHCP on the local network so a static network was configured. Sarge
4.10 Target Machines 67
search ktware.com
Set up, for the user account, ssh for access to remote accounts if you like, to
avoid repeatedly typing a password:
# mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig
# scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list
> wajig update
> wajig dist-upgrade
Use visudo to set up wajig usage for a user. Install grub. Install kernel-
image-2.4.24-1-686.
68 Installation
Install ntpdate to set the system clock accurately from a reliable server (e.g.,
ntp.ktware.com).
Get X Windows working with the nVidia card by installing x-window-system
gnome gdm gdm-themes cinepaint xine-ui.
Install openoffice.org xmms apache
Run tasksel to install groups of packages.
Install vrms
4.10 Target Machines 69
This is a server with dual processors, 4GB memory, SCSI disk with a PERC
320/DC Adaptec controller with 440GB of disk (4 110GB drives).
The base install was with the beta Debian Installer (12 Nov 2003), which was
under development for the next stable release of Debian. The SCSI controller
was not recognised (although Knoppix had no problem with it, loading the
percraid module and identifying it as scsi2) but going to tty2 (C-A-F2) and
doing a modprobe aacraid (there was no percraid module) then a detect
hardware did the trick. A partition of 10GB was used for /, and 420GB for
/dmrnet and 10GB (far too much) for swap.
Caravan Specification
The beta release of the Debian Installer, identified as Sarge i386 Netinst and
dated 9 Nov 2003, was downloaded as an ISO image from http://gluck.
debian.org/cdimage/testing/netinst/i386/sarge-i386-netinst.iso.
70 Installation
Booting from CD-ROM was arranged from the BIOS by going into the boot
device menu (F12) and choosing CD-ROM. For the Debian install choose
English (USA)—choosing Australia results in a bad keyboard amp. There is
no DHCP on the local network so a static network was configured. Create
partitions: 9GB ext3 for /, 70GB ext3 for /home, and 1GB for swap. Sarge
was chosen as the mirror. The driver for the SCSI RAID was loaded by
going to another virtual terminal (C-A-F2) and loading it with modprobe
aacraid. Then C-A-F1 and Choose Detect Hardware. Now partition the
(420GB) into 10GB ext3 for /, 390GB ext3 for /home and 10GB for swap.
This is too much for swap - seems to only recognise 2GB. Choose to install
GRUB (on hd0), then reboot.
Configure the clock as GMT (although it might not be GMT at present, it is
the usual set up) and the time zone is Australia/ACT. Choose to use Shadow
Passwords. Add Root and User accounts. For apt choose http with the US
mirrors.kernel.org. Don’t do any task selection for now. No specific exim4
options need be selected - set up as a satellite system.
Note that the hostname remained as localhost. I had to change this as below.
Now the setup begins. Install wajig ssh emacs21 less most. Use visudo to set
up wajig usage for a user. Install kernel-image-2.4.22-1-686.
Correct the host name with the command hostname caravan then emacs
/etc/hostname and emacs /etc/hosts.
Install ntpdate to set the system clock accurately from a reliable server (e.g.,
ntp.ktware.com). Install ntp-simple to regularly update the clock.
Set up ssh from remote accounts if you like:
# mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig
4.10 Target Machines 71
This is a desktop machine with modem access, a flat screen (with 4 USB
sockets), and a USB mouse.
Base install was with the beta Debian Installer (12 Nov 2003), which was
under development for the next stable release of Debian. A partition of 9GB
was used for /, 65GB from /home and 5GB for swap.
With xfree86 4.3.0 multiple virtual terminals are not (always) supported for
the intel 865G graphics card. With kernel-image-2.4.22-1-686 multiple virtual
terminals are just fine. With kernel-image-2.4.23-1-686, starting a second X
server freezes the system with a black screen. There have been problems with
switching virtual terminals in that there is a 30 second delay after switching.
There is also a 30 second delay on start up. Clearly something is timing
out, and the suspicion is that it is something to do with USB. When hotplug
was installed and the module usb-uhci was removed from /etc/modules
the delay disappeared.
Modern Specification
This is identified as the Sarge i386 Netinst dated 9 Nov 2003, and the ISO im-
age was downloaded from http://gluck.debian.org/cdimage/testing/
netinst/i386/sarge-i386-netinst.iso.
Simply boot from CD-ROM by going into the boot device menu (F12).
Choose English (USA)—choosing Australia resulted in bad keyboard. There
is no DHCP set up on the local network so set up a static network. Choose
sarge as the mirror. Partition the 80GB disk into 10GB ext3 for /, 65GB
ext3 for /home, and 5GB for swap. Choose LILO (but should have chosen
GRUB). Reboot.
Problems included DHCP failing and requiring the user to skip menus over
to the set static network choice. The hostname remained localhost and had
to be reset later. The clock was really not GMT but I said it was because I
want it to be.
Now install wajig, ssh, emacs21, less, and most. Set up visudo for wajig
usage by users. Replace LILO with Grub using
74 Installation
# grub-install /dev/hda
# update-grub
# wajig remove lilo
# reboot
postinst_hook = /sbin/update-grub
postrm_hook = /sbin/update-grub
A trial run of Debian GNU/Linux 3.0 using the GNOPPIX GNU/Linux live
CD was attempted (25 Sep 2003). Booted just fine but the install to hard
disk is still under development. Also trialled both the sarge (testing) netinst
and the sid (unstable) install CD-1, but both failed. So used Debian 3.0r1
to install and upgraded immediately to unstable.
GNOPPIX 0.5.4-1
wget ftp://source.rfc822.org/pub/local/gnoppix/gnoppix-0.5.5-2.iso
Works just fine. Choose to install to hard disk from the icon. This allowed
the disk to be partitioned and configured, but there were problems on reboot
with the tty1 printing / as -. So use a traditional install.
wget http://gluck.debian.org/cdimage/testing/netinst/i386/sarge-i386-netinst.iso
Simply boot then choose English (Australia), us keyboard, cdrom, load kernel
modules, installer modules (none chosen), skip PCMCIA, find network and
configure, configure static network: fairmont, act.cmis.csiro.au, 125.83.72.15
125.83.72.1, 105.229.8.169, 255.255.255.192, 105.229.8.190, mirror http US
ftp.us.debian.org sarge, hardware and kernel drivers, partition (/dev/hda1 /
36GB ext2, Swap 1GB), create filesystems, base install, ERRORS....
4.10 Target Machines 77
wget ftp://ftp.fsn.hu/pub/CDROM-Images/debian-unofficial/sid/sid-i386-1.iso
Debian 3.0r1
boot> bf24
Fairmond Specification
Hostname fairmond
Address 105.229.8.169
Netmask 255.255.255.192
Broadcast 105.229.255.255
Gateway 105.229.8.190
DNS 125.83.72.15,125.83.72.1
Domain ktware.com
4.10 Target Machines 79
Debian GNU/Linux 2.2r2 was installed from a Debian CD-ROM (2002) and
then upgraded to unstable 6 August 2003.
Bigdaddy Specification
Hostname bigdaddy
Address 105.229.9.9
Netmask 255.255.255.192
Broadcast 105.229.255.255
Gateway 105.229.8.190
DNS 125.83.72.15 125.83.72.1
Domain ktware.com
4.10 Target Machines 81
Debian GNU/Linux 3.0 was installed from a Debian CD-ROM (15 Apr 2003).
This desktop machine is considered a production machine and so needs to
stay with the stable release. However this machine requires XFree 4.3. The
XFree86 documentation said the video chipset (Intel i845) was only supported
in version 4.3.0, which is only available in Debian packaged for the unstable
distribution.
The vesa driver in XFree86-4.1.0 is an option but has serious problems. Even
with the Debian testing release there were problems with the vesa driver.
The solution was better kernel support of the devices. But before considering
this option think about buying an extra video card or at least have a read of
http://support.intel.com/support/graphics/intel845g/screen.htm to
decide if the features on offer are going to be worth the trouble.
A first attempt was to install XFree86 4.3.0 from the tar files provided by
xfree86.org. This works but it lives outside the Debian package system and
might break your package management system at some stage down the track,
although this is usually easily managed.
Intel does provide some information from http://support.intel.com/support/
graphics/linux/index.htm Intel indicates that xfree86-4.2.0 is required,
which means using Debian’s testing distribution at the moment. See the De-
bian Reference for how to upgrade your distribution from stable to testing.
Some BIOS changes:
# cd /usr/src
# ln -s kernel-build-2.4.20/686 linux
# cd dripkg
# sh ./install.sh
The install script prompts you for the information it needs, and keeps a log
of what it does. You need to run it as root.
The compilation can fail if the /usr/src/linux link is not pointing to the right
place (see above), or the kernel version is too old (less than 2.4.11).
As part of the install script, the newly built files are installed at the locations
shown below. Any preexisting files are moved to a file of the same name with
a “.dri-old” suffix.
dripkg/i830/i810_drv.o /usr/X11R6/lib/modules/drivers/i810_drv.o
dripkg/i830/i830_dri.so /usr/X11R6/lib/modules/dri/i830_dri.so
dripkg/drm/i830.o
/lib/modules/2.4.20-686/kernel/drivers/char/drm/i830.o
dripkg/agpgart/agpgart.o
/lib/modules/2.4.20-686/kernel/drivers/char/agp/agpgart.o
dripkg/core/libdri.a /usr/X11R6/lib/modules/extensions/libdri.a
dripkg/core/libdrm.a /usr/X11R6/lib/modules/linux/libdrm.a
dripkg/core/libpcidata.a /usr/X11R6/lib/modules/libpcidata.a
dripkg/core/libscanpci.a /usr/X11R6/lib/modules/libscanpci.a
(Note that the set of files and the locations will likely be different on your
system.)
The fact these modules replace ones provided by the packaging system may
break the packaging system to some extent, but to a far smaller extent than
installing XFree86-4.3 from a tarball or from source.
Configure your X server
4.10 Target Machines 83
This is quite simple once you have the correct hardware support. All you
really need is the line Driver “i810” in the Device section. In the Screen
section, start with a default graphics depth of 16. This is what Intel rec-
ommend. It may help to specify a VideoRam size, but it’s not required.
Resolutions 1024x768 and 1280x1024 work at 16 and 24 bits and seems to
do the 3D graphics things (running glxinfo and glxgears to verify this).
VESA driver
Messing around with VESA modes in XFree86 4.2.1 did not help with this
chipset. The drivers only work for a little while. The failure was that once
you switch VTs or restart the X server, the screen goes black. Sometimes
the card seems to go into the correct video mode (verify this using the menu
buttons on the monitor) but when the screen is a uniform black you can’t do
much useful work. There was one other mode of failure, where the screen had
strange colours. This may have been an incorrect pixmap depth problem, or
possibly a bad video modeline (though I find it hard to accept the latter, I
let vbe/ddc do its thing.)
The upgrade described in this note makes no real difference to these problems
with the vesa driver. Presumably this is because the upgrade doesn’t affect
the relevant bits of the system.
84 Installation
Debian GNU/Linux 3.0 was installed from a Debian CD-ROM (29 Nov 2002).
This desktop machine is used for data analysis and desktop environment.
The NIC (e1000) was not supported in the default 2.4.18 kernel. A kernel-
image-2.4.19 was installed but again did not support the NIC. A kernel-
image-2.4.20-pre11 was compiled for the machine (at the time the 2.4.20
was not released) and worked just fine. When it was released kernel-image-
2.4.20 was installed and worked just fine (and the NIC worked after insmod
e1000—add e1000 to /etc/modules).
Installed ssh to get things started with standard configs, startup files and
passwd/group files copied from the server (Altrop (Section 4.10.20)). Installed
gdm and then run a simple script to place the standard setup files in the
appropriate locations. Installed wajig to get the show on the road!
The on-board video was at first run using vesa because XFree86 4.2.1 does
not have a driver for the 82845G AGP. It is supported in XFree86 4.3 (the i810
driver) which at the time was not released. The video works just fine. Until
4.3 is officially released you can add the following to /etc/apt/sources.
list:
deb http://www.penguinppc.org/~daniels/sid/\$(ARCH) ./
Festival Specification
00:00.0 Host bridge: Intel Corp.: Unknown device 2560 (rev 01)
00:02.0 VGA compatible controller: Intel Corp.: Unknown device 2562 (rev 01)
00:1d.0 USB Controller: Intel Corp.: Unknown device 24c2 (rev 01)
00:1d.1 USB Controller: Intel Corp.: Unknown device 24c4 (rev 01)
00:1d.2 USB Controller: Intel Corp.: Unknown device 24c7 (rev 01)
00:1d.7 USB Controller: Intel Corp.: Unknown device 24cd (rev 01)
00:1e.0 PCI bridge: Intel Corp. 82820 820 (Camino 2) Chipset PCI (rev 81)
00:1f.0 ISA bridge: Intel Corp.: Unknown device 24c0 (rev 01)
00:1f.1 IDE interface: Intel Corp.: Unknown device 24cb (rev 01)
00:1f.3 SMBus: Intel Corp.: Unknown device 24c3 (rev 01)
00:1f.5 Multimedia audio controller: Intel Corp.: Unknown device 24c5 (rev 01)
01:0c.0 Ethernet controller: Intel Corp.: Unknown device 100e (rev 02)
Festival Install
Hostname uramys1
Address 125.83.88.13
Netmask 255.255.255.0
Broadcast optional
Gateway 125.83.88.177
DNS 183.44.72.1
Domain ktware.com
86 Installation
At the time of installing the NIC card (e10000) was not supported by the
available Debian kernels. Kernel 2.4.20 fixed this. A kernel was compiled
from source and patched up to 2.4.20-pre11. The default .config (i.e.,
starting from no .config file) was the starting point. Below is recorded
the specific configurations added.
# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz
# wget http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.20-pre11.gz
# tar zxvf linux-2.4.19.tar.gz
# cd linux-2.4.19
# gzip -dc ../patch-2.4.20-pre11.gz | patch -p1 -N -F4
# make menuconfig
Processor type and features
Processor family
CONFIG_MPENTIUM4=y
#General: Seem to get ‘‘Can’t get display ID errors’’
# CONFIG_APM=y
# CONFIG_APM_DO_ENABLE=y
# CONFIG_APM_CPU_IDLE=y
# CONFIG_APM_DISPLAY_BLANK=y
# CONFIG_APM_RTC_IS_GMT=y
Block devices
RAM disk support
CONFIG_BLK_DEV_RAM=y
Initial RAM disk (initrd) support
CONFIG_BLK_DEV_INITRD=y
Network device support
Ethernet (1000 Mbit)
CONFIG_E1000=y
Sound
CONFIG_SOUND_ICH=y
# make-kpkg clean
# make-kpkg --append-to-version -gjw --revision edm01
--initrd kernel_image
# cd ..
# wajig install kernel-image-2.4.19-gjw_edm01_i386.deb
This works just fine and all standard drivers (CDROM and NFS) were in-
cluded by default and the e1000 support included in the kernal. The result-
4.10 Target Machines 87
ing kernel is quite a bit smaller that the kernels supporting lots of hardware
(700K initrd cf 2.4MB and 56K modules cf 20MB)!
88 Installation
Debian GNU/Linux 3.0 was installed from a Debian CD-ROM (28 Nov 2002).
This desktop machine is to be used as a server for CVS, apache, and other
services. The NIC (e1000) was not supported in the default 2.4.18 kernel. A
kernel-image-2.4.20-pre11 was compiled for the machine. Lilo was replaced
by grub and
The on-board video is run using vesa because XFree86 4.2.1 does not have a
driver for the 82845G AGP. See Festival (Section 4.10.11) for further details.
Uramys1 Specification
00:00.0 Host bridge: Intel Corp.: Unknown device 2560 (rev 01)
00:02.0 VGA compatible controller: Intel Corp.: Unknown device 2562 (rev 01)
00:1d.0 USB Controller: Intel Corp.: Unknown device 24c2 (rev 01)
00:1d.1 USB Controller: Intel Corp.: Unknown device 24c4 (rev 01)
00:1d.2 USB Controller: Intel Corp.: Unknown device 24c7 (rev 01)
00:1d.7 USB Controller: Intel Corp.: Unknown device 24cd (rev 01)
00:1e.0 PCI bridge: Intel Corp. 82820 820 (Camino 2) Chipset PCI (rev 81)
00:1f.0 ISA bridge: Intel Corp.: Unknown device 24c0 (rev 01)
00:1f.1 IDE interface: Intel Corp.: Unknown device 24cb (rev 01)
00:1f.3 SMBus: Intel Corp.: Unknown device 24c3 (rev 01)
00:1f.5 Multimedia audio controller: Intel Corp.: Unknown device 24c5 (rev 01)
01:0c.0 Ethernet controller: Intel Corp.: Unknown device 100e (rev 02)
4.10 Target Machines 89
Uramys1 Install
Hostname uramys1
Address 125.83.88.13
Netmask 255.255.255.0
Broadcast optional
Gateway 125.83.88.177
DNS 183.44.72.1
Domain ktware.com
At the time of installing the NIC card (e10000) was not supported by the
available Debian kernels. Kernel 2.4.20 fixed this. A kernel was compiled
from source and patched up to 2.4.20-pre11. The default .config (i.e.,
starting from no .config file) was the starting point. Below is recorded
the specific configurations added.
# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz
# wget http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.20-pre11.gz
# tar zxvf linux-2.4.19.tar.gz
# cd linux-2.4.19
# gzip -dc ../patch-2.4.20-pre11.gz | patch -p1 -N -F4
# make menuconfig
Processor type and features
Processor family
CONFIG_MPENTIUM4=y
General
CONFIG_APM=y
CONFIG_APM_DO_ENABLE=y
CONFIG_APM_CPU_IDLE=y
CONFIG_APM_DISPLAY_BLANK=y
CONFIG_APM_RTC_IS_GMT=y
Block devices
RAM disk support
CONFIG_BLK_DEV_RAM=y
Initial RAM disk (initrd) support
CONFIG_BLK_DEV_INITRD=y
Network device support
Ethernet (1000 Mbit)
90 Installation
CONFIG_E1000=y
Sound
CONFIG_SOUND_ICH=y
# make-kpkg clean
# make-kpkg --append-to-version -gjw --revision sis01
--initrd kernel_image
# cd ..
# wajig install kernel-image-2.4.19-gjw_sis01_i386.deb
This works just fine and all standard drivers (CDROM and NFS) were in-
cluded by default and the e1000 support included in the kernal. The result-
ing kernel is quite a bit smaller that the kernels supporting lots of hardware
(700K initrd cf 2.4MB and 56K modules cf 20MB)!
4.10 Target Machines 91
root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
kernel /Vmlinuz-2.4.20-pre11-p4 ro root=
[Linux-bzImage, setup=0x1400, size=0x10ea0d]
Reverting to lilo fixed the problem! However, at a later stage (27 June 2003)
a new kernel was installed (kernel-image-2.4.21-1-686) and the next reboot
stopped at LIL. To recover the system it was booted from a Debian CD
using a rescue kernel:
Lilo could not be fixed easily so instead grub was again installed, and worked
just fine.
Vivaldi Specification
00:00.0 Host bridge: Intel Corp.: Unknown device 2560 (rev 01)
00:02.0 VGA compatible controller: Intel Corp.: Unknown device 2562 (rev 01)
00:1d.0 USB Controller: Intel Corp.: Unknown device 24c2 (rev 01)
00:1d.1 USB Controller: Intel Corp.: Unknown device 24c4 (rev 01)
00:1d.2 USB Controller: Intel Corp.: Unknown device 24c7 (rev 01)
00:1d.7 USB Controller: Intel Corp.: Unknown device 24cd (rev 01)
00:1e.0 PCI bridge: Intel Corp. 82801BA/CA PCI Bridge (rev 81)
00:1f.0 ISA bridge: Intel Corp.: Unknown device 24c0 (rev 01)
00:1f.1 IDE interface: Intel Corp. 82801DB ICH4 IDE (rev 01)
00:1f.5 Multimedia audio controller: Intel Corp.: Unknown device 24c5 (rev 01)
01:08.0 Ethernet controller: Intel Corp.: Unknown device 103a (rev 81)
01:09.0 RAID bus controller: CMD Technology Inc PCI0680 (rev 01)
01:0b.0 RAID bus controller: CMD Technology Inc PCI0680 (rev 01)
4.10 Target Machines 93
Vivaldi Install
Hostname vivaldi
Address 155.229.8.158
Netmask 255.255.255.192
Broadcast optional
Gateway 155.229.8.190
DNS 125.83.72.1
Domain ktware.com
For information on the AGP see http://www.intel.com/support/graphics/
intel845g/linux.htm and http://www.xfree86.org/~dawes/845driver.
html.
Two IDE controllers (Silicon Image CMD680) were installed delivering disks
/dev/hde, /dev/hdg, /dev/hdh, and /dev/hdj.
At the time of installing the CMD680 IDE controller chip kernel 2.4.19 was
available as a Debian package but had did not recognise the IDE card on the
motherboard. Kernel 2.4.20 fixed this, but was not released nor available for
Debian. A kernel was compiled from source and patched up to 2.4.20-pre11.
The default .config (i.e., starting from no .config file) was the starting
point. Below is recorded the specific configurations added.
# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz
# wget http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.20-pre11.gz
# tar zxvf linux-2.4.19.tar.gz
# cd linux-2.4.19
# gzip -dc ../patch-2.4.20-pre11.gz | patch -p1 -N -F4
# make menuconfig
Processor type and features
Processor family
CONFIG_MPENTIUM4=y
General
CONFIG_APM=y
CONFIG_APM_DO_ENABLE=y
CONFIG_APM_CPU_IDLE=y
CONFIG_APM_DISPLAY_BLANK=y
94 Installation
CONFIG_APM_RTC_IS_GMT=y
Block devices
RAM disk support
CONFIG_BLK_DEV_RAM=y
Initial RAM disk (initrd) support
CONFIG_BLK_DEV_INITRD=y
ATA/IDE/MFM/RLL support
IDE, ATA and ATAPI Block devices
CONFIG_BLK_DEV_CMD64X=y
CONFIG_BLK_DEV_CMD680=y
Sound
CONFIG_SOUND_ICH=y
# make-kpkg clean
# make-kpkg --append-to-version -p4 --revision dha01
--initrd kernel_image
# cd ..
# wajig install kernel-image-2.4.19-p4_dha01_i386.deb
This works just fine and all standard drivers (CDROM and NFS and EEPRO100)
were included by default. The resulting kernel is quite a bit smaller that the
kernels supporting lots of hardware (700K initrd cf 2.4MB and 56K modules
cf 20MB)!
4.10 Target Machines 95
Debian GNU/Linux 3.0 was installed from a Debian netinst PGI CD-ROM
(2 October 2002). This machine is used as a database server.
Brick Specification
Brick Install
Hostname brick
Address 155.229.8.165
Netmask 255.255.255.192
Broadcast optional
Gateway 155.229.8.190
DNS 183.44.72.1
Domain ktware.com
4.10 Target Machines 97
Debian GNU/Linux 3.0 was installed from a Debian netinst PGI CD-ROM
(2 October 2002). This machine is used as a database server.
Atom Specification
Atom Install
Hostname atom
Address 155.229.8.164
Netmask 255.255.255.192
Broadcast optional
Gateway 155.229.8.190
DNS 183.44.72.1
Domain ktware.com
4.10 Target Machines 99
Debian GNU/Linux 3.0 was installed from a Progeny netinst CD-ROM (28
June 2002). This desktop machine is to be used for data analysis by a
government department.
After installation a new IDE card was installed (CMD680) with two IDE
60GB hard drives. This required at least version 2.4.19 of the kernel. I have
also had feedback from another user at the University of London who has
three cards running on a machine with kernel 2.4.19.
Bach Specification
00:00.0 Host bridge: Intel Corp. 82845 845 (Brookdale) Chipset Host Bridge (rev 04)
00:01.0 PCI bridge: Intel Corp. 82845 845 (Brookdale) Chipset AGP Bridge (rev 04)
00:1e.0 PCI bridge: Intel Corp. 82801BA/CA PCI Bridge (rev 05)
00:1f.0 ISA bridge: Intel Corp. 82801BA ISA Bridge (LPC) (rev 05)
00:1f.1 IDE interface: Intel Corp. 82801BA IDE U100 (rev 05)
00:1f.2 USB Controller: Intel Corp. 82801BA/BAM USB (Hub #1) (rev 05)
00:1f.4 USB Controller: Intel Corp. 82801BA/BAM USB (Hub #2) (rev 05)
00:1f.5 Multimedia audio controller: Intel Corp. 82801BA/BAM AC’97 Audio (rev 05)
01:00.0 VGA compatible controller: nVidia Corporation NV6 [Vanta] (rev 15)
02:08.0 Ethernet controller: Intel Corp. 82801BA/BAM/CA/CAM Ethernet Controller (rev 03)
100 Installation
Bach Install
Hostname bach
Address 155.229.8.158
Netmask 255.255.255.192
Broadcast optional
Gateway 155.229.8.190
DNS 183.44.72.1
Domain ktware.com
Passwords using MD5 was turned off (DES instead used) as I think this is
the same as the server of the network into which this host will connect.
The second IDE disk was formatted:
After installing Debian a serious performance hit was noticed every time the
disks were busy. In the X Window System, for example, the mouse would
be extremely sluggish (for several seconds or more) and there was no hope of
typing. It turned out that the parameters for the hard disk required tuning.
Installing hdparm allowed the tuning to happen. Running hdparm with
/dev/hda showed the current parameters:
# hdparm /dev/hda
/dev/hda:
multcount = 0 (off)
I/O support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 7297/255/63, sectors = 117231408, start = 0
busstate = 1 (on)
4.10 Target Machines 101
It turns out that the following fixes the problem. It turns on DMA (-d1), 16
multiple sectors (-m16), and 32 bit I/O support (-c1):
To ensure these new settings are saved for each reboot install the package
hwtools and edit /etc/init.d/hwtools:
A new IDE controller (Silicon Image CMD680) was installed delivering disks
/dev/hde and /dev/hdg.
At the time of installing the CMD680 IDE controller chip kernel 2.4.19 (which
supports this chip, but not kernel 2.4.18) was not available as a Debian
package but had just been released. A kernel was compiled from source
to get support for this new controller. The default .config (i.e., starting
from no .config file) was the starting point. Below is recorded the specific
configurations added.
# cd /usr/src
# wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz
# tar zxvf linux-2.4.19.tar.gz
# cd linux-2.4.19
# make menuconfig
Processor type and features
Processor family
CONFIG_MPENTIUM4=y
Block devices
RAM disk support
CONFIG_BLK_DEV_RAM=y
102 Installation
This works just fine and all standard drivers (CDROM and NFS) were in-
cluded by default. The resulting kernel is quite a bit smaller that the ker-
nels supporting lots of hardware (700K initrd cf 2.4MB and 56K modules cf
20MB)!
4.10 Target Machines 103
This desktop machine is used primarily for testing new installations and new
software updates. Also serves as a spare desktop workstation when required.
Installed Debian GNU/Linux 3.0 from the Debian 3.0 beta netinst CD-ROM
of 14 May 2002 (26 June 2002).
After the install the system was immediately upgraded to unstable and other
packages from unstable were installed as required.
Prefect Specifications
Prefect Install
For the Debian 2.2 install be sure to identify the network card when config-
uring devices. It is a 3c59x. This is not required for Debian 3.0. For the
Debian 3.0 install the Debian netinst was used since the PGI netinst did not
include INSTALL/BOOT nor LOADLIN.
4.10 Target Machines 105
Cleveland Specification
Cleveland Install
Debian GNU/Linux 2.2r2 was installed from CD-ROM (22 May 2002). The
network card was not recognised and so the kernel was upgraded to 2.4.6
which was available on a CDROM, requiring moving to the use of initrd and
resulting lilo configuration changes (see Sections 4.8 and 4.10.1). This ker-
nel supported the ethernet card so that the installation could be upgraded
immediately to unstable. The graphics chip (ATI Rage 128 Pro TF) though
was not supported by the current XFree86 (4.1.0). An upgrade to the exper-
imental XFree86 (4.2) fixed that.
Cultus Specifications
The disk was partitioned into two: one for swap (1GB as /dev/hda2) and
the rest for everything else (39GB as /dev/hda1).
The ethernet driver (3c59x) in this release (kernel 2.2.18pre21) does not sup-
port the 3Com 3c905C-TX card. The kernel needed to be upgraded to a 2.4.6
kernel on a more recent release (e.g., Debian 3.0 woody beta CD-ROM—see
Section 3.7.5 for details of making a CD-ROM available to apt-get):
The networking began working just fine. In moving to the unstable release
(after a dist-upgrade) kernel-image-2.4.18-686 was installed without effort
(except for initrd addition to lilo—see Sections 4.8 and 4.10.1)
Sound card support from the kernel required adding the following line to
/etc/modules.conf (by adding it to /etc/modutils/sndconfig then run-
ning update-modules:
Altrop Specifications
Altrop Install
There were no particular issues in the install except for the lack of support in
the 2.2.18pre21 kernel for the Ethernet card (3c905C-TX) in this machine.
The disk was partitioned into two: one for swap (2GB as /dev/sda2) and
the rest for everything else (65GB as /dev/sda1).
The NIC (ethernet card) driver (3c59x) in this release (kernel 2.2.18pre21)
does not appear to support the 3Com 3c905C-TX card. The kernel needed
to be upgraded to a 2.2.19 kernel on a more recent release (e.g., Debian 3.0
woody beta—see Section 3.7.5 for details of making a CD-ROM available to
apt-get):
The networking began working just fine. In moving to the unstable release
(after a dist-upgrade) kernel-image-2.4.14-686-smp was installed without ef-
fort (except for initrd addition to lilo)
Sound card support from the kernel required adding the following line to
/etc/modules.conf (by adding it to /etc/modutils/sndconfig then run-
ning update-modules:
To ensure the module is loaded at boot time add i810 audio to /etc/
modules.
4.10 Target Machines 111
Cepheus Specifications
HAX is a dual boot laptop used for development. Debian GNU/Linux 2.2r2
was installed (kernel-image-2.2.18pre21) from CD-ROM 12 December 2001. It
was immediately upgraded to unstable and running with kernel-image-2.4.16.
HAX Specifications
kb qwerty/us
disks partition
swap /dev/hda3 linux /dev/hda2
root mount /dev/hda2
kernel from cd-rom /dev/hdc
devices net/eepro100
network host = hax
base from cd-rom
config timezone Australia ACT NO GMT
Make Linux boot directly from hard disk MBR
Make boot floppy Custom Boot
Reboot
114 Installation
HUKZ Specifications
00:00.0 Host bridge: Intel Corp. 440BX/ZX - 82443BX/ZX Host bridge (rev 03)
00:01.0 PCI bridge: Intel Corp. 440BX/ZX - 82443BX/ZX AGP bridge (rev 03)
00:02.0 CardBus bridge: Texas Instruments PCI1450 (rev 03)
00:02.1 CardBus bridge: Texas Instruments PCI1450 (rev 03)
00:03.0 Communication controller: Lucent Microelectronics WinModem 56k (rev 01)
00:06.0 Multimedia audio controller: Cirrus Logic CS 4614/22/24
[CrystalClear SoundFusion Audio Accelerator] (rev 01)
00:07.0 Bridge: Intel Corp. 82371AB PIIX4 ISA (rev 02)
00:07.1 IDE interface: Intel Corp. 82371AB PIIX4 IDE (rev 01)
00:07.2 USB Controller: Intel Corp. 82371AB PIIX4 USB (rev 01)
00:07.3 Bridge: Intel Corp. 82371AB PIIX4 ACPI (rev 03)
01:00.0 VGA compatible controller: Neomagic Corporation NM2360
[MagicMedia 256ZX]
05:00.0 Ethernet controller: 3Com Corporation 3CCFE575CT Cyclone
CardBus (rev 10)
kb qwerty/us
disks partition 1GB Linux hda6
Swap hda7
4.10 Target Machines 115
Inco has two NTFS partitions (C and D drives) using about 7GB with the
remaining 13GB partitioned as 1GB swap and 12GB for linux:
Inco Specifications
Hostname: inco
Domainname: ktware.com.au
IP Address: 105.229.8.156
Netmask: 255.255.255.192
Broadcast: 105.229.255.255
Gateway: 105.229.8.190
DNS 125.83.72.15 125.83.72.1
Boot: Grub
Kernel: 2.4.22-1-686
The basic install chose the qwerty/us keyboard. The disks were partitioned
as 12GB for a linux partition (hda3) and 1GB for swap (hda4). Root was
mounted from /dev/hda3. The kernel was installed from CD-ROM with de-
vices selected including fs/autofs, fs/nfs, fs/nfsd, fs/ntfs, fs/vfat, net/3c59x,
misc/psaux and net/ppp. The network hostname was identified as inco. The
base system was installed from CD-ROM. Configuration involved setting the
timezone to Australia/ACT with the clock not set to GMT (since it is dual
boot). Initially skipped the ”Make Linux boot directly from hard disk”,
but created a boot floppy. A Cusomt Boot was chosen and the system was
rebooted.
The built-in network card is eth1 when docked and eth0 when undocked. See
Section 60.9 to handle this.
Install i8kutils to control the Dell Latitude CPU fan, volume buttons, and
Fn-keys, and to report CPU temperature. Includes a little applet to include
118 Installation
a CPU temperature in the Gnome-Panel. You may need to load the module
i8k. (By the way, i8k stands for Insperion 8000.) The command line i8kctl
lists the current status of the fans.
Lilo was configured to boot MS-Windows/2000 by pointing it to /dev/hda1.
Later, lilo was replace with grub for booting.
Sound card support from the kernel required adding the following line to
/etc/modules.conf (by adding it to /etc/modutils/sndconfig then run-
ning update-modules:
which tells it to use whatever the BIOS recognises as connected (either CRT
or FP).
At one time I had a problem playing videos with xine. Starting xine on Inco
(Section 4.10.24) displayed just a blue screen, even when the video is playing.
If I choose the video driver to be xshm it works acceptably. Ogle fails to start
also, although mplayer coped. The problem was running with 16 rather than
24 bpp X server!
4.10 Target Machines 119
Plymouth Specifications
CPU
RAM 256MB
Disk 10GB
CD-R
NIC 3COM Ethernet Card 3C905B
Video ATI Technologies Inc 3D Rage Pro AGP 1X/2X (rev 5c)
Audio
Plymouth Install
Installed Debian GNU/Linux 2.2r2 from CD-ROM (15 December 2000). Up-
graded to unstable and installed packages from unstable as required.
Velox (Section 4.10.26) is a dual boot machine with the first partition kept as
NTFS (C: Drive). During the Debian install the second partition (originally
the D: Drive) was deleted and partitioned as:
Velox Specifications
Velox Install
No particular trouble with the install. This is a dual boot machine with
MS-Windows/NT so do not install a boot loader - use NT’s boot loader.
4.10 Target Machines 123
Debian GNU/Linux 2.2r2 was installed from CD-ROM (15 December 2000)
and immediately upgraded to unstable. This is a desktop machine with an
external modem for network connection and acts as the Internet gateway for
a small network.
Mint is a dual boot machine with the first partition as NTFS (C: Drive).
The second partition (originally a D: Drive) was deleted during the Debian
install and partitioned as:
Mint Specifications
mint.act.cmis.csiro.au
CPU Pentium III (Coppermine) version: 6.8.6 730MHz
capabilities: fpu fpu_exception wp vme de pse tsc msr
pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx
fxsr sse
Memory 254MB
PCI VGA NV5M64 [RIVA TNT2 Model 64/Model 64 Pro]
capabilities: vga bus_master cap_list irq=9
PCI Network Ethernet controller 3c905C-TX/TX-M [Tornado]
capabilities: bus_master cap_list
configuration: driver=3c59x irq=5
IDE IBM-DTLA-307015 /dev/hda 13GB
IDE NEC DV-5700A /dev/hdc 1023GB
IDE LG CD-RW CED-8080B /dev/hdd 1023GB
Multimedia 82801AA AC’97 Audio
capabilities: bus_master
configuration: driver=intel810_audio irq=10
Mint Install
kb qwerty/us
disks partition
124 Installation
swap linux
root mount
kernel from cd-rom
devices fs/ntfs net/3c59x
network host = inx
base from cd-rom
config timezone Australia ACT GMT no
(skip the "Make Linux boot directly from hard disk")
Make boot floppy Custom Boot
Reboot
IP 183.44.70.89
Netmask 255.255.255.192
Gateway BLANK
DNS 183.44.72.1
4.10 Target Machines 125
Inka Specifications
color
kb qwerty/us
disks partition 6GB Linux N P 6063 B T 83 B hdc1
128MB Swap N P 125 T 82 hdc2 W Q
swap /dev/hdc2 scan
linux /dev/hdc1 scan
root mount /dev/hdc1
kernel from /dev/fd0 Rescue Disk Drivers Disk
devices misc psaux
net ppp
network host = debian
connected = no
base from /dev/fd0 Base Disks 1-7
config timezone Australia ACT GMT no
(skip the "Make Linux boot directly from hard disk")
Make boot floppy Custom Boot
Reboot
With the initial boot the extra internal bay hard disk drive had to be men-
tioned to the kernel with the following command line when the boot prompt
is displayed (you have about 10 seconds to begin typing):
(the numbers were eventually figured out one time when the drive was even-
tually auto-detected after a kernel upgrade).
# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-cs4236
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
# Options for the Crystal sound card in the Dell Latitude CPi D300XT
options snd-cs4236 index=0 id=CARD_0 port=0x530 cport=0x210 mpu_port=0x330 fm_port=0x388 i
# OSS/Free portion
alias char-major-14 soundcore
XF86 Configuration
(**) NEOMAGIC(0): *Default mode "1024x768": 65.0 MHz, 48.4 kHz, 60.0 Hz
(II) NEOMAGIC(0): Modeline "1024x768" 65.00 \
1024 1048 1184 1344 768 771 777 806 -hsync -vsync
If you are using version 3 of the XFree86 server then the following modeline
might help out:
Modeline "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
128 Installation
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "unix/:7100"
FontPath "/usr/X11R6/lib/X11/fonts/local/"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/CID/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
ModulePath "/usr/X11R6/lib/modules"
EndSection
Section "Module"
Load "dbe"
SubSection "extmod"
Option "omit xfree86-dga"
EndSubSection
Load "dbe" # Double-buffering
Load "GLcore" # OpenGL support
Load "dri" # Direct rendering infrastructure
Load "glx" # OpenGL X protocol interface
Load "extmod" # Misc. required extensions
Load "v4l" # Video4Linux
EndSection
Section "ServerFlags"
Option "blank time" "10" # 10 minutes
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
4.10 Target Machines 129
This older notebook PC has limited resources but works quite well with
a basic installation and on a network with a more powerfull server. At
the time the XWindows driver for the NeoMagic chip was not part of the
XFree86 distribution (it has been since version 3.3.3). This Dell Lattitude
XPi P133ST has a NeoMagic NM2070 chipset. The machine has 24MB of
memory and a 1.2 GB hard disk, using a PCMCIA modem card with PPP.
The 1.2GB hard disk was partitioned into two equal partitions, the first for
Windows95, the second for Linux. Windows95 offers less functionality, is
slower, has more bugs, and consumes considerably more disk space than the
Linux installation which includes X, TeX, and much more!
Originally installed Debian GNU/Linux 1.1 with individual package updates
as needed.
Checking NeoMagic’s web pages at the time found that “NeoMagic does
not support Unix drivers, and cannot provide device/programming informa-
tion to end-users,” protecting their intellectual property rights. So for the
NeoMagic chipset there was no SVGA driver (800x600x8bpp 256 colors) in
XFree86 prior to version 3.3.3—only the simple VGA16 driver (800x600x4bpp
16 colours) could be used. There was a RedHat rpm with a driver for this
chip with XFree86 versions prior to 3.3.3 available and a commercial (ap-
proximately US$250) X11 server from Xi Graphics with a NeoMagic driver
for Linux, with many positive reports.
Running an older version of XFree86 and of the kernel, you will find that the
VGA16 server from XFree86 version 3.1 works with the NM2070, giving just
16 colours. A “trick” is required to get the server to use the whole screen
(800x600) rather than the 640x480 default or the split screen effect. This
requires putting the monitor into 800x600 mode on bootup. A consequence
of this is that the normal console is turned off, and you will need to go directly
into XWindows, via xdm. This is not usually a problem.
Note that using the Neomagic 2070 xserver provided with XFree86 version
4 works fine with both 8bit and 16bit on 640x480 and 800x600 but causes
a corrupted screen (vanishing window content etc.) in all x-applications if
used with default settings. To fix the problem append both Xaa-options in
the screen-section of the x86config:
Option "XaaNoPixmapCache"
Option "XaaNoScreenToScreenCopy"
132 Installation
From:
mode_set:
mov bx,ax
cmp ah,#0xff
jz setalias
To:
mode_set:
mov ax,#0x0302 <- Insert this line
mov bx,ax
cmp ah,#0xff
jz setalias
The Compaq Presario 1020 notebook (which also uses a NeoMagic NM2070
chip) requires no LILO switches nor kernel patches. Similarly the NEC Versa
4200 also uses the NeoMagic and no hacks are required to get it to run in
800x600x4bpp mode.
Rose Specifications
This much older machine demonstrates a basic install with limited resources.
The machine is networked and provides a limited but useful interface to
applications running on a more powerful server. Some basic applications
installed included emacs, ssh, and lynx.
Roast Specifications
CPU 486/DX66
BogoMIPS
RAM 12MB
Disk 420MB
NIC
Video
Audio
4.11 Resources
4.11.1 Books
There are many books that deal with the installation of Debian or RedHat.
Some of the Debian books include:
Debian GNU/Linux: A Guide to Installation and Usage by John
Goerzen and Ossama. 158 pages, published July 1999 by New Riders, ISBN
0735709149.
Learning Debian GNU/Linux by Bill McCarty. 360 pages, published
October 1999 by O’Reilly & Associates, ISBN 1565927052.
Debian GNU/Linux 2.1 Unleashed by Mario Camou, Aaron Von Cowen-
berghe, Aaron Van Couwenberghe. 1119 pages, published December 1999 by
Sams, ISBN 0672317001.
134 Installation
Chapter 5
Basic Survival
135
136 Basic Survival
$ cat /proc/cpuinfo
Chapter 6
If you’ve tried to remember all the different commands to get different in-
formation about different aspects of Debian package management and then
used other commands to install and remove packages then you’ll know that
it can become a little too much.
Swaping between dselect, deity, deity-gtk, aptitutde, apt-get, dpkg, gnome-
137
138 Wajig: Administering Debian
deb http://togaware.com/debian ./
# apt-get update
# apt-get install wajig
$ wajig help
$ wajig -v help
All wajig commands:
password frequently. If ‘sudo’ is installed but not set up for you to access
the appropriate APT commands you will see a permission denied message.
Installing sudo is straight forward. As root run the command ‘visudo’ to edit
the configration file. Add the lines:
and
in the appropriate places. Then user ‘kayon’ can run the APT and related
commands as the super user.
If you prefer user ‘kayon’ not to need to enter their password every time you
could instead add the following:
The Debian packaging system relies on your local system having some idea of
what packages are available. This is initialised when you install your system.
You will generally need to update this list of packages with what is currently
available from the Debian archives for downloading. If you are staying with
the stable release you generally only need to update the list of available
packages once. The following command is used to update the information
about what is available for downloading:
(In brackets after the wajig command is the underlying command that wajig
calls upon to perform the operation.)
This uses entries in the file /etc/apt/sources.list to know where to get
the list of available packages from and which release of Debian you wish to
follow. You can edit this file with:
This will use the system’s default editor, but you can change which editor is
the default with the command:
(Use the command wajig listalts for a list of things for which alternatives
exist, and hence can be updated.)
You need to understand the format of the file /etc/apt/sources.list as
explained in the manual page:
$ man sources.list
Once the list of available packages is updated you can see what new packages
have recently been added to Debian with the command:
$ wajig new
Note that after the first time you use wajig update all packages will be
considered new! But after the next update the new packages are those that
were not in the available list from the previous update.
Some (and often many) of the packages that you already have installed on
your Debian system may have been upgraded in the archive since the last time
you performed an update. The following command will list these packages:
143
$ wajig newupgrades
For a complete list of the packages you have installed but for which there are
newer versions available on the archive use:
$ wajig toupgrade
To check the version of any installed package and also the version available
from the archive previously (last time, but one, you performed an upgrade)
and now (based on the last time you performed an update), and to also see
the so called Desired and Status flags of the package, use:
Without the string argument all known package names will be listed.
Each package installs some collection of files in different places on your system
(e.g., in /usr/bin/, /usr/man/man1/ and usr/doc/). Sometimes you like
to see where those files go or even just view the list of files installed. The
command to use is:
To install a new package (or even to update an already installed package) all
you need do is:
The .deb file will be searched for in both the current directory and in the apt
archive at /var/cache/apt/archive/.
You can list multiple .deb files to install.
If the .deb package file you wish to install is available on the internet you
can give its address and wajig will download then install it:
Sometimes you may want to install many packages by listing them in a file,
one per line. You can do this with:
The file of packages to install can conveniently be created from the list of
installed packages on another system with:
And you can upgrade all installed packages, remove those packages that need
to be removed (for various reasons, including issues to do with dependencies)
and install all newly required packages in the distribution with:
Once again, you can list multiple packages to remove with the one command.
A remove will not remove configuration files (in case you have done some
configuration of the package and later re-install the package). To get rid of
the configuation files as well use:
Occasionally, and particularly if you are following the unstable release, some
packages are broken for various reasons. This was the case with the package
cdrecord in unstable. This package was compiled with kernel 2.4.n and had
some kernel specific issues that were done differently with kernel 2.2.n. At
compile time one or the other options was chosen (but not both!). Thus the
newer binary versions of cdrecord would not run on a system using kernel
2.2.n. One solution is to build a Debian package of cdrecord using the wajig
build command. Another is to reinstall an older version that worked and
then place the package on hold with:
Generally you can add the ‘-src’ to copies of pre-existing ‘deb’ lines.
To retrieve and unpack a source Debian package use:
Note that you can list several packages and grab all of their sources.
The source command downloads a .tar.gz file and a .dsc file for the pack-
age. The .tar.gz file contains the source code and associated files. The
.dsc file contains test information that is used by the packaging system.
The source command will also extract the contents of the .tar.gz archive
into a subdirectory consisting of the package name and version.
To go one step further and also configure, compile and generate a default
Debian .deb package from source code (useful if you need to compile a package
for your setup specifically) then use instead:
But, if you need to modify the source in some way and rebuild a package:
$ wajig update
$ wajig build ncftp
$ dpkg-source -x ncftp_3.0.2-3.dsc
$ cd ncftp-3.0.2
$ fakeroot dpkg-buildpackage -b -u
When packages are installed the corresponding .deb files are stored in /var/cache/apt/archive.
This can become quite populated with older versions of packages and we can
clean out these older versions with:
To remove files immediately after they have been installed edit /etc/apt/
apt.conf:
With the Debian packaging system you can specify that your packages come
by default from one distribution but you can override this with packages
from other distributions. The concept is called pinning and after it is set up
you can have, for example, testing as your default release and then include
unstable in /etc/apt/sources.list and install cdrecord from unstable with:
Package: *
Pin: release a=testing
Pin-Priority: 900
Package: *
Pin: release o=Debian
Pin-Priority: -10
149
To set up a local debian cache of deb files that you’ve created or downloaded
separately:
# mkdir -p /usr/local/cache/dists/local/local/binary-i386
# cp *.deb /usr/local/cache/dists/local/local/binary-i386
# cd /usr/local/cache
# dpkg-scanpackages dists/local/local/binary-i386 /dev/null \
> dists/local/local/binary-i386/Packages
An alternative where you can specify a particular front end to use for the
configurator is:
6.0.19 Bugs
If you find a problem with your system and think it might be a bug, use the
reportbug package to check it out. This package will allow you to view bugs
recorded against packages and also allow you to add a new bug report to the
Debian bug reporting system.
In the following sections I identify a number problems or issues that I’ve not
yet resolved for some of my installations.
In addition to managing the installed packages wajig also allows you to start,
stop, reload , and restart services (which are often provided by so called
daemons—processes that run on your computer in the background perform-
ing various functions on an on-going basis). The commands all follow the
same pattern:
The start and stop commands are obvious. The restart command generally
performs a stop followed by a start. The reload command will ask the daemon
to reload its configuration files generally without stopping the daemon, if
this is possible. The services you can specifiy here depend on what you have
installed. Common services include:
apache Web server
cron Regular task scheduler
exim Email delivery system
gdm The Gnome Windows Display Manager (for logging on)
ssh The Secure Shell daemon
# wajig update
# apt-get --download-only dist-upgrade
In this way you are able to leave the download unattended and when you are
ready you can monitor the unpacking and setup.
If things go wrong somewhere the apt may be able to help. The apt-get–
fix-broken will do its best:
but if things still don’t work, you may need to use dpkg directly to remove
and isntall packages.
The apt method within dselect and the apt-get command (which the apt
mathod uses) place all downloaded files into /var/cache/apt/archive. You
can then use the apt-move command to move the archived files into a local
hierarchy that mirrors a standard distribution hierarchy. Then you can point
apt-get to this local archive by pointing to it from /etc/apt/sources.list
using the file:// format. You can also give the option apt-get–download-
only to apt-get to download but not unpack nor install the package.
To set up a local machine as a local (partial) mirror of the Debian archive,
first install apt-move:
APTSITES="mirror.aarnet.edu.au_pub_debian
ftp.debian.org_debian
non-US.debian.org
security.debian.org"
Then remove all architectures not of interest from the ARCHS variable and
DIST:
ARCHS="i386 sparc"
DIST=unstable
The apt-move command is then used to install any packages in your /var/
cache/apt/archives into the Debian mirror being created:
# apt-move update
# apt-move mirror
# cd /var/www
# ln -s /mirrors pub
All of this might happen on your server, yet your server is not likely to be the
most up to date machine. Suppose your experimental machine (always kept
up to date) is Inco (Section 4.10.24). You can rsync all packages in /var/
cache/apt/archives on Inco (Section 4.10.24) to your sever (e.g., Altrop),
then on Altrop run apt-move (and also remove the original files from the
archive on Inco (Section 4.10.24)):
6.2 Package Information 153
The package system maintains a list of all packages installed (and de-installed).
You can access this list, save it to a file, and use it to mark those same pack-
ages for installation (or deinstallation) on anther machine:
The dpkg and apt-get commands are pretty useful and provide a lot of func-
tionality. Here’s some common things that you may want to do:
Search for the package that installed the file diff.info.gz
List the information for any package with diff in its name
Debian has a mechanism for dealing with applications that provide the same
functionality. We describe here how this mechanism works and how you can
use it to tune your installation.
If you have more than one variant of emacs installed (e.g., emacs19, emacs20,
and xemacs) then you can configure which one you get by default with:
Suppose the window-manager you want to use as the default is not listed as
available. You can install it with:
Where PRIORITY is a number higher than the highest existing priority for
the x-window-manager alternative. You can get a list of priorities with:
3. Your sponsor will have access to the debian machines and can test your
package on all the architectures with you.
When you want to create a new package, send a message to debian-devel with
a subject line ITP: mynewpackage. The ITP stands for Intend to Package.
I’ve packaged up a tool I’ve written called wajig which is a simplified front
end to the APT and DPKG suite of tools. It is a python program. I use
autoconf to manage the configuration.
I turned the tool into a Debian package using the steps outlined below.
Files
The files include some that are required by the GNU standards and some
that are required for the installation:
$ autoconf
Next time you ./configure the new Makefiles and source code will contain
the updated information.
$ ./configure
$ make dist
$ mv wajig-0.1.1.tar.gz ..
configure.in
PACKAGE=wajig
VERSION=0.1.1
158 Wajig: Administering Debian
AC_PATH_PROG(PYTHON, python)
AC_SUBST(PYTHON)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CC
The first task is to set up the information required for the Debian packaging
system. Extract the distribution:
to create the wajig-0.1.1 subdirectory. Change into this directory and then
run dh make to set things up for Debian:
$ cd wajig-0.1.1
$ dh_make -e kayon@ktware.com -f ../wajig-0.1.1.tar.gz
You will be asked what kind of package to create and since wajig is a single
binary package we choose s.
This has now created a debian subdirectory and copy of the original distri-
bution in ../wajig-0.1.1.orig.
Now edit the files in the debian subdirectory to tell Debian the appropriate
information about the package.
6.5 Packages: Roll Your Own 159
control
copyright
changelog
rules
docs
Other Files
Now you are ready to build and check the new package:
$ dpkg-buildpackage -rfakeroot
$ cd ..
$ lintian -i wajig_0.1.1-1_i386.changes
Once the package is correctly built load it onto your Debian archive to provide
it for others to access:
$ cp wajig_0.1.1* /var/www/debian/
$ cd /var/www/debian/
$ chmod go+r wajig_0.1.1*
$ apt-ftparchive packages . > Packages
$ apt-ftparchive sources . > Sources
$ gzip -c Packages > Packages.gz
$ gzip -c Sources > Sources.gz
deb http://ktware.com/debian ./
deb-src http://ktware.com/debian ./
160 Wajig: Administering Debian
If you are a Debian developer you would upload the package directly to the
Debian archives using the dupload tool instead of onto your own archive.
$ cd wajig-0.1.1
$ uupdate -u wajig-0.1.2.tar.gz
$ cd ../wajig-0.1.2
$ dpkg-buildpackage -rfakeroot
$ cd ..
$ lintian -i wajig_0.1.2-1_i386.changes
$ cp wajig_0.1.2* /var/www/debian/
$ cd /var/www/debian/
$ chmod go+r wajig_0.1.2*
$ apt-ftparchive packages . > Packages
$ apt-ftparchive sources . > Sources
$ gzip -c Packages > Packages.gz
$ gzip -c Sources > Sources.gz
$ apt-get update
$ apt-get install wajig
$ wajig update
$ wajig install wajig
6.5 Packages: Roll Your Own 161
Make changes to any of the debian files and increment the Debian release
number (the number after the “-” in the version) using dch and regenerate
the Debian packages:
$ dch -i
$ dpkg-buildpackage -rfakeroot
$ cd ..
$ lintian -i wajig_0.1.2-2_i386.changes
$ cp wajig_0.1.2* /var/www/debian/
$ cd /var/www/debian/
$ chmod go+r wajig_0.1.2*
$ apt-ftparchive packages . > Packages
$ apt-ftparchive sources . > Sources
$ gzip -c Packages > Packages.gz
$ gzip -c Sources > Sources.gz
162 Wajig: Administering Debian
Chapter 7
Audio
GNU/Linux provides tools for listening to, recording, and modifying audio.
Recording audio CDs is discussed in Section 14.3. Making sound recordings
and mixing is covered in Chapter 78. To extract audio from your DVD see
Section 87.2.3.
In this chapter we talk about setting up of audio chips under GNU/Linux,
and tools for manipulating audio files.
Use the Debian package sndconfig to automatically identify your audio chip
and to add this information to /etc/modutils/sndconfig.
If the audio device is not supported then you will probably need to get a
newer kernel. Suppose you has an i810 audio chip (82801DB AC’97). Get
this information from the lspci command:
> lspci
...
00:1f.5 Multimedia audio controller: Intel Corp. 82801DB AC’97
...
163
164 Audio
If you notice that a user starts up Gnome and receives a message about Audio
not working the likely cause is that the user is not in group audio (as no users
are in group audio by default). You need to:
Next time user kayon logs on they will be able to use the audio device.
Information about an audio file can be stored as part of the audio file itself
(at least in OGG or MP3 format). This can include track titles, artists,
album titles, genre, and more. You can view the information using the
vorbiscomment command:
Other useful tools for editting the audio information includes the terminal-
based orpheus (not currently packaged for Debian as of 11 March 2004).
Chapter 8
A very useful feature of AbiWord is its export to LATEX. It does quite a good
job in generating a representation in LATEX.
165
166 AbiWord: Word Processor
append="apm=on apm=power-off"
If you have apm as a module then use the following when you load the
module:
apm power_off=1
167
168 APM: Power Management
CONFIG_APM=y
CONFIG_APM_DO_ENABLE=y
CONFIG_APM_CPU_IDLE=y
CONFIG_APM_DISPLAY_BLANK=y
CONFIG_APM_RTC_IS_GMT=y
CONFIG_APM_IGNORE_MULTIPLE_SUSPEND=y
CONFIG_APM_IGNORE_SUSPEND_BOUNCE=y
# apm
AC off-line, battery status high: 56% (2:27)
# apm -s
A suspend while connected to power within a docking station does not seem
to suspend the machine completely. It sends it to sleep but it does not beep
and power down.
Some useful commands related to rebooting are:
After installing the apmd package the suspend maintains the clock correctly
between a suspend and a resume. (Although I seem to be losing a few seconds
each time.)
Note that a suspend will disconnect your modem!
169
PROBLEMS When you eject the laptop from a docking station while run-
ning an X session it does not come back properly when the laptop is reinserted
into a docking station. Sometimes the display is half off the screen. Some-
times simply get streaks across the screen. If this happens, you can go back
to a console as usual with CTRL-ALT-F1, or exit from the X session with
CTRL-ALT-BACKSPACE. If you eject while running an X session and open the
laptop lid you will not get the proper display, and may damage the display.
It can also freeze the laptop.
Suspend maintains RAM with the battery. Hibernate saves everything to
disk. Standby powers down disks and the lcd display.
170 APM: Power Management
Chapter 10
Backup
#!/bin/sh
#
# Script for /etc/cron.daily
#
171
172 Backup
LOGFILE="/root/BACKUP.log"
RSYNC="/usr/bin/rsync"
DEST="kayon@caravan.ktware.com:backup/$(/bin/hostname)"
OPTS="--rsh=ssh --cvs-exclude --archive --compress "
OPTS=${OPTS}"--delete --delete-excluded --verbose"
INCFILE="/etc/backup.include"
#
# Identify specific file types to exclude
#
- *.mp3
- *.rpm
- *.deb
- *.wav
- *.avi
- *.mov
- *.temp
- *.tmp
- *.cdr
#
# Exclude paths that contain
#
- .thumbnails
- .xvpics
- cache
- skins
- thumbnails
#
# Now specify specific trees to back up
#
+ /etc
10.2 Legato NetWorker 173
+ /home
+ /root
+ /usr/local
+ /var/mail
+ /var/backups
#
# And exclude everything else
#
- /*
Since this is using ssh (OpenSSH, ssh protocol 2) and it is a cron job (i.e.,
you can not supply a password or passphrase), create a ssh public key for
adding to kayon@caravan’s authorized keys file:
caravan$ cd .ssh
caravan$ cat authorized_keys.n >> authorized_keys
caravan$ rm authorized_keys.n
caravan$ exit
To install the client software and the manual pages (available as Red Hat
packages) on your Debian workstation mount the supplied CD-ROM (which
might be called the Solstice Backup 6.1: Servers, Clients and Storage Nodes,
Volume 1 ) and then:
#!/bin/sh
case "$1" in
start)
echo -n "Starting NetWorker daemons: "
if [ -f /usr/sbin/nsrexecd ]; then
echo -n " nsrexecd"
#
# Allow access from only the specified hosts.
#
/usr/sbin/nsrexecd -s nsrhost
fi
if [ -f /usr/sbin/nsrd ]; then
echo " nsrd"
/usr/sbin/nsrd
fi
echo "."
;;
stop)
echo -n "Stopping NetWorker daemons:"
if [ -f /usr/sbin/nsr_shutdown ]; then
echo -n " nsr_shutdown -a -q"
/usr/sbin/nsr_shutdown -a -q
fi
echo "."
;;
restart|force-reload)
$0 stop
$0 start
10.2 Legato NetWorker 175
;;
*)
echo "usage: ‘basename $0‘ {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
Now you can start the daemon and check that it is running (you will get 2
nsrexecds running):
To have the daemon start and stop at boot and shutdown time create the
following symbolic links:
# cd /etc/rc2.d
# ln -s ../init.d/networker S95networker
# cd /etc/rc0.d
# ln -s ../init.d/networker K05networker
Note that in the init script above reference is made to nsrhost. This is the
host name of the backup server (on the local network it might actually be
called nsrhost). Replace this with the host name of your own backup server.
Now to recover a file run the graphical interface nwrecover.
176 Backup
Chapter 11
When Bash is invoked as an interactive login shell it first reads and executes
commands from the file /etc/profile, if that file exists. After reading that
file, it looks for ~/.bash\_profile, ~/.bash\_login, and ~/.profile, in
that order, and reads and executes commands from the first one that exists
and is readable. When a login shell exits Bash reads and executes commands
from the file ~/.bash\_logout, if it exists.
177
178 Command Line: Bash
Chapter 12
Booting
Booting is simply the process of starting up the system when the computer is
powered on. The computer’s BIOS (the Basic Input/Output System which
is programmed into the hardware of the computer) takes charge and decides
what is to be done. Usually the BIOS first runs a Power-On-Self-Test (POST)
and then looks for boot information which typically resides in the Master
Boot Record (MBR) of the hard drive (or in general the boot sector of any
available device).
For a GNU/Linux system the MBR contains a boot loader like lilo of grub.
These will give you choices of operating systems to boot whenever you reboot
your computer. To install a boot loader you will either overwrite the master
boot record with one that will start up lilo, or, for MS-Windows/NT, you will
add extra information in a configuration file to identify, for MS-Windows/NT,
how to boot into GNU/Linux. The grub boot loader is quite a bit more
flexible than LILO and is often a good choice.
Lilo is the traditional GNU/Linux boot manager (and silo is the boot man-
ager for Sparc GNU/Linux). A newer alternative that may replace lilo is the
GNU grub (GRand Unified Bootloader). Grub can be set up to automati-
cally identify newly installed kernels, making the installation of new kernels
quite straightforward. Another emerging alternative is xosl, the extended OS
loader.
If you are using a GNU/Linux boot loader such as Grub then the Grub
code will be loaded into memory and executed. Grub takes on the task of
then loading an operating system, such as the GNU/Linux kernel. More
information about the process is available from http://www.tldp.org/LDP/
179
180 Booting
sag/index.html.
In this chapter we also explore issues around dual booting. See Chapter 45
for what happens once the Linux kernel starts booting.
12.1 Lilo
Lilo can be installed into the Master Boot Record (MBR) or as the first
part of some other disk partition. That is, you have the choice of the BIOS
starting up lilo or some other program in your MBR. The MBR program that
cames with Debian is installed when you run the command install-mbr. To
overwrite the part of lilo that is installed on the MBR you simply install
something else in the MBR!
When lilo overwrites the MBR it keeps a copy of the old MBR in case you
find you need to restore it for any reason.
On Velox (Section 4.10.26) lilo fails because the disk is too big. Use lilo
-L (or add lba32 to /etc/lilo.conf), then:
# lilo -L
Added 2.2.18pre21 *
# dd if=/dev/sda of=/root/bootsect.lnx bs=512 count=1
# mcopy /root/bootsect.lnx a:
# lilo -u /dev/sda
Note that new kernel images go into /boot/vmlinux. The old is put into
/boot/vmlinux.old. Thus you can have a /etc/lilo.conf like:
12.2 GRUB: The Grand Unified Boot Loader 181
image=/vmlinuz
label=linux
root=/dev/hda2
image=/vmlinuz.old
label=linux.old
root=/dev/hda2
Note also that /vmlinux is a symbolic link into the actual file stored in /boot.
This creates a /boot/grub/menu.lst file which you might like to review just
to make sure it looks okay. For most simple situations it should be fine.
For a dual boot with MS-Windows/NT on the first partition and Linux on the
second (like Mint), you may need to change the default locations of Linux.
Look at /boot/grub/menu.lst to see if the following two lines have been
changed:
182 Booting
# kopt=root=/dev/hda1 ro
# groot=(hd0,0)
to
# kopt=root=/dev/hda2 ro
# groot=(hd0,1)
title Windows NT
rootnoverify (hd0,0)
makeactive
chainloader +1
If you start having problems booting, at the grub menu type c to get the
command line. Try:
MS-Windows/NT has it’s own boot loader that likes to be in charge. That’s
okay. One solution is to simply tell the MS-Windows/NT boot loader what to
do if you want to boot into GNU/Linux. This means copying the GNU/Linux
boot code into a file, transferring that file to a MS-Windows/NT partition,
and then adding a menu item for the MS-Windows/NT boot loader to select
the GNU/Linux boot if required. Using grub we don’t need to do this as
184 Booting
grub supports chain loaders that allows you to choose to load up the MS-
Windows/NT boot loader.
If you wish MS-Windows/NT to remain in control, the do the following:
Boot from floppy disk into GNU/Linux. Log in as the root user. Check
where the boot sector of your GNU/Linux partition is:
# rdev /vmlinuz Root device /dev/hdc1
So on this particular machine the boot sector is on the second hard drive
(/dev/hdc).
When installing don’t let lilo install a boot loader over the existing master
boot record on your hard drive (usually /dev/hda) unless you wish to wipe
out the original NT – For dual boot using the MS-Windows/NT boot loader
see the http://www.tldp.org/HOWTO/Linux+NT-Loader.html Linux with
NT Loader mini HOWTO, but I detail the steps below. Use LILO You then
copy the Linux boot sector to floppy disk, reboot to NT, and copy the Linux
boot sector onto the NT hard disk. The NT boot loader is then told where
to find the file (edit C:\boot.ini). It is all very clearly documented in the
above mini HOWTO. On bootup you can then choose between GNU/Linux
and Windows NT.
# editor /etc/lilo.conf
root=/dev/hdc
boot=/dev/hdc
append="hdc=13424,15,63"
# /sbin/lilo
Warning: /dev/hdc1 is not on the first disk
Added Linux *
# dd if=/dev/hdc1 of=/root/bootsect.lnx bs=512 count=1
# mcopy /root/bootsect.lnx a:
# reboot (into NT)
C:\>copy a:\bootsect.lnx c:\bootsect.lnx
C:\>attrib -s -r c:\boot.ini
C:\>notepad c:\boot.ini
[boot loader]
timeout=30
default=C:\bootsect.lnx
[operating systems]
C:\bootsect.lnx="Linux"
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation ...
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation ...
12.5 MS-Windows/NT or MS-Windows/2000 185
C:\>attrib +s +r c:\boot.ini
C:\>reboot (into Linux)
Note the inclusion of the append line above in my lilo.conf. This ensures
/dev/hdc is found. Otherwise, sometimes it is not.
After you install a new kernel under Linux (either from a kernel-image pack-
age on the Debian archive or else your own compiled kernel-image) you will
need to rerun LILO. By default lilo.conf identifies the image to boot as ”/vm-
linuz”. This is a symbolic link to, for example, /boot/vmlinuz-2.0.36.
image=/dev/hda1
label=Windows2000
boot=/dev/hda
root=/dev/hda2
Run lilo:
# lilo
Added 2.2.18 *
After running lilo (if you overwrite the master boot record—MBR) you can
no longer boot into MS-Windows/NT immediately. But, lilo stores a backup
MBR in /boot/boot.0300, so don’t despair. Copy the lilo boot sector to file
then restore the MS-Windows/NT MBR using lilo -u.
The recipe is:
You don’t need to use any special boot programs if you are not comfortable
with the process of using a boot loader and modifying the computer’s master
boot record. Instead, all you need is to boot GNU/Linux from a boot floopy
that will be created when you install GNU/Linux. You simply insert the
12.6 The Booting From Floppy Alternative 187
floppy whenever you boot your computer into GNU/Linux and make sure it
is not inserted if you want to boot into the original operating system. Booting
from floppy is a little slower than booting from hard disk but otherwise
functionally equivalent.
188 Booting
Chapter 13
Cameras
See Section 86.1.1 for information on setting up the camera through a USB
connection.
One time after deleting photos from the camera after mounting the camera
as a USB Mass Storage Device and deleting all photos the camera thought
it had no memory left and yet knew that it had no photos! Had to reformat
the memory!
Use gphoto2:
# gphoto2 --get-all-files
189
190 Cameras
Chapter 14
CD-ROM
A clean install of Debian GNU/Linux is most likely to find your CD-R, CD-
RW, and DVD drives without the need for you to do anything. If not, then
see Section 14.1. The simplest way to burn a CD is with the Naultilus CD
Creator described in Section 59.3. Other approaches are details below.
14.1 Setup
To make use of a CD-ROM device you need to know what device it is mapped
to. Let’s assume it is /dev/hde (but look through the output of the dmesg
command to see which it is). If the device /dev/hde does not exist (for
modern versions of Debian it usually does exist as the devices where identified
at boot) you will need to create it with MAKEDEV as root:
# cd /dev
# ./MAKEDEV hde
# ln -s /dev/hde cdrom
191
192 CD-ROM
If users can not mount the CD-ROM device then they probably don’t have the
right permissions. To allow general access to the CD-ROM edit /etc/fstab
to add the following line.
Any user can then mount and unmount /cdrom, irrespective of who mounted
it. Also note that the standard CD-ROM format is iso9660 and the auto in
the above could have been this. However, as DVDs become more common
using auto allows the udf format to also be recognised with no extra effort.
The Gnome mount applets allow a user to mount and unmount the CD-
ROM. Make sure you unmount the CD-ROM before you physically remove
the media. (For most drives the eject button is disabled while the CD is
mounted.)
The various options in the /etc/fstab line above are: ro which mounts the
file system as read-only; users which lets all users mount and unmount the
file-system; noauto which means that the file-system is not automatically
mounted at boot time; and nohide which shows hidden and associated files.
With the above entry in /etc/fstab the command line mounting of the
partition becomes:
# mount /cdrom
By default the CD-ROM device belongs to group disk. For audio CD access
the user will need to be a member of the group to which the device belongs.
But do not add users to the group disk because this will give them read/write
access to raw devices for all disks meaning that they can directly read the
bits off the hard disk and effectively ignore file system permissions. Instead
change the Unix group of /dev/hde from disk to cdrom and add users who
need access to the drive to the group cdrom:
Next time user kayon logs on they will be in group cdrom in addition to
the other groups they were already in. They will then have access to the
CD-ROM device.
CD writing software for GNU/Linux (prior to kernel 2.6) targets SCSI de-
vices, so you will need to install appropriate drivers so that your ATAPI IDE
CD-RW (and your CD-R/DVD if you wish) pretends to be a SCSI device.
It will then be identified as /dev/scd0 rather than /dev/hdd.
Turning a IDE CD-RW into a SCSI CD-RW is pretty straightforward. First
ensure the appropriate kernel modules are loaded (you need sg and ide-scsi ).
Use the command lsmod to list the modules currently loaded in the kernel,
and the commands modconf or insmod to load the modules. If you already
have the drive under the control of ide-cd then you need to get rid of it (as
below).
You can ensure these happen at boot time, and the appropriate dependencies
between kernel modules are identified, by creating /etc/modutils/cdrw:
#
# As suggested in CD Writing HOWTO
#
# This assumes IDE-CD is a module rather than copmiled into kernel.
#
options ide-cd ignore="hdc hdd"
alias scd0 sr_mode
pre-install sg modprobe ide-scsi
pre-install sr_mod modprobe ide-scsi
pre-install ide-scsi modprobe ide-cd
Note here that we are telling the IDE CD module to ignore the disk which
we want the ide-scsi module to handle. The ide-scsi module won’t touch any
disks already being driven. Change the hdd to the appropriate one of hda,
hdb, hdc, or hdd. To check which one to ignore look through the output of
the dmesg command for the CD-RW line which identifies the driver, which
on Altrop (Section 4.10.20) is:
Thus ide-cd should ignore hdd. If you want all CD drives to be SCSI (useful
for some cases like cdrdao when asked to copy a disk) then don’t include
either of the lines that mention ide-cd!
Now update the modules.conf file with:
# update-modules
Finally, tell the kernel to load the modules at boot time by adding the fol-
lowing to /etc/modules
sr_mod
sg
ide-cd
You will now probably need to reboot to have the new configuration take
effect. Also, don’t include ide-cd if you want all your drives recognised as
SCSI.
Once set up cdrecord can be used to identify the SCSI device on which the
CD writer sits:
For example, on Mint (Section 4.10.27) the device is 0,1,0. The LG CD-RW
CED-8080B 1.04 on this host is identified using:
# cdrecord -scanbus
scsibus0:
0,0,0 0) ’_NEC ’ ’DV-5700A ’ ’3.07’ Removable CD-ROM
0,1,0 1) ’LG ’ ’CD-RW CED-8080B ’ ’1.04’ Removable CD-ROM
On Velox (Section 4.10.26) the device is 2,0,0. The SONY CD-RW CRX140E
on this host is identified using:
# cdrecord -scanbus
scsibus0:
0,0,0 0) ’QUANTUM’ ’ATLAS10K2-TY184L’ ’DA40’ Disk
scsibus2:
2,0,0 200) ’SONY’ ’CD-RW CRX140E’ ’1.0n’ Removable CD-ROM
14.1 Setup 195
Altrop (Section 4.10.20) and Velox (Section 4.10.26) have DVD drives (which
remain as IDE devices as /dev/hdc) and a CD-RW writer (which with the
above set up becomes /dev/scd0). Mint (Section 4.10.27) also has two drives
but both are run as SCSI devices.
If you are having problems with CD drives being found try adding ide-probe-modbefore
ide-scsi in /etc/modules.
A line that someone suggested to be added to lilo.conf:
Incx (Section ??), a laptop, has a CD-ROM located in the Docking Station.
You will need a recent version of the kernel (at least post 2.2.15) so that it
will be recognised on boot, displaying the following message:
On Mint (Section 4.10.27) this hardware seems to have some bad firmware.
Others report a similar problem and yet others say they have no problem at
all. If I knew how to obtain an update to the firmware and how to install
it, no doubt it would all work! The problem is only for writing TAO. DAO
seems just fine.
196 CD-ROM
Under Debian, cdrecord version 1.10a18 was compiled with kernel version
2.4.x which has some incompatibilities with kernel version 2.2.x, resulting in
an error in trying to mmap on /dev/zero.
The typical scenario is:
and again:
14.2 CD Software 197
or
14.2 CD Software
Once you have set up your CD-R, CD-RW, or DVD driver you may be
interested in packages like cdrecord, cdrdao, mkisofs, cdmaster, and video-
dvdrip.
14.2.1 cdrdao
The cdrdao package provides, by far, the simplest interface for burning CDs.
By default cdrdao must be run as root, which is best set up for users through
the use of sudo. If you trust all with access to your machine the you may
want to allow anyone to run the program:
The first step is then to find out where on the scsi bus your CD writer is and
cdrdao does this with:
198 CD-ROM
$ cdrdao scanbus
write_device: "0,0,0"
write_driver: "generic-mmc"
The following cdrdao commands can be specified on the command line with-
out the need to identify the device each time:
14.2.2 gcdmaster
Gcdmaster provides a Gnome GUI for cdrdao. For cdrdao be sure to create
the following link:
# cd /dev
# ln -s cdrw cdrecorder
But gcdmaster failed for some reason (after cdrdao read the CD and then
requested a RETURN!) and so why not just use the command line to copy
a CD as described below!
14.3 CD Audio 199
14.2.3 xcdroast
MP3 encoders are entwined in legal issues that are too complex to get into
here. Recording your personal CDs to listen to the music you’ve already paid
for appears reasonable.
The encoder of choice is call lame. The Debian package is available at
http://hive.me.gu.edu.au/ and the source is also at http://www.sulaco.
org/mp3/.
The issue with MP3 is that the MP3 codec is patented by Fraunhofer in
Germany, and a license is required to use it. To address this a free audio
format has been developed called Ogg Vorbis. There are many utilities that
will rip CDs to Ogg Vorbis format.
14.3 CD Audio
Because Mint (Section 4.10.27) has no working cdrecord (at least for recording
audio) we need to use cdrdao. The cdrdao package can be used to duplicate
both data and audio CD-ROMs.
To directly record an audio CD (or a data CD) from the SCSI device then
burn it on the same device using cdrdao, add the following to /home/kayon/.cdrdao
200 CD-ROM
(replace the 0,1,0 with your SCSI device address as identified by cdrecord
-scanbus, and the driver with the appropriate one for your CD writer):
write_device: "0,1,0"
write_driver: "generic-mmc"
Then:
$ cdrdao copy
You’ll be asked to insert a new CD-R once the reading is complete and it is
ready to write.
The use of the .cdrdao file is simply to avoid having to specify the command
line options of cdrdao which require --device and --driver.
If you have both a CD drive (or perhaps a DVD drive) and a CD writer both
as SCSI devices (see Section 14.1) then you can use cdrdao to record direct
from the reader to the writer:
$ cdrdao copy
The read-cddb will look up the CDDB web database to find track informa-
tion for the audio CD and generates a suitable table of contents that will be
written to the CD-R if the CD writer supports CD-TEXT.
To just create a table of contents for an audio disk:
On Altrop (Section 4.10.20) and Festival (Section 4.10.11) we can use cdrecord
(which fails on Mint (Section 4.10.27)) to duplicate an audio CD in Disk
At Once mode. The SCSI device for the CD-RW is 1,1,0 on Altrop (Sec-
tion 4.10.20) and 0,0,0 and Festival (Section 4.10.11).
First extract the audio from the source CD into individual WAV files:
Using cdrecord to record Track At Once mode (with a resulting 2 second gap
between each track)
#!/bin/sh
for i in *.mp3; do
if [ ! -e $(basename $i .mp3).cdr ]; then
mpg123 --cdr - $i > $(basename $i .mp3).cdr;
fi
done
printf "CD_DA\n" > disk.toc
for i in *.cdr; do
printf "TRACK AUDIO\nFILE \"$i\" 0\n" >> disk.toc
done
printf "\n========== disk.toc ==================\n"
cat disk.toc
printf "========================================\n"
printf "\n>>>>>>>> Now run \"cdrdao write disk.toc\" <<<<<<<<<<\n"
Then the following two steps will convert all mp3 files in the current directory
to cdr, then burn them to a CD-R or CD-RW. If you want to change the
order of the tracks, simply edit disk.toc.
> mkcdrtoc
> cdrdao write disk.toc
Grip is able to obtain information about your CD from the Free CD Database
automatically over the web. This information includes the tack details and is
displayed under the Tracks tab (see Figure 14.1). You may need to ensure the
configuration for the Free CD Database server is set up—see Figure 14.2 for
an example configuration. If the CD information is already available locally
(because grip or some other CD utility has previously updated the database
of disks in ~/.cddb) then it will be displayed.
The process of reading the WAV tracks from an audio CD is called ripping.
A popular GNU/Linux ripper is cdparanoia and Grip includes cdparanoia so
you do not need to install the package separately. Also supported are the
separately installed rippers cdparanoia and cdda2wav. See Figure 14.3 for an
example configuration.
Grip will rip and encode a CD in separate processes allowing the encoding to
happen while the next track is being ripped.
204 CD-ROM
Figure 14.2: Here grip is configured to query the Free CD database server to
find information about the CD. If this query fails then the non-free database
is searched. If the CD information is found in the non-free database and
not in the free database you will given the opportunity to update the free
database with the information.
Now we are ready to rip and encode an audio CD. Insert your CD into the
CD-ROM drive.
The Tracks tab should list the available tracks. If what you get is a list
like that in Figure 14.4 then for some reason the information is not available
(probably because you are not connected to the internet or the CD is not
know to the databases). In this case, enter the information yourself. This is
useful because the information is then recorded in the MP3 file as the ID3
tag. This is used by various MP3 players to display track information. To
enter the information yourself click on the Toggle disk editor button (the
pencil icon along the bottom row of buttons). This will open up an area
for you to enter the relevant information (see Figure 14.4). Once you have
enetered the information be sure to share it by clicking on the Submit disc
info button with the letter icon.
Figure 14.4: Grip is unable to find the information for this disk.
Next select the tracks you wish to encode. Click in the Rip column heading
to select all tracks. Go to the Rip tab and click on the Rip+Encode button.
Sit back and wait. This process takes quite a while and is quite resource
206 CD-ROM
intensive (so your games may be slow while you wait). The progress bars on
the Rip tab show how things are going.
For each CD a playlist is created in ~/mp3 and for each track two files are
created, usually somehwhere in ~/mp3 as well, depending on the settings
in Figure 14.3. You set the location of the playlist in the Config tab un-
der MP3 Options (where you can also tell grip to automatically delete the
temporary WAV files). The playlist is identified as an M3U file. The ex-
ample configuration places both the temporary WAV file and the MP3 file
in ~/mp3/\%a/\%d/\%t.\%n.wav and ~/mp3/\%a/\%d/\%t.\%n.mp3 respec-
tively. That is, a folder is created having the same name as the artist (%a),
and a sub-folder of this having the disc name (%d). Into this sub-folder all of
the tracks are stored with names consisting of track number (%t) and track
name (%n). So, for example, you might have:
~/mp3/pink_floyd/a_saucerful_of_secrets/04.corporal_clegg.mp3
This scheme works quite nicely but of course use whatever scheme suits you.
If there are problems accessing the CD make sure /dev/sg0 has the correct
permissions:
# ls -l /dev/sg0
crw------- 1 root root 21, 0 Mar 15 2002 sg0
# chgrp cdrom /dev/sg0
changed group of ‘/dev/sg0’ to cdrom
# chmod g+rw /dev/sg0
mode of ‘/dev/sg0’ changed to 0660 (rw-rw----)
14.6 CD Data
Nautilus provides by far the simplest approach to burning data CDs. See
Section 59.3 for details.
14.6 CD Data 207
The output of mkisofs can be fed directly into cdrecord if the CPU is fast
enough (better than 400MHz). Note that the default installation requires
cdrecord to be run as root.
The first step is to determine the image size:
This works for Altrop (Section 4.10.20), Mint (Section 4.10.27) and Festival
(Section 4.10.11) and only for root (unless cdrecord is configured to install
setuid ), by default.
CD_ROM
TRACK MODE1
DATAFILE "cdimage.raw"
TRACK AUDIO
FILE "drumnbass.wav" 0
was able to write a CD with 2 tracks, the first being data and the second
being audio. The audio can be played on a CD. The CD can be mounted to
read data. Swapping order on Mint (Section 4.10.27) did not allow the CD
to be mounted? Perhaps need newer kernel? But first audio track could be
played okay.
14.8 CD-RW 209
14.8 CD-RW
Although the command returns quite quickly the blanking process continues
for quite some time while it performs a long write (you can instead do a mini-
mal blank with the option --blank-mode minimal. After this has completed
you can burn to the CD-RW as if it were a new blank CD-R.
First burn:
You may want to add some other options to mkisofs. Check out:
Second burn:
14.10 CD Labels
The package cdlabelgen provides a useful tool to quickly put together covers
for CD:
The main title is Debian GNU/Linux with subtitle Version 2.2r2 (potato)
netinst. No date will be written, but the front cover will include the image
from the file openlogo-nd.eps, scaled by 0.8. The back cover will contain
the text from contents.list. Once it looks okay in Ghostview (gv) replace
the gv - with lpr.
Chapter 15
Chinese
211
212 Chinese
Chapter 16
The chroot allows multiple installs on the one machine without rebooting! In
this way you can then keep an older “stable” release that some applications
might require, and run those applications as in:
sudo chroot /path/to/chroot /bin/sh
Set it up with (from http://www.debian.org/doc/manuals/reference/
ch-tips.en.html#s-chroot):
# cd /
# mkdir /sid-root
# debootstrap sid /sid-root http://ftp.debian.org/debian/
... watch it download the whole system
# echo "proc-sid /sid-root/proc proc none 0 0" >> /etc/fstab
# mount proc-sid /sid-root/proc -t proc
# cp /etc/hosts /sid-root/etc/hosts
# chroot /sid-root /bin/bash
# apt-setup # set-up /etc/apt/sources.list
# vi /etc/apt/sources.list # point the source to unstable
# dselect # you may use aptitude, install mc and vim :-)
213
214 ChRoot: Multiple Distributions
Chapter 17
Clock: An Explanation
There are two clocks in your computer: a system clock and a hardware
clock. The system clock is maintained by the running operating system
(Debian). It is also said to be maintained by the kernel. The date command
talks to the system clock. The hardware clock is part of the actual hardware
of the computer and is usually battery backed up. The hwclock command
talks to the hardware clock.
17.0.1 Timezones
With a dual boot system it is often best to set the clock to local time. If, on
the otherhand, GNU/Linux is the only operating system installed then using
GMT (Greenwich Mean Time) is recommended as the standard approach for
Unix.
To change the timezone use the tzconfig command. You also have to change
the line in /etc/default/rcS which states the CMOS clock configuration.
Some system clocks do not run all that accurately. Some hints on dealing
with clock problems can be found in the Clock mini HOWTO at http://
www.tldp.org/HOWTO/Clock.html, but the hwclock and adjtimex manual
pages tend to be an easier read!
Be warned though, the Debian suggestion is not to fiddle with hwclock. It is
215
216 Clock: An Explanation
highly recommended that you install the ntp-simple package (to run a daemon
that checks regularly to keep your clock in sync) and/or ntpdate (to update
your clock at each boot or to manually run a command to update your clock)
to keep your clock accurate. These are discussed in more detail below.
If you install both ntp-simple and ntpdate and you manually set up cron to
run ntpdate every hour then you will probably receive email every hour to
tell you that ntpdate can’t get the ntp socket (because the ntpd daemon
from ntp-simple is probably using it!):
Using NTP
The Network Time Protocol (NTP) daemon provided by the ntp-simple pack-
age is by far the easiest way to manage the accuracy of your clock, particularly
if you are connected to the internet (even if only intermittently).
After running ntpd for a little while your clock will be set to an accurate time
and will maintain an accurate time. However, if the amount of difference is
too great then ntpd will not modify the clock. After setting up ntp-simple
you can install ntpdate and on install (and reboot) the clock will be updated
to the correct time according to the server you have chosen for ntp-simple.
With ntp-simple installed on one of your hosts, Velox (Section 4.10.26) for
example, on the local network you can now use Velox (Section 4.10.26) as a
ntp server simply by installing ntp on each machine and pointing them to
Velox (Section 4.10.26) as the server.
217
ntpdate
If you only have irregular access to the Internet then ntpdate is useful. The
package provides the ntpdate command to query an NTP server and to
update your clock. You can do this manually as you see fit with:
$ ntpdate ntp.ktware.com
The advantage is that you will not have regular net transmissions as with
the NTP server. This could save you up to 4MB per day. This could also be
done as a cron job, for example.
For irregular access through a modem using PPP though, a good idea is to
create a script file in /etc/ppp/ip-up.d called ntpdate containing:
#!/bin/sh
Then each time you connect the local clock will be synchronised with the
NTP server.
17.0.3 chrony
For dialup connections the suggestion is to use the chrony package. This does
the same thing as ntp but works well with a dialup. The default installation
installs the necessary script and the default configuration works out of the
box (but you should change the default timeserver to one near you).
218 Clock: An Explanation
Using adjtimex
The adjtimex command can be used to counter systematic drift in the system
clock. It is tricky to fine tune, and it is recommended that you use ntp
instead if you can.
To set the system clock do:
Then monitor how the system (and hardware) clock varies over 24 hours.
The adjtimex command communicates with the kernel to change the number
of ticks in a day (default is 10000 which corresponds to about 8.64 seconds
per tick) and the frequency (default is 0) of the system clock. In Debian
you can use the command adjtimexconfig to automatically tune the tick
and frequency to match the accuracy of the hardware clock (assumed to be
accurate) and so that the change has effect on each boot. Alternatively,
override the automatic settings by editting /etc/adjtimex.conf.
INDY The system clock was losing (very) roughly 1 second per hour. (The
hardware clock seemed to lose nearly one second each day.) Not too much
on the face of it but considering the machine is rarely rebooted this can
become a significant drift. For this machine a tick of 10002 and a frequency
of 4000000 set the clock accurately:
# adjtimex --tick=9997
Velox (Section 4.10.26) The system clock was losing about 1 second every
hour (16 seconds in 24 hours). The hardware clock was very accurate as best
I could tell. I Installed adjtimex then:
# adjtimexconfig
219
This claims to adjust the ticks for the system clock against the hardware clock
which is assumed to be, and generally is, accurate. However, after 24 hours
the system clock was still about 5 seconds slow. I noticed the hwclock was
also a few seconds out after a weekend (fix that another time). I decided to
set the parameters myself by editting /etc/adjtimex.conf. Before I started
it contained:
TICK=10000
FREQ=1653461
At 2pm, 6 Jun (22 hours later) the clock was 9 seconds too fast. So let’s half
the freq and see where that gets us. Really need to set things back to base
(tick 10000 and freq 0) and do the actual calculations for the value.
The hwclock command provides the interface to the hardware clock. If you
are wanting to ensure the correct time then with a default Debian set up it
is recommended that you use ntp instead if you can. When you reboot the
system will save the current correct time to the hardware clock.
Anyhow, the --adjust option of the hwclock command checks information
stored in the configuration file /etc/adjtime and makes an actual correction
to the time stored in the hardware clock to account for the drift that it (the
220 Clock: An Explanation
hwclock utility) has been monitoring. (Each time you set the hardware clock
with the hwclock command the current time is compared to the previous
time it was corrected to determine the amount of drift.) Thus, when setting
the system clock from the hardware clock it is advisable to do the following:
# hwclock --adjust
# hwclock --hctosys
When updating the hardware clock from an accurate system clock do:
# hwclock --systohc
Chapter 18
Commercial
While the focus is on free systems in this book it would be unfair not to
include some great commercial software. Free open source software may not
always serve your needs. You have two options: implement (or pay someone
to implement) what you need yourself on top of the base already provided by
the open source software; or buy an off-the-shelf solution. The former will
give you plenty of kudos in the GNU/Linux world, but the latter might be
more practical.
Here we do not delve into the individual products, but rather catalogue what
is available.
221
222 Commercial
Configuration
/etc/debian\_version
Contains the debian version.
/etc/exports
This file contains information to tell NFS (Network File Systems) which
partitions are to be shared with other systems.
/etc/fstab
This file lists filesystems, possibly spread over multiple drives, partitions, and
remote hosts, that can be mounted. At boot time, partitions identifed as auto
mount will be auto mounted. Other convenient mount rules for CD-ROMS,
DVDs, Floppy drives, etc., are usually also included.
/etc/hosts.allow
This file, and its companion /etc/hosts.deny control access to your com-
puter. The file /etc/hosts.allow lists hosts that are allowed to access the
system. If empty then no restrictions apply. Similarly, /etc/hosts.deny is
a list of hosts that are not allowed to access the system.
/etc/inetd.conf
This file is the internet server configuration database and is used to identify
services like ftp and ssh which should be started. As a security measure it is
223
224 Configuration
All Unix systems have a mechanism for running certain applications regularly.
The mechanism is through a daemon called crond.
Debian uses cron in a very neat and stylised fashion. Scripts to be run
regularly are maintained in one of /etc/cron.daily/, /etc/cron.weekly/,
or /etc/cron.monthly/. The entries in /etc/crontab then simply run any
scripts in these directories on a regular basis. The daily scripts, by default,
are run at 6:25am each day. The weekly scripts are run each Sunday at
6:47am and the monthly scripts are run at 6:52am on the first day of each
month. The default /etc/crontab essentially contains just the following
lines:
The first line is read as: 25 minutes past 6am on every day of the month and
every month of the year and every day of the week as user root run the rest of
the line. The “rest of the line” tests to see whether anacron is installed and
if not runs the scripts found in /etc/cron.daily/. If anacron is installed
then it is used instead to ensure the scripts are run. The anacron package is
a replacement for cron that does not assume the local host is always powered
on (Unix and GNU/Linux systems rarely require rebooting and are happy to
remain powered on indefinitely) and will ensure the regular scripts still get
run appropriately when the local host is powered on.
If the default times for cron don’t suit (e.g., you like to work early in the
225
226 CRON: Regular Tasks
morning and get annoyed by the sudden disk whirling each morning at 6:25
am) then simply change the times in /etc/crontab. Unlike traditional ver-
sions of cron, the newer versions do not require the running of the crontab
command to install the new version when you edit /etc/crontab.
Chapter 21
You can create a CVS repository for yourself . Simply create a directory to
hold the repository then initialise it:
$ mkdir /home/kayon/cvs
$ cvs -d /home/kayon/cvs init
You can then create new projects within this repository with
227
228 CVS: Concurrent Versioning
You can check out projects from there with either of the following, the first
for local hosts (which mount the file system via NFS perhaps) and the second
for network hosts:
To create a new project consisting of all files in the current working directory
use:
No commit is required after an import. Note that the files and subdirectories
in the current directory will then be recognised as src/docs/spec. You can
now remove the directory and use CVS to create a new one for you, with the
new one now under CVS control:
cvs co src/docs/spec
This will create the whole directory hierarchy as well so be sure to be at the
root of the hierarchy where you want this new hierarchy to live.
To checkout a project from a remote host use:
This will use rsh (set CVS RSH to ssh to use ssh instead) to access the CVS
server and checkout the src/docs directory.
To check out a project and give it a different local name:
You mark files to be added to the CVS repository with, for example:
The files will be added to the repository when you next commit.
If you are adding binary files then you probably don’t want keyword ex-
pansion and you’ll want to let the repository know that they are binary files:
You can edit the files you have checked out. It is useful to regularly ensure
you are working on the latest copies by doing:
cvs update
This will update your copy of the files from the archive. Any updates made
to the archive by others will appear in your copy. If there are any conflicts
you will be warned about them and will need to find and resolve them in the
files updated. CVS will tell you of conflicts:
CVS will actually modify your file which ends up with both versions of the
conflict:
<<<<<<< main.py
def detect_outlier(limit, score)
=======
def detect_outlier(maximum, score)
>>>>>>> 1.43
230 CVS: Concurrent Versioning
Here I added a limit variable to the method whereas someone else added
maximum. I need to choose one or the other.
To add any new directories that have been added to the repository to your
local checked out copy, and to prune any directories that are empty from the
local checked out copy, use:
To see the differences between a file you are working on and the current
version in the archive use:
To remove a file from the repository first remove it from your directory then
use:
Once you are happy with your changes (and you’ve made sure the program
still works or the document is still printable) then it is time to update the
repository with all changes you have made. You need to give a short message
to describe briefly what has changed:
You can tag a collection of files in a repository so that you can later restore
all of the current versions of the files together. This is useful when you have
a stable release of your software. Tag all the files and then start breaking
the code again! To tag all files in the current directory and below simply:
21.2 Tuning
about the repository (so you won’t need the CVSROOT environment variable
or the -d option for any other cvs commands within this project).
It may be convenient (but not necessary) to have a default CVSROOT de-
fined in your /home/kayon/.bashrc:
export CVSROOT=/var/lib/cvs
Set the environment variable CVS RSH to ssh to use ssh instead:
*.glo
*.idx
*.toc
*.ilg
*.ind
*.pyc
*.log
*.aux
21.3 CVS for NT 233
*.out
*.pdf
*.cut
.thumbnails
tmp_*.png
Desktop
235
236 Desktop
Chapter 23
237
238 DIA: Charts and Diagrams
The main dia tools window allows you to create new canvases, select the
tools you wish to use, and set your preferences. The application preferences
are accessed through File→Preferences. Options include compression of saved
files, the default size of new canvases, and characteristics of the grid displayed
on the canvas (including its visibility and whether objects snap to the grid).
These choices take effect from the next canvas that is opened (but not for
currently opened canvases) and are saved in ~/.dia/diarc.
The first step in drawing is to start a new canvas with File→New Diagram.
You then select objects, lay them out on the canvas, add the lines to connect
the objects, and add relevant text.
The tools available on the main dia window fall into four distinct areas. The
Pointer and Standard Shapes generally occupy the top half of the window.
The Sheets area is next with an option menu that may be showing UML as
the currently selected sheet. Below this (in a scrollable window if required)
are the actual shapes provided by this sheet. The next area selects the pen
colour and type. Finally, line types are selected with the final row of buttons.
If you are unsure of the purpose or intent of a shape or button simply move
the mouse pointer to hover over the corresponding button and a tooltip will
remind you. Click the left mouse button on the tool button to activate the
tool.
Figure 23.1: The default new canvas ready for a new diagram. The right
mouse button clicked over the canvas contains a menu of all the operations.
Let’s put together a design for a Movies database that will store information
about movies and their stars. We have two entities in our database: Movies
and Stars. Entities are represented pictorially as rectangles containing text
that names the entity. To create the entity Movie click on the Entity button
of the ER sheet. Then move the mouse pointer to the canvas and click again
(with the left mouse button) to place a rectangle containing a default label
(Entity). You will now want to change the name of the entity to Movie. To
do this double click this entity with the left mouse button to bring up the
Object properties window. Now double click the word Entity that appears
in the Name: text field and type Movie. Click the Apply button and you will
see the entity name change on the canvas. You can click on OK or Close to
close the Object properties window if you wish.
Next we will create the attributes of this entity: a Movie has a Title, the Year
in which the movie was made, and the Length of the movie. The procedure
for creating attributes is the same as for all shapes. Select the Attribute tool
(the oval) from the ER sheet and click on the canvas where you would like to
240 DIA: Charts and Diagrams
place the Attribute. Double click this to edit the Object properties to change
the Name of the attribute to Title. This attribute is also going to be the
attribute by which we uniquely identify every movie in the database. This
is called Key, so select the Key checkbox. Click on the OK or Apply button
for this change to take effect.
Another diagram (Figure 23.3) uses UML shapes although it is not itself a
formal UML diagram.
Before we get into the details it is useful to review the dia command line op-
tions. Dia supports all of the usual Gnome, GTK+ and Session Management
options which are listed with the --help option. In addition dia has just a
single option, --export, abbreviated as -e. This will generate an exported
23.4 Reference: The Tools Windows 241
Figure 23.4: Sample diagram saved as a graphic and imported into this book.
graphic of the supplied dia diagram in one of the supported export formats.
The particular export format is determined from the supplied filename ex-
tension. Thus,
The top section of the main dia window contains the pointer and a collection
of standard shapes. The pointer (the top left icon with the arrow) allows you
to select objects on the dia canvas.
Next to the pointer are the zoom and scroll buttons. The zoom tool will
enlarge (zoom in on) the diagram each time you click the left mouse button
somewhere within the diagram. By holding down the Shift key when using
the zoom tool the diagram will be zoomed out. The scroll tool will scroll
the diagram when you hold the left mouse button down within the diagram.
This mimics moving the scroll bars. By holding down the Shift key when
242 DIA: Charts and Diagrams
using the scroll tool you can grab (as with a hand) the diagram and scroll
the diagram around in this way.
The fourth button selects the Create Text tool allowing text to be added to
your diagram.
The second collection of four buttons on the main window consist of the
standard shapes of a Box, Ellipse, Polygon, and a Beziergon.
The next group of five buttons are line drawing tools consisting of a Line,
Arc, Zigzagline, Polyline and Bezierline.
The final button allows you to import graphics from other applications.
Double click the left mouse button on the tool button to set the object
defaults for that object (not all objects have defaults). For example, double
clicking the Create Text tool button will bring up a window to set defaults for
the alignment of the text, the font, and the font size. The Box object defaults
include whether the background is drawn and how the corners are rounded.
The Ellipse, Polygon, and Beziergon object defaults allow for turning off of
the drawing of the background. The only other standard shape with object
defaults is the Image tool which can identify a default image file, whether
a resize of the image should keep the aspect ratio, and whether to show a
border around the image. Objects from the various sheets may also offer
object defaults.
All objects have handles that generally allow the object to be resized. The
usual handles are small boxes with a green fill. You can move these handles
by dragging them with the mouse. This will resize the object. If the handles
have a dark blue fill instead then the object can not be resized. This is typical
of boxes that resize automatically as you enter text into the box.
Lines have handles at each end that are also green (but also have a small
internal cross identifying it as a connection point—see below). Once again
you can resize the line simply by grabbing these handles with the left mouse
button and moving the handle around.
23.4 Reference: The Tools Windows 243
Some lines (e.g., a polyline) have internal handles that are coloured orange.
These handles have restricted movement and may also move as you move the
line end-points.
Most objects also have connection points that identify locations on the shape
to which lines can be snapped. (An Arc, for example, does not have any
connection points.) They are identified as the small blue crosses on the
edges of the objects. The handles on the end of lines also have crosses
identifying connection points. A line’s connection point becomes attached
to the connection point of an object, as indicated by the line’s green handle
becoming red. Moving the object will also move all of the attached lines.
The Line shape can have extra connection points added to it through the
middle mouse button menu. Each new connection point is added to evenly
space all of the connection points along the line.
23.4.4 Sheets
The next section of the main dia window begins with a choice of sheets (i.e.,
shape libraries). Many are included by default and new ones can be added
(see Section 23.7). Selecting one of the available sheets (by choosing from the
pull-down menu that is labelled UML for the Universal Modelling Language
in the above sample window) will display a collection of shapes associated
with the particular sheet. (The sample window includes the shapes useful
for drawing UML diagrams.) Some shapes, when selected and placed onto
the canvas, have text associated with them and will grow in size depending
on the text you type. An example is the Text box button.
Increasing the height of the main dia window will often allow you to see all
of the available shapes of any of the sheets at one time.
23.4.5 Pen
The lower section of the window contains the pen colour chooser.
23.4.6 Lines
The line thickness and line types. These affect the standard shapes rather
than shapes from the sheets. The smallest line width is 0pt (hairline).
244 DIA: Charts and Diagrams
A variety of lines are supported. You can add arrows to the lines by clicking
on the button at the bottom right (or bottom left for backwards pointing
arrows) of the Dia control window. Figure 23.5 shows the button before and
after selecting an arrow.
Figure 23.5: Selecting the arrow and line type for the various line drawing
tools. The first shows the default Dia window with undecorated lines (as
indicated by the bottom three buttons being straight lines). We have chosen
the straight line tool in the top half of the window. An arrow is added in
the second, a backward arrow with a hollow head in the third, and the line
is changed to a dotted line in the fourth.
The right mouse button anywhere on a canvas will bring up a diagram specific
menu. From here all of the operations are available, including those to save,
print and export the file, to cut and paste, to select various objects or regions,
to group objects and to layer objects, to operate on objects with various tools,
and to edit the object properties and layout.
The middle mouse button will bring up an object-specific menu. Double
clicking an object will bring up the properties editor for that object.
The File menu provides the usual New diagram, Open..., Save, and Save As
operations. Once again F3 (open) is the keyboard shortcut to open a dia-
23.5 Reference: The Right Mouse Button Menu 245
gram from a file and Ctl+S (save) is the shortcut to save a diagram to a
file.
Preferences
With the Preferences... menu item you set the various options allowed by dia
(this is the same as selecting File→Preferences from the main dia window.
These options affect new diagrams only, not currently open diagrams. To
change options like Snap To Grid for a currently open diagram, use the right
mouse button View menu.
The three categories of preferences for new dia diagrams are shown in Fig-
ure 23.6.
Under the User Interface the first option indicates whether the tools in the
main window are reset to their defaults after creating a new canvas. The
native dia save format uses XML which can be quite verbose. As with many
Gnome applications it is common to compress the saved document (using the
gzip format) and you can control this behaviour here. dia supports only a
limited number of undo levels which can also be set here. Finally, reverse
dragging, when enabled here, allows you to drag-select from the right to
the left (unlike normal dragging which usually goes left to right) to have a
different effect. It selects all objects that intersects the dragged rectangle
rather than just those that are fully contained in the dragged rectangle.
View Defaults controls the size and initial magnification of the new window
when you create a new canvas. You can also control whether the connection
points (the blue crosses) are visible.
246 DIA: Charts and Diagrams
Grid Lines can be turned on and off. Objects can be made to snap to the
grid (i.e., when you place or move objects they will move automatically to
the nearest grid when placed). The size of the grid (both along the x and
y axes) can be changed as can the colour and style of the grid lines. Page
borders can be displayed on the grid using different colours and line styles.
Export
\include{diagram}
23.5 Reference: The Right Mouse Button Menu 247
Depending on the version of LATEX and PStricks you are using, you may need
to uncomment some macro definitions in the diagram file. If LATEX gives you
the error something like:
You will need to remove the initial percent sign (LATEX’s comment command)
from the definitions in diagram.tex and it is best to rename the newcommand
to providecommand in all three cases (to avoid problems when including more
than a single diagram in the one LATEX document:
\newcommand{\setlinejoinmode}[1]{}
\newcommand{\setlinecaps}[1]{}
\newcommand{\setfont}[2]{}
Printing
When dia is compiled it will be compiled with either internal print support
or support through the Gnome printing library. An alternative to printing is
to export the diagram as PostScript which can then be printed.
You can scale the diagram to fit the page when printing through the use of
the File→Page Setup... menu. Here you can also set up the size of the page,
orientation, and the page margins.
Quitting
The usual Close and Exit items are part of the File menu with their common
keyboard shortcuts of Ctl+W (close) and Ctl+Q (quit) respectively. Close
will close the current document while Exit will exit from dia completely.
The Edit menu allows you to Copy, Cut, Paste and Delete objects with the
common keyboard shortcuts of Ctl+C (copy), Ctl+X (cut), Ctl+V (paste),
248 DIA: Charts and Diagrams
and Ctl+D (delete), respectively. Edit operations can be undone and re-
done. The number of undo levels is controlled by an option in File→Preferences
as we saw in Section 23.5.1. The default is 15. That is, you can recover from
the last 15 actions!
The View menu affects how you view the diagram. Zoom In enlarges the
viewed diagram and Zoom Out contracts the viewed diagram. Particular
scales can be chosen with the Zoom submenu. The Diagram Properties. . .
menu allows the background colour to be changed and the grid characteristics
(spacing and visibility) to be modified. These changes affect the current
diagram only and are saved with the diagram.
Various features can be turned on or off with the following option items.
New View pops up a new canvas showing the same objects. Editing any
object in any of the views will affect that object in all of the views.
Show All zooms the diagram to fill the viewable area of the canvas.
The Select menu provides shortcuts for selecting objects. All objects can be
selected or None. Those currently not selected can be selected in place of
those that are selected (Invert). For any selected objects you can cause those
objects directly connected to them to also be selected (Connected). Doing
this repetitively results in all connected objects being selected, which is the
same as selecting Transitive. Finally, you can select all objects that are of the
same type as the currently selected object.
Selecting same type actually works even if objects of different types are se-
lected.
The following five check buttons modify how new objects are selected. Usu-
ally a new selection replaces the old selection as the final set of selected ob-
jects. With Union the final set of selected objects consists of the previously
selected object plus the newly selected objects. Intersection results in those
object that were previously selected and now selected again to be in the final
selection, but no others. Remove removes from the old set of selected objects
23.5 Reference: The Right Mouse Button Menu 249
those that are newly selected. And Invert causes those objects newly selected
to have their state of selection inverted—that is, those previously selected
and now newly selected be no longer be selected, and those not previously
selected but included in the new selection will become selected.
The Objects menu allows you to layer objects and to group and align objects.
Objects can be selected individually with the left mouse button by clicking
on the object. This allows a single object to be selected at a time. To select
multiple objects you can hold down the Shift key while you click the left
mouse button. Selecting with the left mouse button actually toggles the
selected state of the object. You can also select a group of objects simply
by dragging the left mouse button (hold the left mouse button down and
move the mouse around) on the canvas to define a rectangular area. When
you release the left mouse button all objects in the rectangular region will
be selected. Of course, you can also use the Select menu described above to
select objects.
Once you have objects selected the menu items in the Objects menu become
available. Send to Back and Bring to Front have the obvious meaning. Fig-
ure 23.7 shows the effect of selecting a Text object which is on top of a Box
object and sending it to the back. The Box object ends up occluding the
Text object.
The Tools menu simply provides menu access to all of the tools located on the
upper area of the main window. You will find the pointer (Modify), Magnify,
and Scroll tools. Remember, Shift with Magnify or Scroll changes their be-
haviour. See Section 23.4.1 for details. Next comes the four standard shapes
(Box, Ellipse, Polygon, and Beziergon) followed by the five lines (Line, Arc,
Zigzagline, Polyline, and Bezierline). Finally Image objects can be selected.
There is a significant reason for repeating the Tools here: keyboard shortcuts
can be easily assigned to each of the tools through this menu. Simply move
the mouse to highlight one of the menu items and type the keystrokes you
which to associate with that tool (e.g., Ctl+Alt+E for the Ellipse). The
shortcut should appear on the menu.
The Dialogs menu allows the Properties of the selected object to be modified
(if it has modifiable properties). For shape objects you can, for example,
select line width, colour, and style and a fill colour. The fill can be made
transparent (by specifying that the background should not be drawn).
You can also edit the Layers.
We describe some of the sheets that are supplied with dia. For each we
list the collection of shapes (objects) provided and give an example diagram
made from the shapes. The specification of each sheet is an XML document
usually located in /usr/share/dia/sheets/.
23.6.1 Chronogram
The Chronogram sheet contains just two shapes, but with functionality that
allows a considerable variety. XXXX Check samples/chronograms.dia for a
trailer and require a lot of explanations to be usable.
23.6 Reference: Sample Sheets 251
23.6.2 Circuit
The Circuit sheet contains shapes useful for drawing electrical and electronic
circuit diagrams. The sheet includes, in order, a Vertical Resistor, Horizontal
Inductor, Vertical Inductor, and a Horizontal Resistor as the first row with
their European counterparts as the second row. Then Horizontal and Ver-
tical Capacitors, npn and pnp Bipolar Transistors, Horizontal and Vertical
Diodes and Zener Diodes, Ground Point, Operational Amplifier, Horizontal
and Vertical Fuses and Power Sources, Lamp, Speaker, Horizontal and Ver-
tical LEDs, NMOS and PMOS Transistors, and a Horizontal Jumper. All
objects have object defaults accessible by double clicking the left mouse but-
ton on the corresponding object within the sheet. In general you can set the
default text padding, alignment, font, and font size for each object.
23.6.3 ER
23.6.4 Flowchart
The Flowchart sheet provides the diagram elements usually associated with
drawing flowcharts of all types. All elements allow text to be included and
the object properties can be used to set the fonts and for boxes to set the
corner rounding. The elements supplied are a Box, Parallelogram, Diamond,
Ellipse, Display, Transaction File, Off Page Connector, Document, Manual
Operation, Preparation, Manual Input, Predefined Process, Terminal, Mag-
netic Disk, Magnetic Drum, Magnetic Tape, Internal Storage, Merge, Ex-
tract, Delay, Summing Junction, Collate, Sort, Or, Punched Card, Punched
Tape, Transmittal Tape, and Offline Storage.
23.6.5 FS
The FS sheet provides support for Function Structure Diagrams. There are
three shapes: A Flow, an Orthogonal Polyline Flow, and a Function.
252 DIA: Charts and Diagrams
The Flows have object defaults where default labels (text) and flow types
can be identified. These can also be changed by double clicking a Flow or
Orthogonal Polyline Flow object on your canvas. The different flow types
(Energy, Material, and Signal) change the properties (colour and type) of the
line. The text label can be grabbed by the mouse and moved around.
The Function object is a box with a text label. It has object properties
with which the Function can be identified as a Wish Function and/or a User
Function. A Wish Function has a dotted box and a User Function has a
double box.
Figure 23.8: A sample of the Function Structure (FS) Diagram sheet objects.
This is not a true function structure diagram, but does illustrate the variety
of shapes.
23.6.6 GRAFCET
23.6.7 Ladder
23.6.8 Networks
Network diagrams include local area networks (LANs) and wide area net-
works (WANs). The Network sheet provides a collection of shapes often used
in network diagrams. The sheet includes, in order, a Computer, Monitor,
Storage, Ethernet Bus, Printer, WAN Connection, Hub, Modular Switch,
RJ45 Wall-Plug, scEAD Wall-Plug, Modem, Antenna (for wireless transmis-
sion), Network Cloud, Router Symbol, Switch Symbol, and an ATM Switch
Symbol.
23.6.9 Pneumatic/Hydraulic
23.6.10 SADT
SADT stands for Structured Analysis and Design Technique which is a trade-
marked and copyrighted by Softech Inc. A SADT model is a collection of
diagrams organised in a tree structure. Each SADT diagram is composed
of Boxes (representing activities) connected by Flows (arrows) representing
flows of materials, data or information.
The SADT sheet provides the three basic components required for drawing
SADT diagrams: Activity/Data Flow, Activity/Data box, and Flow Anno-
tation. The activity/data flow can be one of several styles, including Normal,
Import Resource, Imply Resource, Dotted Arrow, or with Disabled Arrows.
The default is Normal but can be changed in the Object Defaults window
(double click the Activity/Data Flow button).
254 DIA: Charts and Diagrams
Flows have different roles in relation to the activities. The middle mouse
button (or control right click on Windows) is used to add or remove segments.
23.6.11 Sybase
The Sybase sheet provides various objects for the design of Sybase replication
domain diagrams. The sheet includes a Dataserver, Replication Server, Log
Transfer Manager or Rep Agent, Stable Storage Device, Client Application,
and a Replication Server Manager.
23.7 Walkthrough: Creating Your Own Shapes 255
23.6.12 UML
Support for the Universal Modelling Language (UML) includes all of the
static structure diagram elements specified in the UML specifications. The
sheet includes, in order, a Class, Template Class, Note, Dependency, Real-
ization (implements a specific interface), Generalisation (class inheritance),
Association, Aggregation (one class is part of another), Implements (class
implements a specific interface), Constraint, Small Package, Large Package,
Actor, Usecase, Lifeline, Object, Message, Component, Node, Class Stereo-
type Icon, State Machine, and a Branch.
You can create your own shapes and include them in your own sheet simply
be defining the shapes in XML (using a subset of SVG, the scalable vector
graphics format based on XML). Installing a new shape is simply a matter
of installing it into ~/.dia/shapes.
A shape consists of at least a name and a SVG element. That is, every shape,
at a minimum, has a name and a description:
<?xml version="1.0"?>
<shape xmlns="http://www.daa.com.au/~james/dia-shape-ns"
xmlns:svg="http://www.w3.org/TR/2000/03/WD-SVG-
20000303/DTD/svg-20000303-stylable.dtd">
<name>Sample - Minimal Shape</name>
<svg:svg width="10" height="10">
<svg:polygon points="0,0 10,0 5,10"/>
</svg:svg>
</shape>
You can place this in a subdirectory of your own dia shapes directory, perhaps
called Sample as in ~/.dia/shapes/Sample/minimal.shape. The actual
filename in which the shape is stored (minimal.shape) is not so important—
dia will find the file.
256 DIA: Charts and Diagrams
Now you need to create a sheet into which this shape is placed. Again, a
sheet is specified using XML. This example is placed in the file ~/.dia/
sheets/Sample.sheet:
<sheet xmlns="http://www.lysator.liu.se/~alla/dia/dia-sheet-ns">
<name>Sample</name>
<description>A collection of sample shapes.</description>
<contents>
<object name="Sample - Minimal Shape">
<description>The most minimal of shapes</description>
</object>
</contents>
</sheet>
Now start up dia and you should see this new sheet, called Sample, containing
a single button with a default icon.
You can now create a new canvas and add this shape to your canvas. Note
that dia takes care of the resizing of the shape and the other characteristics.
The XML describing the shape begins with the usual xml meta element
followed the actual shape element, identifying the appropriate XML names-
paces (xmlns). The shape has a unique name used to identify the shape by
dia. Next we have the actual SVG description of the shape which is 10 by
10 in size (actually these are ignored by dia but are required by the SVG
format), and consisting of a single polygon. The shape is a simple triangle (a
polygon with three points) pointing downwards. The polygon is drawn from
the top left corner (0,0) to the top right (10,0) then to the bottom middle
(5,10) and then back to the top left to finish off the polygon.
The XML for the sheet then identifies this shape as belonging to the Sample
sheet, which contains just one object, the Sample - Minimal Shape shape. The
description for the object is used as the tooltip for the resulting button.
An icon can be associated with the shape through the icon element. An
example is:
23.7 Walkthrough: Creating Your Own Shapes 257
<icon>minimal.xpm</icon>
which comes after the name element. The specified X pixmap file is used
as the icon in the dia toolbox. The filename can be relative to the shape
file (e.g., icons/minimal.xpm or ../icons/minimal.xpm). When no icon is
specified a default icon is used.
Connection points can be added to the shape with the connections element
which allows any number of point elements. For example you can add two
connection points to the above Minimal Shape by inserting the following after
the icon element (or after the name element if there is no icon element):
<connections>
<point x="5" y="0"/>
<point x="5" y="10"/>
</connections>
This adds a connection point to the top and another to the bottom of the
triangle. The coordinate system used for connection points is the same as
for the shape itself.
Next an aspectratio element can be specified to indicate how the shape is
to be distorted. The default is as if the following was specified:
<aspectratio type="free"/>
This indicates that there is no restriction on the aspect ratio (i.e., you can
stretch the shape arbitrarily in the X and Y directions independently). A
fixed aspect ratio requires Y to change in the same proportion as X, and
vice versa. A range can be specified, with two attributes, min and max,
identifying a range of allowable amounts of distortion. For example,
A textbox element can appear next. This is used to provide a box that
automatically adjusts the size of the shape to fit the supplied text. The
location of the text box is specified using the same coordinate system:
From SVG the supported elements are: line, polyline, polygon, rect, circle,
ellipse, path and g. For the path element only the M, m, L, l, H, h, V,
v, C, c, S, s, Z, and z commands are supported. User units are supported
but not CSS units (only a limited set of the CSS attributes are supported).
Transformations are not supported.
Sheets are often distributed as compressed tar files (having the filename ex-
tension of .tar.gz). To install the sheet (assuming the tar file has been
created properly) open the tar file in the Gnome archive tool (guitar). Select
all files in the archive (Ctl+A or Archive→Select all) then click the Extract
button. You will be asked where to extract the files to—choose the .dia
folder in your home directory.
Next time you start up dia the new sheet will be available.
23.9 Acknowledgements
Debian can install files almost anywhere within the filesystem, except for
/usr/local. The Debian Policy Manual and the FSB (Filesystem Base)
definition provide guidelines on what goes where.
• /usr/local contains programs and data files that have been added
locally to the system, independently of the particular GNU/Linux dis-
tribution. These are intended to be kept separate from the main system
directories that are managed by the distribution.
261
262 Directories: Linux Folders
• /var contains administrative files (such as system logs) and data that
changes frequently (such as spool directories and caches like incoming
mail and news).
Other file managers for GNU/Linux are also available, including the KDE
offering, Konqueror, and the Midnight Commander which has a long history
and provides both a Gnome interface and a terminal interface (for those not
into GUIs).
Chapter 25
Disks
# tune2fs -j /dev/hda1
263
264 Disks
hard disk parameters could be set and with hwtools we could ensure the
parameters were set on each reboot. See Section 4.10.16 for an example.
To test your current performance (this one shows results after tuning):
/dev/hda:
Timing buffer-cache reads: 128 MB in 0.56 seconds =228.57 MB/sec
Timing buffered disk reads: 64 MB in 1.60 seconds = 40.00 MB/sec
/dev/hdg:
Timing buffer-cache reads: 128 MB in 0.55 seconds =232.73 MB/sec
Timing buffered disk reads: 64 MB in 49.39 seconds = 1.30 MB/sec
# hdparm /dev/hda
/dev/hda:
multcount = 0 (off)
I/O support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 116301/16/63, sectors = 117231408, start = 0
busstate = 1 (on)
# hdparm -i /dev/hda
/dev/hda:
Be careful though as some settings may cause the disk to stop responding!
This may require a hard reboot after which the default settings are returned.
For example, on Bach an additional IDE controller (a CMD680 from Silicon
Image) with 2 ST360021A disks, identical to the disk on the PIIX4 IDE
controller, but setting the parameter -d1 hangs the shell on a test with -Tt.
Also see http://linux.oreillynet.com/pub/a/linux/2000/06/29/hdparm.html
for further introductory explanations.
266 Disks
Chapter 26
Documentation
Debian has a central utility to view all locally installed documentation, called
doc-central. Other Debian packages for browsing Debian documentation in-
clude dwww and dhelp. The newer doc-central has several improvements over
the previous tools, with an improved interface and requiring no further effort
than installing the doc-base package.
Doc-Central is a collection of scripts that give you a convenient way to browse
the documentation installed on your Debian system.
Doc-Central uses a local http server (like apache) to present a list of all regis-
tered documents. Depending on the type of document other tools are used to
view the document: for info files we use info2www. All other types are cur-
rently linked to directly. To get the list of installed documentation the doc-
base registration entries as used. For more information on doc-base please
267
268 Documentation
Suppose your local machine is called misty. In /etc/hosts you will see:
misty
269
270 Email
This will ensure all outgoing mail appears to come from user@ktware.com.
Local mail is delivered locally without leaving rose. All incoming mail is
collected by fetchmail, detected by Exim and delivered.
27.1.1 Exim
The default email server for Debian is exim. This can be set up in one
of several ways, depending on how you will access your email. The exim
configurator will list the options. The newer exim4 will become the default
at some time and its configuration is somewhat simpler. To configure it:
The fetchmail package will retrieve email from remote hosts (via POP or
IMAP, for example) and have it delivered locally.
The following scenario for user kayon with the following .fetchmailrc will
use ssh to tunnel to POP to avoid sending clear text passwords, and to also
encrypt all the communications.
This gives user kayon access from their desktop Linux machine to the host
lynx (Section ??) which might be inside the company firewall and which has
access to the mail server imaphost (Section ??). Kayon’s email comes from
an MS Exchange server (called imaphost (Section ??)) on the same company
network with IMAP enabled. But for security reasons the company network
does not allow IMAP access externally.
Then start fetchmail with one of the following:
> fetchmail
> fetchmail -v (Show what it does)
> fetchmail -d30 (Run fetchmail every 30 seconds)
The -N indicates that no command should be run on the remote host, which
is suited to tunnelling where the connection is required to simply sit there.
This will link localhost:5143 to mailhost:143. You can confirm connection by
trying:
Trying 127.0.0.1...
Connected to localhost.
Escape character is ’^]’.
* OK Microsoft Exchange IMAP4rev1 server version 5.5.2655.37
(saab-bt.ktware.com) ready
A sample .procmailrc:
# DEBIAN
:0:
* ^Resent-Sender.*debian-devel-request@lists.debian.org
lists/debian-devel
:0:
* ^Resent-Sender.*debian-user-request@lists.debian.org
lists/debian-user
The :0 begins a recipe. The following : ensures the mail file is locked. A line
beginning with * begins a condition. You can have multiple conditions within
a recipe. The condition ^Resent-Sender.*debian-devel-request@lists.debian.org
captures email sent to the debian-devel mailing list. This matches messages
that include Resent-Sender: debian-devel-request@lists.debian.org
in their header. The final line of a recipe is the mailbox into which procmail
will send the mail.
27.2 Retrieving and Filtering Email 273
You can manually interact with a POP server to perhaps manually delete an
email that your mail too is having trouble downloading, or simply to check
things out. Here’s a sample manual session:
...
.
DELE 1
+OK Deleted.
QUIT
+OK Bye-bye.
Connection closed by foreign host.
27.3.1 Mutt
27.3.2 Gnus
Grepmail searches mailboxes to build a new mailbox with all emails contain-
ing the results, so that they can be reviewed with your favourite mail tool.
The default is to search for the pattern in both the head and body of the
email. Only email headers are searched if you specify -h; search is restricted
to email bodies with -b. To be case insensitive use -i and to ignore MIME-
encoded blocks use -M. Date searches are effected with -d which allows a date
string in a variety of formats, including -d yesterday, -d "5/18/2001" for
email since 18 May 2001.
The basic use is:
So, for example, you might search for the email containing that meeting:
$ uuencode message.uu
You may want to do this in a temporary directory to deal with the potential
of uuencode overwritting pre-existing files.
27.5 Spam
spamassassin -e
Now tell evolution to filter you email with this script. So, create a new
filter with Tools→Filter and click on Add. Call the new filter something
like ‘SpamAssassin’. Select ‘Pipe Message to Shell Command’ as the first
part of the criteria. Then fill in /home/kayon/bin/spam-filter.sh as the
command to run. Set ‘Does Not Return’ and ‘0’ for the other fields. For
the action choose a folder into which the identified spam should be placed
(rather than deleting it, just in case spamassassin gets it wrong). Click OK
to close the filter and then OK to close the filter editor. You are now done!
27.6 Viruses
:0fw
| clamfilter.pl
:0:
* ^X-Virus-Found: yes
clam-‘date +%Y-%m‘
You can talk directly to an SMTP server, for example to test that it actually
works for you. Here’s a sample interaction.
The Eye of Gnome is an image viewing and cataloging program. It can deal
with large images, and zoom and scroll while keeping memory usage constant.
You can drag a collection of filenames into a window and EOG will open
each of them.
279
280 Eye of Gnome: Image Viewer
Chapter 29
281
282 Evolution: GNU Personal Information Manager
Figure 29.1: The Evolution Welcome Screen showing some email from the
Evolution development team at Helix Code.
File Systems
The default GNU/Linux file system (which defines how data is stored on
a storage device like a hard disk) is call the ext2fs. Ext2fs is an inode
(information node) based filesystem. Inode based file systems store pertinent
file data in inodes. Such file systems have been around since the early days
of Unix. Other inode-based file systems include XFS and BSD’s UFS.
Ext3fs extends ext2fs with journaling. Thus, when you reboot without prop-
erly shutting down the machine, for example, no more messages about non
clean un-mounts of the file system.
ReiserFS is a very different file system based on fast-balanced trees. It was
proposed by Hans Reiser who took the theoretical concept of AVL-trees to
the task of a filesystem.
283
284 File Systems
Chapter 31
Firewalls
31.1 IPMASQ
31.2 IPCHAINS
With a update to the klogd package (or perhaps it was an update to the
netbase package which contains ipchains, I started getting the following log
285
286 Firewalls
With the following ipchains command the log messages are stopped:
# /etc/init.d/ipchains save
which places the saved rules into /etc/ipchains.save. Load them in again
with:
# /etc/init.d/ipchains load
KLOGD=""
to
KLOGD="-c 5"
The messages are now gone from the console, but still remain in dmesg and
/var/log/syslog. Indeed, /var/log/syslog gets filled with these so it still
may be best to turn them off with the ipchains rule.
288 Firewalls
Chapter 32
Floppy Disks
The floppy disk device (i.e., the code that knows how to deal with the floppy
disk drive) is usually /dev/fd0. Under MS-Windows this would be referred
to as drive a:.
In this chapter we cover topics relating to using floppy disks on a GNU/Linux
system.
In some installations users might not, by default, have access to the floppy
drive. Generally the floppy device (/dev/fd0) belongs to group floppy and
the administrator may need to add a user to this group to grant them access.
This can be done simply with the Gnome interface from Applications→System
Tools→Users and Groups. Refer to Chapter 42 for details on managing groups.
Alternatively, from the command line the following has the same effect:
The Gnome tool to format a floppy disk is gfloppy, as shown in Figure 32.1.
This can be accessed from Applications→System Tools→Floppy Formatter.
289
290 Floppy Disks
From the command line there are several options. You can format the floppy
with:
$ superformat /dev/fd0
$ fdformat /dev/fd0
will also format a floppy, but does not create an file system. A file system can
be created with mkdosfs. You could put, instead of a MS-DOS file system
on the floppy, a Linux file system with:
This user, guest, can then use the mtools commands to access the floppy
disk. These are tools that mimic the Microsoft DOS commands: mdir, mcd,
mcopy, mdel.
Edit /etc/fstab to add the following line to allow any user to mount /mnt/
floppy which is particularly convenient from the Gnome mount applets which
32.4 Mounting Floppy Disk Device 291
you can click on to cause a mount or unmount. Or create symbolic links for
Gnome from your ~/.gnome-desktop directory to /floppy. Then Gnome
seems to magically do the mounting for you when you open them (they
will appear on your Gnome desktop and you can change the icons to more
appropriate symbols such as a floppy). I guess you better make sure you
unmount the floppy before you physically remove the media.
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
$ xset fp rehash
FontPath "/usr/lib/X11/fonts/Type1"
293
294 Fonts: X Window System
FontPath "/usr/lib/X11/fonts/100dpi:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi:unscaled"
Now that it’s all setup, install some font packages. ttf-bitstream-vera
is a rather nice set of fonts, and is Free
(http://www.debian.org/intro/free) enough to go into Debian itself.
It’s not in woody yet, but you can download the .deb from
http://http.us.debian.org/debian/pool/main/t/ttf-bitstream-vera/ttf-bitstream-vera_
(or your local mirror) and install it with "dpkg -i
ttf-bitstream-vera_1.10-3_all.deb" (as root). sid and sarge users are
just an "apt-get install ttf-bitstream-vera" away from it. Another
option is ttf-freefont, which is in all three current versions of
Debian.
For Japanese and other non-roman languages, you might want to try these
fonts: tfm-arphic-bsmi00lp, tfm-arphic-bkai00mp, tfm-arphic-gbsn00lp,
tfm-arphic-gkai00mp, hbf-jfs56, hbf-cns40-b5, hbf-kanji48, ttf-baekmuk
and ttf-thryomanes.
Both of these packages (and the other ttf-* packages in Debian) should
now Just Work, and appear available to all X programs that use the
regular "core" font system. This includes things like xterm, emacs and
most other non-KDE and non-GNOME applications.
For KDE2.2 and GNOME1.4 (with libgdkxft0, which is a hack to get GTK
33.2 Fonts are too Large 295
dir "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
before the other dir lines. I don’t have any xft1 stuff on my machine
anymore, so I’m not sure if you need to restart X or not before this
change will take effect. I seem to remember that "xftcache" would
update the Xft1 cache, but it’d be good if someone could confirm that
for me.
Now, for fontconfig, which does *not* exist in woody. You shouldn’t
need to install anything extra for this, since all the packages using
fontconfig will Depend on it (indirectly) already. First, look in
/etc/fonts/fonts.conf. There should be a line like the one below. If
not, open up /etc/fonts/local.conf and add this
<dir>/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType</dir>
Depending on your setup you might find that the default fonts used by the
X Window System are too big. Generally, the default setup is good for
1024x768 resolution but on laptops and older hardware that only support
800x600, for example, it is best to use smaller fonts. To achieve this simply
edit your /etc/X11/XF86Config file so taht the 75dpi (dots per inch) fonts
come before the 100dpi fonts. A snippet from a typical installation is:
Section "Files"
296 Fonts: X Window System
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "/usr/X11R6/lib/X11/fonts/local/"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/lib/ghostscript/fonts/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/freefont/"
FontPath "/usr/X11R6/lib/X11/fonts/sharefont/"
EndSection
Chapter 34
297
298 Ghemical: Chemical Modelling
The GNU Image Manipulation Program (the GIMP) is the open source im-
age and photo manipulator which gives Adobe’s very popular and powerful
Photoshop a serious run for its money. GIMP is a very powerful tool for
editing images and creating impressive graphics. It is one of the highlights of
all open source software, and demonstrates the quality that can be achieved
through open source development.
This chapter provides a number of recipes for some common tasks using the
GIMP. Many excellent books that unleash the full power of the GIMP are
available and some are mentioned in Section 35.3.
Use the lasso selection tool to select the red eye region (zoom in first). Then
bring up the Channels dialogue and de-select Green and Blue. Then from
the menus choose Desaturate a few times. That should fix it.
Image resolution (dots per inch or just dpi) is an indication of the quality
of an image. It is less important for screen images but more so for print-
299
300 GIMP: Image and Photo Manipulation
ing. Common image resolutions include 72, 120, 300 and 600 dpi (dots per
inch). When producing graphics for web pages or for viewing on the screen
then 72dpi is generally the more popular resolution (and keep the images to
less than about 30K). For scanning and printing, 400dpi is a good quality
resolution.
For printing 100dpi is generally exactly 100 dots per inch. On screen however
this is not always so, as it depends on the resolution of the monitor (so a 72
pixel wide image on a 17” monitor at 640x480 might come out at about an
inch but at 1280x1024 it will be half the size, and so about 144dpi).
When scanning or printing dpi is something that becomes important.
For images meant for display on a screen, as in web design it is the pixel di-
mension that is more important. Consider two images that are both 100x100
pixels, but one is say 100dpi and the another is 300dpi. They will be exactly
the same size on your monitor but when printed the first image will be 3
times larger then the second.
The GIF format doesn’t store any dpi information—only the pixel dimensions
so when the GIMP saves to GIF you “lose” your printer settings! When
opening a GIF the resolution will be set to 72dpi.
When designing for screen display of images consider what monitor size will
you want to design for (640x480, 800x600, 1024x768, etc). Then ensure your
final image is not any larger then your screen. You will also need to take into
account that the actual area of your browser is smaller then the screen and
so you should keep images as small as possible.
303
304 Glade: GUI Builder
Start Glade from the Programs→Development menu of the Gnome desktop (or
else use Ctl+F2 and then type in glade to start the application). You will
see three new windows popup. These constitute the Glade interface.
The left most window above is the main Glade window which will list the
windows and dialogs of your own project. Currently it is empty. The mid-
dle window is the Palette window from where you choose the user interface
widgets to include in your interface. The right window is the Properties
window where you can edit the properties of each widget such as it’s size,
behaviour, and signals it responds to. There are two other Glade windows
not shown but which can be displayed by selecting them from the main win-
dow’s View→Show Widget Tree and View→Show Clipboard menus. We will
see them later.
306 Glade: GUI Builder
Project Options
The remaining options we won’t change either. Again they are generally
good choices. Note in particular though that we have the Enable Gnome
Support option turned on. You can take a look at the other two option tabs,
C Options and LibGlade Options, to get an idea of what else you can configure
(see the Reference sections later for details). When satisfied simply click the
OK button. The main Glade window’s title will have changed to be ‘Gwords,’
the name of our application, replacing the previous ‘<untitled>.’
Now we are ready to start building our Gnome interface. We first need to cre-
ate our main Gnome Application Window which will be the window displayed
when our application starts up. Select the Gnome button of the Palette win-
dow to display in the palette the Gnome widgets (which are extensions to the
GTK+ Basic widgets which are displayed by default). Identify the Gnome
Application Window widget by hovering the mouse over the various widgets
to display their tool tips. It is the top left widget in the palette. Simply click
on it with the left mouse button to create one.
There are many other widgets available on this Gnome palette. They include
36.2 Glade Walkthroughs 307
dialog boxes, message boxes, a standard Gnome About Dialog, file entry field
with a browse button, a pixmap entry field with built-in preview, and a druid.
We’ll see some of these later and all of them in the reference sections. For
now we simply create the Gnome Application Window.
You will be presented with a new win-
dow that has many of the characteristics
of a Gnome application window. There
is the menu bar along the top with the
usual File, Edit, View, Settings, and Help
menus, most including standard menu
items within them. This is followed by
the default toolbar with the New, Open,
and Save buttons. Below this is the can-
vas area where you will construct your in-
terface. At the bottom is the status bar
and a progress monitor. Note that not all
menus and toolbar buttons will be useful for your application and you will
have others in mind that you may wish to add. Feel free to click around the
window and see the menus by clicking the menu twice—once to select the
menu itself then once to open up the menu to show it’s sub-items. Also note
how widgets are identified in the Properties window as you select the widgets.
Adding Widgets
For now let’s ignore the excess of decoration. Instead we will build the
basic interface components. There’s not much that we need in the interface.
Certainly we need to identify the file to be word counted. Also we want to
identify whether to just count the words or also the lines and bytes.
We go back to the GTK+ Basic palette for one of the layout widgets. These
are towards the bottom of the palette—third row from the bottom in fact.
Hover the mouse over each of them to find the Horizontal Box, Vertical Box,
Table, and Fixed Positions. Click on the Vertical Box layout. Now on the
central canvas area of your Gwords interface click the left mouse button. You
will be asked for the number of rows for your box—the default of 3 will do
for now so just click on the OK button. Your canvas will be divided into 3
rows. Each one of the 3 rows can now be constructed independently—each
can contain a different widget, including further layout widgets.
We will use the first row to identify the name of the file whose contents we
308 Glade: GUI Builder
will be counting. We will use a file entry box to allow for the entry of the
filename. We will also add a label so that we know what the file entry box
is for. That means two widgets and all we have is a single row—so we need
to add a Horizontal Box with two columns. Find the Horizontal Box on the
GTK+ Basic palette, click it with the left mouse button and then click in the
top row of the three rows of our canvas. When prompted select just 2 (rather
than the default 3) columns for this Horizontal Box.
Labels should probably go to the left of the entry
box so we will place the label first. Select the
Label widget from the GTK+ Basic palette—the
first item on the second row. Now click in the
top left box of our canvas (this is the left most of
the two cells we have just created). A GtkLabel
widget should now appear with the label label1
(and some resizing of the cell might occur). This
is now our first “real” widget. Of course we don’t
want the label to read label1 (even though we
might leave it’s name—as distinct from it’s label
text—as label1 for now). We can change the la-
bel text through the Properties window where you
will find the fields relevant to this widget (assum-
ing it is still the selected widget). Change the Label field to be ‘File:’ (re-
placing label1). For good measure set the X Pad field to be 10 (so that the
widgets won’t look so cramped). You will see the effect of these immediately.
To summarise so far. A basic Gnome Application
Window has been created with the default menu
bar and toolbar and a Gnome Application Bar at
the bottom. We have added a 3 row Vertical Box
and in the top row of this a 2 column Horizontal
Box. In the resulting top left cell we have added a
Label widget and changed the text to be ‘File:.’
It also has it’s X Padding set to 10 to give a less
cramped layout.
Removing Widgets
You can remove widgets easily through the menu on the right mouse button.
First click on a widget with the left mouse button to select it. The right
mouse button will then list the actions you can perform on this widget,
36.2 Glade Walkthroughs 309
including cut and delete. Note also the list of “parent” widgets all the way
up to the root widget which is called app1. Before proceeding let’s explore
this widget pathway in a little more detail.
We can see the Widget Tree window expanded above. Thus, app1 contains
dock1 which is made up of three sub-components: dockitem1 contains the
menu bar; dockitem2 contains the toolbar; and vbox1 is the Vertical Box that
we added above. The Widget Tree window provides an alternative mechanism
for selecting widgets.
Now we add the widget for entering the filename. The one we will use is
the one provided by the Gnome palette. We could use the text entry field of
the GTK+ Basic palette and add a Browse button ourselves, but the Gnome
palette Gnome File Entry widget does it all for us, and more. Click on this
widget in the palette then click in the top right cell of your canvas. The
browse button might look a bit strange (stretched out) but don’t worry, it
will sort itself out!
310 Glade: GUI Builder
Tooltips
Where possible you should think about tooltips—those small popup frames
that appear while you hover the mouse over some item and contain useful
information about the item. Tooltips provide the basic reminders that help
the user ignore the application’s written documentation. Tooltips should be
just a little verbose, perhaps taking up 3 or 4 lines of text. Aim to inform
with the minimum number of words.
You add tooltips to widgets by first selecting the widget. Select the text area
of your fileentry1 widget—this will select something called combo-entry1
which is contained within the Gnome File Entry widget. Then in the Properties
window click on the Basic tab. On that page you will see the Tooltip text
entry about halfway down. Simply type in the required text, such as:
Now hover the mouse over the file entry field on your canvas and the tooltip
should pop up.
An interesting question is whether the tooltip should be associated with the
file entry field as we have done or with the label of the field, or both? The
answer is left as an exercise for the reader! We prefer to associate the tooltip
with just the entry field itself since that is where the mouse will be hovering
while you are thinking about it. On the other-hand Glade’s own interface
associates the tooltips with the labels.
36.2 Glade Walkthroughs 311
Check Buttons
We will now add a label and 3 check buttons to the next row of our canvas.
This will be used to indicate what we want counted: words, lines, and bytes.
So we need space for 4 widgets which we achieve with the Horizontal Box
widget of the GTK+ Basic palette. When prompted change the default 3
columns to 4 columns.
Add a Label to the first cell of this row and change the text of the label to
‘What to count:.’ This label is called label2 in our collection of widgets.
You may like to set the X Pad field to 10.
Now add a check button for ‘Words’ in the next cell of this row. The
check button widget is the third widget of the third row of the GTK+ Basic
palette—the third row contains 4 different types of buttons. Select the Check
Button from the palette with the left mouse button then click the left mouse
button in the second cell of the second row of your canvas. This creates a new
widget called checkbutton1. Change the Label: text field in the Properties
window for this new checkbutton to read ‘Words.’ Similarly add check but-
tons for ‘Lines’ and ‘Bytes.’ That is, select the Check Button on the palette
again then click in the next cell of your canvas. Note that after you place
a widget on your canvas the selected widget button on the palette becomes
in-active and the left mouse button reverts to being used for selection.
Also add tooltips for each check button, selecting each of the check buttons,
in turn, and adding text to the Tooltips field of the Basic tab of the Properties
window.
312 Glade: GUI Builder
Removing a Row
We now realise that we didn’t really need 3 rows for vbox1. Two are sufficient.
Select the third row. You may notice that the Properties window goes blank
and from the right mouse button menu this row of our canvas is nothing
more than a Placeholder. The right mouse button menu Delete will remove
it for us. You could put it back anytime (or indeed place any row within
vbox1) through the right mouse button menu. Select any widget within
vbox1 (e.g., the Words check button checkbutton1) and then with the right
mouse button traverse the menu to select vbox1→Insert After.
The Run and Stop Buttons and the on run button activate callback.
Editing Menus
We will now tidy up the menus, removing those that don’t apply, and adding
a new one to perform the actual word count.
Display Results
After the words, lines, and bytes have been counted we will write the results
to the Status Message area of the Gnome Application Bar at the bottom of
the window.
You can now run your interface, even though you have yet to write the code
to perform the counting. Each of the following walkthroughs begins with the
minimum required to run the interface without any actions behind it. You’ll
want to give this a try just to make sure you can!
36.2 Glade Walkthroughs 313
Once you have your basic user interface constructed tell Glade to save the
project (using the Save button—this updates the file that contains the XML
description of the interface) and then to build the project (using the Build
button).
Start up a terminal window, such as the gnome-terminal, and change to the
project directory. There you should see an executable file called autogen.
sh. This shell script takes care of the initial configuration of your package,
running automake to automatically generate the appropriate support files for
the configuration. It also runs the appropriate automake components leaving
you with a collection of Makefiles.
$ cd Projects/gword
$ ./autogen.sh
**Warning**: I am going to run ‘configure’ with no arguments.
If you wish to pass any to it, please specify them on the
‘./autogen.sh’ command line.
processing .
deletefiles is
Creating ./aclocal.m4 ...
Running gettextize... Ignore non-fatal messages.
You should update your own ‘aclocal.m4’ by adding the necessary
macro packages gettext.m4, lcmessage.m4 and progtest.m4 from
the directory ‘/aclocal’
Making ./aclocal.m4 writable ...
Running aclocal -I macros ...
Running autoheader...
...
creating Makefile
creating macros/Makefile
creating src/Makefile
creating intl/Makefile
creating po/Makefile.in
creating config.h
Now type ‘make’ to compile the package.
You can now simply run the make command to perform the compilation
314 Glade: GUI Builder
(making use of the generated Makefiles). Once completed, run the command
src/gword to start up your application.
$ make
$ src/gword
The first time you build the project all of the necessary files and sub-directories
are created. From then on each time you build only the relevant files that
need to be changed as a result of changes in the interface are modified.
Glade generates all the necessary files to be GNU compliant and to essen-
tially run your application immediately (although without any callbacks
the application won’t do much). The primary location for your C source
code is in a subdirectory called src. In there you will see 3 header files
(support.h, interface.h, and callbacks.h) and 4 source files (support.c,
interface.c, callbacks.c, and main.c). Of these you should never edit
support.h, support.c, interface.h, and interface.c. The first pair con-
tain code that Glade supplies to support your application and the latter two
are the actual interface code. Glade manages these files. You will be making
changes primarily in callbacks.c to add the code for each callback. Glade
will add new callbacks to the bottom of callbacks.h and callbacks.c.
Now that you have built your interface (perhaps without any callback code
just yet) you are in a position to configure, compile and run your application.
The GNU automake and autoconf packages are used to simplify the manage-
ment of the configuration, compilation, and installation of your application.
These packages are a great help in the task of managing software projects.
Discuss the files generated by the build and how they conform to the GNU
Standards.
Now on to the code to actually do the word count and the appropriate call-
backs.
36.2 Glade Walkthroughs 315
To recompile we simply run make again, either directly in the src directory
or else in the gword directory.
Using LibGlade with python is an excellent option for rapid prototyping and
even build full strength applications. Like the use of LibGlade in C there
is never any need for you to convert the .glade file (containing the XML
description of the interface) into Python code. Instead, LibGlade reads the
XML and directly builds the interface using the LibGlade library (written in
C but with an interface for Python).
The basic code is:
#! /usr/bin/env python
import gtk
import libglade
import gnome.ui
Here we have linked the interface callback on exit1 activate to the library
callback gtk.mainquit. The on exit1 activate is associated through Glade
with the Exit menu item and is supplied by default by the Gnome Application
Window.
Problems arise if you don’t have the appropriate packages installed. At a min-
imum make sure you have python-gnome installed (this package will depend
on various other python and gnome packages which should be automatically
installed by choosing to install python-gnome if you are using Debian).
You may also need to ensure that the PYTHONPATH environment variable
includes the gnome and gtk modules, but check this only if you have problems
running your Python program.
Now we need to write some Python code to perform the counting of the words.
This will not be much of a challenge though as we’ve already got the logic of
the algorithm under control! It’s now just a task of knowing the appropriate
Python syntax.
In this section we cover some of the commonly used functions and concepts
you need to know about when writing code to add functionality to your
interface.
36.3 Glade Reference 317
If you use Glade to generate source code for your interface (rather than using
LibGlade) you should make use of the lookup widget() function that Glade
defines for you (in support.c) to access your widgets. You pass this function
a pointer to any widget in a window and the name of the widget that you
want to get (where the name is a string and is the same as the Name in the
Properties dialog for the widget). The function will return a pointer to the
widget whose name matches the string you supply.
The lookup widget() function relies on you giving a pointer to any other
widget in the same tree (perhaps a pointer to the root of the widget hierarchy
for that particular application window or dialog). Usually in a signal handler
(the callbacks that you write in callbacks.c) you can use the first argument
to the signal handler as the first parameter to lookup widget(). For example
you may have a button in you window called button1 and when it is clicked
you may want to access some text entry field that has the name “entry1.”
In callbacks.c you may have a callback:
void
on_button1_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *entry1;
...
}
Internally Glade uses gtk object set data() for storing pointers to all the
widgets in a window using the names set in the property editor as the key.
Then, inside lookup widget(), gtk object get data() is used to retrieve
the pointer indexed by this key. These two functions are also available to the
developer for their own purposes.
318 Glade: GUI Builder
Using Libglade If you are using LibGlade to create the interface for you
dynamically you will make use of glade xml get widget() to access you
widgets. The LibGlade approach stores its widget pointers differently.
To make use of these libraries you will need to add the appropriate libraries to
your src/Makefile.in and make appropriate modifications to autogen.sh
and configure.in. Or perhaps you ONLY need to add to the appropriate
LIBS line in src/Makefile.am. This seems more likely.
An eternal issue in GUI development is how to get hold of the pointer to the
individual widgets when you need them. Should they be accessed from global
pointers that then restrict you to a single instance (or a known number of
instances) of the widgets a priori, or is there a better mechanism?
Global Top Level Widgets One solution is to have the top level widgets
global. This then allows all child widgets to be accessed using lookup widget()
provided by Glade.
Normally you construct your GUI interactively with Glade and then choose
to build the C code for the interface with the Build button. It is sometime
inconvenient to fire up Glade just to build the C source code from the Glade
XML file. Instead you can do the conversion from the command line with:
The File menu provides the usual New Project, Open..., Save, and Exit oper-
ations. In common with all Gnome applications F3 is the keyboard shortcut
to open a project from a file, Ctl+S is the shortcut to save a project to a file,
and Ctl+Q is the shortcut to quit from Glade.
New Project The New Project returns the project options to their default
values (the same as when you start Glade without providing it a project file
name). You will be asked to confirm that you wish to start a new project.
Be sure you have saved the current project (if there is one) before you start a
new project. Click the Cancel button on the popup if you have not yet saved
the current project and wish to do so. Then choose New Project again. Click
on the OK button to proceed.
Open If you have an existing Glade project you can Open it through this
menu item, or through the Open button of the toolbar, or through the F3
shortcut, or else on the command line if you start glade from a gnome-
terminal. Via the menu, button, or keyboard shortcut you will be presented
with a File Selection Dialog to choose the Glade project file.
Save Glade currently does not keep tabs of whether you have saved your
project. Be sure to do so with the Save menu item or the Save button or
the Ctl+S keyboard shortcut. You can do this anytime and it is useful to
be in the habit of saving your project regularly. Saving the project writes
the current interface to a Glade project file which stores the interface in a
compressed (gzip) XML format. See Section 36.3.7 for details of the save
format.
The first time a project is saved (when no project file already exists) Glade
will present the Project Options dialog. This gives you an option to set the
location of the project files and to set various source code options.
Each time Glade saves the project the previous version is saved into a backup
file (e.g. gwords.glade.bak). Only the most recent backup is kept.
Build Source Code The File→Build Source Code menu item (and the
Build button and the Ctl+W keyboard shortcut) will generate the source code
that implements the interface.
The language code generated is chosen from the Project Options dialog under
the General options tab (see section 36.3.4). The default is C source code
which is supported natively by Glade. Generation of C++, Ada95, Perl,
and Eiffel is effected through helper applications from the packages glademm
(for the glade– program), gate, glade2perl, and eglade respectively. These
need to be available on your system if you are to build the interface in these
languages. If Glade can not find the appropriate helper application it will pop
up an explanatory window and show the message “Error writing source”
in the main window status bar.
See Section 36.3.3 for a description of the files generated by a build for C.
When you select to build your project source code if you have not previously
saved the project the Project Options dialog will be displayed allowing you
to set the project paths and other options. Otherwise Glade will silently
generate the source code.
Project Options The File→Project Options... item will bring up the Project
Options dialog. See Section 36.3.4 for details.
Exit To exit Glade choose the File→Exit menu or else the Ctl+Q keyboard
shortcut. Glade will ask for confirmation (but it has no indication of whether
36.3 Glade Reference 321
you have saved the project—make sure you have saved your project).
Glade has a cut and paste facility, placing widgets into the a clipboard. The
clipboard can be viewed by choosing View→Show Clipboard. Note the short-
cuts are the standard Ctl+X for Cut, Ctl+C for Copy, and Ctl+V for Paste.
Cut The Edit→Cut menu item (and its Ctl+X keyboard shortcut) will re-
move the selected widget (and all of its children widgets) from the canvas.
The widget (together with its children) will be placed on the clipboard as a
single item. Later on you can select this widget on the clipboard and paste
it onto your canvas.
Copy The Edit→Copy menu item (and its Ctl+C keyboard shortcut) is
similar to Cut in placing the widget (and it’s children) on the clipboard,
except that the widget is not removed from the canvas.
Paste After cutting or copying a widget the Edit→Paste menu item (and its
Ctl+V keyboard shortcut) will place that widget onto the canvas to replace
whatever is currently selected. This may mean that a currently selected
widget will be replaced by the pasted widget. To avoid this ensure that what
is currently selected is an empty place holder.
Clear The Edit→Clear menu item will delete the selected widget from the
canvas. The widget is not saved on the clipboard—it is removed permanently.
322 Glade: GUI Builder
The Help menu provides access to three useful reference documents and the
mandatory About... dialog. (Note that the reference documents are only
available, currently, with the Gnome version of Glade.)
The Help→Quick-Start Guide is a short document that reviews the main
Glade interfaces and what happens when Glade generates source code. The
Help→Manual is under development but provides details of all interfaces. The
Help→FAQ contains a collection of typical questions asked by new users of
Glade.
36.3 Glade Reference 323
The Project Options dialog allows you to tune many aspects of the project
you are developing with Glade. The types of options fall under three tabs:
General, C Options, and LibGlade Options.
General
When you save or build a project the directories will be silently created as
needed.
The Project Name is the name of your project. This will be used as the title
of the main application window you create (the Gnome Application Window).
The name can have spaces and other characters. As you change the name
of the project the Program Name, and Project File fields also change to re-
flect your project name (with spaces and other non-alphanumeric characters
converted to dashes).
The Program Name is the name by which the final executable program will
be known. This is used by Glade to name the output executable file in the
Makefile it generates. Once again, as you change this field the following field
(Project File) automatically changes to be the same. The previous fields do
not change.
The Project File is then the file located in the Project Directory in which the
interface is saved. This file has the extension .glade and is a gzip’ed XML
document that records all of the project information. See Section 36.3.7 for
details.
Gnome The Enable Gnome Support check button causes Glade to generate
the appropriate calls to initialise a Gnome application (rather than a Gtk+
application). For a Gnome project this should always be enabled.
C Options
36.3 Glade Reference 325
Support Functions
LibGlade Options
List all of the widgets provided by each palette and basic description and
functionality.
The GnomeApp
The GnomeApp widget is the basic Gnome application root window. It pro-
vides some standard menus, toolbar buttons and a status bar. The canvas
area between the toolbar and the status bar is where you will layout your
application. See page 307 for an example of the GnomeApp.
The GnomeDruid
Once you get into writing code you will need the GTK+/Gnome API docu-
mentation and might find the tutorial at http://www.gtk.org/tutorial/
and the API documentation at http://developer.gnome.org/doc/API/
api-toc.html useful.
You can find an introductory article on using LibGlade with Python at http:
//www.linuxfocus.org/English/July2000/article160.shtml.
Some useful books include:
Beginning GTK+ and Gnome Programming by Peter Wright. 613
pages, published May 2000 by Wrox Press, ISBN 1861003811. Covers glib,
Gtk+, and Gnome. Also covers Glade but rather skimpily. Suitable for the
beginner.
GTK+/Gnome Application Development by Havoc Pennington. 492
pages, published August 1999 by New Riders, ISBN 0735700788. Provides
extensive coverage of the GTK+/Gnome APIs and is a good guide to getting
up and started with Gtk+/Gnome.
Developing Linux Applications with GTK+ and GDK by Eric Har-
low. 512 pages, published February 1999 by MacMillan, ISBN 0735700214.
Provides a basic introduction to using the GDK and GTK+ toolkits, but not
the Gnome toolkit.
Teach Yourself Gtk+ Programming in 21 Days by Donna Martin, et
328 Glade: GUI Builder
al.
GTK+/Gnome Application Development by Havoc Pennington.
Gnome/Gtk+ Programming Bible by Arthur Griffith.
Linux Application Development by Michael K. Johnson, Erik W. Troan.
36.5 Acknowledgements
FROM http://www.funky-penguin.co.uk/index.php
Multimedia : Napster on Linux
If you haven’t heard of Napster then you have been sitting in from of your
Linux box staring at Emacs/vi (no arguments please). Napster is a file
sharing system which can be used for pointing users towards other users
who have the file the first user was looking for. The client that the user runs
contacts the server and sends it a list of the files available for download, when
a user does a search for a file the server searches through its database of users
and files and gives the user a list of other users the file could be downloaded
from. No files are stored on the server, it just acts a matchmaking system.
The Napster system started as a client for Wintel systems, but the protocol
was reversed engineer and many new clients and servers have been coded,
many are open source.
36.6 Using Napster 329
To create an account enter a username and password and ensure the new
account option is selected. Select your connection type and where files you
are willing to serve are stored and where you want files you have downloaded
put, I have these put in a different directory from the rest of my collection.
Before you close the window click ’Build mp3 list’ and a database of all the
files in your upload directory will be recorded. When you have finished your
configuration click ’OK’ and you will be able to connect to a Napster or
Opennap server. The shot below shows a list of Napster servers you can
connect to. The first time you login an account will be created for you.
Using gnapster is extremely simple, after you have connected and read the
330 Glade: GUI Builder
MOTD (Message Of The Day). Goto the seach tab and enter a search phrase,
shortly a list of files matching your search will be displayed. Right click over
the file you wish to download and select ’Dowload File’. You will notice that
the text of the download tab goes white, this indicates something has changed
whilst you are not looking at it. The download tab shows the files you are
downloading and and the upload tab shows the files people are downloading
from you. There are many cool features available in the download and upload
sections which are beyond the scope of this document, have a fiddle and find
out for yourself what they do.
One area where I will go into detail is the console/chat section of the client.
If you havent changed the default settings then when you connect you will
automagically be dropped into the channel gnapster (shown below). You can
join a channel using /join channel-name and leave a channel /part channel-
name. You can have multiple channel windows open and even chat with a
person 1 to 1 using the /query username command. The chat system is very
close to IRC and some other IRC commands are also supported /help gives
you a full list.
If the official Napster network has been closed down when you read this then
dont worry as a network of interconnected Opennap servers is available for
your use, your client will most likely provide you with a list of these.
36.6 Using Napster 331
Gnome hack is a game that lets you have an adventure. First you choose
who you want to be. You can be any character like an elf, wizard, caveman,
knight etc. Then you read the history and your mission. Then you use the
arrow keys to move your character. If you find something on the ground you
go to the tool bar and then go to action and click on ‘get’.
Sometimes jackal and bugs and gobiens can atak so you go to action if you
don’t have any thing to throw go to ‘kick ’ if you do have something to throw
then you go to ‘throw/shoot’ and then it will say ‘ in which direction ’[ when
you pick up something it will have letter when you want to use your item
press the letter after you click on what you want to do with it]
Chapter 37
Gnome is desktop for Unix and GNU/Linux delivering a high level of usabil-
ity and interoperability. The Gnome Foundation, initiated in August 2000,
brought together many of the major Unix vendors, including Sun Microsys-
tems, IBM, HP and Compaq, to support the further development of Gnome.
Sun, for example, has identified the Gnome desktop as the standard for So-
laris, one of the most popular commercial versions of Unix.
In this chapter we begin with the basics of the Gnome desktop and walk you
though interacting with Gnome applications, including menus, toolbars and
dialogs. This is followed by reference sections identifying Gnome applications.
333
334 Gnome: The Desktop
Menus in Gnome applications work in much the same way as other applica-
tions. The left mouse button is used to select a menu. You can either click
the mouse button on the menu or else hold the mouse button down over the
menu. In both situations the menu will stay until you make a choice or else
click somewhere else on the window.
Generally there are four types of menu items. The first have a right pointing
arrow and lead to further sub-menus. The second type may have a small icon
and some text followed by three dots. These items lead to dialogues that ask
for further information. The third type also may have a small icon followed
by some text but no dots. These items perform their action immediately on
selection. Finally, some menu items represent options that can be turned on
and off.
All Gnome applications have at least a File menu and a Help menu. The
File menu contains at least an Exit with keyboard shortcut to Ctl+Q. The
Help menu contains an About item which opens a dialogue that identifies the
application, author, version and date.
menus this fact is lost and you will need to tear them off again.
37.1.2 Shortcuts
Menus will often have combinations of keys that can be used as a shortcut.
These keyboard shortcuts will usually appear to the right within the menu
itself as a reminder. The associated keyboard shortcut is usually a com-
bination of keys beginning with Control or Alt. Pressing the specified key
combinations has the same result as choosing the menu item. For example,
if the Edit menu has a Cut choice with a keyboard shortcut of Ctl+X then
holding down the Control key while you type the X key has the same effect
as choosing the Cut menu item.
Many shortcuts are in common usage amongst Gnome applications and will
be familiar to users of the Win32 OS. These include:
New Ctl+N Cut Ctl+X Find F6
Open Ctl+O or F3 Copy Ctl+C Replace F7
Save Ctl+S Paste Ctl+V
Print Ctl+P Select All Ctl+A
Close Ctl+W Undo Ctl+Z
Quit Ctl+Q Redo Ctl+R
A powerful feature is that you can choose your own shortcuts whenever you
wish. To do this, simply move the mouse over the menu item whose shortcut
you wish to redefine (or to define if it currently does not have one) and
type the keyboard shortcut you wish to associate with that menu item. For
example, to map Cut to Shft+Ctl+Alt+X simple move the mouse to the Cut
menu item and press all four keys at the same time. This is probably not
a very useful binding, but it’s unlikely to be used for anything else, so it’s
a save choice to play with! Note that if the new shortcut previously was
associated with another menu item, the previous binding is lost.
If you use Shft+X as a shortcut it will be accepted but may not be useful. If
the context is a text editor then Shft+X will be captured to capitalise the x
rather than passed on as a shortcut. Other combinations involving the Shft
key work just fine, such as Shft+Alt+X and Shft+Ctl+X. Some applications
(e.g., nautilus) automatically save your shortcuts so that next time they will
appear. Others (e.g., bluefish) provide an option for you to save them if you
decide they are suitable.
Finally, some shortcuts might be identified by the applications as immutable
336 Gnome: The Desktop
37.2 Toolbars
Toolbars (and menubars) can float. The left end of each toolbar and menubar
contains a raised dotted image like that above. By placing the mouse over it
and holding the left mouse button down you can drag the toolbar to wherever
you like before releasing the mouse button.
Unlike floating (or tear-off) menus a floating toolbar or menubar does not
remain in the main window. You will have at most just a single instance of
a toolbar.
A toolbar or menubar can be returned to the parent window simply by drag-
ging it back there. You can even drag the toolbars to the bottom of the
parent window if that’s where you like them to be.
37.3 Dialogues
When prompted to load or to save files the dialog does not show any hidden
directories (those beginning with a period). To get them displayed, simply
enter a period in the Selection text field and press TAB.
There are many Gnome applications freely available either from the Internet
or else available for purchase from distributors. We identify here a selection
37.4 Gnome Applications 337
Figure 37.1: Toolbars and menubars can often be torn away from the main
window or even located elsewhere within the main menu. Here, the dia
application menubar is moved to the bottom of the main window and then
out of the window altogether.
File Managers
• mc
HTML Editors
• quanta.
• screem.
338 Gnome: The Desktop
evolution
Web Browsers
galeon
Email Clients
banksia
balsa
spruce
grin
News Readers
pan
Word Processing
abiword
staroffice
Spreadsheets
gnumeric
Presentation Tools
presentation
Graphics Tools
dia
gimp
gnuplot
37.4 Gnome Applications 339
imagemagick
sketch
xfig
sane
gphoto
eog
gqview
xzgv
Music
grip
gnapster
Finance
gnucash
Database Management
340 Gnome: The Desktop
Games
gnomehack
memblocks
Educational
gperiodic
ghemical
37.7.1 KDE
The one thing that significantly held back the wide acceptance of the excellent
KDE desktop was the fact that it used the QT+ toolkit for its graphical
user interface development. For many years this toolkit did not meet the
requirements of the General Public License (GPL) and so could not legally
be included in many distributions. Indeed, because of this the Gnome project
was begun. By September 2000 when it was announced that the new version
of QT+ (2.2) would be released under the GPL Gnome was already catching
up to KDE in its development and many of the major Unix players had
decided to adopt Gnome.
37.7.2 XFCE
The aim of XFCE is to provide a simple and very small desktop requiring
minimal resources but providing a sufficient feature set for the genral user.
Xfce is actually based on the GTK+ toolkit as is the Gnome desktop.
342 Gnome: The Desktop
37.8 Troubleshooting
If you have your home directory NFS mounted and log onto Gnome multi-
ple times, make sure ORBIT can talk TCP/IP to communicate with your
other gconf daemons. To enable this uncomment the following line in /etc/
orbitrc:
ORBIIOPIPv4=1
$ gconftool-2 --shutdown
GnuCash: Finances
343
344 GnuCash: Finances
Chapter 39
Gnumeric: Spreadsheet
From humble beginnings the spreadsheet has become one of the most useful
tools on the computer desktop. Serving very many different purposes, all
essentially dealing with numbers, spreadsheets provide a platform for tabu-
lating numbers and automatically peforming operations on those numbers.
Spreadsheets today provide a comprehensive array of functions for all kinds
of purposes, together with impressive graphical reporting facilities.
The Gnome desktop supplies the gnumeric spreadsheet modeled on Excel.
When you start gnumeric for the first time you will get an empty spreadsheet
ready for your to work with, as in Figure 39.1.
345
346 Gnumeric: Spreadsheet
Gnumeric will import your existing Excel, 1-2-3, Sylk, XBase and Oleo files.
If you are a developer and you want to contribute new importers (or polishing
and perfect existing importers) we welcome your patches.
39.1.2 KSpread
You can use gqview for presentations where your presentation is a collection
of images (one image for each slide!). Click the button to go to full screen.
351
352 GQView: Viewing Images
Chapter 41
Graphics
• xfig: A older, but very versatile and powerfull vector graphics editor.
Highly recommended.
353
354 Graphics
With xfig figures are drawn using objects such as circles, boxes, lines, spline
curves, and text. Images can be imported, supporting formats such as gif,
jpg, and eps.
Xfig saves its figures in its native Fig format that may be converted into
various formats such as eps, gif, and jpg
Other applications can produce output in the Fig format, including gnuplot
and xgraph, both of which can generate graphs direct from the corresponding
data. Alternatively, pstoedit can generate input suitable for editting with
Xfig.
Figure 41.1: Xfig is an older Unix-based vector graphics tool. It has been
quite popular and although its interface is showing signs of its age, it remains
a useful and powerful vector graphics editor.
41.2 Common Operations 355
Many fine packages provide plotting capabilities. See Chapter 71 for plotting
capabilities in the R statistical package.
Gnuplot
GDChart
This charting toolkit with bindings for Python is available from http://
athani.pair.com/msteed/software/gdchart/. However, for sophisticated
plotting the R statistics package is recommended, particularly through it’s
Python interface RPy. See Chapter 71.
Some of the required packages include: python2.1-dev zlib1g-dev libpng2-dev
libjpeg62-dev.
Installation is straightforward. (Note that there is not currently a Debian
package for python-gdchart so need to compile and install it. The installation
is in /usr/local because of this.)
$ wget http://athani.pair.com/msteed/software/gdchart/gdchart-py-0.6.tar.gz
$ tar zxvf gdchart-py-0.6.tar.gz
$ cd gdchart-py-0.6
356 Graphics
Ggobi
At times one comes across the need to capture the screen. That is, to save
what you see on your display, or in a window on your display, into an graphics
file. Perhaps you want to impress your colleagues with how you’ve managed
to settle upon a wonderful combination of Gnome and Sawfish themes (Sec-
tion 85).
Gnome Screen-Shooter
Using ImageMagick
Try imagemagick with screenshot...I think or something like that ...its part
of the Gnome desktop environment
41.3 Conversions 357
Using xv
41.2.3 Thumbnails
Suppose you have a PNG graphics file that you want to place on your web
page but its background is white, whereas your web page is blue. Make the
PNG background transparent with:
41.3 Conversions
41.3.1 PostScript
A useful tool for converting from PostScript to other editable formats (in-
cluding vector formats like fig and svg) is pstoedit.
To convert from PostScript to XFig placing the output into example.fig:
Use:
$ epstopdf image.ps
Some applications (e.g., Splus) seem to place extra white space around the
encapsulated PostScript that they generate. This is a problem when import-
ing into other packages, such as LaTeX. A simple solution is:
This determines an accurate bounding box and trims the image to that box.
Chapter 42
Every file and folder in a GNU/Linux system belongs to a group. Each user
is also a member of a group. Groups are used to control collections of users
who may have access to particular files and folders.
A Debian GNU/Linux system creates some standard groups and users. The
system administrator can also create new users and may also create new
groups. Groups can be managed using the Gnome users-admin tool, ac-
cessed from Applications→System Tools→Users and Groups. By default this
shows only users, but you can access groups by selecting the More Options
button. This allows you to add new groups and to add and remove users
from groups.
We list below the standard groups and users, but the reader is referred
to /usr/share/doc/base-passwd/users-and-groups.html for further de-
tails.
359
360 Groups: Managing Access Permissions
floppy 25
tape 26 for device nodes. Include users allowed to access these
in the appropriate groups.
sudo 27
audio 29 for device nodes. Include users allowed to access sound
in this group
dip 30 For daemons running under their own uid/gid. Why are
these static?
majordom 30 For daemons running under their own uid/gid. Why are
these static?
postgres 32 For daemons running under their own uid/gid. Why are
these static?
www-data 33 This has been discussed in the past, and the discussion
is not finally finished. Today, www data files belong to
this group and the web servers run with that group, thus
being able to write the files. This has been considered
a security hole, but was not yet changed.
backup 34
msql 36 For daemons running under their own uid/gid. Why are
these static?
operator 37
list 38
irc 39 For daemons running under their own uid/gid. Why are
these static?
src 40 This group is intended for users who need to access
source code, including files in /usr/src. Users in this
group can thus manage system source code. Also, this
group is the default group for access to the CSV repos-
itory in /var/lib/csv.
gnats 41 For daemons running under their own uid/gid. Why are
these static?
shadow 42 Programs that should be able to access the shadow pass-
words are sgid shadow.
HTML Editors
HTML editors include bluefish, screem and quanta. Bluefish is the standard
Gnome editor.
43.1 Bluefish
Editing HTML (and indeed any type of XML document) is supported through
bluefish, a purpose built editor based on the Gnome edit toolkit. Bluefish is
described as a programmer’s HTML editor because it is not a graphical edi-
tor (in that you work directly with the mark-up, i.e., the actual HTML tags,
rather than with how the final page might look, as with Netscape Compser).
Features include a multiple file editor, multiple toolbars, custom menus, im-
age and thumbnail dialogs, open from the Web, CSS dialogs, PHP, SSI and
RXML support, HTML validation, and many wizards.
Figure 43.1 shows the basic interface editing a simple HTML document.
Syntax highlighting has been turned on under the View→Highlight syntax
menu. You may also need to initialise a set of highlighting patterns with
Options→Lists→Reset syntax highlighting. You can refresh the highlighting
with View→Refresh highlighting or else F5.
When you are ready to see what your marked up document will look like in
a browser simply select View→Preview or use the F4 keyboard shortcut.
363
364 HTML Editors
ImageMagick
365
366 ImageMagick
Chapter 45
Initialisations on Booting
The Debian GNU/Linux kernel loads init very early on in the boot process,
using /etc/inittab as its configuration file. This file defines the default run
level and what should be done for each run level.
If you have a look at the processes running on your system (with the com-
mand line ps or with the graphical Gnome utility gtop) you will see that the
init process has process identifier of 1 (unless you are running a more secure
GNU/Linux where random numbers are assigned to the processes).
The initialisation table (/etc/inittab) is where system initialisations occur.
This table consists of records with four fields separated by a colon:
id:runlevels:action:process
The first field is an identifier. The second lists the runlevels for which this
record is relevant. The third is the action to be performed. The fourth is the
command to be run.
In this chapter we look at how the GNU/Linux system is initialised. See
Chapter 12 for an explanation of the boot process and how to control booting.
The runlevel is an identifier for each of the different states in which the
GNU/Linux operating system can be running, such as in single user mode,
367
368 Initialisations on Booting
multi-user mode, and halt and reboot modes. Generally a GNU/Linux sys-
tem is running in multi-user mode.
The first script run by init, after booting into GNU/Linux, is /etc/init.
d/rcS. The initialisation files for the default run level (usually 2) are then
run. This is specified in /etc/inittab with the line:
l2:2:wait:/etc/init.d/rc 2
In general the runlevels 2, 3, 4, and 5 are all multi-user run levels and Debian
sets them up to be the same.
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
Thus, when the system enters a runlevel it executes the scripts in /etc/rc.n
where n is the runlevel in question. These scripts are in fact symbolic links
(symlinks) to scripts in /etc/init.d/. A script starting with S starts a
service. One starting with K stops a service. The number after the ‘S’ or
‘K’ specifies the order in which the scripts are run. For example, S25xdm
will start before S35xdm.
45.2 Initialisation Scripts 369
To stop xdm, for example, from starting up by default on boot, simply remove
the symbolic link of the corresponding ‘S’ script from /etc/rc?.d/S*xdm.
See the man page for init for an extensive discussion.
The init script is run with ”start” on changing runlevel (S) and runlevels 0
(the halt runlevel) and 6 (the reboot runlevel).
To remove something (e.g., gdm) from the init scripts:
si::sysinit:/etc/init.d/rcS
45.4 Terminals
There are six terminals enabled by default in Debian. This means that when
you boot the machine you will have one terminal where you see the boot
messages and eventually the login prompt (unless you are using a window-
based login such as gdm). This terminal is controlled as the device /dev/
tty1. By default there are five others: /dev/tty2. . . /dev/tty6. The entries
in the initialisation table responsible for running the appropriate application
to control each of these terminals are:
# Format:
# <id>:<runlevels>:<action>:<process>
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
45.4 Terminals 371
We can see that only the terminal on tty1 is initiated for all user run levels
(2, 3, 4, and 5). The others are initiated only for run levels 2 and 3.
To get more than the default six terminals add additional getty entries and
inform the init daemon with:
# telinit q
A total of 256 terminals are available with a default kernel. There are 64
virtual consoles available. More terminals can be provided for in the kernel
by recompiling the kernel with different options.
Note that exporting a serial console is in the default init script. This is
particularly handy for Palms and similar handheld computers as a system
rescue option.
You can move to any of the consoles using left Alt-F1 to left Alt-F6 or left
Ctl-Alt-F1 to left Ctl-Alt F6. You can also move between the consoles with
Alt-Left and Alt-Right. If you have more that 12 virtual consoles (hence
you run out of function keys for Ctl-Alt) you can access them directly with
Alt-F1 (for console 13) etc.
If you are running one of the X Window System display managers (i.e., you
are presented with a graphical log on screen) such as gdm then this is usually
running on virtual terminal 7 which you can access with Alt-F7. Note that
X captures the Alt key so you will need to use Ctl-Alt-F1 to switch to virtual
console 1.
372 Initialisations on Booting
Chapter 46
Java
Debian can not distribute Sun’s Java because of Sun’s licenses which do not
meet the Debian Free Software Guidelines. This is a problem since Java is
such a widely used Internet language. However, you can manually install
the Sun Java software development kit yourself, as long as you are happy to
accept the Sun Java license. Alternatively, install one of the alternatives like
kaffe.
# sh j2sdk-1_4_2_03-linux-i586.bin
To accept the license type yes and the installation will begin. This will create
a new directory in /usr/local/bin with the name j2sdk1.4.2 03. Now create
the necessary links:
# ln -s /usr/local/bin/j2sdk1.4.2_03/bin/* /usr/local/bin
To confirm it is installed:
373
374 Java
# cd /usr/lib/mozilla/plugins
# ln -s /usr/local/bin/j2sdk1.4.2_03/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so
Then run Mozilla and visit about:plugins to ensure the plug in is found.
Old Recipes
An older recipe for installing a Java plugin for the then new version of Mozilla
(e.g., 2:1.3.1-3) which was compiled with gcc 3.3 was:
$ mkdir j2sdk-1.4.1-01-linux-i586-gcc3.2
$ cd j2sdk-1.4.1-01-linux-i586-gcc3.2
$ wget ftp://ftp.easynet.be/blackdown/JDK-1.4.1/i386/01/j2sdk-1.4.1-01-linux-i586-gcc3.2.b
$ wget http://twolife.free.fr/debian/j2se1.4-i586_1.4.1.0.1-4.diff
$ patch -p1 -i j2se1.4-i586_1.4.1.0.1-4.diff
$ debuild -uc -us
$ cd ../
$ wajig install j2re1.4_1.4.1.0.1-4_i386.deb
<download jre.xpi>
ftp://ftp.netscape.com/pub/netscape6/english/6.01/unix/linux22/xpi/jre.xpi
Install jigdo-file
To build snapshot of sid distribution:
$ jigdo-lite ftp://ftp.fsn.hu/pub/CDROM-Images/debian-unofficial/sid/jigdo/sid-i386-1.is
<ENTER>
ftp://mirror.aarnet.edu.au/pub/debian/
ftp://mirror.aarnet.edu.au/pub/linux/debian-non-US/
377
378 Jigdo: Build CD-ROM Images
Chapter 48
379
380 KDE: Desktop Management
Chapter 49
Compiling your own Linux kernel may sound like a pretty scary task. Take
a deep breath and “enjoy the experience.” It is actually not such a big thing
to compile your own kernel. And Debian makes it even more straightforward
by supplying the kernel-package to leave you with a kernel-image package that
you simply install, just as you would any kernel-image package you might get
from Debian.
The advantages of compiling your own kernel include being able to tune the
kernel to your specific hardware, and ending up with a smaller kernel. You
may also need to compile your own kernel if the default kernel does not sup-
port some specific hardware you have. The distributed kernels though are
becoming modular and it is becoming rare that you would need to compile
your own kernel. If you do though, the recipe here should help and the intro-
duction to compiling your own kernel at http://newbiedoc.sourceforge.
net/tutorials/kernel-pkg/index-kernel-pkg.html should prove a use-
ful read.
The hardware we review in this book has occasionally required kernel com-
piles. For example, Bartok (Section 4.10.1) contains over 1GB of memory
but the supplied kernels limit to less than 1GB (NOHIGHMEM). Mint (Sec-
tion 4.10.27) had a specific kernel compiled for it with sound support through
ALSA, IDE SCSI emulation support for CDRW, and with PPP and IPMASQ
support. Velox (Section 4.10.26) had a kernel compiled with sound support
through ALSA, IDE SCSI emulation support for CDRW, and support for
dual processors.
Some sample compiles of the kernel are included with specific installations
381
382 Kernel: Rolling Your Own
in Section 4.10. See Section 4.10.1 for an example of compiling kernel 2.4.16
with extra memory support (HIGHMEM) and multiple CPU support (SMP).
See Section 4.10.16 for an example of obtaining the linux kernel source (kernel
2.4.19) directly and compiling it the Debian way for Bach (Section 4.10.16).
See Section ?? for an example of obtaining the linux kernel source (kernel
2.4.19) and patching it with a pre-release (2.4.20-pre11) and compiling it the
Debian way for Vivaldi (Section 4.10.13).
bin86
kernel-package
kernel-source-2.4.16
debconf-utils
alsa-source-0.5 (if you need ALSA’s extra sound support)
pcmcia-source
For the particular release of Debian being used the version numbers will be
different. The kernel-package provides tools to generate, from the compiled
kernel image, a genuine Debian package that you simply install as a stan-
dard type package. The resulting package can be installed (and uninstalled)
cleanly and correctly with dpkg and wajig.
Note that you do not need the kernel-headers package as all the headers
required are in the kernel-source package. The headers were split out for
other reasons (compiling other packages without installing all of the kernel
sources).
Installing the kernel-source package simply places the archived kernel source
file (kernel-source-2.4.16.tar.bz2) into /usr/src. Similarly for any ker-
nel modules you wish to also install (like alsa). Extract the actual source code
into /usr/src/kernel-source-2.4.16:
# cd /usr/src
# tar jxvf kernel-source-2.4.16.tar.bz2
# tar zxvf alsa-driver-0.5.tar.gz
# tar zxvf pcmcia-cs.tar.gz
49.2 Kernel Configuration 383
You can also obtain a more recent (or even just any different) version of the
kernel from the net yourself and still use the Debian kernel-package utilities.
The next task is to configure the kernel to suit your setup. There are very
many configuration options and most can be ignored. Each also has a brief
but helpful piece of documentation in /usr/src/linux/Documentation/
Configure.help.
There are three methods available for selecting the configuration. The first
and most basic is config which presents each option, sequentially, for you
to decide what to do. This is a long process. The menu-based menuconfig
presents a menu in a terminal. Options are grouped hierarchically and you
can navigate to the specific options you wish to modify. The X Window
System configurator is xconfig. We might suggest xconfig as the more conve-
nient of the methods, but menuconfig is a good alternative if there is no X
Window System running.
A good starting point for configuration is the basic configuration that is
the default provided by Debian. You then refine the configuration. For an
installed kernel-image you can find its configuration in /boot/config-2.4.
16, for example. A simple approach to configuration is to copy the installed
kernel’s configuration as the starting point and simply enable the options
missing from that configuration (e.g., SMP):
# cp /boot/config-2.4.16-686 kernel-source-2.4.16/.config
However, you may be better off starting with no .config. A default configu-
ration will be installed and you can then add to this support for your specific
hardware.
Below is a record of my configurations for Mint (Section 4.10.27) and Velox
(Section 4.10.26) where configuration started with no /usr/src/kernel-source-2.
4.16/.config:
# cd kernel-source-2.4.16
# make xconfig (or menuconfig or config)
-> CONFIG_M686=y
384 Kernel: Rolling Your Own
For Altrop (Section 4.10.20) and Bartok (Section 4.10.1) the configuration
began with a copy of config-2.4.16-686-smp and /boot/config-2.4.16
respectively and the following were modified for the extra memory and SMP.
For the laptop Inco the initial configuration was that of /boot/config-2.4.
16-686 then modified as:
This is not really needed though as I believe this simply adds some minor
tunings to the kernel.
If you are installing a new version of a kernel that is already installed you
should move the corresponding modules aside, or else you will be asked to
do so during the install:
# cd /lib/modules
# mv 2.4.16-p3 2.4.16-p3.prev
# cd /usr/src
# wajig install kernel-image-2.4.16-p3_kayon01_i386.deb
You will be asked whether you wish to run lilo. Usually you would. If this
wipes out a precious master boot record (MBR) you can recover it with lilo
-u.
Now install the modules (if any):
For Mint (Section 4.10.27) with support for CD-RW you now need to modify
/etc/modutils/cdrw (as suggested in CD Writing HOWTO):
To get this information into the right place the following should be done:
# update-modules
Again for Mint (Section 4.10.27) the following were added to /etc/modules
(otherwise the modules must be loaded manually for some reason which can
be avoid using char-major stuff but don’t understand this yet):
49.6 Lilo Configuration 387
sr_mod
sg
ide-cd
# reboot
If you have a kernel-source installed you can update to latest available kernel
with:
# cd /usr/src/kernel-source-NNN
# uupdate -u ../linux.tar.gz
388 Kernel: Rolling Your Own
The Debian way allows you to keep multiple versions of kernel images on the
same machine with little effort. Even multiple flavours of the same kernel
version can easily be accommodated, You could have kernel-image-2.4.16-
686 and kernel-image-2.4.16-p3hmsmp available and choosable at boot time
through lilo.
Other kernel module packages are also hooked into the Debian way of dealing
with kernels so that you can simply compile them as part of the kernel compile
process. This includes pcmcia-source and alsa-source. Such modules generally
rely on the particular kernel version.
Debian also has the nice feature of keeping the configuration file for each
kernel image in /boot.
You can optionally apply patches to the kernel (supplied as .deb files) and
build a patched kernel automatically.
You can compile a kernel for another computer, for example using a fast
machine to compile the kernel for installation on a slower machine. This is
really nice since the modules are all included in the .deb; and one does not
have to deal with modules manually. The postinst looks at a configuration
file on the installation machine (as opposed to the machine that the image
was compiled on), and allows the local admin to decide on issues of symbolic
links, and whether the boot loader stuff must be run, and whether one wants
to create a boot floppy or not. The postinst and the postrm scripts allow the
local admin on the installation machine to add a script into runtime hooks;
this can allow, amongst other things, grub users to add and remove kernel
image stanzas from the grub menu (example scripts to do this are in the
package).
49.10 Loading Kernel Modules 389
Keyboard
First find the keycode of the key you wish to map. Do this by running xev
and press the key you wish to map (e.g., the Windows key) and look for the
keycode:
391
392 Keyboard
Now you should be able to bind F15 to any action with, for example, sawfish.
Even better, sawfish supports custom modifier keys (i.e., modifiers apart
from Ctrl, Alt, and Shift- and knows about Hyper). You can map the left
windows key:
Then use Hyper_L for all bindings related to the window manager (thus free-
ing Ctrl and Alt-based bindings). This makes it a perfect window manager
key.
I end up with /home/kayon/.Xmodmap containing:
Konqueror is a file manager and web browser for the KDE desktop. It pro-
vides the usual file manager functionality including display of files and di-
rectories using an icon view or tree view, copying, moving and deleting by
direct drag and drop or by using copy, cut and paste, and file properties.
393
394 Konqueror: The KDE File Manager
Chapter 52
LaTeX
Many Debian packages can generate LaTeX. These include the Gnome office
suite applications Gnumeric (Chapter 39), AbiWord (Section 8.1) and Dia
(Chapter 23).
395
396 LaTeX
A great GUI for editing LaTeX documents is LyX. LyX provides much help
for the novice LaTeX user in getting started with producing very nice looking
documents.
The AucTeX package provides a complete emacs environment for editing La-
TeX documents.
C-c = runs the reftex command reftex-toc which will split the current
Emacs window to show two buffers, the top buffer showing the table of con-
tents of the whole document, allowing quick navigation around the document.
The preview-latex package will provide a preview of graphics and mathematics
inside the emacs buffer where the LATEX file is being edited.
...
for line in self.lines:
if line[0:23] == "! pdfTeX warning (dest)":
print "PDF WARN: " + line[25:],
return 0
if line[0] == "!":
...
52.5 LaTeX Tips and Tricks 397
The natbib package in LATEX checks to see whether the chapter command is
defined. If so it decides to use that for the bibliography headings. This will
generally place the bibliography on a new page, which is what you would
expect for a book. However, the llncs LATEX document class does define
the chapter command, but is used generally for writing articles! A sim-
ple solution is to tell natbib to use section rather than chapter for the
bibliography:
\usepackage{natbib}
\makeatletter
\renewcommand\bibsection%
{
\section*{\refname
\@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}
}
\makeatother
pool_size = nnnnnn
where you add something to the current value of nnnnnn. This should take
effect next time you run LATEX.
398 LaTeX
Chapter 53
Login
If you enter your username on the login prompt all in capitals then the login
progam will be lead to believe that you have an upper-case only terminal
(pretty rare devices these days but once upon a time they ruled the desktop).
You will then enter into the system where uppercase letters rule. This is a
feature and not a bug!
Make sure your disable capslock before entering your userid.
399
400 Login
virtual terminals on your system. When getty starts, it prints the contents
of /etc/issue to the terminal. To customize the look of your console, all you
have to do is edit /etc/issue.
You can also add colour by using the colour capabilities of the Linux console.
The Linux console, like almost any other existing terminal, has escape se-
quences that can be used to change the appearance of text on screen. Piping
the following script into /etc/issue:
#!/bin/sh
The 44;37 specifies White on Blue. To see how your terminal renders colours,
use this script:
#!/bin/bash
53.3 Midnight Commander 401
You can browse through the contents of a Deb package (*.deb file) with gmc
as if it were a locally mounted fileystem,¿ without having to unarchive and
untar all the constituent components. You can also browse tarballs, gzips,
bzips, gzipped tarballs, bzipped tarballs, and zips as well, providing that the
attendant gzip, bzip, tar, and zip programs are all installed. Double click the
archive in question and you can browse the archive as if it were a directory.
403
404 Magellan: KDE Personal Information Manager
Chapter 55
Modems
55.1 Silence
If you want to turn the speaker of your modem off, then add ATM0 to /etc/
chatscripts/provider:
# ispnumber
OK-AT-OK ATM0
OK-AT-OK ATDT12345678
Replace ATZ with ATH1. May need to extend the time wait-
ing from the 100 (1 sec) standard setting to 250, so the modem
doesn’t send the ATDT(phone no.) too soon.
405
406 Modems
By default pon does not wait around too long to establish a connection.
Sometimes it does not wait long enough. You can introduce a longer wait
(e.g., two minutes) as below.
Edit /etc/ppp/peers/provider (assuming your connection is the default,
called provider ) to replace:
with
If you connection is not the default provider but something else, then edit
the file with the same name in /etc/ppp/peers/.
Chapter 56
MSWindows
Wine works well with MS-Windows/98 (e.g., winword and excel work just
fine) but not so good with MS-Windows/NT, MS-Windows/2000, and MS-
Windows/XP.
407
408 MSWindows
56.2.1 Screenshot
56.2.2 Installation
Citrix provides both a standard client and a Java based client that can run
as an application or as an applet (although the Java application is only
available as version 6, with version 7 only providing an applet). The clients
can be downloaded from the Citrix web site, after agreeing to their licensing
conditions.
Client Installation
$ wget http://download2.citrix.com/files/en/products/client/ica/current/ICAClient-7.00-1
$ wajig rpminstall ICAClient-7.00-1.i386.rpm
$ /usr/lib/ICAClient/wfcmgr
Create new Entry
Network
Server [ACT] [citrix.ktware.com]
Window
Window Size [75%]
Login
[kayon,NEXUS,passwd]
Tools -> Settings
Drive Mapping
H: /home/kayon/
Enable Drive Mapping
$ /usr/lib/ICAClient/wfcmgr -desc ACT
$ wget http://download2.citrix.com/files/en/products/nfr/ica/setup.class
$ java setup
Install into /usr/local/share/citrix
$ CLASSPATH="/usr/local/share/citrix/JICAEngJ.jar:$CLASSPATH"\
java com.citrix.pn
$ CLASSPATH="/usr/local/share/citrix/JICAEngJ.jar:$CLASSPATH"\
java com.citrix.JICA ACT
410 MSWindows
Chapter 57
Music
Most computers today have hardware for producing great audio. In this
chapter we explore how to get the most from your sound system.
FIRST DISCUSS CD PLAYERS
With the explosive growth of MP3 freely available on the web you will need
an MP3 player. There are several to choose from, but we concentrate on
xmms and qvmpeg.
You may want to record your own audio CDs so that you can listen to them
yourself or download them to your portable MP3 player. The grip package
encodes an audio CD as a collection of MP3 files.
411
412 Music
Chapter 58
MySQL
413
414 MySQL
You will then also need to let cron jobs work on the database so create a
personal mysql config file for root in /root/.my.cnf containing:
[mysqladmin]
user = root
password = <secret>
The data to populate a new table we will create is stored in the file nhds99.
data as comma separated values. We can write a simple script to create the
table and import the data. The script is called nhds99.sql:
USE nhds;
LOAD DATA
LOCAL INFILE ’nhds99.data’
INTO TABLE nhds99
FIELDS TERMINATED BY ’,’;
Using mysql-navigator you can not currently create new databases (except
by running an external script) but you can create tables. You can also run
SQL scripts. So create your database for nhds as above. Then start up the
navigator and open root@localhost. Then under the MySQL menu choose
Script. Identify the script and a log file then Fire. The new table should
then appear under the nhds database.
With the navigator you can even edit the script files with the Edit item in
the MySQL menu.
The mysql-navigator can be used to create a new user. Fire it up and open a
connection to the localhost server with user root and database mysql. Under
the MySQL menu select User. Choose the action to permform, prvoide the
relevant information then Fire. Then under the MySQL menu select Privilege
to grant database access. Note that you may still need mysqladmin -u root
-p reload?
Alternatively, you can do it as follows. The first insert adds this user’s
password to the users table. The second then gives this user access to a
particular database.
mysql> exit
Then this user can access the specified data base to perform SELECT queries:
On any host in domain ktware.com user kayon would like to connect to the
customers database with select privileges on the MySQL server running on
altrop.ktware.com.
You can arrange this as follows. The first insert adds this user’s password
to the users table. The second then gives this user access to a particular
database.
On altrop.ktware.com:
mysql> exit
$ mysql -u nhds -p
Nautilus: Navigating
Folders—Near and Far
Navigation will be familiar to any user, with the usual Back, Forward, Up,
Reload, Home, Search and Web Search buttons in the toolbar.
421
422 Nautilus: Navigating Folders—Near and Far
The main window has two panels with the left hand panel containing tabs
to access different components.
The right hand panel displays folders and documents in a rich variety of
ways. Users will be familiar with the View as List and View as Icons Folder
displays.
Folders containing MP3 music can be displayed using the View as Album
component, which provides a specialised view of your music collection as an
album, designed to allow easy music listening. Selecting an MP3 file starts
it playing automatically.
It can also display the album artwork if you have that available. To link the
artwork in you need to.
HTML documents (the type of documents that form the basis of the world
wide web), whether they live on your local disk or somewhere on the web,
are just another type of document, and Nautilus treats them as such. Open
one and you begin browsing the web within the Nautilus shell! By default
Nautilus uses the Embedded Mozilla to render these documents, but others
can be plugged in, depending on your desires.
59.3 Nautilus CD Creator 423
ssh://festival/home/kayon/
Or ftp:
ftp://kayon:pswdHere@ktware.com.au
424 Nautilus: Navigating Folders—Near and Far
Chapter 60
Networks
60.1 Introduction
425
426 Networks
You will then see the interface that will allow you to set up your networking.
With a laptop, for example, with regularly changing network configurations
you can create a number of appropriate Network Profiles, with one called
home chosen in Figure 60.2. To establish a connection you can click on the
unselected button for the appropriate network device in the Status column
of the Connections tab (after choosing the appropriate Network Profile).
Note that to have networking started in this way you need to have auto eth0
in /etc/network/interfaces. Otherwise the start-up script /etc/init.d/
60.2 Network Configuration 427
networking will not start eth0. The start-up script calls ifup -a which
only starts those interfaces marked as auto. You can still manually start the
network with ifup eth0.
If you get a neighborhood table overflow message make sure the loopback
device is running:
# ifup lo
UP LOOPBACK RUNNING
auto eth0
iface eth0 inet dhcp
Velox (Section 4.10.26) was initially set up to allow DHCP allocation of the IP
address. The DHCP server delivered the appropriate information as demon-
strated in /var/log/installer.log:
auto eth0
iface eth0 inet static
address 105.229.8.151
netmask 255.255.255.192
broadcast 105.229.8.191
gateway 105.229.8.190
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:C0:4F:F7:02:BF
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:21
collisions:0 txqueuelen:100
Interrupt:10 Base address:0xfc80
# mkdir /tmp/cisco
# cd /tmp/csico
# wget http://www.cisco.com/pcgi-bin/Software/Tablebuild/download.cgi/Linux-ACU-Driver-v
# tar zxvf Linux-ACU-Driver-v2.0.tar.gz
# mkdir -p /opt/cisco/bin
# mv utilities/* /opt/cisco/bin
# mv helpml.tar.gz /opt/cisco
# cd /opt/csico
# tar zxvf helpml.tar.gz
# tm helpml.tar.gz
# cd
# /opt/cisco/bin/acu
430 Networks
For LEAP authentication you can login with a username and password. This
can be set up with:
# ifup wifi0
• Perhaps you may need to first set your IP address to 0.0.0.0 sub-
net mask 255.255.255.0 before initializing the DHCP client process (a
known problem when the DHCP server is Windows). How to do this?
If you would like to search for hosts in other domains by simply listing the
host name (e.g., inco, rather than inco.ktware.com) you can add those other
domains to /etc/resolv.conf. Note that PPP will add its own ”ISP” re-
lated resolv.conf file on dial up. Thus, with ISP identified as ”provider” add
the following line to /etc/ppp/resolv/provider:
search ktware.com
60.5 Hostname Changes 431
# hostname zafira
This alone will not suffice as the change in hostname will not survive a reboot.
You need to edit /etc/hostname which is where the name is obtained at boot
time.
Then search through /etc, for example, for occurances of the old name, just
in case:
You can turn services on and off by the update-inetd command. For exam-
ple, to turn telnet off:
You can also manually turn services off by directly editing /etc/inetd.conf.
For example, if you have telnetd installed (not recommended) and wish to
turn it off (rather than uninstalling it) then comment out the line in /etc/
inetd.conf that starts with telnet and restart inetd:
# /etc/init.d/inetd restart
432 Networks
7 echo
9 discard This is like /dev/null but for networks. This port is
generally not needed, especially if you are worried about
attacks.
13 daytime Prints the current date as a string (e.g.,
Mon May 23 07:14:21 2001). Not generally not
needed. Can be turned off to avoid possible denial of
service attacks where an attacker may link it to the
echo port using spoofing. Also, the returned format
could be used to guess the operating system type.
17 quotd
20 ftp-data
21 ftp
22 ssh
23 telnet
25 smtp
37 time prints the current time as seconds sine the epoch in
machine readable form. This can be useful if network
clients expect the service for crude time synchronisation
(some windows clients can use this service). Otherwise
it is not generally needed.
53 domain
70 gopher
79 finger
80 http
110 pop3
111 sunrpc
113 auth The IDENT protocol. It is not useful but most IRC
servers require this port to be open and returning infor-
mation. Apparently some FTP servers and postgresql
require this service as well.
119 nntp is the Network News Transport Service if you are run-
ning a news server (e.g., inn or cnews). Otherwise it is
not needed.
60.7 Getting the Cabling Right 433
123 ntp
143 imap2
161 udp snmp Simple Net Management Protocol
194 tcp irc Internet Relay Chat
194 udp irc
220 imap3
389 tcp ldap Lightweight Directory Access Protocol
443 tcp https Secure HTTP
873 tcp rsync Efficient protocol for copying and syncing files.
2049 tcp nfs This port will advertise the export list for NFS.
2049 udp nfs Older versions of nfsd have bugs so make sure your nfs
is up to date.
3306 tcp mysql
6000 X Window System
6667 udp ircd Internet Relay Chat
8080 tcp webcache WWW caching service
32860 udp nlockmgr Not known to be a security problem but could be turned
off.
# iptables --flush
# iptables --table nat --flush
# iptables --delete-chain
# iptables --table nat --delete-chain
# iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
434 Networks
This clears the rules for filtering and then adds a rule to provide the IP
forwarding. Now we need to turn it on for the kernel:
And that’s it! This host, Modern (Section 4.10.7) will now act as a gateway
to the Internet for your local machines.
There is some setup needed to have this survive a reboot. One approach is
to do this through init.d, as explained in Section 45.2. The first step is to
create a script file called /etc/init.d/myfirewall containing:
#! /bin/sh
#
# Set up a firewall for IP Masquerading
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
case "$1" in
start)
echo -n "Starting IP Masquerading: myfirewall"
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "."
;;
stop)
echo -n "Stopping IP Masquerading: myfirewall"
echo 0 > /proc/sys/net/ipv4/ip_forward
echo "."
;;
reload)
echo "Not implemented."
;;
force-reload|restart)
60.8 IP Forwarding: Home Networks 435
sh $0 stop
sh $0 start
;;
*)
echo "Usage: /etc/init.d/myfirewall {start|stop|restart|force-reload|reload}"
exit 1
;;
esac
exit 0
On the Dell laptop Inco (Section 4.10.24) we have two Ethernet cards when
the Laptop is docked and one when not docked. The card in the Laptop itself
is identified as eth0 when not docked but as eth1 when docked, in which
case the docking station Ethernet card is identified as eth0.
The laptop’s internal Ethernet card is only used when the laptop is not
docked. Thus we can get away with configuring eth0 for both situations and
eth1 as a removable card so that it is not automatically configured when the
machine is booted!
Chapter 61
Suppose Altrop (Section 4.10.20) is the host of the home directories that are
exported to Cultus (Section 4.10.19). On Altrop install nfs-kernel-server:
/home cultus(rw)
437
438 NFS: Network File System
nfs
nfsd
You should also maintain common passwd, shadow, group and gshadow files
between the various hosts. See Section 66.1 below for details.
Suppose you have a network that is a subnet of a C class network, as with the
hosts on ktnet. They have addresses starting from 155.229.8.150 with a
netmask of 255.255.255.192. To NFS export to all hosts in this subnetwork
you can use the following:
/home 155.229.8.150/255.255.255.192(rw)
/usr/local 155.229.8.150/255.255.255.192(rw)
/edmnet/altrop 155.229.8.150/255.255.255.192(rw)
/var/lib/cvs 155.229.8.150/255.255.255.192(rw)
/var/spool/mail 155.229.8.150/255.255.255.192(rw,no_root_squash)
61.3 Root Access On NFS 439
/var/spool/mail cultus(rw,no_root_squash)
440 NFS: Network File System
Chapter 62
NT File System
Kernel 2.2.12 and beyond support read only access to NTFS, the file system
of MS-Windows/NT. The kernel needs to be configured to use it:
CONFIG_NTFS_FS=m
The various options mean: ‘ro’ mounts the file system as read-only; ‘user’
lets any user mount the file-system; ‘nohide’ shows hidden and associated
files; ’noexec’ avoids regular files showing up as non-executable.
Then create directories for the mount points:
# mkdir /nt/c
# mkdir /nt/d
# mount /nt/c
# mount /nt/d
441
442 NT File System
These will be mounted each time you reboot, unless you add the ‘noauto’
option to the appropriate lines in [NTFS]/etc/fstab.
Users are granted access to [NTFS]/nt/c and [NTFS]/nt/d through the
use of the umask=002,gid=100 in the fstab, and then add trusted users
to this group. You can allow access for only a specific user by adding
”uid=1000,gid=1000” to the options. Or you can remove all security and
give complete access to everyone with umask=000 (this is dangerous as any
login will be able to peruse your possibly private and password containing
files on the NTFS partition).
Note that permissions on the mountpoint itself ([NTFS]/nt/c are irrelevant:
when you mount a filesystem the permissions of the mounted filesystem’s
root directory replace the permissions of the mountpoint, even when the
filesystem in question does not support permissions.
If you need to transfer files from your linux partition to your NTFS partition
then Explore2fs is an option. Have a look at http://uranus.it.swin.edu.
au/~jn/linux/explore2fs.htm
Chapter 63
OpenOffice
$ openoffice
OpenOffice Writer can be used for a variety of tasks including business letters,
documentation and desktop publishing. Flexible layout and design options
make support multicolumn newsletters and brochures. Indexing can be used
for bibliographical and index entries and keywords as well as the generation of
indexes and reference tables (such as a table of contents). Groupware features
support easy collaboration with others on the same document, while keeping
track of changes. Export to HTML means you can create your own web site
with hyperlinks, frames, and image maps.
63.2 Dictionaries
443
444 OpenOffice
$ wget http://dict.progbits.com/en_GB.zip
$ cd /usr/lib/openoffice/share/dict/ooo
$ sudo unzip ~/en_GB.zip
$ chmod u=rw,go=r *en_GB*
$ sudo zile dictionary.lst
DICT en GB en_GB
$
THES en GB th_en_US
Installing Oracle on Debian involves obtaining the Oracle tar file, setting up
an Oracle user and some Oracle groups, and running the Oracle installation
software.
See http://openacs.org/doc/openacs-4/oracle.html for details.
# cd /ktnet/oracle
# tar xvf linux817.tar
# adduser oracle
Then create various groups which normal users might belong to in order to
administer Oracle.
447
448 Oracle: Commercial Database
# addgroup dba
# addgroup oinstall
export ORACLE_BASE=/ktnet/oracle
export ORACLE_HOME=$ORACLE_BASE/product/8.1.7
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
export ORACLE_SID=ora8
export ORACLE_TERM=vt100
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
umask 022
# cd /ktware
# mkdir oracle
# chown -R oracle.dba oracle
# su - oracle
$ cd /ktware/oracle
$ ./runInstaller
Partitions
Partitioning of your hard drive(s) can be as trivial as creating just two parti-
tions, one for swap and the rest for the installation and everything else—this
is the Debian default and recommendation for new users. Or it can be as
complex as creating many partitions for different parts of the system to use.
An argument for creating multiple partitions is that filling up one partition
won’t impact on other partitions (which could be a problem if the system is
unable to function properly because the disk is full). Also, corrupting one
partition (although rare) won’t affect another, thus it is good to keep the
system partition separate from the user partitions. The decision is yours.
It is useful to see where the disk is being used for an installed system. Below
we identify the usage on several systems at some specific time.
449
450 Partitions
Your computer perhaps came with MS-Windows installed and perhaps two
partitions on the hard drive, one called the C: drive and the other called
the D: drive. These are simply areas on the disk that have been allocated
to each of these “drives.” The partition essentially marks where on the disk
the boundaries are between the different drives. The raw bits associated
with each drive are then organised in some way to create a filesystem. The
C: drive and the D: drive probably have the FAT or the FAT32 filesystem.
(Under GNU/Linux these drives are usually identified as /dev/hda1 and
/dev/hda2.)
These two partitions (or however many your computer came with—perhaps
just one) will probably have been arranged to fill the whole of the hard drive,
leaving no room for any other operating system. So, if you wish to keep a
dual boot system you need to move these partitions to make room for other
partitions (with different organisations of the bits—that is, different types of
file systems).
Changing the size of an existing partition can damage the data on that
partition although by carefully following certain steps this should not happen.
Nonetheless be sure to make a backup of the current partitions if you can.
This is important if you have data on the system you do not want to lose.
The first step is to decide how much space you need for each of your par-
titions. For a 6GB hard drive you might give 3GB to Win32 and 3GB to
GNU/Linux. But this depends on how much space you are currently using.
Next, the aim is to move all of the data on the current partitions to the
beginning of the partition, then change the location of the end of the parti-
tion. The Win32 tool fips is commonly used to perform this rearrangement
of partitions.
65.3 Repartitioning MS-Windows 453
Passwords
If you forget your password for root, then you will be in a spot of bother. One
way to fix this is to reboot the machine using the Debian installation floppy
or CD. When you get the first question (about the having a colour monitor)
press CTRL-ALT-F1 to get a shell. Mount your root partition (let’s say it is
/dev/hda1):
then edit the password file to erase the encrypted password for root:
# editor /mnt/etc/passwd
NIS, which manages password file sharing among several hosts, provides the
simplest mechanism for doing this, but there are alternatives that can work
for small networks (2 or 3 machines). You can maintain the passwd, shadow,
group, and gshadow files on a server Altrop (Section 4.10.20) and copy them
across to the other machines as needed, as described below, using rdist! The
downside is that all new users should be added on the server and passwords
should be changed on the server only with the appropriate password files
then pumped out to the other hosts.
455
456 Passwords
The rdist package can be used to update files on a collection of hosts from
a central host. This is what I do from Altrop (Section 4.10.20) where the
password and group files are maintained.
On Altrop (Section 4.10.20) in /root/distfile I have the following:
Thus I have seveb hosts that are updated with seven files from altrop. The
options for install include: younger so that if the remote host has update the
files they won’t be updated from altrop, and instead I need to have a look
at them to see what has changed; chknfs so that NFS mounted files are not
updated; and savetargets so that old copies are placed in .OLD files so I can
then compare what has changed!
The command to do the update is:
# rdist -F -P /usr/bin/ssh
This will use ssh to communicate and will do it serially (-F) so that the
passwords that are asked for don’t interfere with each other!
When a new user is added (using adduser) the files need to be copied to
each of the other hosts. A simple way is to tar up the files, copy them to a
NFS mounted are (e.g., a trusted user’s home directory), log in as root on
the other host, cp the tar file to /tmp so that root can access it (root access
to the NFS mounted home directories is not permitted) and then untar it in
/etc.
This is okay for a small network! It also relies on /home being mounted by
NFS from the master (altrop). Still, I need a better solution.
66.1 Password File Sharing 457
You will be asked to name the nis domain. You can call it anything and later
edit it in /etc/defaultdomain. Let’s call it ktnet.ktware.com (it has no
formal relationship to the network domain name).
In the file /etc/default/nis set NISSERVER=master to identify caravelle
as the master server.
To restrict who can access you NIS server add your local network number to
the file /etc/ypserv.securenets
Now restart the NIS server:
You will be asked to list all of your servers (just caravelle for now).
This essentially builds the maps from the current password file on caravelle.
Note that you can’t use the nis maps on caravelle itself - don’t remove the
users from caravelle’s password file!
458 Passwords
You will be asked the name of the nis domain. You must use the name
you supplied to the master server (ktnet.ktware.com). It is stored in
/etc/defaultdomain.
Specify the NIS server address in /etc/yp.conf:
ypserver 105.229.8.170
Now edit the passwd, shadow, group and gshadow files. In passwd remove
all the users (anyone with a user id in the 1000’s) and add:
+::::::
And in shadow:
+::::::::
Then in groups and gshadow files, similarly remove the users and add:
+:::
NIS should now be working. Certainly ypcat passwd should show the users
in NIS.
Chapter 67
For Debian use pppconfig to configure your network connections. This tool
will request the appropriate information and knows about chat scripts and
PAP connections. It will ask you to name the connection you want to con-
figure, with a default name of provider. It will then generate the appropriate
configuration scripts in [ppp]/etc/chatscripts/provider and [ppp]/etc/ppp/peers/provider
(the provider in these paths is replaced with the name you supply pppcon-
fig).
The plog command will show you the ppp log which is in [plog]/var/log/ppp.log.
To watch the plog file issue the command plog -f as root or else as a user
in the group adm.
The pppconfig command allows you to configure your modem connections.
Essentially it is a front end to the various scripts in /etc/ppp. My PCMCIA
modem is loaded at /dev/ttyS1. Newer versions of ppconfig check the serial
ports for modems for you. Usually, /dev/ttyS0 corresponds to COM1 under
MS-Windows and /dev/ttyS1 corresponds to COM2.
To allow users other than root to connect through the modem (using the pon
and poff pair of commands) add the users to the Unix group ”dip”:
Then, next time user kayon logs on he will be in group dip in addition to
the other groups he was already in. He will then be able to initiate and
459
460 PPP: Networking Over Modems
terminate a dial up session. However, user kayon does not have access to the
log file through the plog command—only root does, presumably for security
reasons, since unless you inhibit it, passwords can be displayed there.
Further information on PPP is available from
This is the Gnome applet I use for modem access. After adding a user to
the ”dip” Unix group they can use this applet to dial the modem, display
transfers, and to hangup. Under properties I had to change the connect
and disconnect commands to be pon and poff rather than pppon and pppoff
(which don’t exist — perhaps this is a ”problem”). The newer Potato version
of the applet had the defaults correct.
Chapter 68
Presentations
68.1 Beamer
68.2 Prosper
461
462 Presentations
68.4 KPresenter
Chapter 69
Printing
CUPS is a newer printing system and may become the preferred printing sys-
tem for Unix and GNU/Linux. It uses PPD (PostScript Printer Description)
files to identify the features of a printer. This allows printer configurations to
be maintained and provides access to the printer options through the com-
mand line. It also has client side filters to convert, for example, PDF to
PostScript to avoid the dreaded raw output of PDF.
If you have CUPS set up already on a server, and you generally have the
same environment on your desktop machines, when setting up a new host,
simply install the packages listed above. Then copy over the appropriate
configuration files:
# cd /etc/cups
# scp ktw:/etc/cups/printers.conf .
# scp ktw:/etc/cups/ppd/* ppd
# chmod o+r ppd/*.ppd
463
464 Printing
Always keep your configuration up to date on the server, perhaps using the
web interface via []http://ktw:631/. (If you use instead the command line
interface with the command lpadmin then you also need to copy lpoptions
across.) A convenient way to keep the configurations consistent is with rdist
(see Section 66.1.1 for an example).
Name: lp0
Location: Richard’s Desk
Description: HP LaserJet 1200
Device: AppSocket/HP JetDirect
URI: socket://hplj:9100/
Make: HP
Model: HP LaserJet 1200 Series PS (en)
If you are using the web interface and now go to the printer and get a
permission denied error, chances are it is because your browser is going to
bartok.act.ktware.com rather than localhost. You can edit /etc/cups/
cupsd.conf to give permission for all local hosts (since in my setup I have
printers configured on the server then use rdist to distribute the configuration
to all clients):
<Location />
...
Allow From 192.168.0.*
</Location>
...
<Location /admin>
...
Allow From 192.168.0.*
</Location>
You could use .act.ktware.com instead to allow access from any host in
your domain. Then restart the cupsys daemon:
69.1 CUPS - Common Unix Printing System 465
Print a test page to make sure it works. Also, go into Configure Printer to
set Page Size to A4, and any other default settings, like duplex printing.
# cd /usr/share/cups/model
# foomatic-datafile -t cups -d hpijs -p HP-PSC_2210 > HP-PSC_2210-hpijs.ppd
# wajig restart cupsys
Then the printer is listed as Make Hewlett-Packard (not HP) in the web
interface to CUPS. Simply choose it.
# /usr/bin/enable lp1
You can also simply use the command line to administer the printers. You
can add a network printer enable the printer with:
# lpoptions -p lp7 -l
$ lp -o HPNup=TwoUpL sample.pdf
$ lp -o HPwmText=Draft odbcmine.pdf
# cd /usr/local/bin
# ln -s /usr/bin/rlpr lpr
# ln -s /usr/bin/rlpq lpq
# ln -s /usr/bin/rlprm lprm
To specify the pinter on which to print you need to include in the printer
name the print server host, as in -Plp1@artz.ktware.com. This can be
improved on by creating a /etc/rlprrc file with something like:
Make sure the protections on the file allow everyone to read the file. Then
when specifying a printer, simply mention its name, as in -Plp1 or set the
PRINTER environment variable to "lp1".
468 Printing
Chapter 70
Python
All python packages are self documenting, and the documentation can be
obtained using the pydoc command:
$ pydoc csv
469
470 Python
We can now install either RSPython or RPy. Both provide a Python in-
terface to R, and RSPython also provides an R interface to Python while
RPy is generally easier to use than RSPython! RSPython is not packaged
for Debian yet, but RPy is.
$ wget http://www.omegahat.org/RSPython/RSPython_0.5-1.tar.gz
This command, executed as the root user has then installed the required files
into /usr/lib/R/library/RSPython. To communicate where the files are
installed to Python we need to set up three environment variables (a Debian
package would probably set this up so that these extra environment variables
are not required), and then run Python and try out some RSPython calls:
$ export R_HOME=/usr/lib/R
$ export PYTHONPATH=${R_HOME}/library/RSPython/Python
$ export PYTHONPATH=${PYTHONPATH}:${R_HOME}/library/RSPython/libs
$ export LD_LIBRARY_PATH=${R_HOME}/bin
$ python
70.2 Python and R: Python Interfaces to R 471
If you get:
$ python
>>> import RS
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/R/library/RSPython/Python/RS.py", line 1, in ?
import RSInternal
ImportError: /usr/lib/atlas/libblas.so.2: undefined symbol: e_wsfe
>>>
$ python
Python 2.3.1 (#2, Sep 24 2003, 11:39:14)
[GCC 3.3.2 20030908 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from rpy import *
>>> l = [r.dchisq(x, 4) for x in r.seq(0, 10, by=0.1)]
>>> r.par(ask=1, ann=0)
{’ask’: 0, ’ann’: 1}
>>> r.plot(l, type=’lines’)
Hit <Return> to see next plot:
>>> r.dev_off()
{’null device’: 1}
>>> ^D
$ cd /tmp
$ wget http://easynews.dl.sourceforge.net/sourceforge/rpy/rpy-0.2.tar.gz
$ tar zxvf rpy-0.2.tar.gz
$ cd rpy-0.2
$ sudo python setup.py install
$ sudo emacs -nw /etc/ld.so.conf
Add the line:
/usr/lib/R/bin
$ sudo ldconfig
$ python
Python 2.2.1 (#2, Sep 7 2002, 15:35:22)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from rpy import *
>>> l = [r.dchisq(x, 4) for x in r.seq(0, 10, by=0.1)]
>>> r.par(ask=1, ann=0)
>>> r.plot(l, type=’lines’)
>>> ^D
$ cd ..
$ sudo rm -rf rpy-0.2*
$ python
>>> from rpy imprt *
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "rpy.py", line 24, in ?
import _rpy
ImportError: /usr/lib/atlas/libblas.so.2: undefined symbol: e_wsfe
>>>
However, more recently this packages is actually required to run R and rpy!
With version 0.3.1 of rpy I get the following (11 Aug 03):
> python2.2
Python 2.2.3+ (#1, Aug 10 2003, 10:11:23)
[GCC 3.3.1 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpy
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/rpy.py", line 24, in ?
import _rpy
ImportError: /usr/lib/python2.2/site-packages/_rpymodule.so:
undefined symbol: jump_now
>>>
R: Statistical Software
71.1 Graphs
475
476 R: Statistical Software
> python
>>> from rpy import *
>>> l = [1,2,3,4,5,4,5,3,6,2,3,4,8,2,1]
>>> r.postscript("rplot01.eps")
>>> r.plot(l, type=’b’, xlab="Days", ylab="Services")
>>> r.dev_off()
8
7
6
5
Services
4
3
2
1
2 4 6 8 10 12 14
Days
r.png("rplot02.png")
r.par(cex=1.5)
r.plot(death6m, type="b", xlab="Month", ylab="Percentage",
lty=1, pch=0, axes=False)
r.lines(death30, type="b", lty=2, pch=1)
r.box()
71.1 Graphs 477
os.system("gv rplot02.png")
#!/usr/bin/env python
ext = ’fig’
if len(sys.argv) > 1: ext = sys.argv[1]
dev = {’eps’ : (r.postscript, ’gv’), ’pdf’ : (r.pdf, ’xpdf’),
’png’ : (r.png, ’display’), ’fig’ : (r.xfig, ’xfig’)}
fn="rplot03." + ext
dev[ext][0](fn)
r.postscript("rplot04.eps")
r.pie(percs, labels=labs)
r.dev_off()
os.system("gv rplot04.eps")
480 R: Statistical Software
Chapter 72
To set up an rsync server simply install the rsync package then copy /usr/
share/doc/rsync/sample-rsyncd.conf.gz to /etc/rsyncd.conf. Edit it
to perhaps turn logging on:
log file=/var/log/rsyncd
...
transfer logging = yes
Make sure that port 873 is allowed through your firewall. Add the following
line to /etc/inetd.conf:
$ rsync datamining.csiro.au::
debianbook Graham’s Debian GNU/Linux Survival Guide
481
482 Rsync: Remote Files
For each module (debianbook in the above) you identify a it’s configuration,
including a path to where it lives, for example:
[debianbook]
$ rsync datamining.csiro.au::debianbook/
To have your local server start up at boot time add the following to /etc/
inetd.conf:
After editing the /etc/rsyncd.conf file be sure to send the process a HUP
signal.
Chapter 73
Samba
Note that the default installation provides access to user homes straight out
of the box.
483
484 Samba
Chapter 74
Scanning
The usual GNU/Linux scanner interface is called sane (Scanner Access Now
Easy).
# ptal-init setup
Probe parallel (n)
Probe USB (y)
Setting up as "mlc:usb:PSC_2200_Series"
# wajig restart cupsys
Reconfigure cupsys printer at http://localhost:631
For the URI choose ptal:/mlc:usb:PSC_2200_Series
Note that the hpoj daemon is the one to start/stop when changing hpoj
options.
Test it works as a user:
> ptal-devid
MFG:Hewlett-Packard;MDL:PSC 2200 Series;
CMD:MLC,PCL,PML,DW-PCL,DYN;CLS:PRINTER;
1284.4DL:4d,4e,1;SN:MY32AF320G0G;
S:0380008084021000002c148005cc250005c;AiO:0;
485
486 Scanning
If permission problems (printing works just fine but can’t access the device
for scanning etc.), then try:
# insmod scanner
If you still have problems, try disconnecting the USB scanner and plug it
back in.
Chapter 75
Science
75.1 Chemistry
487
488 Science
Chapter 76
Security
You can protect against just anyone booting your system into Linux by dis-
abling booting from floppy disk and CD-ROM in the BIOS, and by password
protecting LILO.
# nessusd -D
Note that this daemon is not automatically run within the /etc/init.d
framework.
As a user start up the nessus client and login with your user name. Go to
the Target selection tab and type in a list of hosts you wish to check, comma
489
490 Security
separated. If you want to test all machine on your network, try something
like 192.167.0.1/24.
After you click Start the scan the checking is initiated. Eventually a report
will be presented. You can save the report in various formats, including
LATEX.
The testing is extensive and the report provides suggestions for eliminating
security holes.
The chkrootkit package provides the chkrootkit command to check for signs
of rootkits on the local system. Run the command as root and scan the
output for warnings.
# chkrootkit
ROOTDIR is ‘/’
Checking ‘amd’... not found
Checking ‘basename’... not infected
Checking ‘biff’... not found
Checking ‘chfn’... not infected
Checking ‘chsh’... not infected
Checking ‘cron’... not infected
Checking ‘date’... not infected
Checking ‘du’... not infected
Checking ‘dirname’... not infected
Checking ‘echo’... not infected
Checking ‘egrep’... not infected
Checking ‘env’... not infected
Checking ‘find’... not infected
Checking ‘fingerd’... not found
Checking ‘gpm’... not found
Checking ‘grep’... not infected
Checking ‘hdparm’... not infected
Checking ‘su’... not infected
Checking ‘ifconfig’... not infected
Checking ‘inetd’... not infected
Checking ‘inetdconf’... not infected
Checking ‘identd’... not found
76.3 Check Security with Chkrootkit 491
Note that with current versions of ps and chkrootkit (as of 3 December 2003),
ps reports the PID of some kernel processes as 0 which chkrootkit does not
match to the process. Output from ps is:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
76.3 Check Security with Chkrootkit 493
# chkrootkit -x lkm
ROOTDIR is ‘/’
###
### Output of: ./chkproc -v -v
###
PID 3: not in ps output
CWD 3: /
EXE 3: /
PID 4: not in ps output
CWD 4: /
EXE 4: /
PID 5: not in ps output
CWD 5: /
EXE 5: /
PID 6: not in ps output
CWD 6: /
EXE 6: /
PID 7: not in ps output
CWD 7: /
EXE 7: /
You have 5 process hidden for ps command
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 32
Groups:
SigPnd: 0000000000000000
SigBlk: ffffffffffffffff
SigIgn: 0000000000000000
SigCgt: 0000000000000000
CapInh: 0000000000000000
CapPrm: 00000000ffffffff
CapEff: 00000000fffffeff
There are some tools to check who is portscanning your machine and when.
A good tool seems to be ippl, the IP Protocols Logger, but others include
snort and portsentry.
In kernel 2.4 iptables has a mechanism for portscans where you can set it up
so that most portscans will take hours to return nothing.
• fingerd
• ftp-server
76.5 Packages to Avoid 495
• ftp: Users will try to ftp to remote hosts and log in using clear text
passwords. Run dsniff on the local machine as root to see that you can
easily capture their passwords!
• ftpd
• netkit-rpc
• nfs-common
• nfs-kernel-server
• nfs-user-server
• portmap
• rsh-client: Users will try to rsh to remote hosts and log in using clear
text passwords. Run dsniff on the local machine as root to see that
you can easily capture their passwords! The ssh package will install a
replacement rsh.
• rsh-server
• rstart
• rstartd
• rusersd
• rwalld
• sendmail
• talkd
• telnet: Users will try to telnet to remote hosts and log in using clear
text passwords. Run dsniff on the local machine as root to see that you
can easily capture their passwords!
• telnetd
496 Security
Install the GNU Privacy Guard package in Debian as gnupg. This is the
GNU implementation of the OpenPGP.
To automatically check signatures from a keyserver add the name of a key-
server to /home/kayon/.gnupg/options file. For example:
keyserver wwwkeys.au.pgp.net
You need a User-ID to identify your key; the software constructs the user id
from Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Comment:
This generates:
mQGiBD6Le6QRBACa0Di6Gcx4Q3Tpghl+hu/geCBRaZUZlMxbx0yxxOgsoOb/SMzP
NNNG5IdMVKrV60X8jwzCi/tx3QdKps9hE+kNESW472LDEUdbDLjxDMajyfW16k2r
sxkvW3iiyQeO8catYdUm4Qt5SoU/X1/U1PGurSzC9jeMcnB5UThQ6tGs+wCg6Qgq
X5NCHtzpKPWU06I7trfSEpsD/1+w3g5+qjy+s3jj+gUf3kELY1NMyrvGnsb5D8ns
y9mXA35QnRGh+66gGYS5JSPB4eZLz/p6E4cum8M8UiFFIYuzdN8mec4hoT8MD1Eg
+WT1S3L6337k0S+p0ePaTVFQuZw7p0O9UX1xlqCsvFXqlsQSy9ZG+2AB4wg5zR25
vnEvBACBB+js3IbvXyWsDRcEsgYHm0whA+rB0cOgYW0VxdpdgLOwhm71TAbR8KDS
icbM8raWwFlA/8m5z/0CMo6izm7pI3lDUmXsrE8qsJvHawMd+Vvt5XAwEB3yonWU
o6lHvZKROZuyNM5I2pT2i331Ukwbg42cRG75HD2LZnrV6CuitLQuR3JhaGFtIFdp
bGxpYW1zIDxHcmFoYW0uV2lsbGlhbXNAdG9nYXdhcmUuY29tPohZBBMRAgAZBQI+
i3ukBAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCeP1CyW4KdSwVEAJ9XbkhnzcYojuII
vsX3JkCK8De3qQCgqY8bbuCJyW5Ky1bPfd3mpEliObS5AQ0EPot7pRAEAIXoJqCf
mWpUasWeeNICVVwM30urggwXHnOjAcKkBN8uJGK6WeHlFNJmFfd4D5bHny6sJw7X
QiYZKlAwFULct55DwS/GUuko1wtPOXS1jmC3XbkzBXpWE05PgP+7BOXkZdimPm+g
xZdeG/GjGGg3HVMHY13xCe0C73Ou0gKSfidrAAMFA/9VrkDyPgYNgWEKfpgqkJHD
TX5cmy5Q1gKFEEKRnJGMhm8UauHIBX3SzlYylguHNFEfITPqOxNbYeMgaDwL6/7h
HVegv5o93bUkqE88J3q5t0EZDRlE2yoL6vcaqyDdwhAGmwGoT2lUk9DrbIwJGmZD
a6BPHIQ23Q2Av/+zl0qLI4hGBBgRAgAGBQI+i3ulAAoJEJ4/ULJbgp1LjhUAniKX
qE3SGxCAVFUeIrKHk/pYqyTVAJ9WkJ31FxQWBmmw81dxsdAslDFxkg==
=nrTb
-----END PGP PUBLIC KEY BLOCK-----
76.7 Securing Your Network 499
To put your public key on to one of the public key servers (so others can
access it) you can do:
The key is also now at other servers without any extra effort:
If you use a switch-network and put MAC address filters on the switch an
attacker can simply unplug an existing PC or Laptop and take over its MAC
address.
Normally the MAC address is in the ethernet card. A typical situation is
to plug a Laptop into a network and perhaps bring up the interface using
DHCP to get an IP but may not be able to do much more.
In some situations the MAC address can be set in software. DECnet, for
example, depends on being able to do this. Older suns had the MAC in
battery-backedup ram and used the same address for all ethernet cards in the
system. When you change the 48 bit MAC address you are actually turning
it into a customised MAC address which will be 96 bits long consisting of
the original 48 bit MAC followed by the new 48 bits you set. To the outside
it appears as another MAC address.
You can change the MAC address with:
Turning off DHCP will help protect against users that plug in a Laptop but
not the hackers you’re trying to guard against.
FROM http://www.linuxlock.org/features/somjuly00.html
LinuxSecurity.Com wins Source of the Month for July, 2000
This month’s LinuxLock.Org Security Source of the Month goes to a group
of individuals dedicated to bringing security to the fore-front of the linux
community; this is the staff of LinuxSecurity.Com. Since we started following
the site in January 2000, it has evolved into one of the internet’s premiere
sources of Linux Security Information.
LinuxSecurity.Com contains a large newsfeed, of linux security news, articles,
and press releases, to keep us on top of the industry.
This month pushed them over the top, when they released The Linux Secu-
rity Quick Reference Guide. This guide is a printable PDF document with
numerous security checks and tips, some of the sections include Linux Kernel
Security, File Permissions, Intrusions Detection, Linux Security Resources,
and more.
LinuxSecurity.Com has provided original features every month, covering things
such as, how to use certain security tools, and interviews with Security
76.8 Identifying Your System? 501
is not really a security risk. Serious attacks will attempt all know vulner-
abilities of the port, irrespective of what is running behind the port. Thus
this is not regarded as sensitive information. On the other-hand, hiding the
banner loses a lot for inter-operation.
502 Security
Indeed, software should advertise its version number to aid debugging in all
kinds of circumstances. If there’s a security flaw then the flaw should be
fixed instead of trying to hide it.
Chapter 77
Sketch
503
504 Sketch
Sound Recording
Recording from the sound card of your computer opens up the possibility of
recording from external sources including your old Long Playing turntable—
turn that old collection of vinyl into a collection of audio CDs.
The Gnome sound recorder comes from the gnome-media package. A com-
mand line application sound-recorder provides an alternative method of record-
ing sounds.
The rawrec package provides a useful command line recorder and might be
used to record to a 320kbps mp3 as in:
505
506 Sound Recording
The gramofile application is more useful for recording from vinyl LPs, for
example. It also supports track splitting and filtering to remove thr tradi-
tional vinyl ‘pop’. For editing the sound signal use the graphical audacity
application.
Sound recording applications rely on proper settings within the audio mixer.
With the mixer you can select the source for the recording (line-in or micro-
phone) and the level of Gain for the recording. The mixer is also used to set
output volume levels.
There are multiple possible sources for recording, including Line-In and Mi-
crophone. If the source is an external multitrack mixer or HiFi then plug it
into the Line In and set Line as the Rec source. Note that both the line level
and IGain need to be set appropriately, perhaps after some experimentation.
Setting the gain too high results in clipping and setting it too low means
that noise in the source can overwhelm the signal.
There are various tools to set the levels of various channels. Gnome Audio
Mixer is available under Programs→Multimedia, providing a graphical inter-
face to mute/unmute channels and to select the channels for recording.
A command line alternative is the aumix command from the aumix package.
You can query the current setting of the line-in and input-gain with:
Here the line-in is selected for recording with 100% level. The gain is set at
30%. These work for my sound card.
Alternatively you can get all the current settings with:
78.4 Using Gramofile 507
$ aumix -q
vol 62, 62, P
pcm 63, 63
speaker 79, 79
line 100, 100, R
mic 62, 62, P
cd 100, 100, P
igain 30, 30
line1 0, 0, P
line2 0, 0, P
phin 0, 0, P
phout 0, 0
video 3, 3, P
To set the line-in and gain to the above values and for recording from line-in:
With aumix-gtk installed aumix will start up a graphical display that allows
setting the values interactively.
This is, currently, by far the simplest tool to record from gramophones, with
a usable but unsophisticated interface.
Consider a sample record: Kraftwerk’s Computer World, side 1. Line-in
is set to 100 and igain is 30. From gramofile’s recording meters this setting
rarely (0.3%) exceeds 50% maximum volume level, which is perhaps too low?
Nonetheless the result sounds okay.
The automatic track finder only found 3 (instead of 4) tracks (but only when
the minimum gap is set to 5). Listening to the Track 3/4 changeover it is
clear why—there is no gap. However, the .tracks file that is written can
be edited by hand and then the audio processing can be deployed to split
the file into tracks. The filtering includes Conditional Median Filtering to
filter out ticks. Mostly works just fine and is the default, so use it. Loading
the resulting 4 tracks into xmms works just fine (the original WAV file has a
508 Sound Recording
header that says it is 100 minutes long but this can be fixed within gramofile
by choosing to process the audio signal and using the Copy Only filter).
To record the resulting files to an audio CD see Chapter 14.
1. Gramofile to record from the sound card through line in from the source
(e.g., LP record)
3. Audacity to confirm and fine tune the track splits stored in the .tracks
file.
4. Gramofile to perform the split into tracks and to filter out pops using
the Conditional Median Filter II. The tracks are saved into separate
files numbered 01, 02, etc.
5. Xmms to check the beginning and ending of each track to confirm the
splits were fine.
6. Audacity to edit out any remaining spikes in each track, being sure to
export back to WAV if any changes are made.
CD_DA
TRACK AUDIO
FILE "side1001.wav" 0
TRACK AUDIO
FILE "side1002.wav" 0
...
TRACK AUDIO
FILE "side2005.wav" 0
Then
When recording using the Gnome Sound Recorder the first 10 seconds of the
recording are chopped off? Might be better to use sound-recorder.
The options set stereo recording (-c 2), 16 bit sampling (-b 16), prior-
ity threading (-P) to ensure high priority in CPU usage, and limiting the
recording to 5 minutes. The output is written to the file recording.wav.
Many of these options are the default so you can simply:
$ sound-recorder -P recording.wav
Spell
For the older standard ispell, to change the default dictionary use the update-
ispell-dictionary. You will be offered a choice if the appropriate packages
are installed. This is being replaced by aspell.
For the newer aspell you can choose your default dictionary by specifying it
in /etc/aspell.conf:
master british
511
512 Spell
Chapter 80
# adduser splus
# su - splus
$ cd
$ umask 022
$ tar zxvf splus.tz
$ ./HOSTINFO
Email the code and your SPlus serial number and server name to SPlus
By return mail you will get a license key
$ ./CONFIGURE
Select 4: Destinations and Name of Splus Script
Select 2: Name of Splus shell script "Splus"
Change to "splus" to make life easier for everyone
The script to start Splus will be installed in /usr/local
$ ./INSTALL
Enter the key when prompted
Then fails with:
cp: cannot create regular file ‘/usr/local/bin/splus’:
Permission denied
So:
$ su
# ./INSTALL
y to CONFIGURE
# chmod go+rx /usr/local/bin/splus
Should now be installed!
513
514 SPlus: Statistical Software
Chapter 81
Spruce: Email
This is not Gnome, but it is GTK+ and supports multiple POP accounts.
515
516 Spruce: Email
Chapter 82
The Secure Shell (provided by the ssh package) provides a secure mechanism
for communicating with remote hosts on a network. Unlike traditional tools
such as rsh, rcp, rlogin, telnet, and ftp, ssh encrypts all communications,
including passwords, reducing the opportunity for inappropriate interception.
It can also be used to encrypt your pop (email) communications and protect
you from DNS and IP spoofing where remote machines pretend to be genuine
machines that you are wanting to connect to. Implementations of ssh exist
for most of the major operating systems.
A Finnish company developed the original ssh but copyright and patent issues
lead to the development of the free OpenSSH.
There are two major (and slightly incompatible) versions of ssh: 1.X and 2.X.
From a 2.X client you will not be able to connect to a 1.X server. Connecting
to an OpenSSH 2.X server from any version of the client is supported though.
82.2 Installation
517
518 SSH: Secure Communications
Having made this addition you can update the information about available
packages and then retrieve, unpack, and configure the package with:
During the install you may be asked about installing ssh as setuid root. The
suggestion from the configuration script is that you do not install as setuid
root and if you have problems, then run dpk-reconfigure ssh to reconfigure
the package.
When you use ssh to connect to a remote host for the first time you will be
confronted with a message like:
SSH does not know this host. Type yes to add the fingerprint of this host
to ~/.ssh/known_hosts. Next time you connect to this remote host you
should not get this message.
Ssh is a client-server program where your client (on your local host) connects
to a remote ssh server (running on the remote host), requiring that ssh be
installed on both hosts. (Many systems now run ssh.) You need to know the
82.5 Public and Private Keys 519
password of the account you wish to connect to on the remote host. Once
connected all communications between the two hosts is securely encrypted.
Connect to a remote host simply by issuing the appropriate ssh command.
To connect as user kayon to a remote host altrop.ktware.com or to copy files
from your local host to kayon’s account at the remote host you can simply:
$ ssh kayon@altrop.ktware.com
$ scp file.name kayon@altrop.ktware.com:remote.file.name
> cd .ssh
> cat id_dsa.pub.modern >> authorized_keys
> exit
520 SSH: Secure Communications
The remote host may already have an authorised keys file in /home/kayon/
.ssh/authorized_keys. Don’t copy over it, but append the contents of your
local /home/kayon/.ssh/identity.pub to it. Multiple keys can appear in
the one file.
Now, when you connect to the remote host using ssh your public key on
that host will be used to send an encrypted message (a random number in
fact) back to your local host. The local host decrypts the message using the
private key stored only on the local host and decrypted using the passphrase.
The decrypted message is returned to the remote host for verification.
This method, using public keys, does not send passwords (or passphrases)
over the network. A passphrase is used on the local host only to unlock the
local private key.
Entering the passphrase every time you want to do a remote copy or make
a remote connection can be tiring. There is a simple mechanism provided to
avoid this. All you need do is to start up a shell or other similar command
that already knows what your passphrase is (by you telling it just once).
This is done with ssh-agent to start the shell and ssh-add to store the
passphrase for this shell:
The ssh-add will prompt you for your passphrase but from then on all further
interaction with the remote host will not require the passphrase again.
The -l option of ssh-add lists the key(s) currently kept in memory for this
ssh-agent. The -d option removes an identity from memory.
82.7 DSA Key Generation 521
$ ssh altrop
$ cd .ssh
$ cat authorized_keys2.inx >> authorized_keys2
$ exit
Be sure the protections on the files do not permit others to access them. In
particular, ssh won’t work if the /home/kayon/.ssh/authorized_keys is
writable by anyone other than the user.
The passphrase to unlock your private key can be changed at any time with:
$ ssh-keygen -t dsa -p
This does not change your private or public key at all so no further action is
required in terms of distributing your public key.
522 SSH: Secure Communications
Rsync is used to efficiently copy files across the network. It can use ssh to
perform it’s tasks by setting the appropriate environment variable:
export RSYNC_RSH=ssh
The default Xsession on Debian is run with ssh-agent so that ssh connections
can be initiated more easily (after you have performed an ssh-add). This is
controlled by the file /etc/X11/Xsession.options:
use-ssh-agent
You can have your ssh passphrase asked for each time you log on. Using
gdm and the Debian Session (rather than the Gnome Session) will load the
/home/kayon/.xsession file which can contain:
#!/bin/sh
ssh-add .ssh/id_dsa < /dev/null
exec gnome-session
$ ssh -X plymz
Or else you can turn it on for all connections to a particular host by adding
the following line to /home/kayon/.ssh/config:
82.11 SSH Tunnelling 523
Host plymz
ForwardX11 yes
Or even more generally allow X Window System forwarding through all con-
nections:
Host *
ForwardX11 yes
$ telnet lynx.ktware.com 22
You will either receive a message stating the version of the remote ssh server
or an error message similar to:
$ ssh -f [kayon@altrop]
-L [local port]:[altrop]:[remote port] [command]
524 SSH: Secure Communications
Then you can access this firewall protected HTTPS server locally through
https://localhost:5443/.
Here’s an example using POP:
Then you can access the POP server on your local machine.
# cd /var/www
# ln -s /usr/share/mindterm/ ssh
which makes it immediately available (assuming you are running a http server
such as apache).
This supports both the external ssh pop up window and the internal (to
the browser) ssh window. No problems with terminal types here. Although
the default internal terminal is a bit too narrow for my liking. I extend it
82.14 SSH Version 1 525
<applet archive="mindterm.jar"
code=mindbright.application.MindTerm.class
width=850 height=400>
<param name=fn value="blah">
</applet>
HostKey /etc/ssh/ssh_host_key
--with-exempt=sudo
--with-secure-path="/usr/local/sbin:/usr/local/bin:/usr/sbin:...
527
528 SUDO: Root Access
Chapter 84
Swap
If running out of swap you can add 257MB more. First have a look at what
you have available:
# free
total used free shared buffers cached
Mem: 256216 252208 4008 118100 56996 46944
-/+ buffers/cache: 148268 107948
Swap: 224900 51268 173632
# mkswap /extra-swap
Setting up swapspace version 1, size = 268431360 bytes
# swapon /extra-swap
529
530 Swap
# free
total used free shared buffers cached
Mem: 256216 252448 3768 118100 56996 46944
-/+ buffers/cache: 148508 107708
Swap: 487036 51268 435768
# swapoff /extra-swap
Then on boot when swapon -a is run the new swap will be added to swap
space.
Chapter 85
Themes
85.1 Enlightenment
Head over to e.themes.org, and find the themes you like. Download them,
and put them in ~/.enlightenment/themes. Then, restart Enlightenment
(use the left-click menu). Now, you can choose your new themes from the
middle-click menu. It’s really pretty simple... I wouldn’t worry about apt-
getting that sort of thing (if you even can). There is supposed to be a tool
that will automatically update your themes, but last time I checked, it was
in the alpha stages. Can’t recall what it was called, sorry...
531
532 Themes
Chapter 86
USB
The USB port is well supported in Debian. USB allows plug-n-play func-
tionality of many devices. Installing hotplug (or the older usbmgr) will install
a daemon that monitors the USB ports and install the appropriate mod-
ules when devices are plugged in, while also noting when they are removed.
The usbview command will display the tree of USB devices connected in a
window, while the lsusb command lists in a terminal the usb devices. The
usbmodules command will list the drivers that might be able to manage
interfaces on currently plugged in USB devices.
For USB devices simply connect them to the USB socket and hotplug will
notice the new device and load the appropriate modules. (The alternative
usbmgr daemon will beep twice as it notices new devices.) The lsusb com-
mand will show that the device is recognised. What happens next depends
on the type of the device.
533
534 USB
The standard Mass Storage Device protocol is used for USB devices such
as hard disk drives, flash memory drives, memory card readers, and digital
cameras. Such devices have a standard VFAT (MSWindows) file system.
The USB mass storage device is treated as a SCSI device so simply mount
the SCSI device:
You should now be able to see and use the device as any other disk. If you
already have a SCSI device then the USB device might be /dev/sdb1!
The kernel module usb-storage drives USB mass storage devices and should
be automatically loaded by hotplug. The kernel module vfat is also required,
and if it does not autoload then you will need to:
# modprobe vfat
You can run dmesg to check that the USB device has been found.
A sample setup of four USB devices includes a USB mouse, HP Printer/Scanner/Copier
with a card reader, a digital camera, and a flash memory drive (3System USB
flash disk). The /etc/fstab includes:
Then any user can mount, for example, /hpcard, when a memory card has
been inserted into the card reader. A problem is that unless the camera is
connected before the flash drive after a reboot, the mappings end up being
reversed!
The devices look like any other hard drive device so you can run fdisk on it
and reorganise partitions:
# fdisk /dev/sda
86.2 Mass Storage Devices (DVD Writer) 535
You can also format the partition(s) on the device, usually with a DOS/FAT
filesystem:
# mkdir /camera
The camera acts just like a mass storage device! Photos can be copied or cut
from the appropriate folder and saved to your hard disk.
# mkdir /dvdrw
With cdrdao and cdrecord the CD write functionality works just fine:
Note that dvdrecord does not appear to be actively maintained. Also, this
dvdrecord command will fail for a DVD+RW (it only works for DVD-
RW presently), so use the dvd+rw-tools instead. This package is actively
maintained and also supports DVD-R(W). Format the DVD+RW with:
# dvd+rw-format /dev/scd1
Now growisofs is meant to work but failed with this particular drive with a
message indicating that the drive does not support TAO (Track At Once)
mode.
# growisofs -Z /dev/scd1=cdimage.raw
# cd /dev
# MAKEDEV usb
# enscript -o - ~/.profile > /dev/usb/lp0
# cd /dev
# MAKEDEV usb
Install the packages for the printer: hpoj hpijs hp-ppd sane xsane mtools
hpoj-xojpanel. Install packages for printer queueing: cupsys cupsys-bsd
cupsys-client. Perhaps also foomatic-bin. Make sure the module printer
is loaded:
If the printer module does not get loaded at boot time then add it to
/etc/modules.
538 USB
Chapter 87
Video
This chapter reviews software for viewing and modifying Video, and the set
up of software for particular video chip sets.
# ln -s /dev/hdc /dev/dvd
There at least five video players available for Debian: totem, xine-ui, mplayer,
ogle, and vlc.
There are considerable uncertainties in the legal situation with respect to the
position of the US movie studios. Certainly illegal copying of DVDs is to be
539
540 Video
avoided, but unfortunately the CSS copy protection scheme (used on DVDs)
has become a view restriction scheme, thereby, according to many, restricting
freedom of speech. Thus the required library to read many commercial DVDs
needs to be obtained separately.
# sh /usr/share/doc/libdvdread2/examples/install-css.sh
87.2.1 Xine
87.2.2 Ogle
You can extract sound from a DVD, one track at a time or a chapter at a
time. Some simple command line examples should suffice to demonstrate
how this is done.
First off place the DVD into the DVD drive! This should probably be iden-
tified as /dev/dvd. Have a look at its table of contents with the lsdvd
command:
87.2 DVD Videos 541
> lsdvd
libdvdread: Using libdvdcss version 1.2.5 for DVD access
Title: 01, Length: 02:32:44 Chapters: 26, Cells: 27, Audio streams: 02, Subpictures: 01
Title: 02, Length: 00:17:36 Chapters: 02, Cells: 02, Audio streams: 01, Subpictures: 00
Title: 03, Length: 00:00:11 Chapters: 02, Cells: 02, Audio streams: 01, Subpictures: 00
Longest track: 1
This DVD has three titles, the first one (Title 01) probably contains the main
material, as it is identified as being the longest track. It also has two audio
streams.
To capture the audio from the tenth chapter of the first title, saving it as
OGG format, the command line is simply:
The arguments identify the input as /dev/dvd (-i), the type of input as
DVD (-x), the title, chapter, and angle to encode, in this case being title
1, chapter 10, and camera angle 1 (-T), the audio track is track 0 (-a), the
output format is OGG (-y, and the output filename is track10.ogg (-m).
To extract multiple chapters from a title you can do the following composite
command:
for i in ’1 2 3 4 5 6 7 8 9’; do
echo transcode -i /dev/dvd -x dvd -T 1,$i,1 -a 0 -y ogg -m track0$i.ogg;
done
To extract the whole audio track of a title (all chapters) as OGG audio:
The video-dvdrip packages provides tools for working with DVD videos. With
this tool you can make backup copies (in numerous compressed video for-
mats) for personal use of videos that you own. Or you could copy the video
onto your hard disk for archiving and watching directly. You’ll need lots of
disk space (a movie DVD contains up to 9GB and converting needs further
disk space).
The dvdrip command provides an intuitive interface and reminder of all the
vast array of options available. Generally, load your DVD, go to the RIP
Title table and obtain the table of contents. The largest one is usually the
movie! If you are space restricted (less than 10GB say) you may like to do
one or more chapters at a time. You can then begin the rip to produce a
.vob file.
You have many choices for the format you would like to convert to.
Here’s a recipe for generating an SVCD backup copy of your own DVD -
DVDs are expensive and a backup can save the heartache of a bad scratch.
The first step is to copy the video data from the DVD. You can use either
cpdvd:
or dvdbackup:
Set the target for ripmake to be avi (generally thought to be a better format
and okay if you only view on computer, but there aren’t many, if any, DVD
players that can play an AVI file, although for backup you could regenerate
the DVD and thus if you lose or damage your original at least there is some
hope):
To adjust the synchronisation of the adio, where the video appears to lag
behind the audio:
87.4 DVD-AUDIO
Use mencoder-686. Convert all images to the same size first. (What’s the
best size? Should I crop or rescale?)
Then transcode to SVCD and burn to CD. So far I do the following. But
this gives 1 frame per second. Can’t seem to slow it down?
Load "GLcore"
Load "dri"
and to replace:
Driver "nv"
with
Driver "nvidia"
If the package for your kernel is not available yo ucan compile your own.
The process of installing the video drivers for GEForce 256 (Velox (Sec-
tion 4.10.26)) and TNT2 (Mint (Section 4.10.27)) is straightforward. Note
that this is no longer required for standard Debian kernels which supply the
nvidia-kernel-2.4.25-1-686-smp and nvidia-glx packages. See section 87.6 for
details.
Install the appropriate Debian packages (with the kernel-headers package
that matches your installed kernel):
# cd /usr/src
# tar zxvf nvidia-kernel-src.tar.gz
Debian packages are now generated from these sources with the following
steps. First build the nvidia kernel package. As part of this step the file
NVIDIA kernel-1.0-4349.tar.gz (about 700K) will be downloaded from the
nVidia archive:
# export KSRC=/usr/src/kernel-headers-2.4.20-686
# export KVERS=2.4.20-686
# cd modules/nvidia-kernel-1.0.4349
# CC=gcc-2.95 debian/rules binary_modules
# cd ../..
# wajig install nvidia-kernel-2.4.20-686_1.0.4349-1+_i386.deb
Next build and install the nVidia GLX package. Again, during this step the
file NVIDIA GLX-1.0-4349.tar.gz (about 4.2M) will be retrieved from the
nNidia archive:
# cd nvidia-glx-1.0.4349
# dpkg-buildpackage -us -uc
# cd ..
# wajig install nvidia-glx_1.0.4349-1_i386.deb
Driver "nv"
with
Driver "nvidia"
Load "GLcore"
Load "dri"
modprobe NVdriver
To have this loaded at boot time add the following line to /etc/modules:
NVdriver
You can check that it all works by loading some of the GL graphics from
xscreensaver. Or run them directly, e.g., ”gears” or ”evas-demo”.
On Mint (Section 4.10.27) with version 0.9.769 of the nVidia driver there were
problems with system freezes. It generally happened in the xscreensaver
preferences when trying some of the GL savers (in full screen mode). In
window mode outside of xscreensaver they work just fine. Also freezes were
occurring when switching between multiple X Window Sessions (C-A-F7 and
C-A-F8, for example). The screen would go black. The problem appears to
have gone away with version 1.0.2314 of the nVidia driver.
On Velox (Section 4.10.26) with version 0.9.769 of the nVidia driver running
the evas test demo command crashed the xserver on exit from evas-demo!
Chapter 88
88.1.1 Epiphany
88.1.2 Galeon
Galeon is the Gnome web browser using Mozilla as the rendering engine.
For information on adding plugins for Galeon see Section 88.1.4.
88.1.3 Mozilla
549
550 Web: Serving, Accessing, and Mirroring
deb http://pandora.debian.org/~kitame/mozilla ./
Mozilla is becoming pretty stable and works as the rendering engine for
galeon and epiphany.
88.1.4 Plugins
You will now have a default web page at http://localhost/. The actual
page being displayed there comes from /var/www/index.html. You can
begin creating your own web site from there.
For a secure web server, using SSL to encrypt all communications from a
browser to the server (recognised with the https: prefix), there are at least two
options in Debian. One is to use apache with the libapache-mod-ssl module
and the other is to install the apache-ssl which installs a separate apache
server to listen to port 443 (instead of 80). There are advantages either
way but using apache-ssl is straightforward and cleanly keeps the two servers
separate (configuration files are in /etc/apache and /etc/apache-ssl and
log files in /var/log/apache and /var/log/apache-ssl respectively).
552 Web: Serving, Accessing, and Mirroring
http://www.ktware.com/~kayon/
That will allow Apache to look at a directory under the user’s home directory
named public_html.
http://www.ktware.com/debian/book
they will get an error since this is actually a directory being referenced.
With a ServerName defined to be www.ktware.com in httpd.conf a / will
be automatically appended.
AuthUserFile /home/kayon/public_html/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
Require user kayon
$ cd public_html
$ htpasswd -c .htpasswd kayon
You will be prompted for a password. This stores the encrypted password in
the file .htpasswd (the -c option says to create the file). You can manually
edit this file, keeping the same format, and perhaps even cutting the user
passwords from /etc/shadow to maintain the same passwords.
Note that you should take precautions to protect the actual encrypted pass-
words if you copy them from the shadow file (otherwise they may be subject
to attempts to crack them). For example:
I would like to figure out a way to use the system passwords file without
making /etc/shadow accessible to everyone (which is precisely the point of
the shadow file) and without having to copy the encrypted passwords into
.htpasswd. Then I would define the particular user group (AuthGroupFile)
as the users who can actually access the relevent web pages.
Protecting a cgi-bin directory through the use of the .htaccess file make
sure you have in /etc/apache-ssl/httpd.conf:
AllowOverride AuthConfig
<Directory "/home/kayon/projects/wwp/cgi-bin">
Options None
554 Web: Serving, Accessing, and Mirroring
AllowOverride AuthConfig
Order deny,allow
Deny from all
Allow from ktware.com
</Directory>
I am using a self-signed certificate. To renew the certificate for 365 days once
it expires (from http://www.euhq.org/debian-apache-ssl-howto.html:
# cd /etc/apache-ssl
# openssl genrsa -out ktware.com.key 1024
# chmod 600 ktware.com.key
# openssl req -new -key ktware.com.key -out ktware.com.csr
AU
ACT
Canberra
Togaware
Data Mining
Togaware
Kayon.Toga@ktware.com
(no challenge)
# openssl x509 -req -days 365 -in ktware.com.csr \
-signkey ktware.com.key -out ktware.com.crt
# mv apache.pem apache.pem.old
# cp ktware.com.key apache.pem
# cat ktware.com.crt >> apache.pem
# chmod 600 apache.pem
# /etc/init.d/apache-ssl restart
Gzip you html documents and apache will still serve them up as if they were
not compressed! All automatically.
88.2 Web Server 555
A very nice web log analyser and summary generator is awstats. Install the
package:
Also you may like to include browser and host OS information in the summary
by using the apache combined log format:
LogFormat=1
Be sure the apache generates this information (the default is not to). Your
/etc/apache/httpd.conf should contain:
To allow the analyser to run through the apache log files (/var/log/apache/
access) it needs permission to be able to read them. The simplest approach
is to:
To identify the web server running on a particular site you can use the http-
type command available from http://httptype.sourceforge.net/. Ex-
ample usage:
Wget is a command line tool to download multiple files from http and ftp
addresses on the Internet. Suppose you wish to download all of the available
xmms skins from http://www.spacefem.com/skins/. The skins are in files
with the .tar.gz extension:
Here the -r flag indicates that we want to recurse through the link, while -l
1 indicates that we recurse only a single level. The -A .tar.gz resticts the
download to just those files the have a .tar.gz extension. The extenstions
can be a comma separated list. The -nd request wget to not create any
directories—the files are downloaded to the current directory.
Chapter 89
557
558 Word: Processing and Printing
Chapter 90
The first task in setting up the X Window System is to determine the type
of your video controller chip. There are very many video controller chips
available and when you purchase a PC with MS-Windows preinstalled some-
one has already done the hard work of making MS-Windows work with the
particular video chip. Under Linux you will need to tune the configuration
to get the X Window System functionally fully.
The freely available XFree86 is the default X Window System for most
GNU/Linux systems. Version 4.1.0 is becoming an easily tuned system.
You will then need to run either xf86config (for a console-based interface) or
XF86Setup (for a X Window System based interface) to create an appropri-
ate /etc/X11/XF86Config file. If you are in luck, this will be straightforward.
Below are sample configurations:
559
560 X: The Window System
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/freefont/"
FontPath "/usr/X11R6/lib/X11/fonts/sharefont/"
EndSection
Section "ServerFlags"
EndSection
Section "Keyboard"
Protocol "Standard"
AutoRepeat 500 5
LeftAlt Meta
RightAlt ModeShift
RightCtl Compose
ScrollLock ModeLock
XkbKeymap "xfree86(us)"
EndSection
Section "Pointer"
Protocol "PS/2"
Device "/dev/psaux"
Emulate3Buttons
Emulate3Timeout 50
EndSection
Section "Monitor"
Identifier "Dell SyncMaster 17GLi"
90.1 Hand Crafting your XF86Config 561
VendorName "Dell"
ModelName "SyncMaster 17GLi"
HorizSync 31.5 - 48.5
VertRefresh 55-65
Modeline "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
EndSection
Section "Device"
Identifier "NeoMagic"
# Option "intern_disp"
Option "extern_disp"
EndSection
Section "Screen"
Driver "svga"
Device "NeoMagic"
Monitor "Dell SyncMaster 17GLi"
DefaultColorDepth 16
Subsection "Display"
Depth 16
Modes "1024x768" "800x600" "640x480"
ViewPort 0 0
EndSubsection
EndSection
This setup is used when the notebook is docked with display being to an
external monitor. Both internal and external displays don’t work together
and so you need to manually edit the XF86Config file each time you change
between the external and internal display (could be done with a script, but
essentially you swap the ”#” around, which is used to identify a comment
line). It is reported that having both enabled can destroy the internal display.
It certainly makes it go pretty ugly momentarily. According to the Linux
on the Dell Latitude CPi A366XT page http://www.radcyberzine.com/
linux/linux-dell.html page, you can’t just switch between internal and
external displays without updating your XF86Config and restarting X, or
YOU CAN DAMAGE YOUR DISPLAYS!
The value for the Vertical Refresh rate of 55-65 was suggested by Charlie
Hedlin since “LCD’s don’t need 80Hz and the like.”
I hand crafted a simple XF86Config for the clgd7543 that worked to get 8
bpp at 800x600:
The most basic mode of operation of Debian is through the console with a
command line interface. This is, after all, how Unix users have interfaced
with Unix for more than thirty years. In a modern environment though
we expect to be able to use the point-and-click interface with the desktop
metaphor invented by Xerox in 197XXXX and popularised by the release of
the Apple Macintosh in 1984, the X11 Window System in 1986, and finally
with MS-Windows in 1995.
It is the X Window System that provides the platform for today’s graphical
user interfaces in Debian and many other platforms. The X Window System
is really nothing more than another application sitting on top of the Linux
kernel. However, it is special in that it uses a client-server architecture so
important to a multi-user, multi-hardware, networked environment. The
significance of this is that you can run your X Window System application
on one machine (whether it is a Debian, Redhat, Solaris, Macintosh, or
Microsft machine) and have remote hosts of any type display directly to it.
As presented in Chapter 90 to run the X Window System we issue the com-
mand startx. With no further embelishments we have a basic graphical user
interface running and can usually start up oher applications like Netscape.
But this is just the start!
When you start up an application under the X Window System that appli-
cation will display a window on your screen. The raw window is under the
control of the application while the X Window System simply handles the
rendering of the window onto your screen. For a very simply installation
this might look like the screen in Figure 90.1. You can get this with the
command:
$ startx xterm
Or to have this happen automatically each time you start the X Window
System simply create an ~/.xsession file and with the single line:
90.2 The Basic X Window System Architecture 563
xterm
$ startx
Either way this will start up the X Window System and then a terminal
emulator (xterm) but absolutely nothing else. If you get an error like the fol-
lowing then you probably already have an X Window System session running
on the default virtual terminal (vt07).
giving up.
The solution is simply to run the new X Window System server on a different
virtual terminal (let’s use vt09, but it could be vt08 or vt10) and we will call
the display by the name :1 rather than the default :0 which seems to already
be in use:
or else
564 X: The Window System
$ startx -- :1 vt09
Note that there is no decoration on this single window. That is the job of a
window manager but we aren’t running any at the moment. There’s plenty
to choose from but let’s stay with sawfish. Sawfish is a window manager that
focusses on just managing windows—it leaves out a lot of the other features
not specifically related to managing Windows that are supported by many
other window mangers like Enlightenment. A window manager is no more
than another X Window System application. So in the xterm window we
can simply type the command sawfish to run this window manager (and
90.2 The Basic X Window System Architecture 565
$ sawfish &
If instead you run the command gnome-session you will see the desktop in
Figure 90.3.
To have this as the default behaviour it is suggested you replace the xterm
in the ~/.xsession file with:
exec gnome-session
Then next time your startx Gnome will automatically begin. Details of
working with Gnome are in Chapter 37.
566 X: The Window System
Figure 90.3: The Gnome desktop is now in control. These are the windows
that come up by default on a new installation.
90.3 Multiple X Window System Users, One Console 567
You want two or more users to be able to run on seperate X Window System
sessions on the same system. Obviously not interacting with the system at
the same time if both sessions are running on console, but not havin to bail
out of a session to allow the other user access.
Do a console login as the desired userid. Launch an X Window System session
to an unused local display. Assuming your first session runs to :0, try:
We will assume that you have installed Gnome and the related packages.
This includes the Gnome Display Manager (gdm) which, once installed, will
automatically start up when you boot into Debian.
The essence to running Gnome is to include the following in the file ~/
.xsession:
exec gnome-session
Alternatively if you are using the Gnome Display Manager (gdm) then select
Gnome or Debian from the Session menu.
The Gnome Display Manager gdm, when installed, will start up automati-
cally on boot. This presents an X Window System interface to log on. If you
are used to starting the X Window System from the command line you will
be used to using either .xsession or .xinitrc to tune some of your X Win-
dow System settings. The System menu in the gdm dialogue lets you start
568 X: The Window System
#
# Left ALT should be META so that it is the way I like it in Emacs.
#
xmodmap -e ’keysym Alt_L = Meta_L’
xmodmap -e ’add mod1 = Meta_L’
#
# Start up by asking for the SSH Pass Phrase
#
ssh-add </dev/null
90.6 References
Section "InputDevice"
Identifier "Generic Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/psaux"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
EndSection
90.8 Window Managers 569
90.9 XFree
XML
sablotron: Works well but my sample genealogy style sheet with a param-
eter cause sablotron to find an error! (Perhaps it’s stricter with XSL or else
it does not implement some feature—not yet explored.)
transformiix: Produces slightly different output to all the rest. Does not
seem to allow assignment to parameters.
xalan: Works well but could not get it to take the parameter?
xsltproc:
571
572 XML
Thanks
Many people have contributed directly and indirectly to this book, with
snippets from email messages and discussion group postings and directly to
me. I list here some of the people who have contributed, knowingly and
unknowingly.
Rohinton Kazak fixed many typos. Vincent McIntyre provided information
on the installation of the machine I’ve called Vince (Section 4.10.10). Damien
McAullay, Christian Kaske, Yoshiro Mihira, Jason Burrell, Bob Bownes, Pe-
ter Lamb, Dirk Eddelbuettel, Dean Jackson, Karsten Self, Shaul Karl, Ethan
Benson, John Flinchbaugh, Nathan Norman, Noah L. Meyerhans, Manoj Sri-
vastava, and many others.
573
Index
575
576 INDEX
171, 270, 456, 517, 518, 520, xmms, 39, 62, 65, 68, 508, 556
521, 523 xosl, 179
subtitleripper, 542 xsane, 486
sudo, 139, 197, 527 xserver-xfree86, 127, 293
swat, 483 xterm, 563
synaptic, 44, 48 zile, 38, 61, 64, 67
task, 27 pcmcia, 425
task-imap, 273 pcmcia-source, 388
task-tex, 28 Pen, 243
tasksel, 48 Photoshop, 299
tetex-bin, 395 plog, 459
tetex-extra, 395 pop, 517
totem, 539 postfix, 269
transcode, 542 ppconfig, 459
usbmgr, 74, 533 pppconfig, 459
usbutils, 533 Prefect, 43, 438
usbview, 533 preview-latex, 396
vcdgear, 208 procmail, 269
vcdimager, 208 Programs
video-dvdrip, 197, 542 Development, 305
viewcvs, 227 prosper, 461
vlc, 539 pseudo-image, 32
vm, 274 pstoedit, 354, 357
vrms, 39, 62, 65, 68 public html, 552
w32codecs, 539 Punto, 438
wajig, 38, 62, 65, 67, 70, 84, purpose built, 58, 60
137–139, 150 pydoc, 469
webmagick, 357 python, 316, 327
wget, 30, 556 python-base, 469
wv, 407 python-dev, 469
x-ttcidfont-conf, 293 python-doc, 469
x-window-system, 39, 62, 65, 68, python-examples, 469
71 python-gdbm, 469
xcdroast, 199 python-glade2, 64
xfce, 235 python-gnome, 316
xfig, 353, 354, 475 python-gnome2, 64
xgobi, 356 python-mpz, 469
xgraph, 354 python-regrtest, 469
xine-dvdnav, 540 python-rpy, 471
xine-ui, 62, 65, 68, 71, 539, 540 python-tk, 469
xingmp3enc, 203 python-xmlbase, 469
INDEX 591
x-ttcidfont-conf, 293
x-window-system, 39, 62, 65, 68, 71
xcdroast, 199
xf86config, 559