Arch Linux - bunnyamin/bunnix GitHub Wiki
Always do a quick comparison to the official Arch Linux Installation guide before a new complete installation.
lsb_release -acat /etc/*-releasehostnamectluname -a
- Decide on an init system: init, SystemD, SysVinit.
- Decide on
Instruction Set Architecture: i686, x86_64, Multilib. - If Internet connection requires login, make sure to note all required credentials.
- Load keymap for keyboard
- Verify boot mode: BIOS or UEFI
- Partition devices
-
Mount devices
- The order devices or partitions are mounted or activated is the order
genfstabarranges devices in fstab. - Example of recommended mount order:
-
# mount /dev/<device> /mntmkdir -p /mnt/boot/{esp,grub}
# mount /dev/<device> /mnt/boot# swapon /dev/<device>- Mount or activate other devices.
-
- The order devices or partitions are mounted or activated is the order
- Connect to the Internet
- Adjust system clock
[timedatectl](systemd#timedatectl)
- Select pacman mirrorlist
[pacstrap](#pacstrap)-
genfstab -U /mnt >> /mnt/etc/fstab- This could be done after changed root, however see Fstab for possible problems.
- Change root
arch-chroot /mnt - Install packages necessary for configuration.
- Configure basic installation.
- Before reboot:
- Reboot.
- Expand basic configuration as needed:
- Query the package database (
-Q) and print installed packages (-d) neither required nor optionally required by any currently installed package (-t)pacman -Qdt <package name>. - Query the package database (
-Q) for owner (-o) of programpacman -Qo <program name>. - Query the package database (
-Q) and list all of its paths (-l) of programpacman -Ql <package name>. - Query the package database (
-Q) quietly (-q) for packages that are dependencies (-d) but are not required (-t)pacman -Qdtq. - Query the package database (
-Q) and check if installed packages are missing any files (-k)pacman -Qk. - Remove all packages (
-R) and their dependencies (-s) which are no longer necessarypacman -Rs $(pacman -Qdtq). - Remove specific package (
-R), but not its dependenciespacman -R <package name>. - Remove specific package (
-R), and its dependencies (-s) and configuration files (-n)pacman -Rns <package name>. - Remove all cached (
-cc) packagespacman -Scc. - Remove all cached packages
paccache -rk0.
-
Required to be non-root user
-
Download snapshot
-
Make package as normal user
$ makepkg -src.-
-iInstall or upgrade the package after a successful build using pacman. -
-sInstall missing dependencies using pacman. When build-time or run-time dependencies are not found, pacman will try to resolve them. If successful, the missing packages will be downloaded and installed. -
-rUpon successful build, remove any dependencies installed by makepkg during dependency auto-resolution and installation when using -s. -
-cClean up leftover work files and directories after a successful build.
-
-
Install package requires root
# pacman -U <package name>.pkg.tar.xz.
If error ==> ERROR: Cannot find the fakeroot binary.
- Install
pacman -S base-devel
- The mirrorlist directory
/etc/pacman.d/mirrorlist. - Download mirrorlist
curl -o /etc/pacman.d/mirrorlist "https://archlinux.org/mirrorlist/?country=all&protocol=https&ip_version=4&ip_version=6". -
NOTE The subdomain
wwwis no longer required (2021-12-29). -
NOTE The trailing
/after mirrorlist is required.
Assign -d to allow installation to a non-mountpoint directory.
- For example, when installing from on existing Arch Linux installation to a directory to chroot into.
pacstrap [-d] /<root> <package 1> <package 2> <package 3> ...
- The base package
base. - AUR build tools
base-devel. - The Linux kernel
linux. - Firmware files for Linux
linux-firmware. - sudo
| package | description |
|---|---|
| alsa-card-profiles | ALSA card profiles shared by PulseAudio. |
| alsa-lib | An alternative implementation of Linux sound support. |
| alsa-topology-conf | ALSA topology configuration files. |
| alsa-utils | Advanced Linux Sound Architecture - Utilities. |
| alsa-ucm-conf | ALSA Use Case Manager configuration (and topologies). |
| asoundconf (AUR) | Utility to read and change the user's ALSA library configuration. |
| libpulse | A featureful, general-purpose sound server (client library). Includes pactl. |
| pulseaudio | A featureful, general-purpose sound server. |
| pulseaudio-alsa | ALSA Configuration for PulseAudio. |
| pulseaudio-bluetooth | Bluetooth support for PulseAudio. |
| pulseaudio-jack | Jack support for PulseAudio. For example, 3.5 mm jacks. |
| pulseaudio-rtp | RTP and RAOP support for PulseAudio. |
| pavucontrol | PulseAudio Volume Control. |
| pulsemixer | CLI and curses mixer for pulseaudio. |
| package | description |
|---|---|
| bluez | Daemons for the bluetooth protocol stack. |
| bluez-utils | Development and debugging utilities for the bluetooth protocol stack. Contains the program bluetoothctl. |
| usbutils | A collection of USB tools to query connected USB devices |
| package | description |
|---|---|
| atftp | Client/server implementation of the TFTP protocol that implements RFCs 1350, 2090, 2347, 2348, and 2349. |
systemd-networkd is now preferred because it was easier to configure. |
|
| mkinitcpio-nbd | mkinitcpio hook to boot from a NBD (Network Block Device). |
| mkinitcpio-nfs-utils |
ipconfig and nfsmount tools for NFS root support in mkinitcpio. Necessary for NFS client. |
| nbd | Tools for network block devices, allowing you to use remote block devices over TCP/IP. Necessary for the server and the client mkinitcpio hook nbd. |
| nfs-utils | Support programs for Network File Systems. Necessary for NFS server and client. |
| package | description |
|---|---|
| binutils | A set of programs to assemble and manipulate binary and object files. For example, ar. |
| dpkg | The Debian Package Manager tools. |
| mc | A file manager that emulates Norton Commander. |
| ncdu | Disk usage analyzer with an ncurses interface. |
| rpmextract | Script to convert or extract RPM archives (contains rpm2cpio). Contains rpm2cpio. |
| xz | Library and command line tools for XZ and LZMA compressed files. |
| package | description |
|---|---|
| intel-ucode | Microcode update files for Intel CPUs. |
| package | description |
|---|---|
| xf86-video-amdgpu | X.org amdgpu video driver. |
| xf86-video-ati | X.org ati video driver. |
| xf86-video-intel | X.org Intel i810/i830/i915/945G/G965+ video drivers. |
| xf86-video-nouveau | Open Source 2D acceleration driver for nVidia cards. |
| xf86-video-vesa | X.org vesa video driver. |
| package | description |
|---|---|
| bumblebee | NVIDIA Optimus support for Linux through VirtualGL. |
intel-virtual-output |
In the package xf86-video-intel. |
| mesa-demos | Mesa demos and tools incl. glxinfo + glxgears. |
| primus | Faster OpenGL offloading for Bumblebee. |
| package | description |
|---|---|
| xf86-input-libinput | Generic input driver for the X.Org server based on libinput. Should obsolete xf86-input-synaptics. The libinput library requires regular users to be members of the group "input" in order to allow access to input devices. |
| xf86-input-synaptics | Synaptics driver for notebook touchpads. Not necessary?; see xf86-input-libinput. |
| xorg-xrandr | Primitive command line interface to RandR extension. |
| xorg-server | Xorg X server. |
| xorg-xinit | X.Org initialisation program. |
| xorg-xinput | Small commandline tool to configure devices (xinput). |
| package | description |
|---|---|
| cryptsetup | Userspace setup tool for transparent encryption of block devices using dm-crypt (cryptsetup). |
| man-db | A utility for reading man pages. |
| nano | Pico editor clone with enhancements. |
| pciutils | PCI bus configuration space access library and tools |
| usbutils | A collection of USB tools to query connected USB devices |
| xterm | X Terminal Emulator. |
| package | description |
|---|---|
| arp-scan | A tool that uses ARP to discover and fingerprint IP hosts on the local network. |
| iw |
nl80211 based CLI configuration utility for wireless devices. |
| iwd | Internet Wireless Daemon. |
| ethtool | Utility for controlling network drivers and hardware. |
| dhclient | A standalone DHCP client from the dhcp package. |
| dhcpc | A DHCP server daemon, and relay agent. |
| dhcpcd | RFC2131 compliant DHCP client daemon. |
| hostapd | IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator. |
| inetutils | A collection of common network programs, such as hostname. |
| ldns | Fast DNS library supporting recent RFCs. |
netcat |
To verify ports; GNU (gnu-netcat) or BSD (openbsd-netcat). |
systemd-networkd is now preferred because it was easier to configure, especially for a network with multiple device interfaces. |
|
| nftables | Netfilter tables userspace tools, for example, ip forwarding and firewall. |
| nmap | Utility for network discovery and security auditing. |
| openssh | Free version of the SSH connectivity tools. |
systemd-resolvectl is now preferred because it was easier to configure together with systemd-networkd. |
|
| tcpdump | Powerful command-line packet analyzer. |
| wireguard-tools | Next generation secure network tunnel - tools for configuration. |
| wireshark-cli | Network traffic and protocol analyzer/sniffer - CLI tools and data files. |
| wpa_supplicant | A utility providing key negotiation for WPA wireless networks. |
| package | description |
|---|---|
| lvm2 | Logical Volume Manager 2 utilities. |
| parted | A program for creating, destroying, resizing, checking and copying partitions. |
| gptfdisk | A text-mode partitioning tool that works on GUID Partition Table (GPT) disks. |
| dosfstools |
DOS filesystem utilities, for example, FAT support. |
| package | description |
|---|---|
| arch-install-scripts | Scripts to aid in installing Arch Linux. Required for an Arch Linux from which another Arch Linux is to be installed. |
| efibootmgr | Tool to modify UEFI Firmware Boot Manager Variables. |
| grub | GNU GRand Unified Bootloader (2). |
| man-pages | Linux man pages. |
| pacman-contrib | Contributed scripts and tools for pacman systems. For example, paccache. |
| sudo | Give certain users the ability to run some commands as root. |
| package | description |
|---|---|
| edk2-ovmf | Open Virtual Machine Firmware to support firmware for Virtual Machines. |
| qemu-base | QEMU without GUI. Prior to Qemu 7.0 the package was named Qemu (headless). |
| qemu-common | A generic and open source machine emulator and virtualizer. Package named as of Qemu 7.0. |
A minimal configuration to expand depending on additional functional requirements.
| file | package | configure |
|---|---|---|
/etc/adjtime |
(base) | Adjust the hardware clock from the system clock with the assumption that the hardware clock is in UTC: # hwclock --systohc --utc. |
/boot/grub/grub.cfg |
grub-install, generate a grub configuration file with grub-mkconfig. | |
| /etc/default/grub | grub | Install grub, and configure grub. |
/etc/fstab |
(base) | Generate fstab # genfstab -U /mnt >> /mnt/etc/fstab, where -U to use UUID or -L to use labels. The order devices or partitions are mounted or activated is the order genfstab arranges devices in fstab. Ensure that options are provided for basic devices ands paths, especially /boot. If using swap file add its entry to the fstab /swap none swap defaults 0 0 >> /etc/fstab. |
/etc/hostname |
(base) | Edit file in a text editor; add <hostname>. Alternatively, use SystemD # hostnamectl set-hostname <hostname>. |
/etc/hosts |
(base) | Edit file in a text editor: 127.0.0.1 <hostname>.localdomain <hostname>. |
/etc/localtime |
(base) | A syslink from the Time Zone Database database to localtime: $ ln -sf /usr/share/zoneinfo/<region>/<city> /etc/localtime. |
/etc/locale.conf |
(base) | Add locale, for example, LANG=en_US.UTF-8. |
/etc/locale.gen |
(base) | Uncomment locale in locale.gen and generate locale.conf and resources in /usr/lib/locale with locale-gen. Remember, any additional language later assigned requires to be uncomment in the locale.gen and locale-gen re-generated. |
/etc/mkinitcpio.conf |
(base) | For example, /etc/mkinitcpio.portable.conf, /etc/mkinitcpio.netboot.nfs.conf. |
| /etc/vconsole.conf | (base) | Add keyboard loadkeys keymap as KEYMAP. |
Expanded from the basic configuration, xorg.
- Add regular user to bumblebee group
# gpasswd -a <USER> bumblebee. - Enable bumblebee service
# systemctl enable bumblebeed. - Reboot, login to xorg server and test bumblebee
$ optirun glxgears -info.
| file | package | configure |
|---|---|---|
/etc/bumblebee/xorg.conf.nvidia |
bumblebee | Configure bumblebee if necessary. |
Expanded from the basic configuration. The diskless node, workstation, system is a minimal configuration that enables a client to boot over the network to a server using a PXE. The Linux OS root is mounted on the client over the network using NFS or NBD. Although the OS and all data are stored on the server, the OS and subsequent programs are executed on the client hardware.
Source:
Assuming network configuration:
SERVER 1 NETWORK DEVICE (0) GATEWAY IP : 192.168.0.1
SERVER 1 NETWORK DEVICE (0) IP : 192.168.0.101/24
SERVER 1 NETWORK DEVICE (1) IP : 192.168.1.101/24
SERVER 1 NETWORK DEVICE (2) IP : 192.168.2.101/24
SERVER 1 NETWORK DEVICE (3) IP : 192.168.3.101/24
SERVER ...
CLIENT 1 NETWORK DEVICE (1) IP : 192.168.1.102/24
CLIENT 2 NETWORK DEVICE (2) IP : 192.168.2.102/24
CLIENT 3 NETWORK DEVICE (3) IP : 192.168.3.102/24
CLIENT ...
- Recommended packages:
-
arch-install-scriptsto install Arch Linux for the clients. -
tcpdumpto debug network traffic. -
wireshark-clito debug network traffic.
-
- Install and configure the client OS on Server:
- basic configuration
- Create a mkinitcpio for NFS, for example mkinitcpio.netboot.nfs.conf.
- Build the new image
mkinitcpio -c /etc/mkinitcpio.netboot.nfs.conf -k 5.8.14-arch1-1 -g /boot/initramfs-linux.nfs.img. - Ensure that the
initramfsis- small, no more than around 50MiB, because if it is too large then the
connection to
TFTPcould be dropped witherror: timeout reading netboot/initramfs-linux.nfs.img(atftpd.log),ICMP enp0s0.localdomain udp port 46503 unreachable, length 40(tcpdump), and - allowed to be read otherwise
ATFTPreturns errorFile netboot/initramfs-linux.nfs.img not found.
- small, no more than around 50MiB, because if it is too large then the
connection to
- Build the new image
- Create a symbolic link from the client
/boot/to the/srv/tftp/netboot/directory. The boot files have to be in theTFTPsearch path. - Configure boot loader:
- Configure SystemD NetworkD
- Configure network for 2 or more static interfaces.
- Ping the IP addresses to confirm that they work.
- Configure DNS
- Configure TFTP
- Configure NFS
systemctl status systemd-networkdsystemctl status atftpdsystemctl status nfs-server
| file | package | configure |
|---|---|---|
| /etc/conf.d/atftpd | atftp | Provide the TFTP directory. Assign --group nobody to ATFTPD_ARGS because atftpd defaults to nogroup and Arch Linux uses nobody. |
/etc/conf.d/nfs-common.conf |
The nfs-common.conf is not necessary. | |
systemctl enable dhcpd4 and systemctl start dhcpd4.systemd-networkd is now preferred because it was easier to configure. |
||
| /etc/exports | nfs-utils | Declare NFS exports of directories. Enable and start systemctl enable nfs-server and systemctl start nfs-server includes, amongst other services, rpc.idmapd and rpc-mountd, or start them specifically # systemctl start nfs-idmapd nfs-mountd. |
/etc/hostname |
(base) | The server hostname. |
| /etc/hosts | (base) | Associate server and client IP addresses with hostnames and domains for the local network. |
| /etc/idmapd.conf | nfs-utils |
Enable or disable idmapping and configure idmapd.conf. The idmapd is started, amongst other services, with systemctl start nfs-server. The service can be started specifically with # systemctl start nfs-idmapd. |
/etc/mkinitcpio.conf |
mkinitcpio-nbd | If root is served over NBD (not tested). |
| /etc/mkinitcpio.conf | mkinitcpio-nfs-utils | If root is served over NFS, setup mkinitcpio nfs. |
| /etc/modprobe.d/nfs.conf | nfs-utils | If enabling or disabling idmapping for NFS using modprobe.d. |
| /etc/modprobe.d/nfsd.conf | nfs-utils | If enabling or disabling idmapping for NFS using modprobe.d. |
| /etc/systemd/network/10-interface-dynamic.network | (base) | Example of a SystemD NetworkD DHCP connection. |
| /etc/systemd/network/20-interface-static.network | (base) | Example of a SystemD NetworkD static connection. |
/etc/nbd-server/config |
nbd | Not tested. Enable and start systemctl enable nbd and systemctl start nbd. |
| /etc/nftables.conf | nftables | In nftables, allow TFTP, NFS, SSH, packages from/to WAN/LAN, and masquerade WAN. |
| /etc/nfs.conf | nfs-utils | All settings commented out for nfs.conf. |
| /etc/resolvconf.conf | (base) | Assign the local network DNS. |
| /etc/nsswitch | (base?) | Should not be necessary to configure. |
| /root/.ssh/sshd_config | openssh | Activate service, either systemctl enable sshd.service, which is appropriate for servers with high SSH traffic. |
| /etc/udev/rules.d/10-network.rules | (base) | Ensure that the device names are constant, that is, do not change after reboot. On computer with 2 Ethernet devices, booting with Archlinux 4.13.11-1-ARCH, the device names randomly switched between the devices, for example, on boot: dev 1 is eno1, dev 2 is eno2, after reboot: dev 1 became eno2, dev 2 became eno1. |
| /srv/tftp/netboot/grub/grub.cfg | grub | grub.cfg |
| setup | description |
|---|---|
| image | Install the OS on an image that is mounted on /srv/os and shared between clients. Changes are copied on write and are on end of session either discarded or saved at a different location. |
| directory | Install one OS on the server /srv/client_x for each served client. A shared OS without CoW (Copy on Write) that is written to by multiple clients causes corruption. |
| virtualized | Install the OS in a virtualized environment, for example, Qemu. |
| file | package | configure |
|---|---|---|
| ~/.ssh/config | openssh | Configure at least SSH server IP and Port. |
/boot/initramfs-linux.nfs.img |
mkinitcpio-nfs-utils | Configure /etc/mkinitcpio.netboot.nfs.conf as described in mkinitcpio nfs, and then rebuild mkinitcpio. |
| /etc/fstab | (base) | Declare the NFS root in the fstab. |
/etc/hostname |
(base) | The client hostname. |
| /etc/resolvconf.conf | (base) | Assign the local network DNS. |
Setup a VNC.
Expanded from the basic configuration.
Assuming
- deployment on a minimal, basic or simple plan, where
- the memory can be upgraded,
- storage can be added.
The storage is partione in three sections. The swap is stored as a file in order to expand and shrink it as needed.
sda
├─sda1
├─sda2 vfat FAT32 ESP abcd-ef01
└─sda4 ext4 1.0 data 01234567-89ab-cdef-0123-456789abcdef 10G 50% /
sdb
└─sdb1 ext4 1.0 data abcdef01-2345-6789-abcd-ef0123456789 40G 10% /
Install packages for VPS configuration:
-
dhcpcd(# systemctl enable dhcpcd) man-dbmcnanoncdunftablesopenresolvopensshpacman-contrib-
rsync(for useradmin)
- StackExchange Information Security NMAP - Closed vs Filtered
- StackExchange Unix & Linux Why are some ports reported by nmap filtered and not the others?
The result of a scan depends on the type of scan. Multiple options may be required for a conclusive result.
For example, a reported state of "filtered" indicates that nmap could not determine whether or not the port is open because packet filtering prevents its probes from reaching the port.
- Scan server for selected open ports
nmap <SERVER IP>. - Scan server for all open ports
nmap -p 0-65535 <SERVER IP>. - TCP SYN scan (
sS) server with root privilegas# nmap -sS <SERVER IP> - UDP scan (
sU) server with root privilegas for# nmap -sS <SERVER IP> - TCP ACK scan (
sA) server with root privilegas# nmap -sS <SERVER IP>
A SYN scan that results in "filtered", which can be because of a firewall.
- Attempt to determine the status of the port
nmap -sV <SERVER IP>ornmap -A <SERVER IP> - Attempt to bypass the firewall
nmap --tcp-flags SYN,FIN <SERVER IP>
Expanded from the basic configuration.
| file | package | configure |
|---|---|---|
| /etc/X11/xorg.conf.d/00-keyboard.conf | (xorg) | Configure input devices: keyboard. |
Careful, read all instructions before upgrade:
- System maintenance -- Upgrading the system (20171226)
- pacman -- Usage -- Upgrading packages (20171226)
- Sync packages (
-S), and update package database even if the local database is updated (-yy)# pacman -Syy. - Update Arch Linux key ring
# pacman -Sy archlinux-keyring. - Execute system wide upgrade
# pacman -Syu.
If Linux boot depends on a custom initramfs image, then manually update the mkinitcpio accordingly before restarting the system after system upgrade.
- Ensure that resulting image file is readable
chmod +r - portable.conf
- nfs.conf
Observed from 4.14.15-1-ARCH upgrade 4.15.9-1-ARCH to 4.17.2-1-ARCH. The System clock synchronized and systemd-timesyncd.service active is set to no.
$ timedatectl status
Local time: Tue 2018-07-03 23:28:44 UTC
Universal time: Tue 2018-07-03 23:28:44 UTC
RTC time: Tue 2018-07-03 23:28:44
Time zone: UTC (UTC, +0000)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: no
Re-adjust the system clock # timedatectl set-ntp true.
If problems occur at the boot up stage then add the arguments debug amd ignore_loglevel to the linux parameter in grub.cfg.
| Event | Error | Cause | Consequence | Remedy |
|---|---|---|---|---|
pacman -S <package> |
[package]: signature from "[developer] <developer>" is unknown trust |
Update archlinux certificates # pacman -Sy archlinux-keyring. |
||
pacman -S <package> |
error: lib__: signature from "Author <[email protected]>" is unknown truestFIile /var/cache/pacman/pkg/lib__.pkg.tar.xz is corrupted (invalid or corrupted package (PGP signature))
|
Update archlinux certificates # pacman -Sy archlinux-keyring. |
||
pacman -S <package> |
error: failed to init transaction (unable to lock database)error: could not lock database: File existsif you're sure a package manager is not already running, you can remove /var/lib/pacman/db.lck
|
Remove file rm /var/lib/pacman/db.lck. |
||
pacman -Syu |
Failed to sync all databases (unable to lock database) |
Database corruption or failure to close the database. For example, due to power failure during system update. | Cannot resume update | rm /var/lib/pacman/db.lck |
checking keys in keyringdownloading required keys...
|
error: key "CEB167EFB5722BD6" could not be looked up remotelyerror: required key missing from keyringerror: failed to commit transaction (unexpected error)Errors occurred, no packages were upgraded.
|
Update archlinux certificates # pacman -Sy archlinux-keyring. |
||
pacman |
pacman error: duplicated database entry ... |
Two or more packages are stored in /var/lib/pacman/local/
|
Remove the older packages rm -r /var/lib/pacman/local/<PACKAGE>
|
|
pacman |
<PACKADE> ... exist on filesystem |
pacman -S --overwrite \* <PACKAGE NAME> |
||
Pacman |
error: failed to commit transaction (conflicting files) |
Errors occurred, no packages were upgraded. |
"Failed to commit transaction (conflicting files)" error |