ArchLinux installation tutorial
Table of contents
- ArchLinux installation tutorial
-
- Preparation before installation
- Install
- Configure the system
- Restart
- Post-installation work
Preparation before installation
Get the installation image
Visit the download page and obtain the ISO file or netboot image and the corresponding GnuPG signature depending on the desired boot method .
Verify signature
It is recommended to verify the signature of downloaded files before use, especially files downloaded from HTTP mirror sources , because HTTP connections are generally easy to be intercepted and provide malicious mirrors .
On a system that has GnuPG installed , you can download the PGP signature ( under Checksums on the download page ) to the path where the ISO file is located, and then verify the signature using the following method :
$ gpg --keyserver-options auto-key-retrieve --verify archlinux-*version*-x86_64.iso.sig
In addition, on a computer that has Arch Linux installed, it can be verified in the following ways:
$ pacman-key -v archlinux-*version*-x86_64.iso.sig
Notice:
If the installation image is downloaded from a mirror site instead of archlinux.org , otherwise the signature can be forged.
In this case, make sure that the public key used to decode the signature is signed by another trusted key.
gpg
The command will output the fingerprint of the public key.Another way to verify the signature is to ensure that the fingerprint of the public key is equal to the fingerprint of one of the Arch Linux developers who signed the ISO file .
Prepare installation media
Installation images are available to the target machine via USB flash drive , CD-ROM and network with PXE : please prepare the installation media with an image that suits you.
Boot into Live environment
Notice:
Arch Linux installation images do not support Secure Boot.
To boot the installation media, Secure Boot needs to be disabled .
If necessary, you can reconfigure Secure Boot after completing the installation .
-
To choose to boot from the media with the Arch installation file, you usually need to press a certain button during the computer's power-on self-test , and there will usually be a prompt on the startup screen. Please refer to the motherboard manual for specific conditions.
-
When the bootloader menu appears, select Arch Linux install medium and press
Enter
to enter the installation environment.hint:
The installation image boots
UEFI
using mode and boots in mode .GRUB
BIOS
syslinux
-
Will
root
log in to a virtual console as , the defaultShell
isZsh
.
If you want to install and use
Lynx
this guide at the same time, you can useAlt+*箭头*
shortcut keys to switch between different consoles.To edit the configuration file, use
mcedit
(1) ,nano
andvim
.
Console keyboard layout
The console keyboard layout defaults to us
(US keymap).
To list all available keyboard layouts, use:
# ls /usr/share/kbd/keymaps/**/*.map.gz
If you want to change the keyboard layout, add the corresponding file name to loadkeys
(1) , but omit the path and extension.
For example, to add a German keyboard layout:
# loadkeys de-latin1
The console font is located /usr/share/kbd/consolefonts/
in the directory. For setting methods, please refer to setfont(8) .
Verify boot mode
To verify boot mode, list the efivars directory with the following command:
# ls /sys/firmware/efi/efivars
If the command results show the directory and no errors are reported, the system boots in UEFI mode.
If the directory does not exist, the system may boot in BIOS mode (or CSM mode).
If the system does not boot in the desired mode, please refer to the motherboard manual.
Connect to the Internet
To configure network connectivity in a Live environment, follow these steps:
-
Make sure the network interface is enabled on the system , check with ip-link(8) :
# ip link
For Wireless LAN (Wi-Fi) and Wireless Wide Area Network (WWAN), make sure the network card is not disabled by rfkill .
-
To connect to the network:
-
Wired Ethernet - Connect the network cable.
-
WiFi - Use iwctl to verify wireless networks.
-
iwd
The software package provides client programsiwctl
, daemonsiwd
, and WiFi monitoring toolsiwmon
. Activate/enableiwd.service
so that it caniwctl
be controlled using .iwctl
The daemon can be started with the following commandiwd
:# systemctl start iwd
Or use the following command to start
iwctl
the daemoniwd
:# systemctl start iwd.service
To enter the interactive prompt, execute:
$ iwctl
The interactive prompt will then
[iwd]#
be displayed with the prefix.hint:
iwctl
In the prompt, you can useTab
the key to automatically complete commands and device names.To exit the interactive prompt, press
Ctrl+d
to send the EOF signal.All commands can be used as command-line arguments without entering an interactive prompt.
For example:
iwctl device wlp3s0 show
.Connect to the network :
First, if you don't know the network device names, list all
WiFi
devices:[iwd]# device list
Second, to scan the network, execute:
[iwd]# station <device> scan
Again, all available networks can be listed:
[iwd]# station <device> get-networks
Finally, to connect to a network:
[iwd]# station <device> connect <SSID>
If a network password is required, the user will be prompted to enter it.
In addition, the connection operation can be applied as a command line parameter:
$ iwctl --passphrase <passphrase> station <device> connect <SSID>
Notice:
-
iwd
Network passwords are automatically stored in/var/lib/iwd
the directory and can be used later to automatically connect to remembered networks. -
To connect to a network with spaces in the SSID, enclose the network name in double quotes when connecting.
-
iwd only supports PSK passwords consisting of 8 to 63 ASCII-encoded characters. If the requirements are not met, the following error message will appear:
PMK generation failed. Ensure Crypto Engine is properly configured
.
Connect to the Internet using WPS/WSC
If the network is configured to connect with the push of a button ( Wikipedia: Wi-Fi Protected Setup , WPS, WiFi protected configuration), first check whether the device is compatible with the following configuration steps:
[iwd]# wsc list
Second, assuming the device appears in the list above:
[iwd]# wsc <device> push-button
Press the button on the router again.
If the button is pressed in advance, but as long as it is less than two minutes ago, the above steps will also take effect.
If the network requires verification of a PIN to connect, check
help
the output of the command to see how towsc
provide the correct options to the command.Disconnect from the network
To disconnect from the network:
[iwd]# station <device> disconnect
Show device and connection information
To display WiFi device details, such as MAC address:
[iwd]# device <device> show
To display the connection status including the network to which a WiFi device is connected:
[iwd]# station <device> show
Manage known networks
To list previously connected networks:
[iwd]# known-networks list
To forget known networks:
[iwd]# known-networks <SSID> forget
-
-
-
Mobile Broadband Modem (Mobile Network Card) - Use
mmcli
the utility to connect to a mobile network.
-
-
Configure network connection:
DHCP
systemd-networkd
: Dynamic IP address and DNS server assignment (powered by andsystemd-resolved
) are available out of the box for wired Ethernet, Wireless LAN (WLAN), and Wireless Wide Area Network (WWAN) network interfaces.- Static IP address: Proceed as a static IP address .
-
Check the network connection with
ping
the command:# ping archlinux.org
Notice:
By default, the installation image is preconfigured with
systemd-networkd
,systemd-resolved
,iwd
and enabledModemManager
.But this is not the case for already installed systems.
Update system time
Use timedatectl
(1) to ensure the system time is accurate:
# timedatectl set-ntp true
You can use timedatectl status
to check the service status.
Create hard disk partition
If the system recognizes the disk, it will allocate it as a block device , such as /dev/sda
, /dev/nvme0n1
or /dev/mmcblk0
. Available using lsblk
or fdisk
viewing:
# fdisk -l
Devices ending with rom
, loop
or can be ignored in the results .airoot
For a selected device, the following partitions are required:
- A root partition (mounted in the root directory )
/
; - To boot in UEFI mode, an EFI system partition is also required .
If you need to create multi-level storage such as LVM , disk encryption or RAID , please do it at this time.
Please use fdisk or parted to modify the partition table. For example:
# fdisk /dev/<the_disk_to_be_partitioned(要被分区的磁盘)>
Notice:
If the desired disk does not appear, make sure the disk controller is not in RAID mode .
The disk to be booted already has an EFI system partition . Do not create a new
EFI
partition. Use an existing partition.If the file system supports it, swap space can be implemented through a swap file .
You can also use a simpler method cfdisk
to partition the disk. Use the following command:
# cfdisk /dev/<the_disk_to_be_partitioned(要被分区的磁盘)>
Note :
GPT
If you mistakenly mix partition and partition hereMBR
, you can use the following command to convert:
GPT
Partition toMBR
partition:Use
parted
tool conversion. If the system does not contain this tool, please install it first and then execute the following command:# parted -s /dev/<the_disk_to_be_partitioned(要被分区的磁盘)> mklabel msdos
Partition example
UEFI andGPT |
|||
---|---|---|---|
mount point | Partition | Partition type | Recommended size |
/mnt/boot 1 |
/dev/*efi_system_partition* |
EFI system partition | At least 300 MiB |
[SWAP] |
/dev/*swap_partition* |
Linux swap (swap space) | Greater than 512 MiB |
/mnt |
/dev/*root_partition* |
Linux x86-64 root directory (/) | remaining space |
If you are using a bootloader that can load the kernel and initramfs
image from the root disk volume, you can use other mount points (for example /mnt/efi
).
BIOS andMBR |
|||
---|---|---|---|
mount point | Partition | Partition type | Recommended size |
[SWAP] |
/dev/*swap_partition* |
Linux swap (swap space) | Greater than 512 MiB |
/mnt |
/dev/*root_partition* |
Linux | remaining space |
Format partition
After the partitions are created, each newly created partition must be formatted with an appropriate file system .
For example, to /dev/*root_partition*
create an Ext4 file system on the root partition, run:
# mkfs.ext4 /dev/*root_partition(根分区)*
If a swap partition is created , use mkswap(8) to initialize it:
# mkswap /dev/*swap_partition(交换空间分区)*
Notice:
For stacked block devices please replace above with the appropriate block device path
/dev/**_partition*
.
To create a EFI
system partition , use mkfs.fat
(8) to format it Fat32
.
warn:
Formatting is only required when creating an EFI system partition during the partitioning step.
If there is already an EFI system partition on this disk, reformatting will destroy the boot loader of other installed operating systems.
# mkfs.fat -F 32 /dev/*efi_system_partition*
Mount partition
Mount the root disk volume to /mnt
, for example:
# mount /dev/*root_partition(根分区)* /mnt
Use mkdir
(1) to create other remaining mount points (for example /mnt/efi
) and mount their corresponding disk volumes.
hint:
--mkdir
Run mount(8) with the option to create the specified mount point.Or, use mkdir(1) to create a mount point first and then mount it.
Notice:
The order of mounting partitions must be followed: first mount the root partition (to
/mnt
), then mount the boot partition (to/mnt/boot
or/mnt/efi
, if separated separately), and finally mount other partitions.Otherwise, you may encounter the problem of being unable to start the system after the installation is completed.
For UEFI
systems, mount the EFI system partition:
# mount /dev/*efi_system_partition* /mnt/boot
If a swap space volume is created , use swapon(8) to enable it:
# swapon /dev/*swap_partition(交换空间分区)*
The mounted file system and swap space will be automatically detected later genfstab
(8) .
Install
Select image
File /etc/pacman.d/mirrorlist
defines the mirror from which the package will be downloaded.
On a LiveCD-booted system, after connecting to the Internet, the mirror list reflector
is updated by selecting the 20 most recently synced HTTPS
mirrors and sorting them by download rate.
Mirrors that are earlier in the list have higher priority when downloading software packages.
Might want to check the file and see if you're happy with it.
If you are not satisfied, you can modify the file accordingly /etc/pacman.d/mirrorlist
and move the geographically closest image source to the head of the file. Some other criteria should also be considered.
Use the following command to add the fastest local Chinese mirror source and world mirror source to the top position to improve the installation speed:
# reflector -c Worldwide -c China -a 15 -p https -p http --sort rate --save /etc/pacman.d/mirrorlist
This file will then be pacstrap
copied to the new system, so please make sure the settings are correct.
Install required packages
Using the pacstrap
(8) script, install base
the package and Linux
kernel as well as the firmware for regular hardware:
# pacstrap /mnt base linux linux-firmware
hint:
can be
linux
replaced with other kernel packages described in the kernel page.When installing in a virtual machine or container, the firmware package does not need to be installed.
base
Software packages do not contain Live
all programs in the environment.
So to get a fully functional basic system, you may need to install additional packages.
In particular, consider installing:
- User tools for managing the file systems used (such as management tools for
XFS
and );Btrfs
- Tools for access
RAID
orLVM
partitioning; linux-firmware
Additional firmware not included (e.g. for sound cards )sof-firmware
;- Programs required for networking
NetworkManager
(such as ordhcpcd
); - Text editor (such as:
nano
,vim
etc.); - Tools for accessing documentation in
man
and pages: , and .info
man-db
man-pages
texinfo
To install other packages or package groups (for example base-devel
), please append their names to pacstrap
the command above (separated by spaces), or use to manually install the package or package group after Chroot
entering a new system .pacman
packages.x86_64
You can learn about the differences between different software packages or software package groups.
The following commands are recommended software packages to install :
# pacstrap /mnt base base-devel linux linux-firmware dhcpcd iwd vim sudo bash-completion nano net-tools openssh man
If you want a relatively more stable system, you can install a long-term support version of Linux
the kernel.
The recommended software packages and long-term support version Linux
kernel installation commands are as follows:
# pacstrap /mnt base base-devel linux-lts linux-firmware dhcpcd iwd vim sudo bash-completion nano net-tools openssh man
Configure the system
Fstab
Generate fstab
the file with the following command (use the -U
or -L
option to set the UUID or volume label):
# genfstab -U /mnt >> /mnt/etc/fstab
It is strongly recommended to check whether the generated file is correct after executing the above command /mnt/etc/fstab
. You can use the following command to check:
# cat /mnt/etc/fstab
You can also use a text editor to view it. The command is as follows:
nano
Editor view command:# nano /mnt/etc/fstab
vim
Compiler view command:# vim /mnt/etc/fstab
Default editor viewing command:
# gedit /mnt/etc/fstab
……
Chroot
chroot
To the newly installed system:
# arch-chroot /mnt
Edit AUR
Chinese sources and other mirror sources (optional)
Use a text editor to edit ArchLinuxCN
the source and other mirror sources:
Use vim
edit:
# vim /etc/pacman.conf
Use nano
edit:
# nano /etc/pacman.conf
Edit using the default editor:
# gedit /etc/pacman.conf
The edited content is as follows:
Open the 32-bit software source and delete [community]
the previous ones #
. The final effect is as follows:
[community]
Include = /etc/pacman.d/mirrorlist
Add ArchLinuxCN source:
Add the following content to /etc/pacman.conf
:
[archlinuxcn]
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
Installation archlinuxcn-keyring
package importGPG key
# pacman -S archlinuxcn-keyring
# pacman-key --init
# pacman-key --populate archlinuxcn
Add other mirror sources:
/etc/pacman.conf
Add the following content to import , blackarch
, arch4edu
source lado.me-audio
:
[blackarch]
SigLevel = Optional TrustAll
Server = https://mirrors.cloud.tencent.com/blackarch/$repo/os/$arch
[arch4edu]
Server = https://mirrors.tuna.tsinghua.edu.cn/arch4edu/$arch
[lado.me-audio]
SigLevel = Optional TrustAll
Server = https://lado.me/repo/$arch
Update mirror source:
Use the following command to update the imported image source:
# pacman -Sy
Time zone
To set the time zone :
# ln -sf /usr/share/zoneinfo/*Region(地区名)*/*City(城市名)* /etc/localtime
hint:
For example, if you want to set the Shanghai time zone, please run
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Then run hwclock
(8) to generate /etc/adjtime
:
# hwclock --systohc
This command assumes that the hardware time has been set to UTC time .
localization
Programs and libraries that require localized text rely on locale settings , which specify the region, currency, time zone date format, character arrangement, and other localization standards.
Need to be set in these two files: locale.gen
and locale.conf
.
Edit /etc/locale.gen
and uncomment ( ) before en_US.UTF-8 UTF-8
and other required locale settings .#
Then execute locale-gen
to generate locale
information:
# locale-gen
Create the locale.conf
(5) file and edit and set the LANG variable , such as:
/etc/locale.conf
LANG=*en_US.UTF-8*
Also for Chinese users:
hint:
Users can set locale by themselves;
Set the system locale to
en_US.UTF-8
, the systemlog
will be displayed in English, which makes it easier to judge and deal with problems;
It can also be set to
en_GB.UTF-8
oren_SG.UTF-8
, with the following advantages:
- After entering the desktop environment, the time is displayed in 24-hour format;
- The paper size of office software such as LibreOffice will default to
A4
instead ofLetter(US)
;- Try to avoid unnecessary and potentially troublesome imperial units.
The set LANG variable must be consistent with the locale setting, otherwise the following error will occur:
- `Cannot set LC_CTYPE to default locale: No such file or directory`
warn:
It is not recommended to set any Chinese here
locale
, as it will causetty
garbled characters.
If you need to modify the # console keyboard layout , you can edit vconsole.conf
(5) to make it effective for a long time, for example:
/etc/vconsole.conf
KEYMAP=*de-latin1*
Network Configuration
/etc/hostname
myhostname(主机名)
Please proceed to complete the network configuration of the newly installed environment . You may need to install appropriate network management software during the configuration process.
Initramfs
There is usually no need to create a new one initramfs
, since it pacstrap
is already installed when executing linux
, which has already been run mkinitcpio
.
For partition configurations such as LVM
, system encryption
or RAID
, modify mkinitcpio.conf
and re-create an Initramfs with the following command:
# mkinitcpio -P
Root password
Set Root password :
# passwd
Create a new personal user
Use the following command to create a new non root
-personal user to improve security:
# useradd -m -G wheel -s /bin/bash <用户名>
Set personal user password
Use the following command to set the account password of the individual user:
# passwd arch
Edit individual user permissions
If used vim
, you can use the following command for simple settings:
# EDITOR=vim visudo
If used nano
, the file needs to be modified sudoers
. The command is as follows:
# nano /etc/sudoers
Just delete %wheel
the one before #
, or add the following content under %wheel
or :root
<用户名> ALL=(ALL) ALL
Set up the network:
In order to prevent many functions from being unavailable due to no network available after booting, LiveCD
set Chroot
up the network environment first.
-
① Use the following command to install the network setting software:
-
# pacman -S networkmanager dhcpcd iw wpa_supplicant dialog net-tools openssh
-
-
②
systemd
Set the network to start automatically at boot using:-
# systemctl enable Networkmanager sshd dhcpcd
-
Notice:
You can also use the following command to
iwd
automatically start the computer to obtain a wireless network connection, whichNetworkManager
is the same as the above function.# systemctl enable iwd
iwd
Although andNetworkManager
can run at the same time, it cannot be used at the same time, that is, it has no effect ifiwd
a connection is used.NetworkManager
-
Install bootloader
A bootloader needs to be installed Linux
to start the system after installation. The available bootloaders are listed in Bootloader . Please select one to install and configure it. This GRUB
is the most common choice.
Install boot software:
Use the following command to install the software for booting:
# pacman -S grub efibootmgr os-prober
Install the microcode update software:
If there is or Intel
, please enable microcode updates in addition.AMD
CPU
Intel
The microcode installation command is as follows:
# pacman -S intel-ucode
AMD
The microcode installation command is as follows:
# pacman -S amd-ucode
Installation guide:
BIOS
System boot installation:
Install the package according to the previous steps grub
. Use the following command to boot the installation:
# grub-install --target=i386-pc </dev/sdX>
where is the disk ( not partition ) /dev/sdX
to be installed GRUB
, such as disk , or , rather than partition `/dev/sda1./dev/sda
/dev/nvme0n1
/dev/mmcblk0
UEFI
System boot installation:
Notice:
Different hardware manufacturers implement UEFI in different ways. The steps described below should be applicable to most UEFI systems.
For users who have encountered problems after using the method below, please share the details of the problem encountered on the specific hardware and possible solutions.
These examples can be added to the page GRUB/EFI examples (Simplified Chinese) .
This section assumes you are installing GRUB on an x86_64 system.
- For IA32 (32-bit) UEFI systems (not to be confused with 32-bit CPUs), will be
x86_64-efi
replaced byi386-efi
.
Follow the steps above to install the software package grub
and efibootmgr
.
Among them, " GRUB
" is the startup boot loader, and " efibootmgr
" is used by GRUB
the script to write startup items NVRAM
.
Follow these steps to GRUB
install to your hard drive:
- Mount
EFI
the system partition . It should be noted that in the content of this section, replace with the partition*esp*
mount point;ESP
- Select a bootloader ID, in this case called
GRUB
. This will*esp*/EFI/
create a directory with the same name as the logo in to store the EFI binaries, and this name will also be used to distinguishGRUB
boot items in the UEFI boot menu; - Execute the following commands to
grubx64.efi
install the GRUB EFI application*esp*/EFI/GRUB/
and install its modules/boot/grub/x86_64-efi/
.
Notice:
Make sure the system where you install
GRUB
the package and run the command isGRUB
the system you want to boot from.That is, if you boot from the installation media, you need to
chroot
run it againgrub-install
.If you have to run it outside the installed system for some reasons
grub-install
, add--boot-directory=
the option at the end to specify/boot
the path to the mounting directory, such as--boot-directory=/mnt/boot
.
# grub-install --target=x86_64-efi --efi-directory=*esp* --bootloader-id=GRUB
After the above installation is complete GRUB
your home directory will be located /boot/grub/
.
Note that in the above example, an entry grub-install
will also be created in the firmware boot manager called GRUB
.
If the startup items are full, this command will fail.
Need to use efibootmgr to remove unnecessary entries.
After the configuration is completed, remember to #generate the main configuration file .
hint:
If the option is used
--removable
,GRUB
it will be installed to*esp*/EFI/BOOT/BOOTX64.EFI
(when is usedi386-efi
)*esp*/EFI/BOOT/BOOTIA32.EFI
, and it will still be possible to boot from the drive even ifEFI
the variables are reset or the drive is connected to another computer.Normally, just
BIOS
select the drive at startup like a device.If the device is installed
Windows
with multi-boot at the same time, please note that an executable programWindows
is usually installed here , and the purpose of this program is to only rebuild the startup items.EFI
Windows
UEFI
If you want to install on a Mac
GRUB
, you must use this option.
Notice:
--efi-directory
and--bootloader-id
areGRUB UEFI
unique to .
--efi-directory
Replaced the obsolete one--root-directory
.You may notice that there is no device_path option (eg ) in
grub-install
the command ./dev/sda
- In fact, even if device_path is provided , it will be
GRUB UEFI
ignored by the installation script becauseUEFI
the boot loader does not useMBR
boot code or boot sectors.
After completing the installation, GRUB loads the configuration file every time it is started /boot/grub/grub.cfg
.
You can use tools to # generate grub.cfg , or you can move # to customize grub.cfg .
Generate grub.cfg
Note:
Remember, whenever you modify a file in
/etc/default/grub
or/etc/grub.d/
, you need to generate the main configuration file again .
Generate main configuration file
After installation, the main configuration file needs to be generated /boot/grub/grub.cfg
.
The configuration file generation process is affected by /etc/default/grub
options in and /etc/grub.d/
scripts under .
Without additional configuration, the autogenerator detects configuration files in the root file system of the currently booted system.
So please make sure the system has been started or chroot
entered via .
Notice:
The default file path is
/boot/grub/grub.cfg
, not/boot/grub/i386-pc/grub.cfg
.If you run it in
chroot
a orsystemd-nspawn
containergrub-mkconfig
, you may get an error ofgrub-probe
"Unable to obtain "canonical path of /dev/sdaX
" and fail to execute normally. You can try to use it at this timearch-chroot
.If installed in an environment
LVM
using , it will hang indefinitely.chroot
GRUB
grub-mkconfig
Use grub-mkconfig
tools to generate /boot/grub/grub.cfg
:
# grub-mkconfig -o /boot/grub/grub.cfg
The auto-generate script will by default add entries in the generated configuration file for all installed Arch Linux kernels .
hint:
Each time you install or remove a kernel , you need to rerun
grub-mkconfig
the command.To manage multiple
GRUB
entries, set up as follows:
If multiple kernels are installed, such as
linux
andlinux-lts
,grub-mkconfig
they will be divided into a group to create a submenu by default, and use the following command to generate the main configuration file to manage multiple startup entries:# grub-mkconfig -o /boot/grub/grub.cfg
If multiple kernel startup entries are divided into one startup entry each, you need to
/etc/default/grub
add the following command in the file or#
delete it in front of it to return to the situation with only one menu:GRUB_DISABLE_SUBMENU=y
If you use
GRUB
the current startup item as the default startup item, you need to edit the/etc/default/grub
MediumGRUB_DEFAULT
option as follows:GRUB_DEFAULT=saved
If you want to use
GRUB
the currently selected startup item as the default startup item, you need to/etc/default/grub
add the following command to the file or#
delete it in front of it:GRUB_SAVEDEFAULT=true
Notice:
Since
GRUB
cannotbtrfs
be written to, it can only be used when/boot
is notbtrfs
a file system.However, a misleading error message is generated: "
sparse file not allowed. Press any key to continue.
"Notice:
To manually add startup items to
/etc/grub.d/40_custom
or/boot/grub/custom.cfg
, such as addingWindows
startup items, you need to addsavedefault
options first.To modify the default menu entries, set as follows:
The default startup items can be changed by modifying the value
/etc/default/grub
in :GRUB_DEFAULT
① Use menu title:
GRUB_DEFAULT='Advanced options for Arch Linux>Arch Linux, with Linux linux'
② Use numerical numbers:
GRUB_DEFAULT="1>2"
Note :
GRUB
The startup item0
serial number starts from ,0
which represents the first startup item, which is also the default value of the above options, which1
represents the second startup item, and so on.Main menu and submenu items are
>
separated by .The above example starts
Advanced options for Arch Linux
the third item of the submenu under the main menu item ' '.
If you want to add custom entries, edit /etc/grub.d/40_custom
the file and then regenerate it /boot/grub/grub.cfg
.
You can also create /boot/grub/custom.cfg
a file and add entries to it.
/boot/grub/custom.cfg
There is no need to run the program after modifying the file grub-mkconfig
, because /etc/grub.d/41_custom
the file has already been referenced by adding relevant source
statements in the generated main configuration file /boot/grub/custom.cfg
.
hint:
/etc/grub.d/40_custom
It can be used as a template for creating/etc/grub.d/*nn*_custom
files, where*nn*
is the priority and specifies the execution order of script files.The execution order of the script files determines the position of the entries added in the GRUB startup menu.
*nn*
Should be06
larger than to ensure that important scripts can be executed first.
Detect other operating systems
To grub-mkconfig
detect other installed systems and automatically add them to the boot menu, install the os-prober package and mount the disk partition containing the boot loader of the other system.
Then run again grub-mkconfig
.
If you get the following output: Warning: os-prober will not be executed to detect other bootable partitions
, you need to edit /etc/default/grub
and uncomment the following line. If there is no corresponding comment, add it at the end of the file:
GRUB_DISABLE_OS_PROBER=false
Run grub-mkconfig
and try again.
Notice:
The partition mount point is not important, os-prober reads
mtab
the information to confirm and search for the bootloader location.
grub-mkconfig
Remember to mount the partition containing the boot programs of other operating systems before each run to avoid losing the startup items of these operating systems.
hint:
You may want to
grub
remember the last selected startup item, see GRUB/Tips and tricks#Calling previous startup items
warn:
This is the last and crucial step of the installation. Please follow the above instructions to correctly install the boot loader before restarting.
Otherwise, you will not be able to enter the system normally after restarting.
Restart
Enter exit
or press Ctrl+d
to exit the chroot environment.
You can optionally umount -R /mnt
manually unmount the mounted partition:
This helps to detect any "busy" partitions and find out the cause via
fuser
(1) .
Finally, by executing reboot
a reboot, systemd will automatically unmount any partitions that are still mounted.
Don't forget to remove the installation media and log in to the new system using the root account.
Post-installation work
System administration tutorials and post-work such as creating non-privileged accounts, GUI installation, sound management, touchpad support, etc.
Not original, please do not reprint