yellowpigs.net

Debian PowerPC

These are detailed instructions about my experience installing and configuring Debian GNU/Linux 3.0 (woody) on my macintosh laptop (large screen iBook 1.2, 700 MHz G3). Hopefully they are thorough enough to help someone who doesn't have any experience with Debian or Debian on PPC.

Starting the Installation:

Partitioning:

Warning: backup any important data and write down your entire partition table before doing anything. I once failed to do so and very much regretted it.

Partitioning (done using mac-fdisk) is a bit tricky. You cannot use the Apple partitioning tools to partition for Linux. Macs have a bunch of strange partitions on them which are needed if you ever want to boot to any Mac operating systems. Additionally, a special bootstrap partition is needed to boot to linux. This partition must be located immediately after the strange Mac partitions (that is, before any other partitions). Other than that, partitioning is the same as on any architecture. Explicit instructions follow for creating four partitions: a bootstrap partition, a Linux partition, a swap partition, and a Mac partition.

The Base Installation:

Initializing. The next part consists of hitting Enter a lot. Really. Initialize and activate a swap partition. Do the same for the linux partition. Checking for badblocks is good, though time-consuming. I chose to use ext3. Mount your linux partition when prompted. Choose your installation medium (in my case, CD).

Kernel. Pay attention to the kernel module section. Some modules which might be useful include wireless/airport, fs/ufs, and net/appletalk.

Configure the network. (If you have an airport card and selected wireless/airport above, your airport card should be ready to go.) If you have a dhcp server, use that. If not, enter your IP, netmask, gateway, and DNS servers. You can check that you are on the network by going to another console (option-rightarrow) and typing ifconfig -a and ping somehost. Return to your original console with option-leftarrow or option-fn-F1.

Install the base system. The default locations should be fine. If this is your first Debian install, here's a tip: when in doubt, stick with the defaults.

yaboot:

Now it's time to make your system bootable. The Debian installer claims to have done this, but most likely it actually hasn't. (The white iBooks require a special parameter to be passed to the kernel.) It also does not know about any non-Debian OSes which you might want to boot to. Execute a shell and use nano (or nano-tiny) to edit the file /target/etc/yaboot.conf. (To exit nano, type control-X.) The contents of my yaboot.conf file follows:

  # yaboot.conf
  # after modifying this file, run 'mkofboot -b /dev/hda9' 
  # (assuming /dev/hda9 is the bootstrap partition)

  boot=/dev/hda9 # bootstrap partition
  device=hd:
  partition=10  # linux partition
  root=/dev/hda10
  timeout=30
  install=/usr/lib/yaboot/yaboot
  magicboot=/usr/lib/yaboot/ofboot

  default=Linux

  image=/vmlinux
  	label=Linux
  	read-only
  	append="video=ofonly" # required for white iBook!

  macos=/dev/hda10
  macosx=/dev/hda12

  # Uncomment for MacOS 9 and BSD:
  # macos=/dev/hda13
  # bsd=/dev/hda14


  # this file requires a trailing newline

Now copy that file to /etc/yaboot.conf (cp /target/etc/yaboot.conf /etc/yaboot.conf) and run mkofboot -b /dev/hdan (where n is the number of your bootstrap partition). Type y for yes. Then type reboot to reboot, or exit and go back to the installation menu.

After the Reboot:

Hopefully that worked. If not, boot from the CD again, select execute a shell, and modify yaboot.conf again. You may end up having to do this several times. If it did work, you should get a nice happy welcome message. And now it's back to hitting Enter a lot.

Packages:

