ARCHINSTALL(1)

NAME
archinstall - archinstall Documentation
archinstall is library which can be used to install Arch Linux.
The library comes packaged with different pre-configured installers, such as the default Guided installation installer.
A demo of the Guided installation installer can be seen here: https://www.youtube.com/watch?v=9Xt7X_Iqg6E.

Some of the features of Archinstall are:

•   Context friendly. The library always executes calls in sequential order to ensure installation-steps don't overlap or execute in the wrong order. It also supports (and uses) context wrappers to ensure cleanup and final tasks such as mkinitcpio are called when needed.

•   Full transparency Logs and insights can be found at /var/log/archinstall both in the live ISO and partially on the installed system.

•   Accessibility friendly Archinstall works with espeakup and other accessibility tools thanks to the use of a TUI.

GUIDED INSTALLATION

Archinstall ships with a pre-programmed Guided Installer guiding you through the mandatory steps as well as some optional configurations that can be done.

NOTE: Other pre-programmed scripts can be invoked by executing archinstall <script> (without .py). To see a complete list of scripts, run archinstall --script list or check the source code scripts directory.

NOTE: It's recommended to run archinstall from the official Arch Linux ISO.

WARNING: The installer will not configure WiFi before the installation begins. You need to read up on Arch Linux networking before you continue.

  Running the guided installation

To start the installer, run the following in the latest Arch Linux ISO:

archinstall

Since the Guided Installer is the default script, this is the equvilant of running archinstall guided

The guided installation also supports installing with pre-configured answers to all the guided steps. This can be a quick and convenient way to re-run one or several installations.

There are two configuration files, both are optional.

  --config

This parameter takes a local or remote .json file as argument and contains the overall configuration and menu answers for the guided installer.

NOTE: You can always get the latest options for this file with archinstall --dry-run, this executes the guided installer in a safe mode where no permanent actions will be taken on your system but simulate a run and save the configuration to disk.

  Example usage

archinstall --config https://domain.lan/config.json

The contents of https://domain.lan/config.json:

