By on

This post is specific to installing Ubuntu Server 12.10 on a Mac Mini (Late 2012). There is another post, that is almost identical to this one that discusses the changes you have to make to install Ubuntu Server 12.04 on a Mac Mini (Late 2012)

If you got your hands on a recent Mac Mini (Late 2012), you may be tempted to install Ubuntu Server 12.10 on it. Most of the instructions on the internet is specific to installing Ubuntu Desktop. I have been scratching my head, trying to figure out how to get the Broadcom’s desktop NetXtreme Ethernet adapter built, installed and configured. Here’s what I started with:

  • A computer with Ubuntu Desktop 12.04 or Ubuntu Desktop 12.10 installed
  • An application to create virtual machines, such as VMware or VirtualBox
  • A DVD Writer and blank media
  • Mac Mini (Late 2012) with model identifiers of macmini6,1,macmini6,2 or macmini6,3
  • Internet access

Chances are that there are easier ways to do this and that I haven’t found it yet.

Creating custom installation media

Download Ubuntu Server 12.10

wget http://releases.ubuntu.com/quantal/ubuntu-12.10-server-amd64+mac.iso

Create directories. When we are done, we’ll create a DVD using the contents of the custom-iso directory.

mkdir original-iso custom-iso

Mount the Ubuntu Server 12.10 installation media

sudo mount -o loop ./ubuntu-12.10-server-amd64+mac.iso ./original-iso

Copy the contents from the installation media to our custom folder

rsync -a original-iso/ custom-iso/

Unmount the drive and delete the directory

sudo umount ./original-iso
rm -Rf ./original-iso

Make the files and directories in custom iso writable.

chmod -R 777 ./custom-iso

Download and customize tg3 source code

Create the directories where we will store the source code of the drivers

mkdir ./custom-iso/src
mkdir ./custom-iso/src/tg3-3.124c

[Download the drivers][2] from Broadcom. Assuming you downloaded the file to your home directory, unzip the file.

   [2]: http://www.broadcom.com/support/ethernet_nic/netxtreme_desktop.php

unzip ~/linux-3.124c.zip

Extract the source

tar -zxvf ./Server/Linux/Driver/tg3-3.124c.tar.gz -C .

Copy it to the custom ISO folder

cp -R ./tg3-3.124c  ./custom-iso/src/tg3-3.124c/src

The source as is, doesn’t compile due to the Linux Kernel that Ubuntu 12.10 uses. Follow [these instructions][3] to modify the source code in ./custom-iso/src/tg3-3.124c/src so it will compile. Using your favorite editor, create a file ./custom-iso/src/tg3-3.124c/dkms.conf with the following contents

   [3]: http://ubuntuforums.org/showpost.php?p=12330661&postcount=6

PACKAGE_NAME=tg3 PACKAGE_VERSION=3.124c CLEAN=”make -C src/ clean” MAKE=”cd src/ && make BUILD_KERNEL=${kernelver} KVER=${kernelver}” BUILT_MODULE_NAME[0]=”tg3” BUILT_MODULE_LOCATION[0]=”src/” DEST_MODULE_LOCATION[0]=/updates AUTOINSTALL=yes

At the end of the installation process, we’ll register, build and install the driver with DKMS, which will rebuild the driver whenever the kernel gets upgraded. There is a risk that an upgrade may render the driver unusable, so be aware of this you are going to use the Mac Mini for anything important. Before upgrading the kernel, you may want to test whether the driver will build and work in a virtual machine.

Obtaining additional packages

The first step would be to create a virtual machine with Ubuntu Server 12.10 installed and configured. It is unnecessary to customize it. For the purpose of this post, we’ll assume the virtual machine has an ip address of 192.168.1.115 and that your username is johnd (as in John Doe). There is no need to install anything but OpenSSH. Login to the virtual machine and clear out the apt cache.

sudo apt-get clean

Add any packages you’d like to have on the server

sudo apt-get -q -y install python-apport
sudo apt-get -q -y install dkms
sudo apt-get -q -y install python-software-properties 
sudo apt-get -q -y install firmware-b43-installer 
sudo apt-get -q -y install linux-firmware-nonfree
sudo apt-get -q -y install build-essential
sudo apt-get -q -y install linux-source
sudo apt-get -q -y install linux-headers-$(uname -r)
sudo apt-get -q -y install python-gi

Going back to your own desktop computer, lets create directories necessary to store additional packages.

