1

I used the link below to install Ubuntu 16 on my 2006 MacBook 2,1. It worked great, props to the contributors. I am interested in upgrading or switching distros on this machine. Will the config on this machine allow a typical upgrade to a newer version of Ubuntu or a fresh install of other distros like a normal Linux machine? Or, will I have to jump through all these hoops again? I've used lighter distros in the past like Alpine or even just Lubuntu and think they might be better suited for this older machine. Thanks in advance.

Installing Ubuntu without DVD or Flash Drive

**** Note **** The reason I (and others) have installed Linux with this method is that this era MacBook will not recognize a bootable Linux USB. I've tried many different ways and settings. It will load the boot mgr by holding option key during boot, but never show the usb as an option. This machine pre dates recovery mode also.

3
  • Ubuntu 22.04.2 LTS has recommended system requirements of at least a 2 GHz dual-core processor, 4 GB of memory and 25 GB of free drive space. You can install 4 GB of memory in your Mac, but not all of this memory will be available to Ubuntu. You might want to consider installing Kubuntu or Xubuntu instead. What is your Mac's processor clock frequency and amount of memory? Commented Jul 14, 2023 at 9:27
  • I have the Core 2 Duo 2.0 GHz (T7200) and 2 GB RAM. I was thinking of switching to Lubuntu so I can stay on the latest version with these lower specs. By the way, your original write up was great, thanks!
    – cdyno4
    Commented Jul 14, 2023 at 14:37
  • So, it looks like it still won't boot from USB using option key. Can I add the USB into the grub menu?
    – cdyno4
    Commented Jul 14, 2023 at 20:12

1 Answer 1

1

Your Mac can preform fresh installs of 32 and 64 bit BIOS booting only Linux distros like a normal Linux machine provided you use the optical drive which came with your machine. The reason for having to jump through all these hoops is because the optical drive is not being employed. Or, the optical media is configured to be both BIOS and EFI booted. If done properly (as shown in this answer), future fresh installs should also not require the use of a virtual machine.


This answer starts where the previous answer left off. Here, a fresh install of Desktop 64-bit Lubuntu 22.04.2 LTS (Jammy Jellyfish) will be performed. The installation file downloaded is named lubuntu-22.04.2-desktop-amd64.iso. This file is 2.8 GB is size.

The first 3 partitions are used by OS X Lion. The steps below will install Lubuntu in the 7th partition (ext4) and address the following issues.

  • The 4th partition (ext4) is not large enough to hold the installation file.
  • The 5th partition (BIOS boot) is 1 MiB and should be increased to 8 MiB in size before installing Lubuntu.
  • The Lubuntu installer creates a swap file instead of using the 6th partition (swap).