{
    "__separator__": null,
    "additional-repositories": [],
    "archinstall-language": "English",
    "audio_config": null,
    "bootloader": "Systemd-boot",
    "config_version": "2.6.0",
    "debug": false,
    "disk_config": {
        "config_type": "manual_partitioning",
        "device_modifications": [
            {
                "device": "/dev/sda",
                "partitions": [
                    {
                        "btrfs": [],
                        "flags": [
                            "Boot"
                        ],
                        "fs_type": "fat32",
                        "length": {
                            "sector_size": null,
                            "total_size": null,
                            "unit": "B",
                            "value": 99982592
                        },
                        "mount_options": [],
                        "mountpoint": "/boot",
                        "obj_id": "369f31a8-2781-4d6b-96e7-75680552b7c9",
                        "start": {
                            "sector_size": {
                                "sector_size": null,
                                "total_size": null,
                                "unit": "B",
                                "value": 512
                            },
                            "total_size": null,
                            "unit": "sectors",
                            "value": 34
                        },
                        "status": "create",
                        "type": "primary"
                    },
                    {
                        "btrfs": [],
                        "flags": [],
                        "fs_type": "fat32",
                        "length": {
                            "sector_size": null,
                            "total_size": null,
                            "unit": "B",
                            "value": 100000000
                        },
                        "mount_options": [],
                        "mountpoint": "/efi",
                        "obj_id": "13cf2c96-8b0f-4ade-abaa-c530be589aad",
                        "start": {
                            "sector_size": {
                                "sector_size": null,
                                "total_size": null,
                                "unit": "B",
                                "value": 512
                            },
                            "total_size": {
                                "sector_size": null,
                                "total_size": null,
                                "unit": "B",
                                "value": 16106127360
                            },
                            "unit": "MB",
                            "value": 100
                        },
                        "status": "create",
                        "type": "primary"
                    },
                    {
                        "btrfs": [],
                        "flags": [],
                        "fs_type": "ext4",
                        "length": {
                            "sector_size": null,
                            "total_size": null,
                            "unit": "B",
                            "value": 15805127360
                        },
                        "mount_options": [],
                        "mountpoint": "/",
                        "obj_id": "3e75d045-21a4-429d-897e-8ec19a006e8b",
                        "start": {
                            "sector_size": {
                                "sector_size": null,
                                "total_size": null,
                                "unit": "B",
                                "value": 512
                            },
                            "total_size": {
                                "sector_size": null,
                                "total_size": null,
                                "unit": "B",
                                "value": 16106127360
                            },
                            "unit": "MB",
                            "value": 301
                        },
                        "status": "create",
                        "type": "primary"
                    }
                ],
                "wipe": false
            }
        ]
    },
    "disk_encryption": {
        "encryption_type": "luks",
        "partitions": [
            "3e75d045-21a4-429d-897e-8ec19a006e8b"
        ]
    },
    "hostname": "archlinux",
    "kernels": [
        "linux"
    ],
    "locale_config": {
        "kb_layout": "us",
        "sys_enc": "UTF-8",
        "sys_lang": "en_US"
    },
    "mirror_config": {
        "custom_mirrors": [],
        "mirror_regions": {
            "Sweden": [
                "https://mirror.osbeck.com/archlinux/$repo/os/$arch",
                "https://mirror.bahnhof.net/pub/archlinux/$repo/os/$arch",
                "https://ftp.myrveln.se/pub/linux/archlinux/$repo/os/$arch",
                "https://ftp.lysator.liu.se/pub/archlinux/$repo/os/$arch",
                "https://ftp.ludd.ltu.se/mirrors/archlinux/$repo/os/$arch",
                "https://ftp.acc.umu.se/mirror/archlinux/$repo/os/$arch",
                "http://mirror.bahnhof.net/pub/archlinux/$repo/os/$arch",
                "http://ftpmirror.infania.net/mirror/archlinux/$repo/os/$arch",
                "http://ftp.myrveln.se/pub/linux/archlinux/$repo/os/$arch",
                "http://ftp.lysator.liu.se/pub/archlinux/$repo/os/$arch",
                "http://ftp.acc.umu.se/mirror/archlinux/$repo/os/$arch"
            ]
        }
    },
    "network_config": {},
    "no_pkg_lookups": false,
    "ntp": true,
    "offline": false,
    "packages": [],
    "parallel downloads": 0,
    "profile_config": null,
    "save_config": null,
    "script": "guided",
    "silent": false,
    "swap": true,
    "timezone": "UTC",
    "version": "2.6.0"
}

  --config options

WARNING: All key and value entries must conform to the JSON standard. Below is human readable examples with links, effectively breaking the syntax. Adapt the descriptions below to suit your needs and the JSON format.

NOTE: Scroll to the right in the table to see required options.

  JSON options