I installed most of my packages from CD (faster than downloading), but also chose to add additional http sources (the list of sources is in /etc/apt/sources.list). I said yes to every source I could add and also added the security updates site. (Security updates are wonderful. You can get notification of new updates by subscribing to the debian-security-announce mailing list. Run 'apt-get update && apt-get upgrade' regularly to upgrade all packages to the most recent versions. It's far easier than keeping a Red Hat, Windows, or other OS up-to-date.)

If you are new to Debian (especially if you have used an RPM-based distribution), you should read about the Debian packaging system. Debian uses .deb files and dpkg, which has front-ends including dselect, apt-get, and aptitude. IMHO, Debian's packaging system is superior (it takes care of dependency problems for you and is ridiculously easy to keep up-to-date), but it does take some getting used to. I usually just use apt-get (command line), but the first few time when I have a lot of packages to install, I use dselect. The Debian installer recommends taskrel, but I skip that and choose dselect instead. Take a look at taskrel and see if there's anything you want there. If you really don't know what packages you want to install, it might be a good idea. Otherwise, onward to dselect.

First of all, read the help and then press the space bar to exit. Use the up and down arrows to navigate through the packages list and + and - to add and remove packages. I know dselect is ugly. I don't think it is ugly, but I remember the days when I thought of it as a sort of hell, where everytime I would want something, it would tell me I needed something else. My advice: when you get to a dependency conflict, just let it install whatever else you need. Don't go mucking about with pluses and minuses. In fact, you can probably just hit enter and let Debian install the default packages. You can run dselect again anytime to add more packages. In addition to the defaults, I installed the following packages:

  bzip2 fping gpm joe libncurses5-dev links-ssl lsof lynx-ssl 
  nmap ntp ntpdate ntp-simple traceroute vim wget

There's a bit of package configuration to be done. The most confusing parts are probably locales (mine was en_US ISO-8859-1) and mail (I chose option 3). Other than that, I think it's pretty straightforward.

Once you are done, you can view all of the installed packages with 'dpkg -l'. (You can also use 'dpkg -l packagename' to check on the status of a particular package.) If you are new to Debian or Linux, read the manpages (help files) for dpkg, dselect, and apt-get ('man dpkg'). You will remember to run 'apt-get update && apt-get upgrade' regularly, right?

Services and Security:

More services are installed and running by default than are probably needed. For example, sunrpc (portmap). I don't know why that's installed by default, but it is, and I usually forget not to install it. But this is a good place to explain about services. Services in Debian are started out of /etc/rc*.d/. The files in these directories are actually symlinks to files in /etc/init.d/. The symlinks follow a particular naming convention which says in one order the services should be started (S) or killed (K). If you want to add scripts to startup, you can use the update-rc.d command or create symlinks yourself. But I'm getting ahead of myself again. To stop portmapper, assuming it isn't needed, run '/etc/init.d/portmapper stop' (or maybe it's portmap not portmapper). Remove the packages portmap and nfs-common with 'apt-get remove portmap nfs-common'. Then purge the config files with 'dpkg --purge portmap nfs-common'. Got that? That's one easy way to remove packages. You can also use 'apt-get -s remove filename' to simulate the removal without actually doing it (useful if you want to know what is going to happen before you do it).

There may be a number of other services running. Run 'lsof -i' to get a list of open ports. You may find other daemons running that you wish to remove (such as lpd). You can remove the package entirely or just stop the processes and remove the symlinks from /etc/rc*.d/. Many services are run out of inetd, probably none of which are needed. Comment the extraneous services out in /etc/inetd.conf and reload the configuration with '/etc/init.d/inetd reload'. Run 'lsof -i' again and note the difference.

Kernel:

Kernel: coming soon (maybe).

Installing X Windows and KDE:

Important: The white iBook requires X 4.2 or later. The version of xserver-xfree86 available in Debian woody will not work! Fortunately, the version of xserver-free86 in Sarge does work. So before installing X, we will need to configure apt to obtain packages from Sarge. This requires making changes to two files: /etc/apt/apt.conf and /etc/apt/sources.list. apt.conf should be created and should contain the following line:

  APT::Default-Release "stable";

A copy of sources.list from my machine follows:

  deb http://ftp.us.debian.org/debian/ stable main contrib non-free
  deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free

  #deb-src http://ftp.us.debian.org/debian/ stable main contrib non-free
  #deb-src http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free

  deb http://security.debian.org/ stable/updates main contrib non-free

  deb http://ftp.us.debian.org/debian/ testing main contrib non-free
  deb http://non-us.debian.org/debian-non-US testing/non-US main contrib non-free

Update the list of available packages with 'apt-get update'. Now we're reading to install X (and a bunch of dependencies) with 'apt-get -t testing install xbase-clients xfonts-base xserver-xfree86'. Accept all of the suggested upgrades (such as glibc).

Debconf should walk you through configuring X. You can reconfigure at any time by running 'dpkg-reconfigure xserver-xfree86' or by modifying the file /etc/X11/XF86Config-4. Here are the answers to the questions, as best I remember them: The driver should be ati, and the video card is located at PCI:0:16:0. Using xfree86 for the XKB rule is fine. The keyboard is a macintosh, and the mouse is at /dev/input/mice. The screen is an LCD which supports 1024x768 @ 60Hz and a color depth of 24 bits.

Type 'startx' to start X. If all goes well, it worked. If not, see what the error seems to be. You can also try out my XF86Config-4 file. Note that you can switch between X and consoles with option-ctrl-fn-F1 and option-fn-F7.

After installing X, you might want to install Gnome or KDE. To install kde, type 'apt-get install kde kdebase-crypto'. This should install a whole bunch of packages. After installation, typing 'startx' should start KDE. (Note that you should not run X/KDE as root.)

The first time you run KDE, you'll be asked to make some basic look-and-feel changes. You can modify your desktop environment at any point by selecting "Control Center" from the K menu or by typing 'kcontrol' in a terminal window.

kcontrol -- coming soon (maybe).

You'll also want to poke around the panel (aka kicker) and K menu. You can add items to the panel by selecting K -> Configure Panel -> Add -> Button. More simply, you can use the second mouse button (once you set one up) to click on the panel and select Add. You can remove an button/icon by clicking on it with the second mouse button. For those who prefer text files, the contents of the panel is contained in ~/.kde/share/config/kickerrc. Also note that files displayed on the desktop are stored in ~/Desktop/.

You'll see a bunch of useful applications in the panel including konsole (terminal application) and konqueror (file manager/web browser). To configure konqueror, select the Configure* options from the Settings menu. Additionally, you may want to install mozilla with 'apt-get install mozilla-browser'. mozilla configuration is available by selecting Edit -> Preferences.

Mouse and Keyboard Tricks:

Macs are (in)famous for having single-button trackpad. In X, two or three buttons are really expected. Fortuantely, you can turn the function keys into additional mouse buttons by modifying the values in /proc/sys/dev/mac-hid/mouse*. Determine which keys you would like to be your mouse buttons (I chose F10 and F11). You'll need to know the keycodes for these buttons which you can obtain by running 'keycodes' and then pressing the desired keys. (Note that keycodes quits automatically after 10 seconds with no input.) For F10 and F11, type the following and then test your buttons:

  echo 1 > /proc/sys/dev/mac_hid/mouse_button_emulation
  echo 68 > /proc/sys/dev/mac_hid/mouse_button2_keycode
  echo 87 > /proc/sys/dev/mac_hid/mouse_button3_keycode

If that worked, you'll want to enable this on startup by adding these lines to /etc/sysctl.conf:

  dev.mac_hid.mouse_button_emulation = 1
  dev.mac_hid.mouse_button2_keycode = 68
  dev.mac_hid.mouse_button3_keycode = 87

Once you have working mouse buttons, you'll be able to use the second mouse button to display contextual menus in applications, on the desktop, in the panel (like the Mac OS X dock), etc. This is very useful. Additionally, you can use the mouse to cut and paste text between windows. To cut and paste, hightlight some text in one window, position your cursor in the appropriate place in another window, and click the second mouse button.

You may also want to modify the tapping behavior of your trackpad. This can be accomplished by running the command trackpad, which is available from the package powerpc-utils (apt-get install powerpc-utils). Options include notap, tap, drag, and lock.

There are also a handful of ways to get the special keyboard keys (volume, brightness, eject) to work. The package pbbuttonsd may be useful.

Power:

There's not much more frustrating than using a laptop and having it suddenly shut off because it's out of battery. Power management requires kernel support (included in default Debian 2.4 kernel) and the existence of /dev/pmu (10,154). I installed the packages pmud and pmud-utils. This installs a bunch of power utilities (pmud, snooze, fblevel). I also installed xpmumon, which is an X app to display the amount of battery time remaining. Tips for extending battery life can be found here

The backlight (screen brightness) can be modified using backlight (from powerpc-utils) and fblevel (from pmud-utils). Additionally, the commands snooze and sleep can be used to put the computer to sleep.

Useful Sites:

(Last modified November 2, 2003)