Linux Tips and Tricks

Preface

Here you can find my collection of Linux tips and tricks. I will update this page time to time. Items are sorted in chronological order, most recent entries first.

Linux evolves very fast, so please take into account that some tips may be obsolete or no longer accurate by the time you read them! Posting dates are available in update history page.

 

Table of Content
Random gcc crashes on AMD Athlon XP and VIA KTxxx Chipset
Problems Connecting to PostgreSQL Database Server
How to Enable Boot Splash & Animation in SuSE Linux 8.x
Problems Compiling Basilisk II Kernel Module
How to View the Content and Extract RPMs under Windows
How to Get Rid of Nautilus 2 Desktop under KDE
How to Monitor System Status and Processes in GUI Mode
How to Automatically Resolve RPM Dependencies
How to Batch-update Installed RPM Packages
How to Erase Bogus Entries from RPM Database
USB Mouse is Detected but not Working
How to Get Rid of nVidia Linux Video Drivers Artifacts
Missed Apple Disk Burner on Linux?
Using Disk Images on Linux
Tracking Software with no RPM Package Available
Mounting Netatalk Shares on MacOS X
Configuring Netatalk Print Server for Networked Laser Printers
Using SuSE Help Center

SuSE Linux PPC Installation Notes for First Time Users

Using LILO PPC on Mac
Using SuSE PPC Kernel Sources
MacOnLinux Configuration Notes
PowerPC Linux Kernel Compilation
Dual-Boot New-World MacOS/Linux System How-To
ReiserFS on PowerPC How-To
How to Transfer Data between Linux and MacOS Running on the same Workstation
Linux Kernel Sources for PowerPC
KDE Installation under SuSE Linux
Getting Updates Easy

Random gcc crashes on AMD Athlon XP and VIA KTxxx Chipset

It may happen that you are one of the unlucky owners of AMD Athlon XP system with mainboard based on the VIA KTxxx chipset, which may work fine for a weeks, but time to time suffers from random crashes, freezes, restarts and other strange artifacts. The common symptom for such system is random gcc crash with internal error. gcc (GNU compiler) stresses CPU, RAM and system bus, and thus, is excellent test for system stability. Need to say, these annoying glitches arise not only with Linux, but with MS Windows, too, usually when running CPU hungry games.

The fight for system stability turned into the combination of nightmare and black magic. I did everything imaginable: BIOS upgrade, tinkering with BIOS settings, complete re-assembling of the entire PC, replacement of CPU fan, RAM, power supply, video card and hard disk cables and hard drive itself, complete reinstall of the OS, upgrading Linux kernel, etc. In short, nothing helped. Finally, I have come to the conclusion that mainboard manufactured by Chaintech is the culprit. However, the company which sold me this mainboard refused to replace it because system have passed all hardware tests successfully. I repeated these tests myself, and yes, everything seem to be fine.

Finally, I have replaced mainboard based on VIA KT266A with another one with AMD 761 chipset (also from Chaintech). All artifacts have gone completely, PC have become absolutely stable and now works without crashes for over one year.

The most interesting part come later. Since I have posted this problem on various mailing lists, I have received a lot of feedback from users who had similar issues and who have asked how I have solved them. All of them had AMD Athlon XP and mainboard with VIA KT266 or VIA KT333 chipsets, from various of manufacturers. My final conclusion is that this issue caused by the poor design or manufacturing defects of the electronic circuit which supplies and filters power for the CPU. Since AMD Athlon XP is known to be the very power hungry, during high CPU loads drop of voltage caused problems with system stability.


Problems Connecting to PostgreSQL Database Server

When you first run PostgreSQL database server you may notice (your experience may vary depending on distro and particular RPM packager, however) that you cannot connect to the PostgreSQL database server from PHP. This is because by default PostgreSQL do not allows connection via TCP/IP socket. To change this, make sure that you have launched PostgreSQL at least once (so it will create default configuration files), open "postgresql.conf" (usually located in) "/var/lib/pgsql/data/" and set "tcpip_socket" to "true" and/or un comment it by means of removing hash mark "#".


How to Enable Boot Splash & Animation in SuSE Linux 8.x

Starting from version 8.1, SuSE Linux have new nice feature - cool looking boot splash and animation. However, if you did minimum install or upgrade, you probably have missed this. Here is how to enable it:

  1. Add "vga=788" into kernel boot parameter's list (YaST -> System - Bootloader Configuration).
  2. Install packages named "bootsplash" and "bootsplash-theme-SuSE".
  3. Enable services "splash", "splash_early" and "splash_late" in YaST -> Runlevel Editor -> Runlevel Properties.
  4. Open YaST -> Editor for /etc/sysconfig -> etc -> splash and set value to "yes".

