You are not logged in.

#1 2015-11-28 03:48:03

otmichael
Member
Registered: 2015-11-28
Posts: 17

[SOLVED] Persistent USB install bootable by Macbook

I've been going at this for about a week, so I thought it warranted me creating a forum account and asking how to do this.

I want to install persistent Arch Linux onto my USB, and for it to be bootable by my macbook, and preferably also by other machines (I.E., I just want maximum compatibility with the USB, with booting to a macbook as first priority).

If it matters, the macbook is a Pro Retina 2015, with force touch and all that, running Yosemite 10.10.5.

I followed this tutorial, which worked for booting to USB from a windows desktop:
https://www.youtube.com/watch?v=sDq1oaYRgeg

The person in the video pretty much does what's covered in the USB Key installation guide (I.E., do the same thing as a regular installation, but move "block" in the mkinitcpio.conf file immediately to the right of "udev").

After following it about 6 times with variations, using a GPT, using FAT instead of EXT4, and more, nothing has worked. The drive just never shows up when holding "alt" on startup of my macbook. I also tried following his tutorial without variation and used rEFInd, but that didn't work either. I'd like this to work without rEFInd anyway. Creating an installation media using "dd", however, does work (But it's not persistent so that doesn't really help anything).

I didn't want to have to ask someone to spell it out for me, but would someone be kind enough to tell me how to go about this?

Something like "Just do the same exact thing as in the installation guide/tutorial video but change ______" would be great.

EDIT:

I accidentally revoked write permissions from the root user for every folder just after I got this working (I was a little too careless....), so after learning my lesson, I reinstalled linux, and wrote every command so other noobs like me could possibly benefit/locate their personal issue.

###### To install Arch Linux onto a USB key that is bootable by a Macbook Pro (2015 Retina) ######
# lines that start with a "#" symbol are comments regarding the command in the line above
# I wrote down all of the commands, and then read off of them to make sure they were right. Use these to compare, but
# in case I made an error, unless you have the time, maybe don't follow these religiously.
# SOLUTION:

ls /sys/firmware/efi/efivars
# just make sure the above exists

timedatectl set-ntp true

parted /dev/sdb
#replace /sdb with your USB
mkpart ESP fat32 1MiB 513MiB
set 1 boot on
mkpart primary ext4 513MiB 100%
quit

mkfs.fat -F32 /dev/sdb1
mkfs.ext4 -O "^has_journal" /dev/sdb2

mount /dev/sdb2 /mnt
mkdir /mnt/boot
mount /dev/sdb1 /mnt/boot

pacstrap /mnt base base-devel

genfstab -U /mnt > /mnt/etc/fstab
arch-chroot /mnt /bin/bash

vi /etc/locale.gen
# in this file, uncomment the line that says "en_US.UTF-8 UTF-8"
locale-gen
vi /etc/locale.conf
# write “LANG=en_US.UTF-8” without quotes and save
vi /etc/vconsole.conf
# write “KEYMAP=cz-qwerty” without quotes and save
ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime
# replace with your zones, PST is America and Los_Angeles, respectively to Zone and SubZone

hwclock --systohc --utc

vi /etc/mkinitcpio.conf
# change the line that starts with "HOOKS=" (this line is uncommented) by moving "block" to the immediate right of "udev"
mkinitcpio -p linux

bootctl install
# this is a bootloader (called systemd) I believe, don't do this in addition to grub
blkid -s PARTUUID -o value /dev/sdb2 >> /boot/loader/entries/arch.conf
vi /boot/loader/entries/arch.conf
# the PARTUUID you appended should be in there, write the following 4 lines into this file, separated by 2 tabs:

#title          Arch Linux
#linux          /vmlinuz-linux
#initrd         /initramfs-linux.img
#options        root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 rw # be sure to include the "rw" at the end of this line, and to use your own PARTUUID instead of this example

vi /boot/loader/loader.conf
# change the file to be the same as the following 2 lines:
#timeout 3
#default arch

echo yourHostname > /etc/hostname
# you can also do "vi /etc/hostname" and write your host name in there.

pacman -S iw wpa_supplicant dialog
# if you want wireless access

passwd
# set password

exit
umount -R /mnt
reboot

# then if everything looks good, reboot your macbook, hold alt/option, and an EFI Boot option should show up.

Last edited by otmichael (2015-11-30 02:38:16)

Offline

#2 2015-11-28 06:31:36

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] Persistent USB install bootable by Macbook

Hi otmichael and welcome to the Forums!

That "tutorial" is for a legacy BIOS compatible installation, but the macbook-pro only boots only trough UEFI. So, just make sure to follow the official Beginners' guide for a UEFI installation and it should work.


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#3 2015-11-28 09:20:13

otmichael
Member
Registered: 2015-11-28
Posts: 17

Re: [SOLVED] Persistent USB install bootable by Macbook

Thank you for the reply and welcome!

I tried, but I decided to try again anyway, and record every command I made.

So I did it again, and in the arch linux 'title page' (for lack of better name) where you choose x86_64, i686, boot from existing OS, etc.., when asked to boot existing os, gets stuck saying "booting...".
In addition, holding the alt/option key on macbook reboot simply doesn't show the USB drive, it only shows the macintosh drive.

Here are the commands (USB is /dev/sdb):
# any line with a "#" symbol is a comment regarding one of the commands.

timedatectl set-ntp true

parted /dev/sdb
mklabel gpt
mkpart ESP fat32 1MiB 513MiB
set 1 boot on
mkpart primary ext4 513MiB 100%

mkfs.fat -F32 /dev/sdb1
mkfs.ext4 -O "^has_journal" /dev/sdb2
#removed journal for minimal writes

mount /dev/sdb2 /mnt
mkdir -p /mnt/boot
mount /dev/sdb1 /mnt/boot

pacstrap /mnt base base-devel

vi /etc/locale.gen
#in locale.gen, uncommented the line that has en_US.UTF-8 UTF-8
vi /etc/vconsole.conf
#added the line: KEYMAP=cz-qwerty

ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime
#yes, I put my specific zones here, not "zone" and "subzone"
hwclock --systohc --utc

vi /etc/mkinitcpio.conf
#edited the HOOKS= line by moving “block” to the immediate right of “udev”
mkinitcpio -p linux

bootctl install
#after this command ran, it said I’m not booted with EFI and that it was skipping variable setup, not sure what to make of this.
#In the beginner install page, this command was posted right after the "installing bootloader" section. I'm not sure what this command does
#(I think It's installing a bootloader?), but I did just this and finished off the installation process and arch wouldn't boot, and then retried with
#both the "bootctl install" command and grub install and arch still won't boot.

vi /boot/loader/entries/arch.conf
# wrote the following in arch.conf separated by 2 tabs:
#title          Arch Linux
#linux          /vmlinuz-linux
#initrd         /initramfs-linux.img
#options        root=/dev/sda2 rw

vi /boot/loader/loader.conf
#wrote the following 2 lines in the loader.conf file:
#timeout 3
#default arch

echo hostname > /etc/hostname
#yes, I chose something other than hostname (it shouldn't matter either way)

pacman -S iw wpa_supplicant dialog
passwd
#set my password

pacman -S grub
grub-install --boot-directory=/boot --recheck --debug --target=i386-pc /dev/sdb --force
#had to force because of blocklists
grub-mkconfig /boot/grub/grub.cfg

umount -R /mnt
#device was busy, rebooted anyway (Then I went back into the file, remounted several times tinkering with stuff, and didn't get this "busy" error again)
reboot

### done ###

Anybody with the time and care willing to read it over and let me know what was wrong? While I do the same trying to refrain from ripping my hair out.

Last edited by otmichael (2015-11-28 09:27:39)

Offline

#4 2015-11-28 09:51:06

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] Persistent USB install bootable by Macbook

otmichael wrote:

bootctl install
#after this command ran, it said I’m not booted with EFI and that it was skipping variable setup, not sure what to make of this.
#In the beginner install page, this command was posted right after the "installing bootloader" section. I'm not sure what this command does
#(I think It's installing a bootloader?), but I did just this and finished off the installation process and arch wouldn't boot, and then retried with
#both the "bootctl install" command and grub install and arch still won't boot.

That is indeed a problem, it means you've not booted using UEFI: in order to make an UEFI installation you must boot in UEFI mode (see again https://wiki.archlinux.org/index.php/Be … #UEFI_mode).

otmichael wrote:

I did it again, and virtualbox, when asked to boot existing os, gets stuck saying "booting..."

Just to be sure... are you using virtualbox only for testing the USB key or are you actually using an arch VM to preform the installation on the USB key?

I never tried to make an UEFI bootable USB, but since I have a Macbook Pro Retina, early 2015 I will try to make one and I'll let you know if it works.


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#5 2015-11-28 16:24:53

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] Persistent USB install bootable by Macbook

Well, I just tired to make an UEFI bootable USB, following the Beginners' guide, and it worked as expected. Again, make sure to boot in UEFI mode when you perform the installation on the USB. I also noticed that you installed both GRUB and systemd-boot... don't do that: chose and install only one of them. I suggest you systemd-boot, which in my case worked out-of-the-box: just make sure to use PARTUUIDs (as suggested here https://wiki.archlinux.org/index.php/Sy … ot_entries) instead of /dev/sda2, in fact PARTUUIDs do not change if you mount the live USB in another machine.


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#6 2015-11-28 17:15:22

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] Persistent USB install bootable by Macbook

mauritiusdadd wrote:

Well, I just tired to make an UEFI bootable USB, following the Beginners' guide, and it worked as expected. Again, make sure to boot in UEFI mode when you perform the installation on the USB. I also noticed that you installed both GRUB and systemd-boot... don't do that: chose and install only one of them. I suggest you systemd-boot, which in my case worked out-of-the-box: just make sure to use PARTUUIDs (as suggested here https://wiki.archlinux.org/index.php/Sy … ot_entries) instead of /dev/sda2, in fact PARTUUIDs do not change if you mount the live USB in another machine.

You got an entry for the USB key in Apples boot-chooser without creating a dedicated hfs+ partition?
I just tried the same (using GRUB) and for me it does only work with such an hfs+ partition.

Did you by chance install Arch-i686?


And why do you recommend using PARTUUID's instead of the filesystems' UUIDs?

Offline

#7 2015-11-28 18:06:16

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: [SOLVED] Persistent USB install bootable by Macbook

respiranto wrote:

You got an entry for the USB key in Apples boot-chooser without creating a dedicated hfs+ partition
I just tried the same (using GRUB) and for me it does only work with such an hfs+ partition.

Exactly, just a standard fat32 ESP mounted on /boot and the USB is automatically detected in the apple boot-choser (the one accessible pressing alt/option when the machine powers on).

--edit: maybe the problem is in the firmware, what are the versions of the boot ROM and fo OS X? Mine is OS X 10.11.1 and  the boot ROM version is MBP121.067.B14

respiranto wrote:

Did you by chance install Arch-i686?

No, it's an x86_64 installation.

respiranto wrote:

And why do you recommend using PARTUUID's instead of the filesystems' UUIDs?

Well, I suppose that UUIDs do the job as well, but i think that PATRUUIDs are more flexible and robust:

https://wiki.archlinux.org/index.php/Systemd-boot wrote:

Using the PARTUUID/PARTLABEL is advantageous because it is invariant (i.e. unchanging) if you reformat the partition with another filesystem, or if the /dev/sd* mapping changed for some reason. It is also useful if you do not have a filesystem on the partition (or use LUKS, which does not support LABELs).

Last edited by mauritiusdadd (2015-11-28 18:25:17)


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#8 2015-11-28 18:56:27

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: [SOLVED] Persistent USB install bootable by Macbook

mauritiusdadd wrote:
respiranto wrote:

You got an entry for the USB key in Apples boot-chooser without creating a dedicated hfs+ partition
I just tried the same (using GRUB) and for me it does only work with such an hfs+ partition.

Exactly, just a standard fat32 ESP mounted on /boot and the USB is automatically detected in the apple boot-choser (the one accessible pressing alt/option when the machine powers on).

--edit: maybe the problem is in the firmware, what are the versions of the boot ROM and fo OS X? Mine is OS X 10.11.1 and  the boot ROM version is MBP121.067.B14

For some reason, it seems like to be shown in the boot chooser, a partition must have been mounted in OS X and thereby populated with some dotfiles before.
I had already figured this out, when setting up a dedicated hfs+ partition for grub.efi (the one residing on hard disk).

I didn't think about doing the same with the EFI partition, which solves the problem, though like this I cannot customize the Name and Logo of the entry in the boot-chooser.

Thank you for your effort anyway!


EDIT: I have a MacBook9,2 with:
- BIOS firmware version: MBP91.88Z.00D3.B0B.1506081214 (recently upgraded)
- OS X 10.9.5 (according to SystemVersion.plist; should be the latest OS X 10.9 version)

Probably the older Software is the reason for the necessitated mounting of those partitions.
Hopefully this can help the OP.

Last edited by respiranto (2015-11-28 19:09:44)

Offline

#9 2015-11-29 03:24:39

otmichael
Member
Registered: 2015-11-28
Posts: 17

Re: [SOLVED] Persistent USB install bootable by Macbook

I FINALLY DID IT!

Thanks for all the help guys, it probably would have taken much longer without the help, and I'd probably understand a lot less.

All I had to do was boot virtualbox in EFI mode (It's in the options), and then do the install for UEFI in the beginner instructions.
My command list above has a few flaws, so I don't recommend following it.

Thanks mauritiusdadd for your time, I very much appreciate it.
Also, thanks respiranto for the extra information smile

Can't wait to finally start playing with this.

Offline

#10 2015-11-29 03:25:43

otmichael
Member
Registered: 2015-11-28
Posts: 17

Re: [SOLVED] Persistent USB install bootable by Macbook

Is there a way to mark this as solved?

Offline

#11 2015-11-29 03:57:23

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: [SOLVED] Persistent USB install bootable by Macbook

Edit your first post on top.


1000

Offline

Board footer

Powered by FluxBB