Skip to main content

My Experience of Installing Archlinux

·1038 words·
Table of Contents

I have a 500G portable SSD, and it contained an Ubuntu to Go before and it was OK. But after changing it to Manjaro, I found that it seemed that I couldn’t boot directly from other computers. Later, I still felt that WSL2 was more attractive, so I freed this SSD. But recently, I decided to use this SSD again and experience Archlinux by it. This article will introduce the my pitfall experience. The Result:

  • Secure Boot coexistence
  • Boot from Network
  • Archlinux in portable SSD

1. Hyper-V’s efforts are not all in vain
#

Since I didn’t have a USB flash drive, I first thought of using a virtual machine to install it, to avoid interference from the hard disk of the installed Windows system, which would cause boot problems. I also used this method to create Ubuntu to go. The main process is:

  1. Take the disk offline(forced by Hyper-V,no need for VMware).
  2. Select the physical hard disk in the virtual machine.
  3. Use the installation image to complete the installation.
  4. Restart your physical computer and select this SSD boot item in BIOS

I used VMware before, but I decided to give Microsoft’s Hyper-V a try. Using Hyper-V to create an Archlinux system disk is not smooth. I will briefly introduce the process.

  1. Windows 11 Home Edition requires manual installation of Hyper-V. Fortunately, there are many tutorials on the Internet, and you can directly run the scripts they provided.
  2. After the installation is complete, restart the computer, then search for Hyper-V and enter the Hyper-V Manager.
  3. Simply create a virtual machine and change the virtual hard disk to a physical hard disk in the settings. Note: The physical hard disk must be offline. You can directly use the DISKPART tool that comes with Windows to operate:
    • DISKPART Enter this command in the Windows terminal to enter the tool
    • LIST DISK List all current disks
    • SELECT DISK <DISK NUMBER> According to the previous step, select the hard disk you want to operate.
    • OFFLINE DISK Offline it.
  4. Install Archlinux according to the online tutorial. After installing the grub and completing the installation, restart the virtual machine and you can enter the system. Then I restarted the physical machine, but the SSD was not in the boot entry of the BIOS.
    • It was found that the problem might be that the UEFI firmware of the motherboard did not recognize the boot file. The solution is also very simple. When excuting grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCH, append --removable to it, which is
    grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCH --removable
    
  5. However, although it can be booted, it cannot mount the hard disk and is stuck at the first step. Although it automatically enters the emergency mode, I don’t know why the keyboard does not respond and I cannot perform any operations. I have tried to locate the hard disk directly using sda1 instead of uuid, but it still doesn’t work.

2. My USB Drivers Is So Scant
#

By chance, my dad got a USB flash drive of unknown origin. Although the USB flash drive is nominally 64GB, no one knows whether it is a false label. Since Hyper-V failed to be created, I burned the installation image into the USB flash drive and tried to directly use the Live system of the USB flash drive to debug the system on the mobile hard drive. However, the USB flash drive booted with the same problem as above, and the hard drive could not be mounted. At this time, I suspected that it might be a problem with the motherboard, or the USB flash drive itself might be broken.

3. NetBoot Descends
#

In the process of searching for solutions, I accidentally thought of the network boot method. However, this method requires setting up a PXE server in the local area network. I tried it, but I was too naive and had no idea of this. Fortunately, there is always a way out. I remembered that I had seen a way to boot from FAT32 on a forum. A USB flash drive in FAT32 format can be booted directly, so I directly formatted the USB flash drive to FAT32 and created a folder /EFI/BOOT. Then, I downloaded the ipxe-arch.efi file from https://archlinux.org/releng/netboot, renamed it BOOTX64.EFI, and put it in the folder I created before. The final path is /EFI/BOOT/BOOTX64.EFI. If don’t change the name here, my motherboard will not be able to boot successfully, but perhaps not all motherboards are like this. This EFI file is very small. I believe that no matter how fake the USB flash drive is, it should not be a problem to store a 1M file. At the same time, my computer is connected to the network by cable, so there is no need to worry about network problems.

At this point, I suspected that it might be because of the problem of opening Secure Boot that caused the hard disk to be unable to mount. After searching online, I found that Archlinux does not support Secure Boot (but it is hard to say whether this is the reason). However, directly turning off Secure Boot does not conform to my aesthetics. The motherboard I use is Gigabyte B650M. After some exploration, I found that the motherboard can customize the signature of the trusted boot program in the Secure Boot related settings. So immediately, I added the EFI file from network boot image and the EFI file of the Archlinux system in the SSD to it.

After selecting the USB drive to boot in BIOS, I successfully entered the Archlinux installation environment. In the Archlinux installation environment, I re-performed the pacstrap and grub installation steps. After restarting, I successfully entered the Archlinux system through the portable SSD.

4. Solo Booting
#

So far, I have only successfully installed Archlinux on a PSSD, and I am not sure whether it can be directly started on different computers. In particular, I has an AMD CPU, so the AMD microcode was installed during the installation, which may cause problems on INTEL CPUs. However, Ubuntu does not need to worry about this problem. I have brought a PSSD with Ubuntu installed to the school computer room and used it directly without a laptop. It is really convenient 😁.