LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Cannot boot on Apple hardware when installing to encrypted root partition. (https://www.linuxquestions.org/questions/slackware-14/cannot-boot-on-apple-hardware-when-installing-to-encrypted-root-partition-4175713844/)

nicholas_hubbard 06-24-2022 03:46 PM

Cannot boot on Apple hardware when installing to encrypted root partition.
 
1 Attachment(s)
I am trying to install Slackware 15.0 on my 2011 MacBook Pro. I am able to do this without any problems when I do not encrypt my root partition. However, if I try to install onto an encrypted root partition then I get stuck on this screen when I boot:
Attachment 39126

I have successfully installed Slackware 15.0 on my main computer (on multiple occasions) using the exact same partition/encryption setup on btrfs using the grub bootloader.

In the image you can see that it seems to know to ask for my decryption passphrase, but cannot actually prompt me. Hmm.

Next I will walk you through how I went about the installation.

Before running the installer I partition my disks. Here is the output of lsblk -f to show how I have done this:
Code:

NAME        FSTYPE      FSVER LABEL UUID                                FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                     
|-sda1      vfat        FAT32      9886-F7B8                            492.1M    4% /boot/efi
|-sda2      ext2        1.0        56454cfa-acaa-488e-a6e7-30a0671b2d00  838.8M    12% /boot
`-sda3      crypto_LUKS 2          6403afb3-cac7-409b-8b81-001ae5ba999f               
  `-lukssda3 btrfs                  81b1cb8e-7ec4-43a9-928c-136931e20e0d  456.1G    2% /
...

As you can see I setup my encrypted partition to use btrfs, so I then create a root subvolume that I mount at /mnt before mounting my boot and efi partitions.

Next I run the installer. Note that I skip installing lilo/elilo because I am going to use grub.

After I successfully run the slackware installer, I go back to the shell, chroot into /mnt, setup my /etc/fstab, and run the following commands before rebooting:

# /usr/share/mkinitrd/mkinitrd_command_generator.sh | sh
Code:

OK: /lib/modules/5.15.19/kernel/drivers/usb/storage/usb-storage.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/ehci-hcd.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/ehci-hcd.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/ehci-pci.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/xhci-hcd.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/xhci-pci-renesas.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/xhci-pci.ko added.
WARNING:  Could not find firmware "/lib/firmware/renesas_usb_fw.mem"
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/ehci-hcd.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/ohci-hcd.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/ohci-pci.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/xhci-hcd.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/usb/host/uhci-hcd.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/usbhid/usbhid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/i2c/i2c-core.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/i2c-hid/i2c-hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-generic.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/acpi/video.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/platform/x86/wmi.ko added.
OK: /lib/modules/5.15.19/kernel/net/rfkill/rfkill.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/input/sparse-keymap.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/acpi/battery.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/acpi/platform_profile.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/platform/x86/asus-wmi.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/usbhid/usbhid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-asus.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-cherry.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/usbhid/usbhid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-logitech.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/usbhid/usbhid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-logitech-dj.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-logitech-hidpp.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-lenovo.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-microsoft.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid.ko added.
OK: /lib/modules/5.15.19/kernel/drivers/hid/hid-multitouch.ko added.
OK: /lib/modules/5.15.19/kernel/lib/zstd/zstd_compress.ko added.
OK: /lib/modules/5.15.19/kernel/lib/zstd/zstd_compress.ko added.
OK: /lib/modules/5.15.19/kernel/fs/btrfs/btrfs.ko added.
OK: /lib/modules/5.15.19/kernel/crypto/af_alg.ko added.
OK: /lib/modules/5.15.19/kernel/crypto/algif_skcipher.ko added.
/boot/initrd.gz created.
Be sure to run lilo again if you use it.

# grub-install --target=x86_64-efi --efi-directory=/boot/efi
Code:

Installing for x86_64-efi platform.
Installation finished. No error reported.

# grub-mkconfig -o /boot/grub/grub.cfg
Code:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-huge-5.15.19
Found initrd image: /boot/initrd.gz
Found linux image: /boot/vmlinuz-huge
Found initrd image: /boot/initrd.gz
Found linux image: /boot/vmlinuz-generic-5.15.19
Found initrd image: /boot/initrd.gz
Found linux image: /boot/vmlinuz-generic
Found initrd image: /boot/initrd.gz
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done

In case you are thinking the problem is with my /etc/fstab, here is what that file looks like:
Code:

UUID=81b1cb8e-7ec4-43a9-928c-136931e20e0d / btrfs rw,noatime,compress=zstd,space_cache=v2,commit=120,subvol=@ 0 1
UUID=9886-F7B8 /boot/efi vfat defaults,noatime 0 2
UUID=56454cfa-acaa-488e-a6e7-30a0671b2d00 /boot ext2 defaults,noatime 0 2
UUID=81b1cb8e-7ec4-43a9-928c-136931e20e0d / btrfs rw,noatime,compress=zstd,space_cache=v2,commit=120,subvol=@snapshots 0 2
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs nosuid,nodev,noexec 0 0

Any ideas on what the problem could be?

Please note that when I get this machine setup I will refer to it as my slackmac.

Didier Spaier 06-24-2022 04:19 PM

Maybe you need a specific module for your USB keyboard in the initramfs built by mkinitrd_command_generator.sh or something like that.

nicholas_hubbard 06-24-2022 04:25 PM

Quote:

Originally Posted by Didier Spaier (Post 6363308)
Maybe you need a specific module for your USB keyboard in the initramfs built by mkinitrd_command_generator.sh or something like that.

I see how that could be the problem. Ill look into figuring out what module that may be.

Didier Spaier 06-24-2022 04:47 PM

I now use dracut. It ships a lot of modules so the risk you miss one is low.

ctrlaltca 06-25-2022 03:54 AM

From the image it looks like the correct module for the usb keyboard is being loaded, and the boot is stuck at the "Enter passphrase for /dev/sda3:" prompt.
The prompt itself is hidden behind some of the output related to the usb keyboard being detected.
Did you try just writing the password?
Does it work if you connect an external usb keyboard?

nicholas_hubbard 06-25-2022 08:33 AM

Quote:

Originally Posted by ctrlaltca (Post 6363385)
Did you try just writing the password?
Does it work if you connect an external usb keyboard?

I did try just typing in the password but that did not work.

However, I tried plugging in my external logitech keyboard as you suggested, and it worked!

This strongly suggests that the problem is indeed centered around keyboard modules. I am going to look into setting up dracut now.

nicholas_hubbard 06-25-2022 08:11 PM

I solved the problem! The missing module was called hid_apple. To add this module to the initrd I ran -
Code:

# /usr/share/mkinitrd/mkinitrd_command_generator.sh -m hid_apple | sh
# grub-mkconfig -o /boot/grub/grub.cfg

When I boot it still seems like I am stuck with the same issue, but now I am able to enter my decryption password from the built-in keyboard.

tjallen 06-26-2022 08:19 AM

I'm running both Slackware64 versions 14.2 and 15.0 on my 2012 MacBook Pros. This problem bit me as well. (And it took me way too long to figure it out!) My solution is to use the following to make my initrd:

Code:

mkinitrd -c -k 5.15.49 -m xhci-pci:xhci-hcd:ehci-pci:i2c_i801:sdhci_pci:agpgart:i915:sdhci:i2c_algo_bit:i2c_core:mmc_core:tg3:libphy:bcma:hwmon:ptp:pps_core:acpi_als:kfifo_buf:industrialio:fjes:video:button:processor:loop:ehci-hcd:hid:usbhid:hid-generic:hid_apple:hid_appleir:applesmc:mbcache:jbd2:drm:swap -f ext4 -C /dev/sda2 -r /dev/cryptvg/root -u -L -h /dev/cryptvg/swap -o /boot/initrd51549.gz
I also get the prompt for the password because I've loaded the video drivers as well as the HID devices.

You'll also need to install a daemon to run the fans on the MBP. I use mbpfan and have a SlackBuild if you want it. There are a few other little quirks that I've solved, too.

Didier Spaier 06-26-2022 09:28 AM

Here:
Code:

root[/]# lsinitrd |grep hid-apple.ko
-rw-r--r--  1 root    root        8053 Jun 17 00:35 lib/modules/5.18.5/kernel/drivers/hid/hid-apple.ko.zst

So my solution is to run:
Code:

dracut
Caveat: in such a case do not run instead:
Code:

dracut -H
as then it will include in the iniramfs only the modules needed on the host where you run it.


All times are GMT -5. The time now is 08:33 AM.