HOWTO: MOL, Debian, BenH kernel

HOWTO get Mac-On-Linux (MOL) running under Debian when using a BenH kernel. In the Debian way, grasshopper. The good news is that getting a basic MOL running takes about 6 commands. The bad news is that to get everything working under MOL will almost certainly involve a recompile, some extra packages, some script editing, and a bunch of MOL reboots. But hopefully this makes all that easier.

An expanded version of an email by Markus Frauenfelder to the mol-users list. I'll presume you are starting with zero MOL configuration.

Important note: I'm running unstable, and as of Nov. 2003, Debian kernel 2.4.22 with the Debian benh patch.


Preliminaries (Skip for quick start)

How do I get the benh kernel?

See Building Debian for PowerPC.

Further preliminaries

  1. Have a working MacOS or OSX partition somewhere. As long as it isn't mounted read-write by Linux, MOL should detect and use it.
  2. I've written this for manual networking, because my dhcp server complains that I need to configure it and I don't know how.
  3. Become root (you'll need it a lot; just be careful)
  4. Possibly consider removing all previous mol: apt-get remove mol mol-drivers* mol-modules* and then move or remove your old /etc/mol directory. (See Troubleshooting for how this can go wrong.)

Install, configure, and run

apt-get install mol-modules-source
cd /usr/src
tar xzf mol-modules.tar.gz     # use xjf if .bz2
cd $KSRC 
make-kpkg modules_image
cd .. 
dpkg -i mol-modules-<your kernel version>
apt-get install mol-drivers-macosx                            #Also gets mol
molvconfig                                                    #Select video modes
startmol --osx                                                #Run it! Why run anything less?
	

MOL should now run either in an X window or full-screen. Yay! It works! However, it's best in full-screen and MOL tries to go there by default. So if it remains in an X window, it's probably because you're on a laptop, and the default screensize (say 800x600) is smaller than the full screen (say 1024x768). Log in, it might change. If so, you can now try to switch to the MOL console using Control-Option-F8, remembering two things:

Otherwise you will have to change the screen size from inside OSX (the display menu, probably in your OSX menubar already). On my system, there is a slight key remapping under MOL (or OSX?) so to get back out, I hit Control-Command-F7. (Command swaps with Option)

But basically, you did it! OK, now it's time to break it.

Tweak, Configure, Network

While MOL is running, we'll switch back to Linux and change some parameters, then switch back to OSX, run something, shut down OSX, and restart MOL to take advantage of the tweaks. Switch back to Linux now and be root.
First, give more RAM to MOL

If you have sufficient RAM, give MOL more than 96 Meg. For example, edit /etc/mol/molrc.macosx and replace:
ram_size: 96 with ram_size: 512. Last I knew, you could give MOL more than your physical RAM, and the suggestion seemed to be to give MOL most of your physical RAM, and let Linux swap out everything else as required.

Disable X11 window

Unless you like the convenience of Mac-in-a-box, I'd say use the console video only. Edit /etc/mol/molrc.video and change: enable_xvideo: yes to enable_xvideo: no. That way MOL will start in full-screen and run there. It's noticeably faster and console-switching is easy (see above).

Allow normal mortals to run MOL
We don't want to have to be root to run MOL.
chmod a+s /usr/lib/mol/bin/mol
Networking
Update MOL drivers in OSX

Switch back to OSX. If you have a MOL icon on your desktop, double-click it and follow the directions. It will most likely ask you to run an installer to update the networking drivers for MOL. You will then have to restart MOL. Eventually, when you've got it right, this icon no longer appears after boot.

You can stop being root now. Hopefully.


Running again and setting the network

Start mol as a normal user: startmol --osx. By the way, notice that you get a lot of nice diagnostic info on the console. Now open the control panel and click on networking. You should see a dialog box indicating a new port: Acknowledge it and then make sure the network card is selected to the new device, "Ethernet Adaptor (en3)" as shown below:
.

Apply and if your linux box has dhcp running, you should be set to go.

If you are not using dhcp, set the method to "Manual" and:

Use ping or something to test that you can get out. If you cannot, then you might need to fiddle the numbers. See Troubleshooting.


Troubleshooting

Basic MOL troubles

/etc/mol is empty!
I had this problem because I had removed all my config files before removing my old mol. Aaron Schrab writes, ``Did you remove the config files at some point? If so, dpkg will count that as a configuration change that needs to be respected and it won't recreate them. If the packaged versions of a config file changes, dpkg will ask if you want to install it, but otherwise it will be silent. You can change this behaviour by using the --force-confmiss option to dpkg.'' That is, as root run, dpkg --force-confmiss -i mol. Thanks Aaron!
It won't run. Complains there are no modules.
Sometimes it's right, but if make-kpkg and everything worked fine, it might just be that the module isn't loading. Try startmol --osx --list. I got:
--------------------------------------------------------------
  Running kernel:         2.4.22
--------------------------------------------------------------
  Available modules:
    
--------------------------------------------------------------
Jens suggested:
  1. Make sure your Debian package is up-to-date. (It was.)
  2. Check that you are actually packaging and installing modules for your kernel by looking at the output of these three commands:
     
              uname -a dpkg -c
              mol-modules-2.4.22_0.9.69+10.00.Custom_powerpc.deb dpkg -L
              mol-modules-2.4.22
    
    All the version numbers matched (2.4.22).
  3. Find mol.o in that output, and try "insmod" or "modprobe" by hand (as root). (In my case: insmod /lib/modules/2.4.22/misc/mol.o worked.)
  4. If that works, run startmol --osx. (It worked!)

Networking Trouble

Networking doesn't work, and when I run MOL I see: Failed to open /dev/net/tun: No such device
MOL creates this device on the fly, so it shouldn't ever not exist. In my case, this error happened because CONFIG_TUN wasn't set in the kernel, so although the device was there, the kernel couldn't use it. That, in turn, happened because make-kpkg failed to apply the benh patch. While MOL is running, check whether the "tun" module is loaded: as root, run lsmod | grep tun, or just lsmod and look yourself. You can also check that a tun device has been created: ifconfig shows all your network devices. "tun0" should be there on inet addr:192.168.1.1.
Networking doesn't work: I can't ping
Occasionally tunconfig might give the network a different number. I have sometimes gotten tun set up for 192.168.2 instead of .1. You can check this on the Linux side via ifconfig. Read the numbers for the "tun0" device and put those in to the Networking panel in OSX.
The local network comes up OK (I can ping the Linux box from OSX and vice versa), but OSX can't see the internet.
You probably have to configure IP masquerade and DNS forwarding. Hopefully you put those two lines at the end of your tunconfig script. Try running them manually from Linux while mol is running, and see if that helps. As root:
/etc/init.d/ipmasq restart
/etc/init.d/dnsmasq restart
		
Also, you may need to make sure that in OSX you have set your DNS server to be 192.168.1.1. (or 192.168.2.1 as appropriate, see above)

Finale

Documentation

What, I didn't answer all your questions? See /usr/share/doc/mol. That's where I learned some of this stuff. The rest was from the MOL list. Ignore any advice to mknod /dev/net/tun.

Thanks

Copyright

This is free documentation. Share it like a recipe. Acknowledge all the cooks.


Stylesheet and backgrounds by njh.      Last modified: Wed Nov 26 15:31:28 EST 2003 Current revision level: $Id: mol-debian-benh.html,v 1.2 2004/04/14 00:45:50 ctwardy Exp $
Charles Twardy