Problems Compiling Basilisk II Kernel Module

In order to allow Basilisk II (Mac emulator for UNIX/Windows) use network you need to compile, install and load sheep_net kernel module. You may notice that compiling Basilisk sheep_net kernel module becomes problematic with 2.4.19 kernel. You need small patch in order to solve this. You can download sources for patched sheep_net module here. To compile it, run "make -f Makefile.module" and "make -f Makefile.module install ".


How to View the Content and Extract RPMs under Windows

Use the free utility 7-Zip written by Igor Pavlov.


How to Get Rid of Nautilus 2 Desktop under KDE

It may happen that you have launched Nautilus 2 file manager under KDE, just to discover later that after each login into KDE Nautilus 2 will remain as default desktop manager. Go to the Edit -> Preferences and disable option titled "Use Nautilus to draw the desktop".


How to Monitor System Status and Processes in GUI Mode

There is excellent open source utility called GKrellM, it is included with the most (if not all) Linux distributions. It may be customized using hundreds of available themes (skins).

GKrellM, Yellow theme (screenshot rotated).

How to Automatically Resolve RPM Dependencies

This article have been moved to "Smart Package Management on RPM-based Linux".


How to Batch-update Installed RPM Packages

It may happen that you have a bunch of upgrade RPMs for your existing Linux system. The question is how to upgrade only installed packages if they are really older than acquired ones, and do not install packages that do not exist in the current system. That's simple - "cd" to the directory of RPMs and run "rpm -Fvh *.rpm". Option "Fvh" means freshen + verbose + print hash marks. There are better automated options descibed in "Smart Package Management on RPM-based Linux".


How to Erase Bogus Entries from RPM Database

Have you ever had a problem with duplicate entries in RPM database? If yes, you will not forget it. Even "rpm --rebuilddb" does not help. Here is quick tip how to solve this - "rpm -e --allmatches --nodeps bogus-package-name".


USB Mouse is Detected but not Working

