[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Install Debian 10 amd64 onto USB flash drive with and for Macintosh



On 9/1/21 1:15 AM, didier gaumet wrote:
Hello,


Hello.  :-)


Le mardi 31 août 2021 à 15:31 -0700, David Christensen a écrit :
[...]
I would like to install Debian 10 onto a USB flash drive as a
self-contained, bootable, full, live installation that I use with
this
and other Intel-based Macintosh computers.

- Booting the installation media with the rescue option will probably
offer the possibility to reinstall grub with the desired option(s)


<POINT_A, see below>

<Insert debian-10.10.0-amd64-xfce-CD-1 USB flash drive>
<Power up>

Debian GNU/Linux 10.10.0
Debian GNU/Linux UEFI Installer menu -> Advanced options... -> Rescue mode
Language -> C
Continent or region -> North America
Country, territory or area -> United States
Keymap to use -> American English
Load missing firmward from removable media?
<insert USB flash drive with Debian 10.10.0 firmware>
-> Yes
Load missing firmware from removable media?
<remove USB flash drive with Debian 10.10.0 firmware>
<insert USB flash drive with Debian instance>
-> No
Wireless network -> wifi.tracy.holgerdanske.com
Wireless network type for w1p3s0 -> WPA/WPA2 PSK
WPA/WPA2 passphrase for wireless device w1p3s0 -> ********
Hostname -> dpchrist-mbp
Domain name -> tracy.holgerdanske.com
Select your time zone -> Pacific

<POINT_B, see below>

Device to use as a root file system -> /dev/sdb3
The installed system appears to use a separate /boot/efi partition.
It is normally a good idea to mount it as it will allow operations such as reinstalling the boot loader. However, if the file system on /boot/efi is corrupt then you may want o avoid mounting it.
Mount separate /boot/efi partition? -> No
Rescue operations -> Execute shell in /dev/sda3
Executing a shell -> Continue
# blkid /dev/sdb1
/dev/sdb1: UUID-"D19A-5B1E" TYPE="vfat" PARTLABEL="buster-mac-esp" PARTUUID="447e5600-211c-4abd-ba38-c03969160b28"
# vi /etc/fstab
<comment out existing /boot/efi line>
<add the following line>
UUID=D19A-5B1E /boot/efi vfat umask=0077 0 1
# mount /boot/efi
# exit
Rescue operations -> Reinstall GRUB boot loader
Device for boot loader installation -> /dev/sdb1
Rescue operations -> Reboot the system

GNU GRUB version 2.02+dfsg1-20+deb10u4 -> Debian GNU/Linux
<Debian 10 graphical login screen>
-> Shutdown

<Wait for system to power off>
<Remove debian-10.10.0-amd64-xfce-CD-1 USB flash drive>


Boot debian-mac and login as root via SSH:

2021-09-01 15:03:56 root@buster-mac ~
# mount | grep '.dev.sd'
/dev/sdb3 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)


Mount device for /boot/efi is wrong -- still using internal SSD, not USB flash drive.


Troubleshoot:

2021-09-01 15:05:09 root@buster-mac ~
# blkid /dev/sda1 /dev/sdb1
/dev/sda1: LABEL_FATBOOT="EFI" LABEL="EFI" UUID="67E3-17ED" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="78155464-748d-48f6-938c-a1341b1ae49a" /dev/sdb1: UUID="D19A-5B1E" TYPE="vfat" PARTLABEL="buster-mac-esp" PARTUUID="447e5600-211c-4abd-ba38-c03969160b28"

2021-09-01 15:05:34 root@buster-mac ~
# grep efi /etc/fstab
# /boot/efi was on /dev/sda1 during installation
#UUID=67E3-17ED  /boot/efi       vfat    umask=0077      0       1
UUID=D19A-5B1E  /boot/efi       vfat    umask=0077      0       1


Shutdown. Remove buster-mac USB flash drive. Boot debian-10.10.0-amd64-xfce-CD-1 USB flash drive. Follow above steps POINT_A through POINT_B, above, then continue:

Device to use as a root file system -> /dev/sdd3
Mount separate /boot/efi partition? -> No
Rescue operations -> Force GRUB installation to the EFI removable media path
Force GRUB installation to the EFI removable media path? -> Yes
Rescue operations-> Reboot system

GNU GRUB version 2.02+dfsg1-20+deb10u4 -> Debian GNU/Linux
<Debian 10 graphical login screen>
-> Shutdown

<Wait for system to power off>
<Remove debian-10.10.0-amd64-xfce-CD-1 USB flash drive>


Boot debian-mac and login as root via SSH:

2021-09-01 15:22:28 root@buster-mac ~
# mount | grep '.dev.sd'
/dev/sdb3 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)


Wrong -- internal SSD ESP is mounted at /boot/efi.


Shutdown Debian USB flash drive instance.


Power up. Press and hold Option. Disk window now shows internal SSD and "EFI Boot" disk. Select "EFI Boot". Debian instance boots. Login as root via SSH:

2021-09-01 15:26:26 root@buster-mac ~
# mount | grep '.dev.sd'
/dev/sdb3 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)


Correct -- USB flash drive ESP is mounted at /boot/efi.


Shutdown, remove buster-mac USB flash drive, and power up -- macOS boots.


So, now macOS boots by default if the debian-mac USB flash drive is not inserted, I can boot the debian-mac USB flash drive using the flash drive ESP if I use Option, but the internal SSD ESP will be used if I insert the debian-mac USB flash drive and boot without Option.


Boot debian-mac USB flash drive via Option. Mount the SSD ESP. Move aside the "debian" tree:

2021-09-01 15:34:50 root@buster-mac ~
# mount /dev/sda1 /mnt

2021-09-01 15:34:57 root@buster-mac ~
# mount | grep sda
/dev/sda1 on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)

2021-09-01 15:35:42 root@buster-mac ~
# mv /mnt/EFI/debian /mnt/EFI/debian-disabled


Shutdown.


Power up with debian-mac USB flash drive inserted. Do not press Option. buster-mac boots. /dev/sdb1 is mounted at /boot/efi. Shutdown.

2021-09-01 15:50:03 root@buster-mac ~
# mount | grep '.dev.sd'
/dev/sdb3 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)

2021-09-01 15:50:08 root@buster-mac ~
# t /boot/efi
/boot/efi
`-- EFI
    |-- BOOT
    |   |-- BOOTX64.EFI
    |   |-- fbx64.efi
    |   `-- grubx64.efi
    `-- debian
        |-- BOOTX64.CSV
        |-- fbx64.efi
        |-- grub.cfg
        |-- grubx64.efi
        |-- mmx64.efi
        `-- shimx64.efi

3 directories, 9 files

2021-09-01 15:50:16 root@buster-mac ~
# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdd3 during installation
UUID=a2ecf948-c990-44fe-a098-b2df2d3ff0d7 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
#UUID=67E3-17ED  /boot/efi       vfat    umask=0077      0       1
UUID=D19A-5B1E  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/sdd2 during installation
UUID=04ac272d-2680-49a1-b0a9-e59c917c1286 none swap sw 0 0


Remove debian-mac USB flash drive.  Power up.  macOS boots.


Thank you for your help.  :-)


David


Reply to: