Arch linux bootable usb

Multiboot USB drive

This article or section is a candidate for moving to Multiboot disk images.

A multiboot USB flash drive allows booting multiple ISO files from a single device. The ISO files can be copied to the device and booted directly without unpacking them first. There are multiple methods available, but they may not work for all ISO images.

Contents

Using GRUB and loopback devices

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

  • only a single partition required
  • all ISO files are found in one directory
  • adding and removing ISO files is simple
  • not all ISO images are compatible
  • the original boot menu for the ISO file is not shown
  • it can be difficult to find a working boot entry

Preparation

This article or section needs expansion.

Create at least one partition and a filesystem supported by GRUB on the USB drive. See Partitioning and File systems#Create a file system. Choose the size based on the total size of the ISO files that you want to store on the drive, and plan for extra space for the bootloader.

Installing GRUB

Simple installation

Mount the filesystem located on the USB drive:

Create the directory /boot:

Install GRUB on the USB drive:

In case you want to boot ISOs in UEFI mode, you have to install grub for the UEFI target:

For UEFI, the partition has to be the first one in an MBR partition table and formatted with FAT32.

Hybrid UEFI GPT + BIOS GPT/MBR boot

This configuration is useful for creating a universal USB key, bootable everywhere. First of all you must create a GPT partition table on your device. You need at least 3 partitions:

  1. A BIOS boot partition (gdisk type code EF02 ). This partition must be 1 MiB in size
  2. An EFI System partition (gdisk type code EF00 with a FAT32 filesystem). This partition can be as small as 50 MiB.
  3. Your data partition (use a filesystem supported by GRUB). This partition can take up the rest of the space of your drive.

Next you must create a hybrid MBR partition table. Without it, a BIOS MBR based system will not boot. It will not find the partitions it expects to find.

Hybrid MBR partition table creation example using gdisk:

Do not forget to format the partitions :

You can now install GRUB to support both EFI + GPT and BIOS + GPT/MBR. The GRUB configuration (—boot-directory) can be kept in the same place.

First, you need to mount the EFI system partition and the data partition of your USB drive.

An example of this would be as follows:

Then, you can install GRUB for UEFI with:

In most cases EFI_MOUNTPOINT will correspond to the /mnt/boot/EFI subdirectory on your mounted USB disk.

Читайте также:  Инструкции по безопасности windows

And for BIOS with:

As an additional fallback, you can also install GRUB on your MBR-bootable data partition:

Configuring GRUB

Using a template

There are some git projects which provide some pre-existing GRUB configuration files, and a nice generic grub.cfg which can be used to load the other boot entries on demand, showing them only if the specified ISO files — or folders containing them — are present on the drive.

Manual configuration

For the purpose of multiboot USB drive it is easier to edit grub.cfg by hand instead of generating it. Alternatively, make the following changes in /etc/grub.d/40_custom or /mnt/boot/grub/custom.cfg and generate /mnt/boot/grub/grub.cfg using grub-mkconfig.

As it is recommend to use a persistent name instead of /dev/sdxY to identify the partition on the USB drive where the image files are located, define a variable for convenience to hold the value. If the ISO images are on the same partition as GRUB, use the following to read the UUID at boot time:

Or specify the UUID explicitly:

Alternatively, use the device label instead of UUID:

The necessary UUID or label can be found using lsblk -f . Do not use the same label as the Arch ISO for the USB device, otherwise the boot process will fail.

To complete the configuration, a boot entry for each ISO image has to be added below this header, see the next section for examples.

Boot entries

It is assumed that the ISO images are stored in the boot/iso/ directory on the same filesystem where GRUB is installed. Otherwise it would be necessary to prefix the path to ISO file with device identification when using the loopback command, for example loopback loop (hd1,2)$isofile . As this identification of devices is not persistent, it is not used in the examples in this section.

One can use persistent block device naming like so. Replace the UUID according to your ISO filesystem UUID.

Arch Linux monthly release

See README.bootparams for archiso options supported in kernel command line.

Memtest86+

Memtest86+ is included in the monthly ISO.

archboot

Using Syslinux and memdisk

Using the memdisk module, the ISO image is loaded into memory, and its bootloader is loaded. Make sure that the system that will boot this USB drive has sufficient amount of memory for the image file and running operating system.

Preparation

Make sure that the USB drive is properly partitioned and that there is a partition with file system supported by Syslinux, for example fat32 or ext4. Then install Syslinux to this partition, see Syslinux#Installation on BIOS.

Install the memdisk module

The memdisk module was not installed during Syslinux installation, it has to be installed manually. Mount the partition where Syslinux is installed to /mnt/ and copy the memdisk module to the same directory where Syslinux is installed:

Configuration

After copying the ISO files on the USB drive, edit the Syslinux configuration file and create menu entries for the ISO images. The basic entry looks like this:

See memdisk on Syslinux wiki for more configuration options.

Caveat for 32-bit systems

When booting a 32-bit system from an image larger than 128MiB, it is necessary to increase the maximum memory usage of vmalloc. This is done by adding vmalloc=valueM to the kernel parameters, where value is larger than the size of the ISO image in MiB.[1]

Читайте также:  Где посмотреть температуру процессора mac os

