This is going to be a long post.
It all started with the idea of
using the old mac as an internet radio. As its screen had become damaged and showed up scratches, and it was underpowered for most tasks, this seemed a good idea. The final solution was to enable booting to console by installing a base install from mini cd of Ubuntu 12.04 and running a script on login. Network connectivity via the built-in ethernet port. Efforts to use a USB wifi adapter were not successful in the sense that the wifi was not reliable, would come up sometimes and not at other times. This post will chronicle the entire story.
Final working solution:
For doing the netboot, after setting up tftpd with the required files as above, the Mac needs to be
booted into open firmware by pressing Alt+Command+o+f at boot, and the command
boot enet:0
needs to be entered at the Open Firmware prompt. The Ubuntu netboot installer works, but stops at "getting installer components" with a blank screen, and continues after 15 minutes! The whole base install takes an hour or so, downloading required files online took around 15 minutes with our 2 Mbps shared link.
The machine was made to
auto-login to the user shell by editing /etc/init/tty1.conf. An interactive bash shell script was the choice for running the "radio" - a simple
bash case statement with a
while loop asking for input to change streams. Changing streams by
killall mpg123 followed by the relevant
mpg123 stream-url. This was made to start on boot by
putting it in .bash_profile. Then the system boots up and starts playing in 90 seconds.
Ease of shut-down - the Ctrl-Al-Delete method
given here was adapted, editing /etc/inittab and changing the shutdown -r to shutdown -h to halt the system instead of reboot on Ctrl-Alt-Del. On the Mac keyboard, the keypress for del needs Fn+Delete, since Backspace is labelled as Delete.
Mis-steps:
In hindsight, the final result above could have been accomplished in around 10 minutes' time. Instead, a week was spent in various explorations. Many things were learnt, which are listed below.
Initially, the idea was to upgrade the running Ubuntu 8.04 LTS to 12.04, so that the newer kernel would have built-in support for the USB wifi device. Upgrade from 8.04 to 10.04 went off OK, via
#apt-get update
#apt-get upgrade
#apt-get dist upgrade
#do-upgrade-release
But 10.04 to 12.04 failed.
Perhaps this was because of not doing the
#apt-get update ? Software sources were manually changed
archive.ubuntu.com/ubuntu to
ports.ubuntu.com , and then doing the above, do-release-upgrade worked. But at the end of the install, some errors were reported, and on reboot, the system went into a loop and refused to boot. Single user recovery console was the only working option, and ifupdown etc seemed to be borked. So, a fresh install was attempted.
Several times when the Mac was booted without an ethernet connection, the date and time were off. Apparently these iBooks don't have a BIOS battery, and only use a capacitor and the main battery. The capacitor as well as the main battery seem to be dead in this case.
Resetting PMU and PRAM etc did not help.
Possibly due to the power constraints of the USB 1.1 port on this iBook, sometimes booting with the
DWA-131 USB wifi adapter would cause repeated errors scrolling by every second, complaining
unable to enumerate usb device on port 1 - connecting via a USB hub stopped this issue. After the driver was detected, removing the hub also did not cause this problem to recur.
In this case,
lsusb showed the appropriate device name, and checking the driver for it, googled 07d1:3303 D-Link System DWA-131 wireless n nano adapter linux and found the driver was
https://wiki.debian.org/rtl819x
that the command to be used to connect via wifi is iwconfig and not ifconfig.
Also, found that on listing drivers, lsmod was listing the driver rtl819x as loaded, so probably it should work.
So, did
#apt-get install wireless-tools
and tried to connect, as given at
this post - in that page, in the "Make it a script" section, perhaps the first line should be
ifconfig wlan0 up
Anyway, tried it, did not work. Finally found via
this thread that iwconfig works only for WEP, and that wpa-supplicant has to be used for WPA. Tried the methods
given here, did not work, so tried to install ubuntu desktop. This was in Ubuntu 13.10 - but starting X was causing a segmentation fault. Even after
googling and trying to
remove other errors, and following the steps
given here, X still seg-faulted when a window manager was installed.
So, went back to 12.04 to try the procedure given at
this post to load X - but before doing the X install, thought of trying to connect with commandline
using wicd and found
this post. This method succeeded! Except in the last line, it was
dhclient wlan0 and not
dhcpd wlan0 in my case.
# ifconfig wlan0 up
# iwconfig wlan0 essid "my_network"
# wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf
# dhclient wlan0
Then used
this method to make it come up at boot, editing /etc/network/interfaces. But the wifi connection was erratic. Sometimes would not connect at all on boot. Sometimes would connect if the
time was set using open firmware with
decimal dev rtc 09 34 13 28 08 2013 set-time
but sometimes not. Would sometimes connect if ethernet cable was connected, sometimes not. Tried going to WEP instead of WPA, and it seemed to work as per the iwconfig method given above, and seemed to connect OK even when the time was off, even when ethernet was off. But a cold reboot the next day showed that the wifi connection was still erratic, and so wired was the way to go.
Testing the networks with wicd, needed to enter wlan0 in Preferences of wicd-curses as per
this post.
mpg123 failed to open module etc errors as non-root user.
Installed alsa, rebooted, fixed.
#apt-get install alsa alsa-tools
Then, choosing amixer set Master 45 seems to be a good volume level to set.