Ubuntu 12.04 LTS on an Apple Mac Mini (Late 2012)

I’m switching my web hosting to a Mac Mini running Ubuntu Linux. These are my notes for getting it set up.

Here’s the hardware specs:

  • Apple Mac Mini 6,2 (Late 2012)
  • Intel Core i7-3615QM 2.3 GHz quad-core processor
  • 16 GB DDR3-1600 memory
  • 128 GB solid state drive
  • 1 TB 5400 RPM hard drive

The Mac Mini is built to run OS X 10.8, but Ubuntu 12.04.1 runs nicely with a couple of tweaks.

  • Installing required the “noapic” flag (F6 when at the boot menu)
  • Set “Boot after power failure” by running the following, and adding it to /etc/rc.local:
    setpci -s 0:1f.0 0xa4.b=0
  • Fan control doesn’t work without applesmc and macfanctld installed from Ubuntu’s Mactel PPA
  • the network card doesn’t work out of the box, you need to download/compile a new version of the tg3 module from Broadcom

For networking, I didn’t want to have to remember to recompile the module after reinstalling each kernel. I setup DKMS to take care of it automatically.

  • Download the Linux “tg3” driver from Broadcom (version 3.124c (10/18/12) at the time of this writing)
  • Extract it
  • Navigate to Server/Linux/Driver/tg3-3.124c.tar.gz
  • Extract that file to /usr/src/tg3-3.124c/src/
  • Create a file called /usr/src/tg3-3.124c/dkms.conf with the following contents:
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
  •  Add the module to DKMS so that it’s automatically built for new kernels:
sudo dkms add -m tg3 -v 3.124c
sudo dkms build -m tg3 -v 3.124c
sudo dkms install -m tg3 -v 3.124c
  • The module is now ready, either load it with “modprobe tg3” or reboot
  • If you need to remove it at a later time, do:
sudo dkms remove -m tg3 -v 3.124c --all

After these changes the Mac Mini is working great. I didn’t test Wi-Fi, Thunderbolt, or Sound, since I won’t be using them. USB works as far as being able to connect a keyboard and mouse, and Ubuntu’s 12.04.1 LiveCD boots into the full desktop.

Update:

Ubuntu has released 12.04.2 install/live CDs based on kernel version 3.5. I have not tested the above instructions with kernel 3.5, so if you’re following them you probably want to stick with the 12.04.1 install ISOs with kernel 3.2. If you install from 12.04.1, you will automatically stay on 3.2 even when updating to 12.04.2.

Update 2 (2014-10-05):

Ubuntu 14.04 and 12.04 with the Trusty hardware enablement stack (installed by default from the 12.04.5 ISO) have the required tg3 driver and do not need the custom DKMS config above.

 

38 thoughts on “Ubuntu 12.04 LTS on an Apple Mac Mini (Late 2012)”

  1. Thanks a lot, it really helps me to get Ethernet on Mac Mini 2012 working. From there, getting the Wifi and other hardware working is simply a matter of using Additional Drivers in settings.

    The & should be the actual ampersand character, otherwise the module will fail to build.

  2. I have just purchased a new Mac Mini, followed above instructions and still can not get the ethernet port to work.
    Have error messages when building the module posted below. Can anyone help?
    Thanks

    Building module:
    cleaning build area….(bad exit status: 2)
    cd src/ && make BUILD_KERNEL=3.2.0-33-generic KVER=3.2.0-33-generic….(bad exit status: 2)
    ERROR (dkms apport): binary package for tg3: 3.124c not found
    Error! Bad return status for module build on kernel: 3.2.0-33-generic (x86_64)
    Consult /var/lib/dkms/tg3/3.124c/build/make.log for more information.
    [email protected]:/usr/src/tg3-3.124c#

  3. I just purchased a new Mac Mini and can not get the ethernet port to work. When I try to add the module to DKMS, it turns out DKMS is not installed yet. I tried “sudo apt-get install dkms” and got:
    E: Unable to locate package dkms

    How can I go through this and get my ubuntu on mac mini connected? Can any one help? Thanks!

  4. Interesting!
    I also plan to buy a Mac mini Server late 2012 to install Ubuntu. I also do not care much about thunderbolt and wifi since I will use it as a server box.
    But one thing I would like to ask you about CPU temperate: is it hot?
    And do you install Ubuntu on SSD or hard disk?

    Thanks for your post!
    LE

  5. Did you have any issues with graphics? I’m seeing dithering & a general lack of enough colours over the desktop (with a mini 6,1 and quantal)

  6. @Le

    The CPU seems fine, with the macfanctld service running the fan will speed up when I stress test the system with Prime95, and it’s silent when idle. It’s also stable enough to run Prime95 for over 24 hours without issues.

    I upgraded my mini with a Samsung 830 SSD, I have both the SSD and original HDD inside the case, with Ubuntu on the SSD.

  7. Are you using it as a desktop? Curious, as I’m trying to at the moment, and apart from the network issues, I’m also seeing graphics problems – lack of colour depth causing dithering, initially noticeable on desktop background but present everywhere. Would be interested to know whether you’re using it with no issues, haven’t used it as a desktop, or are having the same issue.

  8. Hi, has anyone experienced problems with the Mac Mini kernel panicing on 12.04 when under load, or having iO issues with the Disk? I don’t have the fan control installed, so thinking it may be that… But anyone have any similar experiences?

  9. Hello, I a trying to get the ethernet drivers working and this is where I’m stuck:

    $ sudo dkms build -m tg3 -v 3.124c

    Kernel preparation unnecessary for this kernel. Skipping…

    Building module:
    cleaning build area….
    cd src/ && make BUILD_KERNEL=3.5.0-23-generic KVER=3.5.0-23-generic….(bad exit status: 2)
    ERROR (dkms apport): binary package for tg3: 3.124c not found
    Error! Bad return status for module build on kernel: 3.5.0-23-generic (x86_64)
    Consult /var/lib/dkms/tg3/3.124c/build/make.log for more information.

    And the make.log says:

    DKMS make.log for tg3-3.124c for kernel 3.5.0-23-generic (x86_64)
    Thu Feb 21 16:47:13 EST 2013
    sh makeflags.sh /lib/modules/3.5.0-23-generic/build > tg3_flags.h
    make -C /lib/modules/3.5.0-23-generic/build SUBDIRS=/var/lib/dkms/tg3/3.124c/build/src modules
    make[1]: Entering directory `/usr/src/linux-headers-3.5.0-23-generic’
    CC [M] /var/lib/dkms/tg3/3.124c/build/src/tg3.o
    /var/lib/dkms/tg3/3.124c/build/src/tg3.c:96:24: fatal error: asm/system.h: No such file or directory
    compilation terminated.
    make[2]: *** [/var/lib/dkms/tg3/3.124c/build/src/tg3.o] Error 1
    make[1]: *** [_module_/var/lib/dkms/tg3/3.124c/build/src] Error 2
    make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-23-generic’
    make: *** [default] Error 2

    Any suggestions on steps I take?

  10. hi iam the gompa from the ubuntu forum and i wondered if one of you also has a problem with screen resolution when a screen is conected to the dp port

  11. Using a miniDisplayPort to DisplayPort cable to a Dell U2713HM monitor, I have no problems with resolution but do have problems with colour depth. The commands above don’t (fully) succeed:

    [email protected]:~# intel_reg_write 0x70008 0xC4002000
    Value before: 0xC0000000
    Value after: 0xC0002000
    [email protected]:~# intel_reg_write 0x70180 0xDA004400
    Value before: 0xD8004400
    Value after: 0xD8004400
    [email protected]:~#

  12. Would you recommend this as a portable-desktop system, for Ubuntu? I move a few times a year between two locations, and have a decent screen on either end – Is this the box I want in my bag, or anything else? (I do like ubuntu, rather than OSx)

  13. @Sam Freed

    It sounds like there are some desktop issues when running Ubuntu (see above comments), but I’m sure they’ll be fixed.

    I’m only using it as a headless server, and for that role it’s been working great. I currently have 110 days of uptime.

  14. Thank you as well for this post. This saved me countless hours of frustration in trying to accomplish the exact same task. I really appreciate it.

  15. I have installed on my MiniMac (late 2012) succesffully the recent version of the tg3 (1.333d) driver and it works as expected.

    Little hassle is that you will probably not have DKMS installed and you’re offline ;-/

    So on some other ubuntu machine install DKMS (apt-get install dkms) if not installed, then use aptoncd and make .iso file with dkms*.deb package on an USB stick.

    Put USB stick into MiniMac and mount the .iso image by using

    mount -t iso9660 -o loop /media// /mnt

    Now go to /mnt and execute dpkg –install dkms*.deb

    The type uname -r and export this as kernelver variable.
    Now follow original instructions on how to add the driver module to the dkms and voila!

  16. Great to see lot of feedback here. I am wondering if any of you tried adding a secondary Ethernet port and used this Mac Mini server as an LTSP server? I want to power 4 thin clients for training and development purposes.

Comments are closed.