AsahiLinux / asahi-installer

Asahi Linux installer
MIT License
807 stars 107 forks source link

Support installing from macOS running from external storage #250

Open RoundDuckKira opened 8 months ago

RoundDuckKira commented 8 months ago
kira@Kiras-Mac-mini installer % curl https://alx.sh | sh                                                                                                       
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1808  100  1808    0     0   1514      0  0:00:01  0:00:01 --:--:--  1515

Bootstrapping installer:
  Checking version...
  Version: v0.7.1
  Downloading...
  Extracting...
  Initializing...

The installer needs to run as root.
Please enter your sudo password if prompted.
Password:

Welcome to the Asahi Linux installer!

This installer will guide you through the process of setting up
Asahi Linux on your Mac.

Please make sure you are familiar with our documentation at:
  https://alx.sh/w

Press enter to continue.

Collecting system information...
  Product name: Mac mini (2023)
  SoC: Apple M2
  Device class: j473ap
  Product type: Mac14,3
  Board ID: 0x24
  Chip ID: 0x8112
  System firmware: iBoot-10151.61.4
  Boot UUID: B2FEADD9-EFE9-43DF-B90F-17C0A1FEE961
  Boot VGID: B2FEADD9-EFE9-43DF-B90F-17C0A1FEE961
  Default boot VGID: B2FEADD9-EFE9-43DF-B90F-17C0A1FEE961
  Boot mode: macOS
  OS version: 14.2.1 (23C71)
  OS restore version: 23.3.71.0.0,0
  Main firmware version: 14.2.1 (23C71)
  No Fallback System Firmware / rOS
  SFR version: 23.3.71.0.0,0
  SystemRecovery version: 23.3.64.0.0,0 (14.2 23C64)
  Login user: kira

Collecting partition information...
  System disk: disk0

Collecting OS information...

Partitions in system disk (disk0):
  1: (free space: 245.11 GB)
  2: APFS (System Recovery) (5.37 GB, 2 volumes)
    OS: [  ] recoveryOS v14.2.1 [Primary recoveryOS]

  [B ] = Booted OS, [R ] = Booted recovery, [? ] = Unknown
  [ *] = Default boot volume

Unable to determine primary OS.
This installer requires you to already have a macOS install with
at least one administrator user that is a machine owner.
Please run this installer from your main macOS instance or its
paired recovery, or ensure the default boot volume is set correctly.

I have macOS 14 on my external SSD, and I did have macOS 14 internally too, but I deleted it via diskutil in the hopes that I could have room for Asahi Fedora Remix, but it ended up in a situation to where it can't find the macOS on the external drive and gives up.

marcan commented 4 months ago

This is not a bug. It is not possible to install anything without having macOS installed first, as you need macOS (machine owner) credentials to authorize the install.

At some point in the future, there will be an option to overwrite an existing macOS and take over its machine owner credentials, once we have SEP support to manage that from Linux. But it will always be required to have a macOS install to begin with (with first-time setup completed and an admin user created), even if at some point it becomes possible to do the install process from recoveryOS and delete it as part of the installation process.

marcan commented 4 months ago

Sorry, I misread. I see you do have macOS, just on an external SSD. Right now we don't support that in the installer to pull auth credentials from (there are complications of that use case due to components getting provisioned in a different way for "external" macOS installs, since the machines don't actually support "external" boot at all). I'll leave this open since we should track support for that at some point.

That said, note that you are expected to keep that external macOS install around to handle upgrades at this time, until we have support for full machine owner user creation and SFR update triggering. If you were to install Asahi like this and then erase your external drive, you would have an unsupported system and might run into trouble in the future.

PaulCharlton commented 3 months ago

1) does this depend on the version of MacOS? 1) based on the contents of RecoveryOSContainer GPT partition being 1TR on later MacOS

2) seems like if the internal drive still has partitions for iBootSystemContainer [Apple_APFS_ISC] and RecoveryOSContainer(1TR) [Apple_APFS_Recovery] that all other MacOS partitions could be removed (as long as the user's machine is still booting). @marcan ?

3) updating the Preboot APFS Volume could still be handled from booting to a Recovery APFS Volume, or perhaps a new Linux toolset with APFS write support

4) rather than focus on "internal/external" drives, it seems like this issue would also be applicable to a MacPro with an add-on "internal" PCI nvme card, and a desire to define which OS launches from which storage device.

5) perhaps need to consider some terminology updates to distinguish between "booting", and "launching an OS" 1) Apple seems to have at least the following boot modes: 1) DFU 2) [default] Boot OS from default APFS volume group 3) [default Recovery] Boot menu with Recovery option from APFS volume in same APFS container as default OS 4) [1TR Recovery] Boot menu with Recovery option from "hidden" GPT partition containing system Boot APFS 5) [Apple Diagnostics] Boot menu + "CMD-D"

@RoundDuckKira is your use case to have all GPT partitions dedicated to Linux, or are you willing to dedicate 10GB or so to "boot overhead" on non-Linux related partitions?

Note: At this moment, I am most interested in the end-goal requirements for "features", not necessarily the actual design of solutions. I am just starting to climb the learning curve for modern MacOS booting process with its related security protocols, so any solution I discuss is a straw-man for a reality which will be discovered and learned iteratively