mkdir ./custom-iso/dists/stable/extras
mkdir ./custom-iso/dists/stable/extras/binary-amd64
mkdir ./custom-iso/pool/extras/

Copy the deb files from your virtual machines to the custom iso directory. Remember to replace the ip address and username with that of your own.

scp -r johnd@192.168.1.115:/var/cache/apt/archives/*.deb ./custom-iso/pool/extras/
pushd custom-iso
apt-ftparchive packages ./pool/extras/ > dists/stable/extras/binary-amd64/Packages
gzip -c ./dists/stable/extras/binary-amd64/Packages | tee ./dists/stable/extras/binary-amd64/Packages.gz > /dev/null
popd

The packages necessary to build the tg3 driver, will be part of the installable media, making it possible for us to install them automatically.

Customize the Ubuntu Server installation media

Encrypt your password

openssl passwd -1 “P@s$w0rd”

Using your favorite editor, create a file ./custom-iso/isolinux/ks-custom.cfg. Replace with the password you created earlier.

#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone America/Los_Angeles
#Root password
rootpw --disabled
#Initial user
user johnd --fullname "John Doe" --iscrypted --password <password>
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use CDROM installation media
cdrom
#System authorization infomation
auth  --useshadow  --enablemd5 
#Firewall configuration
firewall --disabled 
#Do not configure the X Window System
skipx
%packages
# install these packages
openssh-server
dkms
build-essential
linux-source
linux-headers-3.5.0-21
python-gi
python-apport
%post
# run these commands when post installation
cp -R /media/cdrom/src/tg3-3.124c/  /usr/src/tg3-3.124c/
mkdir /usr/src/tg3-3.124c/
dkms add -m tg3 -v 3.124c
dkms build -m tg3 -v 3.124c
dkms install -m tg3 -v 3.124c

This is a kickstart file which automates most of the configuration. It will install the packages openssh-server, dkms, build-essential, linux-source, linux-headers-3.5.0-21, python-gi and python-apport from the cdrom. When the installation is done, it will copy the source from the installation media and use DKMS to add, build and install the driver. In order to make it useful, we should add a menu. Using your favorite editor, edit the ./custom-iso/isolinux/txt.cfg and add the following entry:

label autoinstall
  menu label ^Automatically Install Ubuntu Server
  kernel /install/vmlinuz
  append file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz quiet ks=cdrom:/isolinux/ks-custom.cfg --

Feel free to replace the Install Ubuntu Server entry if you feel adventurous.

Create custom installable media

First, lets create an ISO (ubuntu-12.10-server-custom-amd64.iso) from the custom iso directory.

mkisofs -J -l -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -z -iso-level 4 -c isolinux/isolinux.cat -o ./ubuntu-12.10-server-custom-amd64.iso custom-iso/

You may want to create a new virtual machine and use this ISO to install Ubuntu Server 12.10. This may help you to diagnose most issues you may run into. Unfortunately, a virtual environment is very different than the real thing, so even if it installs fine in a VM, you may still encounter issues. For example, I had some issues doing automatic partitioning. When you are ready for the real thing, write a DVD. It may work with a USB stick, but I have not verified it.

Installing from custom media

Go to your mac mini

  • if it is running, turn it off
  • press the ALT key on your keyboard, power on your mac mini, and release the key once you see a “boot menu” with a CD
  • Select the “Windows” CD. We’re installing Ubuntu, but Macs show “Windows” for any operating system it doesn’t understand.
  • Select “English”
  • Select “Automatically Install Ubuntu Server”
  • You’ll be warned that a network adapter could not be found, select to continue.
  • You’ll be asked to create partition; select use whole disk and configure LVM.
  • Wait for the installation to complete and the mac mini to reboot

Once you rebooted, you can login and configure networking. For example, if you want to use DHCP, add the following to /etc/network/interfaces

auto eth0 
iface eth0 inet dhcp

If you’d like to have a static IP address,

auto eth0
iface eth0 inet static
address 192.168.1.90
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

Be sure to replace the address, gateway, net mask and so forth. Finally, bring the interface up:

sudo ifup eth0

And you should be able to ping an external site (google.com). If not, start diagnosing the issues. One thing to note is that your sevrer will have the name “ubuntu”. You may want to change that. Save the DVD in a safe place, just in case you have to reinstall Ubuntu in the future…

References:

I had some help along the way to get me started:

I don’t endorse them, but credit is due where credit is due.