Tuesday, April 18, 2017

Create bootable USB stick with Linux for old Macbook with MacOS 10.5.8

Since my old MacBook with MacOS 10.5.8 is only running with outdated browser versions I am having more and more troubles looking at modern websites which are using fancy features (LinkedIn, Ryanair, ...). Since I cannot upgrade the machine I needed a workaround to access up-to-date browsers. An idea was to create a bootable USB stick with Linux.
You basically need to
  • download a Linux image iso file
  • prepare the USB stick so that it can receive the iso file
  • copy the iso file onto the stick
  • There are GUI tools out there which can achieve this but I prefer the simple command line set of instructions which I could not find for MacBooks. I did find instructions for creating a USB stick on a Linux or Windows box though which I combined with instructions for the particular device handling on MacBooks.
    Main resources:

  • http://askubuntu.com/questions/372607/how-to-create-a-bootable-ubuntu-usb-flash-drive-from-terminal
  • Download Linux image

    Download your favourite Linux image which you want to put onto the USB stick. I opted for Lubuntu from https://help.ubuntu.com/community/Lubuntu/GetLubuntu
    where I chose the PC 64bit Standard image disc.

    Attach the USB stick

    Attach the USB stick to a USB port. It will be shown in Finder. Check on the system:
    mount points: my USB stick is mounted under disk2, to be precise: the file system in partition s1 is mounted.

    ls of disk devices: disk2 is the whole device, disk2s1 is the partition with the file system

    Unmount the partition

    What we want is: keep the USB stick attached and in the list of devices but unmount all partitions. Eject in Finder is no option since it will completely remove the device. We only want to unmount the USB stick.Overall this was the trickiest part since the normal UNIX umount did not work as expected. The usual umount does not work on MacOS since there are applications (spotlight, etc.) constantly accessing the file system so an error is thrown (of course this command and all the following need to be done as root therefore I am using sudo):


    One could try to kill all these processes (after first identifying them) but the real trick is to use the Mac specific diskutil command:


    Write Linux image to USB stick

    The good old dd is all you need. Input file if is the Linux iso file, output file of is the USB device (note the full device /dev/disk2, not a particular partition), and block size 4MB (could be anything which you think feasible on your machine).

    Note: this takes some time, 22 minutes in my case.

    Reboot and choose USB stick

    Now when rebooting the machine and pressing the Option button after the sound there is screen showing the old Mac harddisk and an EFI as boot options.

    2 comments:

    1. Hadoop concepts, Applying modelling through R programming using Machine learning algorithms and illustrate impeccable Data Visualization by leveraging on 'R' capabilities.With companies across industries striving to bring their research and analysis (R&A) departments up to speed, the demand for qualified data scientists is rising.
      data science training in bangalore

      ReplyDelete