Install linux from hdd - without usb
By Martin on Regards: Infrastructure;Intorduction
Recently, I embarked on a quest to install Linux on my Surface Pro 4. I followed several installation guides specifically tailored for Surface Pro devices. These guides suggested creating a bootable Linux USB, adjusting the UEFI Settings to select either “None” or “Microsoft & 3d-party CA”, and modifying the boot order accordingly.
Despite my best efforts, my Surface Pro 4 refused to boot from the USB and would always default to starting Windows. The cause of this behavior remains a mystery to me. I experimented with various setups, including using different USB sticks and employing different applications to create the bootable Linux USB. However, none of these attempts bore fruit. Even when I accessed GRUB, the bootloader used by Linux, the USB stick was nowhere to be found.
The journey continues as I seek a solution to this intriguing challenge. The goal remains: successfully booting Linux on my Surface Pro 4.
Installing grub2win
Given the persistent issue with the UEFI Settings not loading my USB Linux setup, I decided to install Grub2Win and attempt to load my Linux setup from there. I installed Grub2Win on my Windows machine and disabled the “Microsoft only” option in the UEFI settings under security.
Upon booting into Grub2Win, pressing c
opens a bash-like
terminal. Using ls
displays all existing partitions
recognized by Grub. However, Grub also failed to recognize my USB
stick.
Create linux setup partition
Given the persistent issues with the USB media, I decided to pivot my
approach and use my internal hard disk drive as the installation source.
To accomplish this, I first booted into Windows and launched the Disk
Management tool using the diskmgmt.msc
command.
In the Disk Management interface, I created a new partition on my main hard disk drive and formatted it to FAT32. This new partition would serve as the destination for my Linux setup files.
Next, I copied the content of the USB media to this newly created
partition. In my case, this involved extracting the Linux
.iso
file directly onto the partition.
With the setup files in place, I rebooted my system to Grub2Win, ready to proceed with the Linux installation from the hard disk drive.
Identifying the Linux Setup Partition in Grub
Armed with the ls
command, I set out to identify the
partition label (hd0,gptx)
corresponding to the newly
created partition housing my Linux setup files. Knowing the specific
folders and files that comprise the Linux setup media can be incredibly
helpful in this process.
To locate these files, I executed a series of commands:
ls (hd0,gpt7)
, ls (hd0,gpt6)
, and so forth. I
continued this process until I encountered folders and files that I
recognized as part of the Linux setup media.
Once I had identified the correct partition label, I executed the
command set root=(hd0,gpt4)
. This was followed by
chainloader /efi/boot/grubx64.efi
and boot
.
These commands instructed Grub to load the Linux setup from the
specified partition.
At long last, my Linux setup loaded successfully, and I was able to install Linux on my Surface Pro 4.
The full grub command history can be found here
GNU GRUB version 2.06
Minimal BASH- like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions. ESC at any time exits.
grub> ls
(hd0) (hd0 ,gpt7) (hd0 ,gpt6) (hd0 ,gpt5) (hd0 ,gpt4) (hd0,gpt3) (hd0 ,gpt2) (hd0,gpt1)
grub> ls (hd0 ,gpt7)
error: unknown filesystem.
grub> ls (hd0,gpt6)/ lost+found/ boot/ etc/ media/
grub> ls (hd0,gpt5)/
$AttrDef $BadClus $Bitmap $B00t $Extend/ $LogFile $MFT $MFTMirr $Secure $UpCase $Volume Recovery/ System volume Information/
grub> ls (hd0,gpt4)/
System Volume Information/ efi/ README.html README.mirrors.html README.mirrors.txt README.source readme.txt autorun.inf boot/ css/ dists/ doc/ firrmuare/ g21dr g21dr.rnbr install/ install.amd/ isolinux/ md5sum.txt pics/ pool/ setup.exe tools/ win32-loader.ini [BOOT]/ $recycle.bin/
grub> set root=(hd0,gpt4)
grub> chainloader /efi/boot/grubx64.efi
/EndEntire
file path: /ACPI(a0341d0,0)PCI(0,1c)/PCI(0,0)/UknownMessaging(17)
HD (4 , 133e8000 , 108fOOO , b68981S490382e41 , 2 , 2) File ( \efi\boot )/File(grubx64.efi)
/EndEntire
grub>boot
After the linux setup is complete one can delete the temporary created linux setup partition.
Links:
- https://linuxhint.com/boot-usb-using-grub/
- https://superuser.com/questions/349633/boot-from-usb-using-grub
- https://szymonkrajewski.pl/how-to-boot-system-from-usb-using-grub/
- https://superuser.com/questions/1499193/how-to-write-a-bootable-iso-windows-installation-disk-to-a-disk-partition-and-n