For example when booting the 32-bit system from the Arch installation ISO, press the Tab key over the Boot Arch Linux (i686) entry and add vmalloc=768M at the end. Skipping this step will result in the following error during boot:

Источник

How to Create Bootable USB for Arch Linux?

A bootable USB or live USB is a USB flash drive that contains a bootable operating system. We create these USB flash drives when we wanted to refresh or change our operating system. Let’s discuss how we can create a Bootable USB flash drive for Arch Linux. Download the Arch ISO image from the Arch download page. Here, https://archlinux.org/download/.

Method 1: Using dd command

Step 1: Check the available disks on the system using the following command. fdisk is a command-line utility used to get info about removable and non-removable disks. Here, -l flag means listing available disks.

Listing available disks

The highlighted one is my removable disk of 32gb. Run the above command and note down the path where the disk is mounted. Here, my disk is mounted at /dev/sdc.

Step 2: Write the ISO image to the removable USB. dd is an acronym for convert and copy, it is called dd because cc is already in use by the C compiler. dd is a command-line utility tool used for creating bootable USB. It converts and copies the ISO image to the USB flash drive. bs is used to set the input and output block size.

Successfully created a bootable USB

Method 2: Using imagewriter

Step 1: Open up the image writer tool using the following command :

Step 2: Insert a USB stick into the computer.

Step 3: Select the downloaded Arch ISO.

Step 4: Click on the write button, a popup will be promoted click the button, and you’re all done.

Step 5: Wait until it completes the writing ISO, then unplug the USB.

Источник

Install Arch Linux on a removable medium

This page explains how to perform a regular Arch installation onto removable media (e.g. a USB flash drive). In contrast to having a LiveUSB as covered in USB flash installation medium, the result will be a persistent installation identical to normal installation to HDD.

Contents

Installation

There are various ways of installing Arch on removable media, depending on the operating system you have available:

  • If you have another Linux computer available (it need not be Arch), you can follow the instructions at Install from existing Linux.
  • An Arch Linux CD/USB can be used to install Arch onto the removable medium, via booting the CD/USB and following the installation guide. If booting from a Live USB, the installation cannot be made to the same removable medium you are booting from.
  • If you run Windows or macOS, download VirtualBox, install VirtualBox Extensions, attach your removable medium to a virtual machine running Linux (either already installed or via a live ISO), and point the installation into the now attached drive while using the instructions at the Installation guide.

Installation tweaks

  • Before creating the initial RAM disk, in /etc/mkinitcpio.conf move the block and keyboard hooks before the autodetect hook. This is necessary to allow booting on multiple systems each requiring different modules in early userspace.
  • If you have chosen to install Arch onto a USB mass storage device and want to be able to continue to use it as a cross-platform removable drive, this can be accomplished by creating a partition housing an appropriate file system (most likely NTFS or exFAT). Note that the data partition may need to be the first partition on the device, as Windows assumes that there can only be one partition on a removable device, and will happily automount an EFI system partition otherwise. Remember to install dosfstools and ntfs-3g . Some tools are available online that may allow you to flip the Removable Medium Bit (RMB) on your USB mass storage device. This would trick operating systems into treating your USB mass storage device as an external hard disk and allow you to use whichever partitioning scheme you choose.
  • If your Arch installation is on a removable drive that needs to have microcode for both manufacturer processors, install both amd-ucode and intel-ucode packages. See Microcode#Installation.
Читайте также:  Как запустить командную строку mac os

Configuration

  • Make sure that /etc/fstab includes the correct partition information for / , and for any other partitions on the disk. If the drive is to be booted on several machines, it is quite likely that devices and number of available hard disks vary. So it is advised to use UUID or label.

To get the proper UUIDs for your partitions use lsblk of blkid. See Persistent block device naming#by-uuid for more information.

GRUB legacy

menu.lst , the GRUB legacy configuration file, should be edited to (loosely) match the following.

When using file system labels your menu.lst should look like this:

And for UUID, it should be like this:

Follow the instructions on GRUB#BIOS systems and GRUB#UEFI systems to install GRUB for both BIOS and UEFI booting:

Syslinux

Using your UUID:

Tips and tricks

Using your portable install on multiple machines

Compatibility for BIOS systems

This article or section needs expansion.

Since this setup will be run on multiple machines and there are still plenty of BIOS only systems around, you might want to consider enabling compatibility for both UEFI GPT and BIOS GPT/MBR systems. See Multiboot USB drive#Hybrid UEFI GPT + BIOS GPT/MBR boot

Video drivers

Persistent block device naming

It is recommended to use UUID in both fstab and boot loader configuration. See Persistent block device naming for details.

Alternatively, you may create udev rule to create custom symlink for your disk. Then use this symlink in fstab and boot loader configuration. See udev#Setting static device names for details.

Kernel parameters

You may want to disable KMS for various reasons, such as getting a blank screen or a «no signal» error from the display, when using some Intel video cards, etc. To disable KMS, add nomodeset as a kernel parameter. See Kernel parameters for more info.

Compatibility

The fallback image should be used for maximum compatibility.

Minimizing disk access

When installing to a device that offers a limited number of writes before it wears out, such as a USB drive, SD card, or similar, reduce the number of writes to increase the device lifetime. This also reduces the performance impact of slow writes.

Источник

Оцените статью