Once I have encountered dumb stupid problem with SuSE Linux 8.0 - my USB wheel optical mouse have been detected and powered up at startup (the red light from mouse's diode clearly showed this), but neither GPM (console mouse services) neither XFree86 have been able to use it. Reconnecting mouse to USB port sometimes helped but sometimes not. Moreover, I never had this artifact with SuSE Linux 7.3 on the same PC with the same mouse. The culprit is buggy USB Hot Plug services. Workaround - include usb-uhci, usbcore, hid, input, mousdev kernel modules in initial RAM disk image. Edit list of these modules in YaST (or another setup utility if you have another Linux distro), then run "mk_initrd" and "lilo".


How to Get Rid of nVidia Linux Video Drivers Artifacts

It may happen that after proper installing and configuring nVidia kernel module and nVidia XFree86 GLX drivers you may experience strange artifacts - XFree86 unexpectedly quits, freeze and sometimes machine even reboot itself. Usually it is related to AGP problems. First of all, you should disable "Enable Fast AGP Write" option in PC BIOS setting. Second - specify "Option "NvAGP" "1"" in XFree86 configuration file device section. You can download my XFree86 configuration file here.

Additionally, it is highly recommended to avoid using XFree, KDE or Gnome as root. This is not just rule of "good" behavior, it is my own experience.


Missed Apple Disk Burner on Linux?

If you have missed great Apple Disk Burner utility on Linux, do not worry. You can use another one which is less user-friendly but much more powerful. It is called KreateCD. KreateCD is a graphical KDE-based front-end to mkisofs, cdrecord and other command-line UNIX utilities. Just select a folder in Konqueror (KDE File Manager, functional analog of Macintosh Finder), push second mouse button to launch contextual menu, and select "Create ISO Image". This will launch KreateCD where you can erase CD-RW (either fast either full mode), select CD format (ISO, hybrid, audio, etc.), and finally burn CD. Please note that commands in KreateCD named differently from Roxio Toast and Apple Disk Burner. In order to switch between "Write Session" and "Write Disk" modes go to Settings -> Configure KreateCD -> Burner -> Preferred Fixating Setting and choose from popup menu "Fixate Session" or "Fixate CD-R".


Using Disk Images on Linux

If you have used Mac, you are certainly used to use disk images created with Apple Disk Copy, Toast and/or ShrinkWrap. Disk images are files which can be mounted and used like ordinary removable media. You can do the same with Linux, although this requires some knowledge of terminal commands and Linux internals. First, you need to create disk image. For example, to build 650 MB disk image formatted as Ext2 run "dd if=/dev/zero of="DiskImage.img" bs=1024k count=650", then "mke2fs -b 2048 DiskImage.img". You will be told that DiskImage.img is not a block special device, but do not worry and just say yes to proceed. To mount newly created disk image, run "mount -t ext2 -o loop=/dev/loop1 DiskImage.img /mnt". Please note that mounted volumes on Linux are visible as directories, so the content of disk image will be shown as directory "/mnt". If you want mounted image to be shown under another directory name create directory on the root level with desired name and run "mount -t ext2 -o loop=/dev/loop1 DiskImage.img /my-mount-point" instead. The same way you can mount, for example, ISO CD-ROM images - "mount -t iso9660 -o ro,loop=/dev/loop0 CD-Image.iso /cdrom".


Tracking Software with no RPM Package Available

It may happen that you may need to install software which is not supplied as RPM package, or SPEC file to build one. Of course, you can create SPEC file and then build RPM, but there is one quick solution, which likely to work fine in most cases. The cool piece of software called CheckInstall may track installation commands, update RPM database, and build RPM package if necessary. Usage is very simple - "checkinstall installation-commands", for example "checkinstall make install", "checkinstal install.sh", etc. For additional options, please check package documentation. I do not know home URL for CheckInstall, but it is included with SuSE Linux, and thus, may be downloaded from SuSE ftp site.


Mounting Netatalk Shares on MacOS X

This article have been moved to MacOS X Tips and Tricks.


Configuring Netatalk Print Server for Networked Laser Printers

It may or may not be common, but I have encountered certain difficulties trying to print from Mac with MacOS 9 to Linux print server. I had two laser printers (Apple LaserWriter 12/640 and Tektronix Phaser 740L), both with Ethernet and original Adobe PostScript. For Windows, it was quite simple. I have assigned fixed TCP/IP address to each printer and created two TCP/IP forwarding queues, named lp1 and lp2 respectively. Then, both queues have been shared using Samba for Windows clients. For Mac, I supposed to create desktop printer using Apple's Desktop Printer Utility, which allows to connect directly to LPR via TCP/IP. However, any attempt to print resulted error #8827. Then, I have tried suggested by many people way: creating separate spool directory for papd (Netatalk print daemon) and using Netatalk print filters. Again, it does not work, although papstatus always returned OK and spool directory permissions were OK, too.

The solution was quite simple - redirect Netatalk print jobs to respective TCP/IP forwarding queues using LPR. My papd.conf is below.

Phaser740_Linux:\
:pr=|lpr -Plp1:\
:pd=/etc/PPD/TEK740L.PPD:

HP2200DN_Linux:\
:pr=|lpr -Plp2:\
:pd=/etc/PPD/HP_LaserJet_2200.PPD:

PS. I am not sure why other two methods did not work for me (although they should), so your feedback is welcome.


Using SuSE Help Center

One of the most really outstanding and valuable features of SuSE Linux is very informative search-able WEB based help system called SuSE Help Center. It combines information from SuSE's own manuals and support database; man/info pages; packages descriptions; and Linux How-to pages. The advantage of this bundle is obvious because it is possible to query several sources of information at once. SuSE support database is the most valuable part, it is updated several times a week with new tips and tricks. In order to use this feature on your workstation/server you need to install WEB server (one of the 4 available in SuSE distro), SuSE Help Center itself and related parts like support database (sdb), Linux How-To pages, etc. SuSE Help Center can be used with any WEB browser, either focally either remotely (run "susehelpcenter" from terminal or connect to http://SERVER-Name/doc/susehilf/index_en.html from WEB Browser). Screenshot, showing search result by PowerPC keyword in SuSE support database available here.

PS. Even if you do not use SuSE Linux, you can access SuSE support database directly at SuSE Web site.


SuSE Linux PPC Installation Notes for First Time Users

SuSE Linux installation procedure in general is well described in the manual, however, many first time users face difficult problem what to install, mostly because of large number of included software packages (over 1500). These people often are not aware what exactly each software package designed for and what it does. Default install creates huge bloated system, which is confusing and difficult to maintain.

In short, to avoid bloated installation, you need to choose "Minimum Install", and then go to "Individual Package Selection" to select packages required for your particular needs (e.g. Netatalk for AppleTalk networking). Do not worry about package dependencies, YaST (SuSE installation/configuration tool) will automatically select required packages and warn about possible conflicts. Also, it is really bad idea to install things which just may be need sometime in the future!

Here is small categorized list of software for typical PowerPC Linux server installation:

  • Base system (kernel, glibc C/C++ shared libraries, important GNU utilities like bash, cron, gcc, zip, etc.), RPM package manager, SuSEconfig scripts, etc. These usually selected automatically.
  • Support for languages like PERL, JAVA, Python, PHP.
  • Networking packages - WEB (one of: thttpd, Apache, Roxen, AOL WEB Server); FTP server (one of: tftpd, wu-ftpd, proftpd); dial-up; mail (SendMail, Postfix); Netatalk (AppleTalk networking); MARS_NWE (Novell networking); Samba (MS Windows networking); printing (one of: LPR, LPRing, PLP, CUPS).
  • Clients for various network protocols (http - Netscape, Mozilla, Konqueror; ftp - many available, etc.).
  • Security software (IP Route, IP Tables, SuSEfirewall, seccheck, Saint, etc.).
  • GhostScript - support for PostScript and PDF.
  • Default GUI-based configuration utilities (YaST 1 and YaST 2 in SuSE Linux).
  • Optional configuration utilities (WEBMIN recommended).
  • Help system - SuSE Help Center, Linux How-to archive.
  • XFree windowing system and one of the desktop environments - KDE or Gnome (or even both).
  • MOL - Mac on Linux emulator (you can use it to test your server configuration from MacOS, or to run some Mac-only software).
  • Includes for current kernel, glibc, and others, depends upon which packages you want to (re)compile yourself.

Please note that many packages listed above are not mandatory (like MARS_NWE if you don't need Novell support). Also, the same features are available from many packages (you do not need to install all 4 web servers available at SuSE Linux distro, you have to choose one, most likely Apache). If you have difficulty to choose, for example, ftp server among 3 available, choose the one used by your friends (e.g. wu-ftpd), you can replace it later with another if necessary.

Additionally, large packages like KDE or Gnome carry a lot of garbage. Skip all alpha and beta applications, and install only ones which are known to be really needed. Please note that you have to install at least one file manager (Konqueror for KDE, included in KDE Base; GMC or Nautilus for Gnome), in order to make desktop environment really functional.

PS. My SuSE Linux PPC package index available here (named *.sel). You can use it as a seed for your own installation. Among necessary server software, KDE and Gnome desktop environments, there are packages required to (re)compile kernel, MOL, Netatalk and Samba.


Using LILO PPC on Mac

If you are having difficulty to setup dual boot MacOS/Linux on New World Mac (writing yaboot/os-chooser configurations and working with Open Firmware) you can simplify this task with LILO PPC found in SuSE Linux PPC distro. LILO PPC is not an actual Linux Loader like on Intel PCs, but rather front-end which parses its configuration file and generates proper yaboot.conf, os-chooser script, sets startup device in Open Firmware and copies Linux kernel(s) to HFS boot partition if necessary. LILO PPC can be used with Old World Macs, too, but I do not use them anymore and thus, have no experience to share.

Using LILO PPC on Mac is quite simple. At first, do not forget to record your partitioning info somewhere (better on the paper). Now, suppose you have the following partitions' numbers: MacOS - #9, Linux root - #10, Linux swap - #11, HFS boot partition - #12 on master disk connected to primary UltraATA controller (factory-installed internal hard drive); and two kernels - factory 2.4 and your own custom-compiled 2.4.2reiserfs.

LILO tag   Sample Comments
boot=xx   boot=/dev/hda12 HFS boot partition
default=xx   default=MySuSE-2.4.2reiserfs Default kernel image
timeout=xx   timeout=50 Timeout before kernel will be picked up automatically
activate     Default parameter
bootfolder=xx   bootfolder=suseboot Fake System Folder where you keep your yaboot, os-chooser and other startup Linux stuff
image=/boot/xx   image=/boot/vmlinux-2.4.2reiserfs Linux kernel image #1
  root=xx root=/dev/hda10 Root partition
  label=xx label=MySuSE-2.4.2reiserfs Name your configuration
  append="" append="ramdisk_size=64000 load_ramdisk=1" Additional kernel arguments (optional)
  copy   This optional parameter is needed if you would like LILO to copy your Linux kernel on HFS Linux partition (required on some Macs)
       
image=/boot/yy     Your next kernel image...

Save your lilo.conf and run "lilo" command in terminal. LILO PPC will generate yaboot.conf, os-chooser script (named MacOS ROM), do necessary modification of Open Firmware variables, overwrite yaboot and optionally copy Linux kernel image(s) to the HFS boot partition.

Attention SuSE Linux PPC 7.0 and 7.1 users! LILO PPC overwrites all corresponding items each time you run lilo command in terminal, including yaboot. Thus, if you load Linux kernel from ReiserFS partition your ReiserFS-enabled yaboot will be replaced with older version. The solution is to replace old yaboot which belongs to LILO PPC package (located in /boot directory) with ReiserFS enabled yaboot 1.2.1 or later.

Also, LILO PPC from SuSE Linux PPC 7.0 and 7.1 assumes Linux as default OS. Thus, to boot MacOS, you need to press space key. This is not convenient if MacOS is your primary workspace environment. Just swap these statements in os-chooser script and save backup copy, since LILO PPC overwrite it next time you run lilo command.

Boots MacOS:
" Booting MacOS ..." cr " boot hd:xx,\\:tbxi" eval

Boots Linux:
" screen" output
" Booting Yaboot ..." cr " boot hd:yy,\\yaboot" eval

PS. You can download my lilo.conf here. Please use it as example only!


Using SuSE PPC Kernel Sources

First of all, you need to decide whether you would like to use stable or development version. I strongly recommend to use stable (see article below), but if you have recent hardware, most likely you have to use development version in order to utilize most of hardware features. SuSE PPC development kernel maintained by Olaf Hering and is available here (inside beta directory) in form of RPM and patches against stock kernel from kernel.org. By the way, you can use SuSE kernel RPMs with other distros like LinuxPPC or Yellow Dog Linux. Look at read me file inside beta directory and download appropriate stock kernel. Unpack it to /usr/src/linux, then download entire patches directory from SuSE kernel archive, and put it inside /usr/src/linux. If you will use ftp client which show invisible dot files, you can find there .patch_info (yes, with dot at the beginning) text file which contains description of each patch. Now run the following commands from the terminal:

cd /usr/src/linux

for i in `ls patches/*`; do \
gzip -cd $i | patch -Ep1 --no-backup-if-mismatch ; done

You will see a progress, and if everything goes OK, your kernel sources are ready to use. See instruction how to compile custom configured PPC kernel.

PS. Shell script for batch patching kernel available here.


MacOnLinux Configuration Notes

MOL (Mac On Linux) is a cool piece of software written by Samuel Rydh which allows to run MacOS under Linux at almost full speed (screenshot available here). However, many first-time users often encounter hard crashes and lockups, what is quite frustrating, especially for Linux novices. This is not surprising, since MOL is very low-level software, and it is very toughly linked to the kernel. If you are new to Linux, I am strongly recommend you to use both MOL and kernel from your distro.

You can safely use MOL only if it is compiled using includes from your current kernel !

If you already have some experience, you can follow my step-by step guide to build your own MOL incarnation. First, download MOL source archives (mol*.tgz) and/or source RPMs (mol*.src.rpm) from MOL web site (you do not need source RPMs if you are not going to build your own mol RPM). Extract MOL sources anywhere you want ("tar xfvz mol.tgz"). To compile MOL, you also need to install gcc, GLIBC/kernel/XFree86 headers, ELF library (for MOL prior to 0.9.59), GNU bison and flex tools. Make a directory of your MOL sources current directory (e.g. "cd /usr/src/mol"), then run "make" and "make _install". Please note that "make _install" will overwrite all current MOL files, including existing configuration file /etc/molrc. Now open molrc, there are some things to be done. Most of tags will be left as is, since MOL does a good job determining hardware configuration. Below is a list of tags which are mandatory to update.

Tag in molrc New Value Notes
boot_method newworld or oldwrold Type (Old World or New World) of your Mac
ram_size >64 RAM allocated for MacOS
blkdev   MacOS partition (e.g. /dev/hda9 -rw -force like in my case). Comment out nonexistent devices.
depth 8 Color depth, try 8 (256 colors mode) first

Depending on version, MOL loads either stripped (MOL 0.9.58 or less) either not stripped (MOL 0.9.59) MacOS ROM image from /usr/lib/mol/rom/rom.nw, or directly from MacOS System Folder (MOL 0.9.60 and above), look carefully in your newly installed molrc file. The simplest way to strip MacOS ROM is to copy it to HFS boot partition (my called macboot), remove spaces from file name, and use "strip_nwrom /macboot/MacOSROM /usr/lib/mol/rom/rom.nw". The last step is to run "molvconfig" script from terminal to configure video modes. Now type "startmol" and enjoy.

Few helpful tips for MOL users:

  • You must recompile MOL after upgrading kernel.
  • It is recommended to recompile MOL after upgrading GLIBC and XFree86.
  • Do not use old molrc file after upgrading MOL, because new MOL may introduce new options.
  • Development version of MOL is available via rsync ("rsync -avzc zorn.theophys.kth.se::mol mol/").
  • If you still have hard MOL crash, I recommend manually remove all MOL files from /etc and /usr/lib/mol, and do only minimal changes in molrc.

PS. You can download my molrc here. Please use it as example only!


PowerPC Linux Kernel Compilation

This procedure is not much different from other Linux-supported platforms. First, you need to acquire Linux kernel sources (see below). You can place kernel sources anywhere you want, but link from /usr/src/linux to kernel sources directory is necessary. I recommend to use SuSE kernel sources since they contain the most stable and proven kernel version plus some important patches, and they can be used in any other distro. First step is to configure kernel compilation options. Make kernel sources directory default directory ("cd /usr/src/linux"), then apply patches (if any). Try to clone configuration of existing kernel ("make cloneconfig" for SuSE kernel or "make oldconfig" for stock kernel.). To do necessary changes, run console-based utility ("make menuconfig"). X-based configuration ("make xconfig") often does not work well. Save your configuration and run ("make dep clean zImage" and "make modules") to compile kernel and modules. Please never build bzImage ("make bzImage"), it will not work on PowerPC Mac!

However, there is one little problem - if you have reconfigured and/or patched the same kernel version as you are running right now, you will have to replace it and its modules. What if something goes work? There is one very useful trick - change extra version number in new kernel. To do this, open top-level Makefile inside /usr/src/linux, and increment or append something to EXTRAVERSION tag. For example, after applying Endian-safe ReiserFS patch I have changed 2.4.2 kernel version to 2.4.2reiserfs. Now you can keep both kernels and switch between them if necessary. Please note that you should change kernel version before running configuration utility and generating dependencies ("make dep").

After successful building of kernel and modules, install modules ("make modules_install"), then append meaningful suffix (e.g. "2.4.2reiserfs") to files named "vmlinux" and "System.map" and move them to /boot directory. Update yaboot.conf accordingly, and reboot your Mac.

PS. You can download SuSE and my configurations for ReiserFS enabled PPC kernel here. Please note that my configurations exclude features I don't need - SMP, parallel port, PC Card, USB->Serial adapters, Video for Linux, certain interfaces like FDDI, file system and partition support for operating systems/platforms like Acorn, Amiga, Alpha, OS/2, Windows NT.


Dual-Boot New-World MacOS/Linux System How-To

In fact, there are many methods of configuration of dual-boot MacOS/Linux system depending upon Mac hardware architecture (Old World, New World) and type of booting partition (invisible bootstrap or HFS with fake System Folder). I have used only second one on New World Macs (which load MacOS ROM file from hard drive, not from ROM chip on the motherboard, more info available here). Configuration manuals are rather complicated and confusing, so all you need is to understand technical background of Linux booting process on the New World Mac.

Basically you just need let Open Firmware evaluate os-chooser script (it must be inside fake System Folder on separate startup HFS Linux boot partition and have type "tbxi" and creator "chrp", sometimes need to be renamed to "MacOS ROM"). After that, either yaboot (Mac Linux Loader) either MacOS will be started up, depending on result of conditional statement in os-chooser (usually it checks whether certain key is pressed to determine which OS need to be loaded). However, yaboot needs valid yaboot.conf file to load proper Linux kernel image. During normal startup procedure yaboot pick ups kernel image from the /boot directory on Linux partition. Kernel image (file called "vmlinux") and RAM/root disk images (usually named "ramdisk.image.gz" or something like that) located on HFS Linux boot partition are usually required only for installation and/or update of the base system if startup CD does not work or do not exists (however, on some 2001 Macs kernel image may be loaded from HFS boot partition only). If you load kernel and RAM/root disk images from HFS boot partition you can install or upgrade base system or entire installation from NFS or FTP without bootable Linux CD. On Linux you cannot safely replace base of currently running system. However, you can safely install, remove, upgrade or reconfigure all other components without reboot (you might need to restart certain services).

Many people ask what PPC LILO (Linux Loader) found in some Mac Linux distributions does? LILO on Mac does nothing but parses lilo.conf and updates os-chooser, yaboot.conf and Open Firmware accordingly, it is not a real bootloader like on PC. You can safely remove it. SuSE did PPC LILO for IBM PowerPC workstations and to make PC people feel more comfortable on Mac.

At first, do not forget to record your partitioning info somewhere (better on the paper). Now, suppose you have the following partitions' numbers: MacOS - #9, Linux root - #10, Linux swap - #11, HFS boot partition - #12 on master disk connected to primary UltraATA controller (factory-installed internal hard drive). The question may be where are partitions #1-8? They are not lost, they are occupied by partition map, hard disk drivers, driver patches, etc. They are visible only with special hard drive formatting utilities or Linux partitioning software. If you plan to install MacOS X on the same hard drive as Linux please do it before installation of Linux, since MacOS X installer may add additional driver patches and thus, shift partition numbers! After creating all necessary partitions copy suseboot folder located on SuSE Linux CD#1 (also available on ftp) to HFS Linux boot partition. You have to edit only two files - os-chooser (startup Open Firmware script) and yaboot.conf (bootloader configuration file). Open os-chooser with text editor like BBEdit and find the following statements: "boot ultra0:xx,\\yaboot" eval and "boot ultra0:xx,\\:tbxi" eval. Now replace xx with partition numbers of Linux and MacOS respectively. Save and close os-chooser. Open yaboot.conf. Syntax is very simple.

image = ultra0:xx,/boot/vmlinux-yy Replace xx with Linux root partition #, vmlinux-yy with actual kernel image name (if all kernels located in /boot directory); if kernel being loaded from HFS boot partition use image = vmlinux-yy, where yy is a suffix which represents kernel version number.
label = linux-2.4-SuSE Name this configuration as you like
root = /dev/hdaxx Replace xx with Linux root partition #
append = "" append additional kernel arguments there, delete this line if there are no additional kernel arguments

Top statement default = xx should list your preferred kernel (e.g. default = linux-2.4-SuSE).In Linux you can install as many kernels as you like, and switch between them on startup. If you install Linux on secondary UltraATA (or SCSI) hard drive, you should change ultra# and hda# accordingly (please refer to special literature, FAQ, or other How-To in order to learn how Linux recognizes and names storage devices and partitions, it is beyond the scope of this article). Now select Linux HFS boot partition in MacOS Control Panels -> Startup Disk, reboot, and press space bar to boot in Linux, then press Tab to switch between configurations listed in yaboot.conf.

PS. You can download my yaboot.conf and os-chooser script (renamed to MacOS ROM) here. Please use them as examples only!


ReiserFS on PowerPC How-To

Mature support for journaling file system ReiserFS appeared on the PowerPC only at the beginning at June 2001, thanks to Jeff Mahoney and sponsorship of SuSE GmbH. Without ReiserFS support PPC Linux hardly could be called real server OS (although another journaling system SGI XFS have been available, it's usage have been rather tricky, and no PPC Linux distributions included it for out of the box deployment). At the time I am writing this (June 10, 2001) I know how to install ReiserFS on PPC with SuSE Linux only. If you are using another PPC distro, you have to develop another installation technique or somehow adapt main. Please note that you will have to reformat your existing ext2 partition(s) or create new one(s).

So, what do you need? SuSE Linux PPC 7.1 CD#1; PPC ReiserFS boot CD, SuSE-patched PPC kernel RPM 2.4.2-11 or later plus kernel sources (usually named lx_suse or lx_hack), if you want later to build custom - compiled kernel. Of course, you can start your Mac from ReiserFS boot CD and then replace it with installation CD, but there is certain risk that old YaST (SuSE Linux installer) will damage your ReiserFS partition or overwrite fstab file with wrong information.

This is step by step guide how to build your own ReiserFS enabled PPC Linux installation CD:

  1. Make a disk image from SuSE Linux PPC CD#1 (with Toast, for example).
  2. Download ReiserFS stuff listed above.
  3. Mount SuSE Linux PPC CD#1 image in read-write mode.
  4. Replace the following files on SuSE Linux PPC CD#1 with the corresponding ones from PPC ReiserFS boot CD: suseboot/yaboot (ReiserFS enabled bootloader), suseboot/vmlinux-2.4 (ReiserFS enabled boot kernel), suseboot/ramdisk.image.deflt.gz (RAM disk image), suse/images/k_deflt.rpm (2.4.2 ReiserFS enabled kernel RPM), suse/images/root (root image with new ReiserFS enabled YaST). Please note that you have to keep original names found on CD#1 (rename files from PPC ReiserFS boot CD while copying), otherwise installation will not work!
  5. Burn modified SuSE Linux PPC CD#1 image as bootable hybrid HFS/ISO CD with the name SU7100.001.
  6. Boot your Mac from CD#1, run installation (it will work in text console mode only, however), and install standard 2.4 kernel for Power Macintosh, and NO other kernels!
  7. After first boot install ReiserFS utilities (you can download them from here).

I found Endian-safe ReiserFS port system a little bit slower than ext2, but small performance drop is certainly worth extra reliability.

PS. First version of yaboot with ReiserFS patch released June 5, 2001 by SuSE may work or sometimes may not with separate /boot ext2 and /root ReiserFS partitions. However, it works without any problem if /boot and /root are located on single ReiserFS partition. The problem is identified by SuSE and fixed version is on the way.


How to Transfer Data between Linux and MacOS Running on the same Workstation

Of course, its possible to do that via e-mail/ftp, removable storage, shared volume on the networked server, etc. But what if you have standalone workstation at your home? There are three very simple and efficient methods.

  1. Use your HFS boot partition (if you have it, of course) to transfer small files. I made boot partition 32 MB which is enough to transfer my backup of Linux configuration files or some stuff I have downloaded from the Internet on MacOS. Just do not forget to remount it in read-write mode. This method is most suitable at the beginning, until your Linux setup is still not completely finished.
  2. This method is much better, since you will not be limited to space available on your HFS boot partition. Install and configure Netatalk (AppleTalk and AppleShare IP emulator) on Linux, configure volumes shared in read-write mode via Netatalk; then install MOL (Mac on Linux emulator), launch MacOS under MOL, and connect to Linux via Chooser. Works great, verified.
  3. Configure ftp server either on Linux side either on MacOS and use any ftp client you like.

Of course, you can mount your primary MacOS partition in read-write mode, if you have initialized it in HFS format, or use Linux HFS+ Utilities, but I am not sure it is very safe.


Linux Kernel Sources for PowerPC

Most people new to PowerPC Linux almost always stumble when they try to build custom kernel (to be honest, I am was not an exception). The reason is very simple - in most cases PowerPC tree in kernel.org is outdated or broken. There are four PowerPC kernel trees, two development - by Paul Mackerras and Benjamin Herrenschmidt; and two stable maintained by Cort Dougan from FSM Labs and SuSE GmbH (unfortunately, time to time PPC kernel repositories move, so please visit PenguinPPC.org for up to date URLs). The last is not exactly tree, but rather one of the recent recent versions proved to be really stable (e.g. patched 2.4.2 vs plain 2.4.5) with some patches for necessary hardware support. I strongly recommend the last. SuSE PPC kernel sources available as RPM source archive (search SuSE PPC distribution/update directory called d2 for package named lx_suse, lx_hack, or kernel-sources); and as number of patches (also available here) for stable kernel tree from kernel.org. (at the time I am writing this, to 2.4.2 kernel).

The main advantage of SuSE PPC kernel tree is out of the box support for Endian safe ReiserFS, which is required in order to deploy ReiserFS journaling file system on the Mac. Although available as separate patch, this patch sometimes depend on other patches, and therefore, is not very safe to use by inexperienced person. Soon or later it will be incorporated into stock kernel, but at the time of last update of this topic (July 2001) the best solution is to use SuSE kernel.

The rest is of build process is almost the same as as for x86 kernel. Since Apple have unified hardware support and the same controllers used in many models, required number of hardware drivers is really small. For example, only one driver (Power Mac DMA Sound) is needed for sound support across entire Apple hardware base which is capable to run Linux.


KDE Installation under SuSE Linux

KDE desktop environment is pretty complicated and damn big piece of software, it requires user to be very careful during installation/upgrade process in order to avoid being screwed up. This is step by step guide for novices or people who do not find themselves very comfortable without GUI shell (i.e. Mac users). I am assuming that you have complete download of KDE from SuSE ftp site (usually around 200 MB).

  1. Archive your current KDE RPM packages in case new ones will not work as expected.
  2. Logout from KDE and login to Gnome.
  3. If your KDE is in good working condition right now, go to /opt/kde2/share/config/ directory and make a copy of the file named kdmrc (e.g. kdmrc.old). Some SuSE KDE releases seem to have buggy post install scripts. If you do not have KDE installed or it does not work, skip this step.
  4. Open terminal, resize terminal window to maximal height, and type "YaST". This will launch SuSE setup tool in terminal mode. In YaST, go to the package management -> install packages, and navigate to your KDE updates directory.
  5. You will see a number of sub-directories there. Each sub-directory has another one inside called "RPM". Everything should be installed from there, here you can see actual packages with version numbers, not just symbolic links. You should install packages with YaST in the following order: gra/libmng, libcms; xdev1/qt, xdev2/qt-extensions; k2de1/everything except unwanted language support; k2de2/i118n-... desired language support. At this time you should install only packages I have mentioned. Please do not exit YaST after installing just one RPM package!
  6. After all packages listed above will be installed, hit "escape" key several times to exit from YaST. YaST will launch set of SuSEconfig post-install scripts. Watch carefully for log messages, if SuSEconfig will throw error messages regarding kdm or kdmrc, replace kdmrc generated by SuSEconfig with backup copy.
  7. Now logout from Gnome and try to login to KDE.
  8. If KDE works OK, install other KDE applications. If it doesn't, revert back to previous version (I hope you have done what is suggested in #1), using the technique described above.

Getting Updates Easy

In order to automate downloading updates, which may consist of hundreds of files, I can suggest PERL script called mirror, which is supplied with SuSE Linux. Although SuSE Linux has an automatic update tool called YOU, I recommend you to keep all updates, because new ones may introduce unwanted side effects, bugs and glitches. I have created directories inside my home directory called "mirror", and sub-directories inside: SuSE-update-i386, SuSE-update-PPC, KDE-update-i386, KDE-update-PPC, etc. "mirror" directory is being shared via FTP, Samba, Netatalk and NFS in read-only mode for easy access.


MacGuruHQ and MacGuruHQ Logo

Copyright© 1996 - 2002 by Andrei Verovski. All right reserved. Content may not be copied in whole or in part, through electronic or other means, without the author's permission. MacGuru Logo (blue penguin) by Sergey Orehov.