Use OS X to Setup Lubuntu Desktop Live

  1. Boot to OS X Lion.

  2. Open a Terminal application window.

  3. Create 2 GB of free space. Here, I will assume your current hard disk is configured as shown below. This output is from the command diskutil list.

    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *80.5 GB    disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            40.0 GB    disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
       4: 0FC63DAF-8483-4772-8E79-3D69D8477DE4               2.0 GB     disk0s4
       5: 21686148-6449-6E6F-744E-656564454649               1.0 MB     disk0s5
       6:                 Linux Swap                         4.3 GB     disk0s6
       7: 0FC63DAF-8483-4772-8E79-3D69D8477DE4               33.4 GB    disk0s7
    

    During this step, the 2nd partition will be shrunk by 2 GB to create free space after the 3rd partition. Since the 2nd partition is 40 GB in size, the command below will shrink the 2nd partition to 38 GB and relocate the 3rd partition, so the free space occurs after the 3rd partition.

    diskutil resizevolume disk0s2 38g
    

    The results can be summarized by the output from the diskutil list command, as shown below.

    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *80.5 GB    disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            38.0 GB    disk0s2
       3:                 Apple_Boot                         650.0 MB   disk0s8
       4: 0FC63DAF-8483-4772-8E79-3D69D8477DE4               2.0 GB     disk0s4
       5: 21686148-6449-6E6F-744E-656564454649               1.0 MB     disk0s5
       6:                 Linux Swap                         4.3 GB     disk0s6
       7: 0FC63DAF-8483-4772-8E79-3D69D8477DE4               33.4 GB    disk0s7
    

    Below is the output of the sudo gpt -r show disk0 command. This output shows 2 GB (3906256 sectors) of free space has been created between the 3rd and 4th partitions.

    gpt show: disk0: Suspicious MBR at sector 0
          start       size  index  contents
              0          1         PMBR
              1          1         Pri GPT header
              2         32         Pri GPT table
             34          6         
             40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
         409640   74218744      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
       74628384    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
       75897920    3906256         
       79804176    3891200      4  GPT part - 0FC63DAF-8483-4772-8E79-3D69D8477DE4
       83695376        240         
       83695616       2048      5  GPT part - 21686148-6449-6E6F-744E-656564454649
       83697664    8388608      6  GPT part - 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
       92086272   65198080      7  GPT part - 0FC63DAF-8483-4772-8E79-3D69D8477DE4
      157284352       2015         
      157286367         32         Sec GPT table
      157286399          1         Sec GPT header
    
  4. Use the gdisk command to add the free space to the 4th and 5th partitions and update the hybrid partitioning.

    Note: To help insure GRUB is not compromised, the new (after) BIOS boot partition needs to contain all the sectors from the old (before) BIOS boot partition.

    Determine a new starting sector for the 5th partition so the BIOS boot space will be 8 MiB in size. Basically, subtract 14336 (7 MiB) from the current starting sector, as shown in the table below.

    Table of Changes in the 5th Partition (BIOS boot)

    Start Sector End Sector Size
    Before 83695616 83697663 2048 sectors = 1 MiB
    Change -14336 0 14336 sectors = 7 MiB
    After 83681280 83697663 16384 sectors = 8 MiB

    The rest of the free space will be added to the 4th partition. Enter the command below to edit the partition tables.

    gdisk /dev/sda
    

    Below are the entries made to gdisk. Make the appropriate substitution when necessary.

    Table of Entries to the gdisk Command

    Entry Default Type Comment
    p command Print the GPT.
    d command Delete a GPT partition.
    4 data Partition to delete.
    d command Delete a GPT partition.
    5 data Partition to delete.
    n command Add a new GPT partition.
    5 data Partition to add.
    83681280 data First sector of 5th GPT partition. (Your value may be different.)
    +8m data 5th GPT partition size of 8 MiB.
    ef02 data 5th GPT partition type "BIOS boot".
    p command Print the GPT.
    n command Add a new GPT partition.
    4 X data Partition to add.
    75897920 X data First sector of 4th GPT partition. (Your value may be different.)
    83681279 X data Last sector of 4th GPT partition. (Your value may be different.)
    8300 data 4th GPT partition type "Linux filesystem".
    p command Print the GPT.
    r command Goto recovery and transformation menu.
    h command Make hybrid MBR.
    2 3 4 data 2nd, 3rd and 4th GPT partitions.
    y data Make 1st MBR partition type EE.
    af X data 2nd MBR partition type "Apple HFS/HFS+".
    n data No boot flag for 2nd MBR partition.
    ab X data 3rd MBR partition type "Apple Recovery".
    n data No boot flag 3nd MBR partition.
    83 X data 4th MBR partition type "Linux filesystem".
    y data Set boot flag for 4th MBR partition.
    o command Print the MBR partition table.
    w command Write tables to drive and exit.
    y data Confirm write and exit.

    Example output from using the gdisk /dev/sda command to edit the MBR partition table and the GPT is given below.

    GPT fdisk (gdisk) version 1.0.3
    
    Warning: Devices opened with shared lock will not have their
    partition table automatically reloaded!
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    
    Command (? for help): p
    Disk /dev/disk0: 157286400 sectors, 75.0 GiB
    Sector size (logical): 512 bytes
    Disk identifier (GUID): A00FDE86-5A09-431E-89BA-45CC6D3ACF58
    Partition table holds up to 128 entries
    Main partition table begins at sector 2 and ends at sector 33
    First usable sector is 34, last usable sector is 157286366
    Partitions will be aligned on 8-sector boundaries
    Total free space is 3908517 sectors (1.9 GiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              40          409639   200.0 MiB   EF00  EFI System Partition
       2          409640        74628383   35.4 GiB    AF00  Apple HFS/HFS+
       3        74628384        75897919   619.9 MiB   AB00  Recovery HD
       4        79804176        83695375   1.9 GiB     8300  Linux filesystem
       5        83695616        83697663   1024.0 KiB  EF02  
       6        83697664        92086271   4.0 GiB     8200  
       7        92086272       157284351   31.1 GiB    8300  
    
    Command (? for help): d
    Partition number (1-7): 4
    
    Command (? for help): d
    Partition number (1-7): 5
    
    Command (? for help): n
    Partition number (4-128, default 4): 5
    First sector (34-157286366, default = 75897920) or {+-}size{KMGTP}: 83681280
    Last sector (83681280-83697663, default = 83697663) or {+-}size{KMGTP}: +8m
    Current type is 'Apple HFS/HFS+'
    Hex code or GUID (L to show codes, Enter = AF00): ef02
    Changed type of partition to 'BIOS boot partition'
    
    Command (? for help): p
    Disk /dev/disk0: 157286400 sectors, 75.0 GiB
    Sector size (logical): 512 bytes
    Disk identifier (GUID): A00FDE86-5A09-431E-89BA-45CC6D3ACF58
    Partition table holds up to 128 entries
    Main partition table begins at sector 2 and ends at sector 33
    First usable sector is 34, last usable sector is 157286366
    Partitions will be aligned on 8-sector boundaries
    Total free space is 7785381 sectors (3.7 GiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              40          409639   200.0 MiB   EF00  EFI System Partition
       2          409640        74628383   35.4 GiB    AF00  Apple HFS/HFS+
       3        74628384        75897919   619.9 MiB   AB00  Recovery HD
       5        83681280        83697663   8.0 MiB     EF02  BIOS boot partition
       6        83697664        92086271   4.0 GiB     8200  
       7        92086272       157284351   31.1 GiB    8300  
    
    Command (? for help): n
    Partition number (4-128, default 4): 
    First sector (34-157286366, default = 75897920) or {+-}size{KMGTP}: 
    Last sector (75897920-83681279, default = 83681279) or {+-}size{KMGTP}: 
    Current type is 'Apple HFS/HFS+'
    Hex code or GUID (L to show codes, Enter = AF00): 8300
    Changed type of partition to 'Linux filesystem'
    
    Command (? for help): p
    Disk /dev/disk0: 157286400 sectors, 75.0 GiB
    Sector size (logical): 512 bytes
    Disk identifier (GUID): A00FDE86-5A09-431E-89BA-45CC6D3ACF58
    Partition table holds up to 128 entries
    Main partition table begins at sector 2 and ends at sector 33
    First usable sector is 34, last usable sector is 157286366
    Partitions will be aligned on 8-sector boundaries
    Total free space is 2021 sectors (1010.5 KiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1              40          409639   200.0 MiB   EF00  EFI System Partition
       2          409640        74628383   35.4 GiB    AF00  Apple HFS/HFS+
       3        74628384        75897919   619.9 MiB   AB00  Recovery HD
       4        75897920        83681279   3.7 GiB     8300  Linux filesystem
       5        83681280        83697663   8.0 MiB     EF02  BIOS boot partition
       6        83697664        92086271   4.0 GiB     8200  
       7        92086272       157284351   31.1 GiB    8300  
    
    Command (? for help): r
    
    Recovery/transformation command (? for help): h
    
    WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
    just hit the Enter key at the below prompt and your MBR partition table will
    be untouched.
    
    Type from one to three GPT partition numbers, separated by spaces, to be
    added to the hybrid MBR, in sequence: 2 3 4
    Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y
    
    Creating entry for GPT partition #2 (MBR partition #2)
    Enter an MBR hex code (default AF): 
    Set the bootable flag? (Y/N): n
    
    Creating entry for GPT partition #3 (MBR partition #3)
    Enter an MBR hex code (default AB): 
    Set the bootable flag? (Y/N): n
    
    Creating entry for GPT partition #4 (MBR partition #4)
    Enter an MBR hex code (default 83): 
    Set the bootable flag? (Y/N): y
    
    Recovery/transformation command (? for help): o
    
    Disk size is 157286400 sectors (75.0 GiB)
    MBR disk identifier: 0x00000000
    MBR partitions:
    
    Number  Boot  Start Sector   End Sector   Status      Code
       1                     1       409639   primary     0xEE
       2                409640     74628383   primary     0xAF
       3              74628384     75897919   primary     0xAB
       4      *       75897920     83681279   primary     0x83
    
    Recovery/transformation command (? for help): w
    
    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
    PARTITIONS!!
    
    Do you want to proceed? (Y/N): y
    OK; writing new GUID partition table (GPT) to /dev/disk0.
    Warning: Devices opened with shared lock will not have their
    partition table automatically reloaded!
    Warning: The kernel may continue to use old or deleted partitions.
    You should reboot or remove the drive.
    The operation has completed successfully.
    

    The results can be summarized by the output from the diskutil list command, as shown below.

    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *80.5 GB    disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            38.0 GB    disk0s2
       3:                 Apple_Boot                         650.0 MB   disk0s8
       4: 0FC63DAF-8483-4772-8E79-3D69D8477DE4               4.0 GB     disk0s9
       5: 21686148-6449-6E6F-744E-656564454649               8.4 MB     disk0s10
       6:                 Linux Swap                         4.3 GB     disk0s6
       7: 0FC63DAF-8483-4772-8E79-3D69D8477DE4               33.4 GB    disk0s7
    

    Below is the output of the sudo gpt -r show disk0 command. This output shows there is no longer any free space between the 3rd and 4th partitions.

    gpt show: disk0: Suspicious MBR at sector 0
          start       size  index  contents
              0          1         MBR
              1          1         Pri GPT header
              2         32         Pri GPT table
             34          6         
             40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
         409640   74218744      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
       74628384    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
       75897920    7783360      4  GPT part - 0FC63DAF-8483-4772-8E79-3D69D8477DE4
       83681280      16384      5  GPT part - 21686148-6449-6E6F-744E-656564454649
       83697664    8388608      6  GPT part - 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
       92086272   65198080      7  GPT part - 0FC63DAF-8483-4772-8E79-3D69D8477DE4
      157284352       2015         
      157286367         32         Sec GPT table
      157286399          1         Sec GPT header
    
    

    The 4th partition is now large enough to hold the Lubuntu installation file and the 5th partition has been increased to 8 MiB.

  5. Quit the Terminal application and then shut down the Mac.

Use Ubuntu Desktop to Setup Lubuntu Desktop Live

  1. Boot to Ubuntu Desktop.

  2. After logging in, use Firefox (or other web browser) to download the installation file lubuntu-22.04.2-desktop-amd64.iso to your Downloads folder.

  3. Open a Terminal (or similar) window and enter the command below. This will give you root user privileges.

    sudo  bash
    
  4. Enter the commands given below to copy the files from the iso to the hard disk.

    Note: The cp command may take a while to complete.

    mkfs.ext4  /dev/sda4
    mkdir  live
    mount  /dev/sda4  live
    cp Downloads/lubuntu-22.04.2-desktop-amd64.iso live
    umount  live
    rmdir  live
    
  5. Configure GRUB. Start by entering the following commands to edit the 40_custom file.

    cd  /etc/grub.d
    nano  40_custom
    

    Add the following lines to the end of the 40_custom file. This will create Ubuntu Desktop Live and Installation entries in the GRUB menu.

    menuentry "Lubuntu Desktop 22.04.2 Live" {
            insmod iso9660
            set isofile="lubuntu-22.04.2-desktop-amd64.iso"
            loopback loop (hd0,4)/$isofile
            linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/$isofile noprompt noeject
            initrd (loop)/casper/initrd
    }
    

    After saving your changes to the 40_custom file, enter the following commands to edit the grub file.

    cd  /etc/default
    nano  grub
    

    Find the following line in the grub file.

    GRUB_DEFAULT=0
    

    Change the line to appear as shown below.

    GRUB_DEFAULT=4
    

    Find the following line in the grub file.

    GRUB_TIMEOUT=10
    

    Replace the line with the following two lines.

    GRUB_TIMEOUT=-1
    GRUB_DISABLE_OS_PROBER=true
    

    After saving your changes to the grub file, use the following commands to update grub.

    update-grub
    
  6. Restart Ubuntu. The Mac should boot to a GRUB menu similar to the one shown below.

Replace Ubuntu Desktop with Lubuntu Desktop

  1. If you have not already done so, boot your Mac. From the GRUB menu, select "Ubuntu Desktop 22.04.3 Live". Next, you should get an image similar to what is shown below. Select "Install Lubuntu 22.04 LTS".

    Desktop

  2. Install until a screen similar to the one shown below appears.

    Select Replace

    Select "Replace a partition", then select the last partition (/dev/sda7), as shown below.

    Select Partition

    Next, select the → Next button. Let the installation proceed to conclusion.

Switch from a Swap File to the Swap Partition

  1. Boot to Lubuntu Desktop.
  2. Open a QTerminal (or similar) window and enter the command below. This will give you root user privileges.
    sudo bash
    
  3. Enter the command given below to temporarily turn off swapping.
    swapoff -a
    
  4. Enter the command given below to reinitialize the Linux swap area on the 6th partition.
    mkswap /dev/sda6
    
    Example output is given below.
    mkswap: /dev/sda6: warning: wiping old swap signature.
    Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
    no label, UUID=a9aeefb6-ab15-434b-9e8a-192848483aa0
    
    The UUID will be needed in the next step.
  5. Configure the /etc/fstab file. Start by entering the following command to edit this file.
    nano /etc/fstab
    
    Find the following line in the /etc/fstab file.
    /swapfile                                 swap           swap    defaults   0 0
    
    Replace the line with the following two lines. Substitute your UUID from the previous step with the UUID shown below.
    #/swapfile                                 swap           swap    defaults   0 0
    UUID=a9aeefb6-ab15-434b-9e8a-192848483aa0 swap           swap    defaults   0 0
    
  6. After saving your changes to the /etc/fstab file, reboot Lubuntu.
  7. Open a QTerminal window and enter the command given below to confirm /dev/sda6 is being used as swap and /swapfile is not.
    swapon --show
    
  8. Enter the command below to remove the swapfile file.
    sudo rm /swapfile
    
  9. Quit QTerminal.

Upgrading to the Next Release

I was able to upgrade to Lubuntu 22.10 by following the instructions given here. This verifies the configuration will allow a typical upgrade to a newer version of Lubuntu.

References

There is no reason for readers to look up any of these references. They appear here for my use.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .