You are not logged in.

#1 2020-10-11 06:43:25

Richardn
Member
Registered: 2020-10-11
Posts: 8

[SOLVED]Trying to start Arch from a removable media on MacBook

New to Arch and system installation. I'm trying to install Arch on my 128G external SSD with my Macbook Air (Early 2014). Here's what I've done:

1. VirtualBox Preparation
I installed VirtualBox and VirtualBox Extension Pack. Plug in my SSD and found it was on /dev/disk2s2. I

sudo chown Richardn /dev/disk2*

to enable raw disk access and

sudo VBoxManage internalcommands createrawvmdk -filename ./archtogo.vmdk -rawdisk /dev/disk2s2

to generate a .vmdk file
Then I created a new VM instance with option 'Do not add a virtual hard disk' and later linked that .vmdk and archlinux-2020.10.01-x86_64.iso to the instance.
Start VM.

2. Arch Linux Installation
For this part I just carefully followed what was said on the Installation Guide and googled a bit to clear up some confusions.
I created partitions using cfdisk. Scheme:

Label: GPT
/dev/sda1 260M EFI System
/dev/sda2 2G   Linux Swap
/dev/sda3 90G  Linux Filesystem

Then the usual mkfs mkswap mount pacman... and finally

arch-chroot /mnt

3. Bootloader Installation
Now since .bash_history started working I can offer the exact commands I used related to bootloader installation:

pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable --recheck
grub-mkconfig -o /boot/grub/grub.cfg

4. Testing Installation on VM
I removed the .iso file (to show that the installation is really independent) from the VM interface and started the instance. The cute GRUB interface was on and I was in Arch Linux in no time. All perfect.

5. Starting Installation on my Macbook
I restarted and held down the option key. The 'EFI' option showed up and I selected it, then this:
Grub%20Rescue.jpeg
The apparent error here was that normal.mod not found. The scarier things were those three-element tuples from ls (I never managed to find such tuples on Google...).
The suspicious thing: the volumes shown were exactly those in my internal drive.
To tackle the errors, I came back to VM and got into the grub command line:
Grub.png
Clearly normal.mod was there and the output from ls was different.

My own humble guesses (I said I'm new to all these things... These days I just absorb things abot UEFI/BIOS/MBR/GPT Bootloaders... from the Internet like mad and still very probably have a very weak knowledge base):
1. That I could get into GRUB was the job of Apple's boot volume chooser, then the control was handed to GRUB. Apple's firmware managed to find GRUB in the EFI section through the USB cable, but GRUB failed to locate my external SSD. Instead, it went into my internal drive and met a strange APFS scheme it didn't understand. The reason my installation worked in the VM was that VM handled the USB thing itself.
2. When writing this first post of mine on Arch Forum I noticed that my .vmdk file was directed to /dev/disk2s2. Should it be /dev/disk2 instead? But in the VM cfdisk told me that my 'drive' did have 128G space, so I think my Arch installation is in the right place and this .vmdk file should not be the cause of the problem (have not tested yet). After all Apple picked up the very GRUB I had installed.

Any suggestions? Like how to direct GRUB to ignore the internal drive and go beyond the USB cable?
Many places Google has led me to said something like 'Oh, Mac. Go to install rEFInd.' I think I should not use advanced tools to magically solve my problem before fully understanding it. (This resonates with the Arch principles right?)

P.S. A Lenovo laptop of my roommate's couldn't even detect my SSD during boot process. Let's talk about that later after getting things done with my Mac...

Last edited by Richardn (2020-10-12 02:40:20)

Offline

#2 2020-10-11 10:16:54

xerxes_
Member
Registered: 2018-04-29
Posts: 662

Re: [SOLVED]Trying to start Arch from a removable media on MacBook

Did you do something like this: 'mkinitcpio -g /boot/initramfs-linux.img -k /boot/vmlinuz-linux' before you setup grub?

If he is expecting file 'normal.mod' (whatever it is) then just give it to him; copy that file from vm or wherever you have it to /grub/x86_x64-efi/ directory.

When you are in 'grub rescue' shell do ls to partitions to see what there is and where you aim to boot, like: 'ls (hd0)/' or 'ls (hd0,1)/' or 'ls (hd4,gpt4)/'. Combine.
More info about grub rescue.

Offline

#3 2020-10-11 11:01:13

Richardn
Member
Registered: 2020-10-11
Posts: 8

Re: [SOLVED]Trying to start Arch from a removable media on MacBook

xerxes_ wrote:

Did you do something like this: 'mkinitcpio -g /boot/initramfs-linux.img -k /boot/vmlinuz-linux' before you setup grub?

If he is expecting file 'normal.mod' (whatever it is) then just give it to him; copy that file from vm or wherever you have it to /grub/x86_x64-efi/ directory.

When you are in 'grub rescue' shell do ls to partitions to see what there is and where you aim to boot, like: 'ls (hd0)/' or 'ls (hd0,1)/' or 'ls (hd4,gpt4)/'. Combine.
More info about grub rescue.

Uh I have read that mkinitcpio will be ran once when grub-install ([EDIT] when pacstrap linux)? Anyway, I remember seeing the output of mkinitcpio and /boot/vmlinuz-linux is present. The installation is complete
...only when checking from the VM.

The problem is that through VM I can find normal.mod in its right place, but through the Apple chip I cannot.
Of course I have tried listing all the partitions in rescue mode, sorry I forgot to mention the output: every

ls (partition)/

returns an error (mostly filesystem error)
except for (hd4,gpt1), ls yields an empty line.

I cannot even put in a /boot/grub/x86_x64-efi/normal.mod for the Apple chip as from the only place that can start the system, the VM, the disk looks differently, like, (hd4,gpt1) doesn't even exist listing from the VM (-_-;)... The problem is way more than just a missing file. The WHOLE disk except the EFI section is missing.

Last edited by Richardn (2020-10-12 23:14:11)

Offline

#4 2020-10-11 12:00:21

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,866

Re: [SOLVED]Trying to start Arch from a removable media on MacBook

You have to adjust the bootloader and possibly fstab to get a VM install to boot on real hardware.
Doing this will break booting as  a VM, usually you want to do this on a copy.

see https://wiki.archlinux.org/index.php/Mo … al_machine for details

P.S. The wiki page I linked may not match with what you want to do, but it should improve your insight what steps need to be taken.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2020-10-11 12:36:35

Richardn
Member
Registered: 2020-10-11
Posts: 8

Re: [SOLVED]Trying to start Arch from a removable media on MacBook

Lone_Wolf wrote:

You have to adjust the bootloader and possibly fstab to get a VM install to boot on real hardware.
Doing this will break booting as  a VM, usually you want to do this on a copy.

see https://wiki.archlinux.org/index.php/Mo … al_machine for details

P.S. The wiki page I linked may not match with what you want to do, but it should improve your insight what steps need to be taken.

!
Looks very much like containing the information I need. Will try soon. Thank you so much! (Why this page is never mentioned in https://wiki.archlinux.org/index.php/In … ble_medium? It just says that if you are not on Linux then set up a VM and follow the normal installation guide. From my naive point of view I really thought a VM is identical to a motherboard...)

By the way, is it possible to set up two bootloaders in two EFI partitions on one SSD so that both my VM and real motherboards can boot the system (while my root still lies in the partition where it is right now)? Or because bootloaders must take the first places in a drive (if I understand the boot process correctly?) so this is not possible?
Further, can I, like, install rEFInd in /dev/sda1 and install bootloader-for-VM and bootloader-for-Mac respectively in /dev/sda4 /dev/sda5 so that I can boot up from anywhere?

Again, I'm really new to this area of knowledge, so please correct my naive ideas tongue

Offline

#6 2020-10-12 02:50:54

Richardn
Member
Registered: 2020-10-11
Posts: 8

Re: [SOLVED]Trying to start Arch from a removable media on MacBook

Lone_Wolf wrote:

You have to adjust the bootloader and possibly fstab to get a VM install to boot on real hardware.
Doing this will break booting as  a VM, usually you want to do this on a copy.

see https://wiki.archlinux.org/index.php/Mo … al_machine for details

P.S. The wiki page I linked may not match with what you want to do, but it should improve your insight what steps need to be taken.

Just managed to boot on my MacBook.
Turns out that my guess #2 is correct, I should have linked /dev/disk2 instead of /dev/disk2s2 as a virtual hard drive to the VM, then the VM is identical to real hardware. No further adjusting fstab or bootloader settings needed. After correcting this mistake and going through the installation process again, Macbook can boot Arch Linux from the prepared SSD. Really learned a lot these days, thanks to you all and the Arch Linux community!

P.S. Now I'm facing another strange situation that never happened before: my system takes several minutes to start. It stucks until a timeout error then I'm into the system. I remember seeing some topics like '100000 milliseconds timeout' here in this forum, so maybe I will go and read. Whatever, the system finally starts.
[EDIT] This is because I mkswap ed before chroot ing. After getting into the system, I feed /etc/fstab with the proper swap partition UUID and mkinitcpio -p linux ,then everything is fine.

Last edited by Richardn (2020-10-12 03:14:34)

Offline

#7 2020-10-12 10:43:43

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,866

Re: [SOLVED]Trying to start Arch from a removable media on MacBook

Richardn wrote:

By the way, is it possible to set up two bootloaders in two EFI partitions on one SSD

two or more bootloaders is possible, but you can only have one ESP (EFI System Partition) per disk.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

Board footer

Powered by FluxBB