[LINUX] How to make multi-boot USB (Windows 10 compatible)

Overview

Create a multi-boot USB memory by placing multiple OS installation ISO files on the USB memory and installing the boot loader. As a procedure, first create a Windows 10 installer and then install GRUB there. Multi-boot is realized by reading the installer ISO files of various Linux OS from GRUB or chain-loading to the Windows installer.

Things necessary

procedure

Working on Windows

Insert the USB memory you want to use as an installer into your Windows machine in advance. At least 8GB is required, and ISOs of other Linux distributions will be placed, so select the one with as large a capacity as possible.

Download Microsoft Media Creation Tool. Download "MediaCreationToolXXXX.exe" from the above page and start it. The version to be installed is entered in "XXXX".

Create an OS installer on the USB memory according to the explanation of the started tool. Success if the message that the installer has been created is displayed. For the time being, the work on Windows is over.

Since the installer is created with FAT32, it will be partitioned into 32GB partitions even if a large capacity USB memory is used. The area remaining from Windows disk management can also be used as a separate partition.

Working on Linux

Insert the created installer USB memory into the Linux machine. Also, prepare the necessary Linux ISO file.

Below, we will proceed on the premise of Arch Linux. Software names and options may differ for other distributions. The version of GRUB described in this paper is GRUB2.

First, install GRUB.

sudo pacman -S grub

Mount the USB memory. When it becomes accessible, rename / mnt / usb / efi / boot / bootx64.efi to bootx64.efi.windows.

mkdir /mnt/usb
mount /dev/sdb1 /mnt/usb

mv /mnt/usb/efi/boot/bootx64.efi /mnt/usb/efi/boot/bootx64.efi.windows

Install GRUB on a USB memory.

grub-install --target x86_64-efi --efi-directory /mnt/usb --boot-directory=/mnt/usb/boot --removable

Next, create a GRUB configuration file. Since it is necessary to describe the UUID of the partition, check it first. Get a hyphen-separated 8-digit string such as XXXX-XXXX.

lsblk -f | grep /mnt/usb

How to write the config file is [Arch Wiki](https://wiki.archlinux.jp/index.php/%E3%83%9E%E3%83%AB%E3%83%81%E3%83%96%E3 % 83% BC% E3% 83% 88_USB_% E3% 83% 89% E3% 83% A9% E3% 82% A4% E3% 83% 96). As for Ubuntu 18.04, the information on Ubuntu on the Wiki is old, so you should refer to the following. Prepare the ISO file of the corresponding version of Arch Linux, CentOS7, Ubuntu 18.04 Server, or modify the relevant part according to the version of the ISO file. For the ISO file, create a / mnt / usb / boot / iso directory and place the file there. Windows 10 starts by chain-loading the first installed one. Save the created config file as /mnt/usb/boot/grub/grub.cfg. For the UUID on the second line of grub.cfg, specify the one obtained earlier.

mkdir /mnt/usb/boot/iso
vim /mnt/usb/boot/grub/grub.cfg

grub.cfg


# path to the partition holding ISO images (using UUID)
set imgdevpath='/dev/disk/by-uuid/XXXX-XXXX'

insmod all_video

menuentry '[loopback]archlinux-2020.03.01-x86_64' {
	set isofile='/boot/iso/archlinux-2020.03.01-x86_64.iso'
	loopback loop $isofile
	linux (loop)/arch/boot/x86_64/vmlinuz archisodevice=/dev/loop0 img_dev=$imgdevpath img_loop=$isofile
	initrd (loop)/arch/boot/x86_64/archiso.img
}

menuentry "[loopback]CentOS-7-x86_64-Minimal-1908" {
	set isofile='/boot/iso/CentOS-7-x86_64-Minimal-1908.iso'
	loopback loop $isofile
	linux (loop)/isolinux/vmlinuz noeject inst.stage2=hd:/dev/sdb1:/$isofile
	initrd (loop)/isolinux/initrd.img
}

menuentry '[loopback]ubuntu-18.04.4-live-server-amd64' {
	set isofile='/boot/iso/ubuntu-18.04.4-live-server-amd64.iso'
	loopback loop $isofile
	linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile locale=en_US.UTF-8
	initrd (loop)/casper/initrd
}

menuentry '[chain]Win10_1909_Japanese_x64' {
  insmod chain
  chainloader /efi/boot/bootx64.efi.windows
}

After arranging various files, the work is completed. Insert it into the machine where you want to install the OS, and select USB partition 1 from the boot menu of the BIOS at boot time. Success if the GRUB menu is displayed.

References

Recommended Posts

How to make multi-boot USB (Windows 10 compatible)
How to make Linux compatible with Japanese keyboard
How to install Python [Windows]
How to make a Japanese-English translation
How to use Dataiku on Windows
How to make a slack bot
How to install pycrypto on Windows
How to make a crawler --Advanced
How to deploy django-compressor on Windows
How to make a recursive function
How to make a deadman's switch
[Blender] How to make a Blender plugin
[Blender] How to make Blender scripts multilingual
How to make a crawler --Basic
How to install music 21 on windows
How to make Word Cloud characters monochromatic
How to make Selenium as light as possible
[Python] How to make a class iterable
[Kivy] How to install Kivy on Windows [Python]
How to use Cmder with PyCharm (Windows)
How to use Google Assistant on Windows 10
[Cocos2d-x] How to make Script Binding (Part 2)
How to install richzhang / colorization on Windows 10
How to install Windows Subsystem For Linux
How to make a Backtrader custom indicator
How to make a Pelican site map
[Cocos2d-x] How to make Script Binding (Part 1)
How to make a dialogue system dedicated to beginners
How to make an embedded Linux device driver (8)
How to make an embedded Linux device driver (1)
How to make an embedded Linux device driver (4)
How to make multiple kernels selectable on Jupyter
How to make a dictionary with a hierarchical structure.
How to make an embedded Linux device driver (7)
How to make an embedded Linux device driver (2)
How to make scrapy JSON output into Japanese
How to make an embedded Linux device driver (3)
How to quickly install h5py on Windows 10 [Unofficial]
How to make a QGIS plugin (package generation)
How to add Anaconda Powershell Prompt to Windows Terminal?
I read "How to make a hacking lab"
[Blender x Python] How to make an animation
How to make Substance Painter Python plugin (Introduction)
[Blender x Python] How to make vertex animation
[Python] How to install OpenCV on Anaconda [Windows]
How to make an embedded Linux device driver (5)
How to make an embedded Linux device driver (10)
How to make Python faster for beginners [numpy]
How to make Python Interpreter changes in Pycharm
How to make an embedded Linux device driver (9)
How to install / verify graphviz on anaconda / windows10
Inspired by "How to make pure functional JavaScript"
How to make AWS rekognition recognize local image files
How to build two CentOS7 environments / Windows10 + VirtualBox + Vagrant
[Continued] Inspired by "How to make pure functional JavaScript"
How to make Yubico Yubikey recognized in Manjaro Linux
Explain in detail how to make sounds with python
How to make a shooting game with toio (Part 1)
How to make unit tests Part.2 Class design for tests
How to share folders with Docker and Windows with tensorflow
How to make an interactive CLI tool in Golang