Key | Value(s) | Description | Required
additional-repositories | [ multilib, testing ] | Enables one or more of the testing and multilib repositories before proceeding with installation | No
archinstall-language | lang | Sets the TUI language used (make sure to use the ``lang`` value not the ``abbr``) | No
audio_config | pipewire, pulseaudio | Audioserver to be installed | No
bootloader | Systemd-boot, grub | Bootloader to be installed (grub being mandatory on BIOS machines) | Yes
debug | true, false | Enables debug output | No
disk_config | Read more under Disk Configuration | Contains the desired disk setup to be used during installation | No
disk_encryption | Read more about under Disk Encryption | Parameters for disk encryption applied ontop of disk_config | No
hostname | str | A string definining your machines hostname on the network (defaults to ``archinstall``) | No
kernels | [ linux, linux-hardened, linux-lts, linux-rt, linux-rt-lts, linux-zen ] | Defines which kernels should be installed and setup in the boot loader options | Yes
custom-commands | Read more under Custom Commands | Custom commands that will be run post-install chrooted inside the installed system | No
locale_config | {kb_layout: lang, sys_enc: Character encoding, sys_lang: locale} | Defines the keyboard key map, system encoding and system locale | No
mirror_config | {custom_mirrors: [ https://... ], mirror_regions: { "Worldwide": [ "https://geo.mirror.pkgbuild.com/$repo/os/$arch" ] } } | Sets various mirrors (defaults to ISO's ``/etc/pacman.d/mirrors`` if not defined) | No
network_config | `see options under Network Configuration` | Sets which type of (if any) network configuration should be used | No
no_pkg_lookups | true, false | Disabled package checking against https://archlinux.org/packages/ | No
ntp | true, false | enables or disables NTP during installation | No
offline | true, false | enables or disables certain online checks such as mirror reachability etc | No
packages | [ <package1>, <package2>, ... ] | A list of packages to install during installation | No
parallel downloads | 0-∞ | sets a given number of paralell downloads to be used by pacman | No
profile_config | `read more under the profiles section` | Installs a given profile if defined | No
script | guided (default), minimal, only_hdd, swiss, unattended | When used to autorun an installation, this sets which script to autorun with | No
silent | true, false | disables or enables user questions using the TUI | No
swap | true, false | enables or disables swap | No
timezone | timezone | sets a timezone for the installed system | No

NOTE: If no entries are found in disk_config, archinstall guided installation will use whatever is mounted currently under /mnt/archinstall without performing any disk operations.

  Options for --creds
Creds is a separate configuration file to separate normal options from more sensitive data like passwords.
Below is an example of how to set the root password and below that are description of other values that can be set.

{
    "!root-password" : "SecretSanta2022"
}

  --creds options
Key | Values | Description | Required
!encryption-password | str | Password to encrypt disk, not encrypted if password not provided | No
!root-password | str | The root account password | No
!users | { "username": "<USERNAME>", "!password": "<PASSWORD>", "sudo": false } | List of regular user credentials, see configuration for reference | Maybe

NOTE: !users is optional only if !root-password was set. !users will be enforced otherwise and the minimum amount of users with sudo privileges required will be set to 1.

NOTE: The key's start with ! because internal log functions will mask any keys starting with explamation from logs and unrestricted configurations.

KNOWN ISSUES
Some issues are out of the archinstall projects scope, and the ones we know of are listed below.

  Waiting for time sync #2144
The usual root cause of this is the network topology.
More specifically timedatectl show cannot perform a proper time sync against the default servers.

A "fix" for this is mentioned in the issue above.
That is to configure /etc/systemd/timesyncd.conf and restart systemd-timesyncd.service.

NOTE: A proposal to override the time sync check has been put up for discussion in #2144.

  Missing Nvidia Proprietary Driver #2002
In some instances, the nvidia driver might not have all the nessecary packages installed.
This is due to the kernel selection and/or hardware setups requiring additional packages to work properly.

A common workaround is to install the package linux-headers and nvidia-dkms

  ARM, 32bit and other CPU types error out #1686, #2185
This is a bit of a catch-all known issue.
Officially x86_64 is only supported by Arch Linux.
Hence little effort have been put into supporting other platforms.

In theory, other architectures should work but small quirks might arise.

PR's are welcome but please be respectful of the delays in merging.
Other fixes, issues or features will be prioritized for the above reasons.

  Keyring is out of date #2213
Missing key-issues tend to be that the archlinux-keyring package is out of date, usually as a result of an outdated ISO.
There is an attempt from upstream to fix this issue, and it's the archlinux-keyring-wkd-sync.service

The service starts almost immediately during boot, and if network is not configured in time — the service will fail.
Subsequently the archinstall run might operate on a old keyring despite there being an update service for this.

There is really no way to reliably over time work around this issue in archinstall.
Instead, efforts to the upstream service should be considered the way forward. And/or keys not expiring betwene a sane ammount of ISO's.

NOTE: The issue can happen on new ISO's too even as little as a few days after release, as some keys might expire right after the keyring is "burnt in" to the ISO.

NOTE: Another common issue relating to the network not being configured, is that time might not be set correctly - resulting in the keyring not being able to update. See Waiting for time sync #2144.

  AUR packages
This is also a catch-all issue.
AUR is unsupported, and until that changes we cannot use AUR packages to solve feature requests in archinstall.

This means that feature requests like supporting filesystems such as ZFS can not be added, and issues cannot be solved by using AUR packages either.

NOTE: But in spirit of giving the community options, archinstall supports Python Plugins, which means you can run archinstall --plugin <url> and source an AUR plugin.

torxed/archinstall-aur is a reference implementation for plugins:

# archinstall --plugin https://archlinux.life/aur-plugin

phisch/archinstall-aur is another alternative:

# archinstall --plugin https://raw.githubusercontent.com/phisch/archinstall-aur/master/archinstall-aur.py

WARNING: This will allow for unsupported usage of AUR during installation.

REPORT ISSUES & BUGS

Issues and bugs should be reported over at https://github.com/archlinux/archinstall/issues.

General questions, enhancements and security issues can be reported over there too. For quick issues or if you need help, head over to the Discord server which has a help channel.

  Log files
When submitting a help ticket, please include the /var/log/archinstall/install.log.
It can be found both on the live ISO but also in the installed filesystem if the base packages were strapped in.

TIP:
An easy way to submit logs is curl -F'file=@/var/log/archinstall/install.log' https://0x0.st.
Use caution when submitting other log files, but archinstall pledges to keep install.log safe for posting publicly!

There are additional log files under /var/log/archinstall/ that can be useful:

•   /var/log/archinstall/user_configuration.json - Stores most of the guided answers in the installer

•   /var/log/archinstall/user_credentials.json - Stores any usernames or passwords, can be passed to --creds

•   /var/log/archinstall/user_disk_layouts.json - Stores the chosen disks and their layouts

•   /var/log/archinstall/install.log - A log file over what steps were taken by archinstall

•   /var/log/archinstall/cmd_history.txt - A complete command history, command by command in order

•   /var/log/archinstall/cmd_output.txt - A raw output from all the commands that were executed by archinstall

    WARNING: We only try to guarantee that /var/log/archinstall/install.log is free from sensitive information. Any other log file should be pasted with utmost care!

DISCORD

There's a discord channel which is frequented by some contributors.
To join the server, head over to https://discord.gg/cqXU88y and join in.
There's not many rules other than common sense and to treat others with respect. The general chat is for off-topic things as well.

There's the @Party Animals role if you want notifications of new releases which is posted in the #Release Party channel. Another thing is the @Contributors role can be activated by contributors by writing !verify and follow the verification process.

Hop in, we hope to see you there! : )

PYTHON LIBRARY

Archinstall ships on PyPi as archinstall. But the library can be installed manually as well.

WARNING: These steps are not required if you want to use archinstall on the official Arch Linux ISO.

  Installing with pacman

Archinstall is on the official repositories. And it will also install archinstall as a python library.

To install both the library and the archinstall script:

pacman -S archinstall

Alternatively, you can install only the library and not the helper executable using the python-archinstall package.

  Installing with PyPi

The basic concept of PyPi applies using pip.

pip install archinstall

  Install using source code
You can also install using the source code.
For sake of simplicity we will use git clone in this example.

git clone https://github.com/archlinux/archinstall

You can either move the folder into your project and simply do

import archinstall

Or you can PyPa's build and installer to install it into pythons module path.

$ cd archinstall
$ python -m build .
$ python -m installer dist/*.whl

PYTHON MODULE

Archinstall supports running in module mode. The way the library is invoked in module mode is limited to executing scripts under the scripts folder.

It's therefore important to place any script or profile you wish to invoke in the examples folder prior to building and installing.

  Pre-requisites

We'll assume you've followed the Install using source code method. Before actually installing the library, you will need to place your custom installer-scripts under scripts as a python file.

More on how you create these in the next section.

WARNING: This is subject to change in the future as this method is currently a bit stiff. The script path will become a parameter. But for now, this is by design.

  Creating a script

Lets create a test_installer - installer as an example. This is assuming that the folder ./archinstall is a git-clone of the main repo. We begin by creating "scripts/test_installer.py". The placement here is important later.

This script can now already be called using python -m archinstall test_installer after a successful installation of the library itself. But the script won't do much. So we'll do something simple like list all the hard drives as an example.

To do this, we'll begin by importing archinstall in our "scripts/test_installer.py" and call a function whtin archinstall.

import archinstall
print(archinstall.disk.device_handler.devices)

Now, go ahead and reference the Install using source code installation method. After runnig python -m archinstall test_installer it should print something that looks like:

[
    BDevice(
        disk=<parted.disk.Disk object at 0x7fbe17156050>,
        device_info=_DeviceInfo(
            model='PC801 NVMe SK hynix 512GB',
            path=PosixPath('/dev/nvme0n1'),
            type='nvme',
            total_size=Size(value=512110190592, unit=<Unit.B: 1>,
            sector_size=SectorSize(value=512, unit=<Unit.B: 1>)),
            free_space_regions=[
                <archinstall.lib.disk.device_model.DeviceGeometry object at 0x7fbe166c4250>,
                <archinstall.lib.disk.device_model.DeviceGeometry object at 0x7fbe166c4c50>,
                <archinstall.lib.disk.device_model.DeviceGeometry object at 0x7fbe166c4a10>],
            sector_size=SectorSize(value=512, unit=<Unit.B: 1>),
            read_only=False,
            dirty=False
        ),
        partition_infos=[
            _PartitionInfo(
                partition=<parted.partition.Partition object at 0x7fbe166c4a90>,
                name='primary',
                type=<PartitionType.Primary: 'primary'>,
                fs_type=<FilesystemType.Fat32: 'fat32'>,
                path='/dev/nvme0n1p1',
                start=Size(value=2048, unit=<Unit.sectors: 'sectors'>, sector_size=SectorSize(value=512, unit=<Unit.B: 1>)),
                length=Size(value=535822336, unit=<Unit.B: 1>, sector_size=SectorSize(value=512, unit=<Unit.B: 1>)),
                flags=[
                    <PartitionFlag.Boot: 1>,
                    <PartitionFlag.ESP: 18>
                ],
                partn=1,
                partuuid='a26be943-c193-41f4-9930-9341cf5f6b19',
                uuid='6EE9-2C00',
                disk=<parted.disk.Disk object at 0x7fbe17156050>,
                mountpoints=[
                    PosixPath('/boot')
                ],
                btrfs_subvol_infos=[]
            ),
            _PartitionInfo(...)
        ]
    )
]

That means your script is in the right place, and archinstall is working as intended.

NOTE: Most calls, including the one above requires root privileges.

PYTHON PLUGINS

archinstall supports plugins via two methods.

First method is directly via the --plugin parameter when running as a CLI tool. This will load a specific plugin locally or remotely via a path.

The second method is via Python's built in plugin discovery using entry points categorized as archinstall.plugin.

  --plugin parameter

The parameter has the benefit of being stored in the --conf state, meaning when re-running an installation — the plugin will automatically be loaded. It's limitation is that it requires an initial path to be known and written and be cumbersome.

  Plugin Discovery

This method allows for multiple plugins to be loaded with the drawback that they have to be installed beforehand on the system running archinstall. This mainly targets those who build their own ISO's and package specific setups for their needs.

  What's supported?

Currently the documentation for this is scarse. Until that is resolved, the best way to find supported features is to search the source code for plugin.on_ as this will give a clear indication of which calls are made to plugins.

  How does it work?

archinstall plugins use a discovery-driven approach where plugins are queried for certain functions. As an example, if a plugin has the following function:

def on_pacstrap(*packages):
    ...

The function archinstall.Pacman().strap(["some packages"]) is hardcoded to iterate plugins and look for on_pacstrap in the plugin. If the function exists, .strap() will call the plugin's function and replace the initial package list with the result from the plugin.

The best way to document these calls is currently undecided, as it's hard to document this behavior dynamically.

  Writing your own?

The simplest way currently is to look at a reference implementation or the community. Two of these are:

•   torxed/archinstall-aur

•   phisch/archinstall-aur

    And search for plugin.on_ in the code base to find what archinstall will look for. PR's are welcome to widen the support for this.

ARCHINSTALL.INSTALLER

The installer is the main class for accessing an installation-instance. You can look at this class as the installation you have or will perform.

Anything related to inside the installation, will be found in this class.

AUTHOR
Anton Hvornum

COPYRIGHT
2023, Anton Hvornum