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

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

November 4th, 2012 Leave a comment Go to comments

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.

 

Categories: server
  1. November 10th, 2012 at 05:59 | #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. MikeTheGeek!
    November 20th, 2012 at 07:14 | #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.
    root@MACMINI:/usr/src/tg3-3.124c#

  3. November 25th, 2012 at 16:40 | #3

    @MikeTheGeek!
    It sounds like the paths are wrong, are the driver files extracted to /usr/src/tg3-3.124c/src/, and the dkms.conf file located in /usr/src/tg3-3.124c/ ?

  4. December 22nd, 2012 at 09:51 | #4

    I build ethernet driver DKMS on launchpad.net, my repo ppa:fantom-h/test
    Package name tg3-dkms, please test it!!

  5. January 1st, 2013 at 21:29 | #5

    If you want tg3 to compile under a 3.5.x kernel, this might help:

    http://ubuntuforums.org/showthread.php?t=2078320&page=2#post12331338

  6. Theta
    January 23rd, 2013 at 08:52 | #6

    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!

  7. January 25th, 2013 at 22:09 | #7

    @Theta
    You probably need to grab the DKMS .deb file with a different computer, transfer it to the mac mini with a USB flash drive, then install it with dpkg.

    Download: http://packages.ubuntu.com/precise/dkms

    Copy it over and install with “sudo dpkg -i dkms_2.2.0.3-1ubuntu3_all.deb”

  8. Le
    January 28th, 2013 at 01:22 | #8

    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

  9. Theta
    January 31st, 2013 at 08:51 | #9

    It works!! Thanks guys.

  10. Nick
    January 31st, 2013 at 14:04 | #10

    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)

  11. January 31st, 2013 at 14:25 | #11

    Nick — it might be the same bug I experience on the 6,2: https://bugs.freedesktop.org/show_bug.cgi?id=59113

    It’s fine if I use HDMI/DVI, but Thunderbolt/Displayport looks awful.

  12. February 3rd, 2013 at 12:57 | #12

    @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.

  13. Nick
    February 3rd, 2013 at 14:04 | #13

    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.

  14. Michael
    February 16th, 2013 at 14:12 | #14

    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?

  15. Monkeypet
    February 16th, 2013 at 20:46 | #15

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

    I was in dependency hell before I found the link above.

    Follow that instructions verbatim, then you should have a tg3 that can be loaded.

  16. Manish Arya
    February 18th, 2013 at 05:32 | #16

    @Theta
    In case, dkms is not available during installation.
    Do ‘make; make install’ in the directory where source is copied, to have temporary networking.

  17. Andrew
    February 21st, 2013 at 13:52 | #17

    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?

  18. February 21st, 2013 at 14:22 | #18

    Andrew – see my comment above :) Instructions are here: http://ubuntuforums.org/showthread.php?t=2078320&page=2#post12331338

  19. monkeypet
    February 21st, 2013 at 20:47 | #19

    For those of you running into low color using the HDMI connected to your TV, try this.

    http://ubuntuforums.org/showthread.php?p=12523426

    These cmds (first one fixed it):

    intel_reg_write 0x70008 0xC4002000
    intel_reg_write 0x70180 0xDA004400

    http://lists.freedesktop.org/archive…ry/015395.html

    Here is the link to the bug:

    https://bugs.freedesktop.org/show_bug.cgi?id=46800

  20. gompa
    February 22nd, 2013 at 09:14 | #20

    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

  21. Nick
    February 24th, 2013 at 13:05 | #21

    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:

    root@testmini:~# intel_reg_write 0x70008 0xC4002000
    Value before: 0xC0000000
    Value after: 0xC0002000
    root@testmini:~# intel_reg_write 0x70180 0xDA004400
    Value before: 0xD8004400
    Value after: 0xD8004400
    root@testmini:~#

  22. Sam Freed
    March 9th, 2013 at 05:06 | #22

    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)

  23. March 9th, 2013 at 15:25 | #23

    @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.

  24. Michael
    March 16th, 2013 at 07:58 | #24

    Hi, thanks again for the post. I’ve written a little post myself at http://mike.kz/how-to/installing-linux-on-a-late-2012-mac-mini/ just focusing on the tg3 network driver changes in the 3.5.x upstream of the linux kernel. Linked back to here too :)

  25. August 8th, 2013 at 06:37 | #25

    @Monkeypet
    To make the wifi work i simply installed this package “linux-firmware-nonfree” (i used a wifi usb dongle to just apt-get install it)

  26. Robert
    August 22nd, 2013 at 17:30 | #26

    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.

  27. dExter
    January 25th, 2014 at 03:32 | #27

    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!

  28. kiran
    May 17th, 2014 at 12:36 | #28

    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.

  1. January 13th, 2013 at 00:56 | #1
  2. January 13th, 2013 at 04:06 | #2
  3. February 15th, 2013 at 21:29 | #3
  4. March 16th, 2013 at 07:56 | #4
  5. April 4th, 2013 at 18:35 | #5
  6. April 19th, 2013 at 11:09 | #6
  7. August 29th, 2013 at 21:33 | #7
  8. March 23rd, 2014 at 23:20 | #8
  9. March 24th, 2014 at 02:01 | #9
  10. October 14th, 2015 at 02:13 | #10