Ubuntu 12.04 (Precise Pangolin) on iMac G3 (PowerPC)


Guide updated 07/17/2012 : some mistakes corrected!

Netinstall and a lightweight desktop

I recently got an old iMac G3 and felt the need to replace the crappy existing MacOS 9 system with my favorite system : Linux of course!

After a mandatory RAM upgrade (from stock 64M to 512M), I found that the CD drive is extremely picky/worn-out and wouldn’t boot any burned install CDs…

But that’s not enough to stop me, since those iMac models support booting from the network.

I first tried to netboot Debian Squeeze on it, but there were some issues (yaboot started but couldn’t load the kernel).

After some research, it appears that Ubuntu has an updated netinstall iso which just works!

Prepare a DHCP server

My internet router already has a DHCP server, but you can’t configure it for network booting, so I configured a secondary (non-conflicting) DHCP server on my main Linux box 192.168.1.21
(an Arch Linux system, but any distro will do).

Here is my /etc/dhcpd.conf :

ddns-update-style interim;

subnet 192.168.1.0 netmask 255.255.255.0 {
option routers                  192.168.1.1;
option subnet-mask              255.255.255.0;

option domain-name              "mydomain.lan";
option domain-name-servers      192.168.1.1;

option time-offset              -18000;     # Eastern Standard Time
next-server                     192.168.1.21;

# yaboot loader for powerpc
filename "install/yaboot";

allow booting;
allow bootp;

# change range here if needed
range 192.168.1.101 192.168.1.120;

host imac1 {
option host-name "imac1";
# change your hardware address here
hardware ethernet xx:xx:xx:xx:xx:xx;
# change your address here if needed
fixed-address 192.168.1.101;
}

}

(I was obliged to set a fixed lease for my iMac, otherwise it wouldn’t get a dynamic IP)

Setup a TFTP server with the required files for netbooting Ubuntu

Install the proper tftpd server for your distro (see here for Arch : https://wiki.archlinux.org/index.php/Tftpd_server )

On my system, the tftpd boot files go in /var/tftpboot.

Download the netboot mini iso for your powerpc machine

NOTICE

At first I tried Ubuntu 11.10, but a bug causes the hard disk not to be recognized during installation on (some/all) iMacs!

http://www.linux-archive.org/ubuntu-kernel-team/602622-ubuntu-add-pata_macio-pata-modules.html

This bug is now solved in the next Debian/Ubuntu releases!

That’s why I use (by the time I’m writing this) a testing version from Ubuntu’s next release (12.04 / “Precise Pangolin”) which has the bug fixed.

If you don’t like to use an alpha/beta release, you might try an earlier stable Ubuntu release (10.04 LTS for example).

Download iso from :
http://ports.ubuntu.com/dists/precise/main/installer-powerpc/current/images/powerpc/netboot/mini.iso

Extract the iso into /var/tftpboot/install

# mount -o loop mini.iso /mnt/cdrom/
# mkdir /var/tftpboot/install
# cp /mnt/cdrom/install/* /var/tftpboot/install/
# umount /mnt/cdrom

Seems that yaboot can’t find it’s configuration file if it’s not in tftpboot’s root, so :

# cd /var/tftpboot
# mv install/yaboot.conf .

Netboot your iMac

Make sure your DHCP and your TFTP servers are running!

Power up your iMac, enter OpenFirmware : HOLD the OPTION-COMMAND-O-F keys until the OpenFirmware console appears.

Note : the OPTION key is the left ALT key, the  COMMAND key is the “APPLE” key

Type at the prompt :

boot enet:0

Yaboot should load (you may see some errors “can’t load configuration file”, until you can see the boot message from Ubuntu)

(if no yaboot appears, network timeouts, etc… you may have a look at your DHCP server logs).

If you get the error message “LOAD-SIZE is too small”, check your “option routers” IP in your dhcpd.conf.

Now start the installer (enter by default)

Install tips

Keyboard : make sure to select the macintosh variant of your keymap (if using a mac keyboard)

Software selection : I only chose to install OpenSSH server. So I can start from a bare console system, and install a lightweight desktop afterwards.
(My iMac has a stock ~6G HDD, I admit I was too lazy to replace it with a bigger one)

Post-installation System Configuration

Log in, then switch to root

# sudo su

Let’s see what we’ve got

# uname -a
# free -m
# df -h
(bare system occupies nearly 1G of disk space)
# aptitude update
# aptitude install htop && htop

Some optimizations

Filesystem optimizations

# nano /etc/fstab

add the “noatime” option to the / line (your UUID will vary)

UUID=1eb86fe2-64ce-48c2-91c8-7193d65a0dc8 /               ext4    errors=remount-ro,noatime 0       1

and set a /tmp to tmpfs, add the line :

tmpfs           /tmp            tmpfs   defaults,noatime,nodev,nosuid,mode=1777        0       0

Swappiness

# nano /etc/sysctl.conf

vm.swappiness=20
vm.vfs_cache_pressure=50

Prelink

# aptitude install prelink
# prelink -a

Boot splash screen removal (because it’s ugly!)

# nano /etc/yaboot.conf

Remove the “splash” option in the “append” line(s).
(On older Ubuntu’s you might add a “nosplash” option instead)

Then update yaboot bootloader

# ybin -v

Next reboot, no splash!

A lightweight desktop

Installing X.Org

# aptitude update
# aptitude install xorg
# startx

Oops! not working (No screens found)

Looks like automatic xorg configuration failed! So we create an /etc/X11/xorg.conf (This is the tricky part)

# nano /etc/X11/xorg.conf

Here is my working xorg.conf (adapt your keyboard layout)

# xorg.conf for iMac G3 350MHz (blueberry)
#
# https://agentoss.wordpress.com

# uncomment these only if using non-hotplug (evdev) drivers
#Section “ServerFlags”
# Option “AutoAddDevices” “false”
# Option “DontZap” “false”
# Option “DontZoom” “false”
#EndSection

Section “ServerLayout”
Identifier “X.org Configured”
Screen 0 “Screen0” 0 0
InputDevice “Mouse0” “CorePointer”
InputDevice “Keyboard0” “CoreKeyboard”
EndSection

Section “Files”
ModulePath “/usr/lib/xorg/modules”
FontPath “/usr/share/fonts/X11/misc”
FontPath “/usr/share/fonts/X11/cyrillic”
FontPath “/usr/share/fonts/X11/100dpi/:unscaled”
FontPath “/usr/share/fonts/X11/75dpi/:unscaled”
FontPath “/usr/share/fonts/X11/Type1”
FontPath “/usr/share/fonts/X11/100dpi”
FontPath “/usr/share/fonts/X11/75dpi”
FontPath “/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType”
FontPath “built-ins”
EndSection

Section “Module”
Load “i2c”
# Load “bitmap”
Load “ddc”
Load “dri”
# Disable “dri”
Load “dri2”
Load “record”
Load “extmod”
Load “freetype”
# Load “dbe”
# Load “glx”
# Load “int10”
Load “type1”
# Load “vbe”
EndSection

# this section will be ignored since we use evdev automatic detection
Section “InputDevice”
Identifier “Keyboard0”
Driver “kbd”
EndSection

# this section will be ignored since we use evdev automatic detection
Section “InputDevice”
Identifier “Mouse0”
Driver “mouse”
Option “Protocol” “auto”
Option “Device” “/dev/input/mice”
Option “ZAxisMapping” “4 5 6 7”
EndSection

# this is where we specify our keyboard settings
# for an Apple keyboard
Section “InputClass”
Identifier “Keyboard Defaults”
MatchIsKeyboard “yes”
Option “XkbModel” “pc105”
# change layout here
Option “XkbLayout” “fr”
Option “XkbVariant” “mac”
Option “XkbOptions” “lv3:rwin_switch,lv3:lwin_switch,terminate:ctrl_alt_bksp,srvrkeys:none”

# special key combinations :
# pipe (|) : Shift-Apple-L
# [ : Shift-Apple-(
# ] : Shift-Apple-)
# { : Apple-(
# } : Apple-)
# tilde (~) : Shift-Apple-N
# Antislash (\) : Shift-Apple-:
EndSection

Section “Monitor”
# Supports 1024×768@75, 800×600@94, 640×480@116
Identifier “Monitor0”
VendorName “iMac”
ModelName “Monitor Model”
Option “DPMS”
HorizSync 58-62
VertRefresh 75-117
# 1024×768 @ 75.00 Hz (GTF) hsync: 60.15 kHz; pclk: 81.80 MHz
# Modeline “1024x768_75.00” 81.80 1024 1080 1192 1360 768 769 772 802 -HSync +Vsync

# ModeLine “1024×768” 78.75 1024 1044 1140 1328 768 781 784 820 +hsync +vsync
# ModeLine “800×600” 62.40 800 821 901 1040 600 609 612 644 +hsync +vsync
# Modeline “640×480” 49.90 640 657 721 832 480 481 484 514 +hsync +vsync
EndSection

Section “Device”
### Available Driver options are:-
### Values: : integer, : float, : “True”/”False”,
### : “String”, : ” Hz/kHz/MHz”,
### : “%”
### [arg]: arg optional
#Option “NoAccel” # []
#Option “Dac6Bit” # []
#Option “Dac8Bit” # []
#Option “ForcePCIMode” # []
#Option “CCEPIOMode” # []
#Option “CCENoSecurity” # []
#Option “AGPMode” #
#Option “AGPSize” #
#Option “RingSize” #
#Option “BufferSize” #
#Option “EnablePageFlip” # []
#Option “Display” #
#Option “PanelWidth” #
#Option “PanelHeight” #
#Option “ProgramFPRegs” # []
#Option “UseFBDev” # []
#Option “VideoKey” #
#Option “ShowCache” # []
#Option “VGAAccess” # []
Identifier “Card0”
Driver “r128”
# comment BusID for your system as it may not be the same (it will be autodetected)
# BusID “PCI:0:16:0”
Option “NoInt10” “true”
Option “CCEusecTimeout” “100000”
Option “UseFBDev” “false”
Option “XAANoOffscreenPixmaps” “true”
Option “SWcursor” “false”
Option “DMAForXv” “true”
EndSection

Section “Screen”
Identifier “Screen0”
Device “Card0”
Monitor “Monitor0”
DefaultDepth 24
SubSection “Display”
Viewport 0 0
Depth 24
Modes “1024×768” “800×600” “640×480”
EndSubSection
EndSection

Section “Extensions”
Option “Composite” “Enable”
EndSection

Section “DRI”
Mode 0666
EndSection

Copy/paste from another computer via ssh, or via pastebin http://pastebin.com/RKRQpPpZ

By the way, it’s best to use a standard USB 2-button mouse, not Apple’s original 1-button mouse!

Install a lightweight window manager, then start X

# aptitude install fluxbox
# startx

An empty Fluxbox desktop (nicely ubuntu-ized) should now appear, nice!

Some more apps

A lightweight file-manager : pcmanfm, some gtk2 and icon themes to go with (optional but it looks ugly without!), and a gtk2 theme changer

# aptitude install pcmanfm gtk2-engines elementary-icon-theme gtk-chtheme

Set pcmanfm as default x-file-manager

# ln -s /usr/bin/pcmanfm /usr/bin/x-file-manager

Change gtk theme within an X session (as a regular user)

$ gtk-chtheme

Set the elementary icon theme as default

$ echo >~/.gtkrc.mine gtk-icon-theme-name = "elementary"

A small notepad : leafpad (always useful)

# aptitude install leafpad

Picture viewer : gpicview

# aptitude install gpicview

Terminal emulator (by default Xterm is installed, but there’s better)

# aptitude install lxterminal

Web browser : the heavy ones – Firefox, Epiphany

# aptitude install firefox
# aptitude install epiphany-extensions

Warning, lots of (gnome) dependencies!

If you prefer a lighter browser, I suggest Midori

# aptitude install midori

(still those heavy gnome dependencies, though!)

NOTE : no flash plugin support for PowerPC platforms!
TIP : use Firefox with FlashVideoReplacer addon, set default video quality to low for smooth playback
TIP2 : use Adblock(+) addon for Firefox, also for Epiphany (ads will slow down everything)

Audio player

Let’s test the sound playback first

# aptitude install alsa-utils
# alsamixer
(set output volumes)
# alsactl store
now switch to regular user
$ aplay /usr/share/sounds/alsa/Noise.wav
if no sound output, check that your user is in the audio group!
if not, as root :
# usermod -a -G audio <username>

Basic console command line player, mpg123

# aptitude install mpg123

With a GUI, I like Audacious

# aptitude install audacious

Desktop enhancements

as a regular user, modify some Fluxbox’s key shortcuts

$ nano ~/.fluxbox/keys

add the lines :

# open file manager with Ctrl-Alt-F
Control Mod1 F :Exec x-file-manager

# open a terminal with Ctrl-Alt-T
Control Mod1 T :Exec x-terminal-emulator

# start default web browser with Ctrl-Alt-W
Control Mod1 W :Exec x-www-browser

# start Audacious audio player with Ctrl-Alt-A
Control Mod1 A :Exec audacious

Some more Fluxbox customization

$ nano ~/.fluxbox/init

(find and replace the values)

session.screen0.toolbar.tools:  prevwindow, nextwindow, iconbar, prevworkspace, workspacename, nextworkspace, clock, systemtray
session.screen0.focusModel:     MouseFocus

Note : “man fluxbox” is your friend!

Conky for system info/monitoring

$ sudo aptitude install conky-all

Let’s configure it (system-wide)

$ sudo nano /etc/conky/conky.conf

Change some defaults :

alignment top_right
background yes
double_buffer yes
xftfont DejaVu Sans Mono:size=8
gap_x 0
gap_y 32

# We add some text to show our Fluxbox shortcuts (I never remind them otherwise!)
# Append at the end of the file :

$hr
Shortcuts :
Control-Alt-F : File manager
Control-Alt-T : Terminal
Control-Alt-W : Web browser
Control-Alt-A : Audio player

When you save the configuration file, conky (if running) is automagically restarted!

Adding a launch panel : fbpanel
(Optional, it’s a bit redundant with Fluxbox’s menu and system tray)

$ sudo aptitude install fbpanel
$ nano ~/.config/fbpanel/default

Modify the values :

Global {
# we want the panel at the top since fluxbox's tray is already at the bottom of the screen
edge = top
allign = center
margin = 0
widthtype = percent
width = 100
height = 24
transparent = true
tintcolor = #ffffff
alpha = 28
setdocktype = true
setpartialstrut = true
autohide = true
heightWhenHidden = 2
roundcorners = false
roundcornersradius = 7
layer = none
MaxElemHeight = 32
}

# Disable the "volume" plugin since it generates an error

#plugin {
#    type = volume
#}

Autostart conky and fbpanel with the Fluxbox session

$ nano ~/.fluxbox/startup

add the lines :

fbpanel &
conky
# note : conky does not need the "&" because it is configured to fork automatically in the background by default

before the “exec fluxbox” line.

Autologin into X at boot (with no X session manager)

# nano /etc/rc.local

Add the line :

su - <username> -c startx

before the “exit 0” line.

If you don’t want autologin like this, install a display manager (xdm, slim, lxdm, lightdm…)

Add reboot/halt entries in Fluxbox’s menu
(we add them in the user’s config file since the system-wide config files are automatically re-generated when apps are installed/removed)

$ nano ~/.fluxbox/menu

[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)

[separator]
[exec] (Reboot computer) {sudo reboot} </usr/share/icons/gnome/16x16/actions/reload.png>
[exec] (Shutdown computer) {sudo halt} </usr/share/icons/gnome/16x16/actions/stop.png>

[end]

Now we have to allow members of group sudo to shutdown/restart without password

$ sudo visudo

add the lines :

%sudo   ALL=(ALL:ALL) NOPASSWD: /sbin/halt
%sudo   ALL=(ALL:ALL) NOPASSWD: /sbin/reboot

Final thoughts

We now have a nice all-in-one computer for web browsing, sound playing, …

Performance is very acceptable for such an old system although the booting process is rather slow due to openfirmware/yaboot and the slow hard disk.
(And the graphics adapter is quite slow too)

This install guide has also been tested on a PowerMac G4 (Sawtooth) successfully!

As always, comments, suggestions, flames(!) are welcome!

Things left to solve :

BUG : console display remains blank when exiting X

References and useful links :
https://en.wikipedia.org/wiki/IMac_G3
http://mac.linux.be/content/guide-open-firmware-apple-bios-0
http://www.debian.org/releases/stable/powerpc/ch05s01.html.en#boot-tftp
https://help.ubuntu.com/community/Installation/MinimalCD#A32-bit_PowerPC.2A.2A
https://wiki.ubuntu.com/PowerPCFAQ
https://wiki.ubuntu.com/PowerPCKnownIssues
http://wiki.gilug.org/index.php/AppleImacG3350-ubuntu1104
https://wiki.archlinux.org/index.php/Maximizing_Performance
https://wiki.archlinux.org/index.php/Xorg#Input_devices
http://ouitech.fr/wiki/doku.php/tutoriels/divers/clavier_mac_sous_linux
http://fluxbox-wiki.org/index.php?title=Faqs

15 thoughts on “Ubuntu 12.04 (Precise Pangolin) on iMac G3 (PowerPC)

  1. Interesting read! Thanks for sharing!

    You should check out the installation instructions linked on this page too https://wiki.ubuntu.com/PowerPCDownloads

    Going by those instructions your blank console is due to you not having the correct framebuffer loaded. Also, sluggish graphics is due to the software rasterizer – it looks a bit of a fiddle to get the r128 fully working with drm/dri.

    Hope this helps!

    • Hi

      In fact the console is only blank when I exit X.
      When booting and login in, console output is ok.

      I have tried some yaboot options for the framebuffer but it doesn’t change anything…

      No big deal though, I use mainly the X desktop🙂

  2. Hi,
    usefull example howto use old computer with new distro version, probably fluxbox is one of the best option for this purpose.

    Iam actually using fluxbox wm on kiosk platform (running debing testing) with touchscreen, damn fast.

    Great, thx. faha

    • Hey man! Just discovered another tip, if this could be helpful!
      Put “video=offb:off” in the append string of yaboot.conf, then insert aty128fb in /etc/modules.
      You’ll see coming out the GUI automagically (after reboot, of course :p), without any sort of tweaking or messin’ around with xorg.conf!😀
      Tested on G3 B&W and Philips monitor.
      00:10.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Rage 128 RE/SG

      • Thanks for the tip. Now that Ubuntu 12.04 is released, some things must have been fixed/improved (since I used a dev. version for this tutorial). I’ll try to do an update but it’s not on my priority list right now!

  3. Hello. Which are the features of the iMac used for 12.04? I have a G3 333mhz lime (last model after Bondi blue) but I haven’t been able to install a latest version of ubuntu. it has MintPPC but based on an old Debian. And I also have an iBook G3 366 clamshell with ubutu 10.10. I know it’s not supported anymore but it is the only one that has worked without giving me the headache of having to configure the video stuff. I’m waiting for the 12.10 to see if there are some bugs fixed so that I could get back to an updated Linux distro.

  4. Hi, my iMac is a “blueberry” model
    http://lowendmac.com/imacs/350-mhz-imac-g3-blueberry.html

    I recently installed MintPPC 11 instead of Ubuntu. (Used the same PXE boot method as in this howto). See my thread here : http://www.mintppc.org/forums/viewtopic.php?f=14&t=1007

    Runs well but still the super slow video problem (no 2D acceleration). But there’s hope, a nice guy has re-implemented 2D acceleration for old Rage 128 video cards. Thus, still waiting for the updated r128 xorg video driver to be available in some next X.Org release!

  5. Thank you very much for sharing this useful information!!! Now I can set up my old iMac after upgrading from a very outdated linux version.

  6. Very informative! I have an iMac G3 400MHz indigo. I installed ubuntu 12.04 ppc alternate with the intention of purging unity and related software, in favor for a more light weight environment. The problem I am having is after boot, X will drop me to a low graphics dialog asking me if i would like to continue in low graphics mode reconfigure x, troubleshoot, or return to CLI. Any option i select will drop me to CLI, even with the xorg.conf provided on this page. So my question to the community is. What do I do from here to give this fun little computer a new life? My plans for it are for video and audio play back, recording voice memos and text notes, and maybe some light web browsing with midori.

    • Hi, try MintPPC instead, it is Debian-based and their forum is friendly and helpful🙂
      (I have MintPPC 11 running on my iMac)

      But be warned that video tasks will be slow whatever you use, because of the CPU speed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s