Install Arch Linux from existing Linux: Difference between revisions

From ArchWiki
(update old (projects|git).archlinux.org links)
(change Arch project URLs from github.com to gitlab.archlinux.org)
 
(25 intermediate revisions by 13 users not shown)
Line 3: Line 3:
[[es:Install Arch Linux from existing Linux]]
[[es:Install Arch Linux from existing Linux]]
[[fr:Install Arch Linux from existing Linux]]
[[fr:Install Arch Linux from existing Linux]]
[[it:Install Arch Linux from existing Linux]]
[[ja:既存の Linux からインストール]]
[[ja:既存の Linux からインストール]]
[[pt:Install Arch Linux from existing Linux]]
[[pt:Install Arch Linux from existing Linux]]
Line 9: Line 8:
[[zh-hans:Install Arch Linux from existing Linux]]
[[zh-hans:Install Arch Linux from existing Linux]]
{{Related articles start}}
{{Related articles start}}
{{Related|Install from SSH}}
{{Related|Install Arch Linux via SSH}}
{{Related articles end}}
{{Related articles end}}


Line 29: Line 28:
{{Note|This guide requires that the existing host system be able to execute the new target Arch Linux architecture programs. This means it has to be an x86_64 host.}}
{{Note|This guide requires that the existing host system be able to execute the new target Arch Linux architecture programs. This means it has to be an x86_64 host.}}


{{Warning|Please make sure you understand each step before proceeding. It is easy to destroy your system or to lose critical data, and your service provider will likely charge a lot to help you recover. }}
{{Warning|Please make sure you understand each step before proceeding. It is easy to destroy your system or to lose data!}}


== Backup and preparation ==
== Backup and preparation ==
Line 73: Line 72:
Then, follow the procedure described in [[Installation guide#Configure the system]] with some caveats and additional steps:
Then, follow the procedure described in [[Installation guide#Configure the system]] with some caveats and additional steps:


* [[Installation guide#Time zone]], [[Installation guide#Localization]] and [[Installation guide#Root password]] can be skipped
* [[Installation guide#Time]], [[Installation guide#Localization]] and [[Installation guide#Root password]] can be skipped
* [[Installation guide#Initramfs]] may be required in particular if changing filesystem, for example from [[ext4]] to [[Btrfs]]
* [[Installation guide#Initramfs]] may be required in particular if changing filesystem, for example from [[ext4]] to [[Btrfs]]
* Regarding [[Installation guide#Boot loader]], it is necessary to reinstall the bootloader
* Regarding [[Installation guide#Boot loader]], it is necessary to reinstall the bootloader
* Delete {{ic|/etc/machine-id}} so that a new, unique one, is generated at the next boot
* Delete {{ic|/etc/machine-id}} and create a new one with {{ic|systemd-machine-id-setup}}


If the mirrored Arch installation may be used within a different configuration or with another hardware, consider the following additional operations:
If the mirrored Arch installation may be used within a different configuration or with another hardware, consider the following additional operations:
Line 88: Line 87:
There are multiple tools which automate a large part of the steps described in the following subsections. See their respective homepages for detailed instructions.
There are multiple tools which automate a large part of the steps described in the following subsections. See their respective homepages for detailed instructions.


* [https://github.com/tokland/arch-bootstrap arch-bootstrap] (Bash)
* [https://github.com/wick3dr0se/archstrap archstrap] (Bash)
* [https://github.com/gh2o/digitalocean-debian-to-arch digitalocean-debian-to-arch] (repartition disk, DigitalOcean specific)
* [https://github.com/gh2o/digitalocean-debian-to-arch digitalocean-debian-to-arch] (repartition disk, DigitalOcean specific)
* [https://github.com/hartwork/image-bootstrap image-bootstrap] (Python)
* [https://github.com/hartwork/image-bootstrap image-bootstrap] (Python)
* [https://gitlab.com/drizzt/vps2arch vps2arch] (Bash)
* [https://gitlab.com/drizzt/vps2arch vps2arch] (Bash)
* [https://github.com/BiteDasher/archbashstrap archbashstrap] (Bash)


The manual way is presented in the following subsections. The idea is to either get [[pacman]] working directly on the host system, or to run an Arch system inside the host system, with the actual installation being executed from the Arch system. The nested system is contained inside a chroot.
The manual way is presented in the following subsections. The idea is to either get [[pacman]] working directly on the host system, or to run an Arch system inside the host system, with the actual installation being executed from the Arch system. The nested system is contained inside a chroot.
Line 98: Line 96:
=== Using pacman from the host system ===
=== Using pacman from the host system ===


[https://gitlab.archlinux.org/pacman/pacman Pacman] can be compiled on most Linux distributions, and used directly on the host system to bootstrap Arch Linux. The [https://github.com/archlinux/arch-install-scripts arch-install-scripts] should run without issues directly from the downloaded sources on any recent distribution.
[https://gitlab.archlinux.org/pacman/pacman Pacman] can be compiled on most Linux distributions, and used directly on the host system to bootstrap Arch Linux. The [https://gitlab.archlinux.org/archlinux/arch-install-scripts arch-install-scripts] should run without issues directly from the downloaded sources on any recent distribution.


Some distributions provide a package for ''pacman'' and/or ''arch-install-scripts'' in their official repositories which can be used for this purpose. As of July 2020, Void Linux is known to provide the ''pacman'' package, and Alpine Linux and Fedora are known to provide both ''pacman'' and ''arch-install-scripts''.
Some distributions provide a package for ''pacman'' and/or ''arch-install-scripts'' in their official repositories which can be used for this purpose. As of July 2020, Void Linux is known to provide the ''pacman'' package, and Alpine Linux and Fedora are known to provide both ''pacman'' and ''arch-install-scripts''.
Line 106: Line 104:
Two methods to setup and enter the chroot are presented below, from the easiest to the most complicated. Select only one of the two methods. Then, continue at [[#Using a chroot environment]].
Two methods to setup and enter the chroot are presented below, from the easiest to the most complicated. Select only one of the two methods. Then, continue at [[#Using a chroot environment]].


==== Method A: Using the bootstrap image (recommended) ====
==== Method A: Using the bootstrap tarball (recommended) ====


Download the bootstrap image from a [https://archlinux.org/download mirror] into {{ic|/tmp}}. You can also download the signature (same URL with {{ic|.sig}} added) and [[GnuPG#Verify_a_signature|verify it with GnuPG]].
Download the bootstrap tarball from a [https://archlinux.org/download mirror] into {{ic|/tmp/}}.
 
Download the bootstrap tarball signature from [https://archlinux.org/download/#checksums the download page] and place it in the same directory. Do not download it from a mirror.
 
[[GnuPG#Verify a signature|Verify the signature with GnuPG]].


Extract the tarball:
Extract the tarball:


  # tar xzf <path-to-bootstrap-image>/archlinux-bootstrap-*-x86_64.tar.gz
  # tar xzf ''/path-to-bootstrap-image''/archlinux-bootstrap-x86_64.tar.gz --numeric-owner
 
Take note of the final {{ic|--numeric-owner}} option, which is important for preserving correct UID and GID numbers of extracted files in case your existing Linux system uses different numbers than Arch Linux.


Select a repository server by editing {{ic|/tmp/root.x86_64/etc/pacman.d/mirrorlist}}.
Select a repository server by editing {{ic|/tmp/root.x86_64/etc/pacman.d/mirrorlist}}.


Enter the chroot:
Enter the chroot:
* If bash 4 or later is installed, and ''unshare'' supports the {{ic|--fork}} and {{ic|--pid}} options: {{bc|# /tmp/root.x86_64/bin/arch-chroot /tmp/root.x86_64/}}
* If bash 4 or later is installed, and ''unshare'' supports the {{ic|--fork}} and {{ic|--pid}} options: {{bc|# /tmp/root.x86_64/bin/arch-chroot /tmp/root.x86_64/}}
* Otherwise, run the following commands: {{bc|<nowiki>
* Otherwise, run the following commands:
 
:{{bc|<nowiki>
# mount --bind /tmp/root.x86_64 /tmp/root.x86_64
# mount --bind /tmp/root.x86_64 /tmp/root.x86_64
# cd /tmp/root.x86_64
# cd /tmp/root.x86_64
Line 162: Line 169:
==== Initializing pacman keyring ====
==== Initializing pacman keyring ====


Before starting the installation, pacman keys need to be setup. Before running the following two commands, read [[pacman-key#Initializing the keyring]] to understand the entropy requirements:
Before starting the installation, pacman keys need to be setup. Run the following commands:


  # pacman-key --init
  # pacman-key --init
  # pacman-key --populate archlinux
  # pacman-key --populate


{{Tip|If you need to run {{ic|pacman-key --init}} on a computer that does not generate much entropy (e.g. a headless server), key generation may take a very long time. To generate pseudo-entropy, install either [[haveged]] or [[rng-tools]] '''on the host system''' and start the corresponding service before running {{ic|pacman-key --init}}. (Installing these services on the target system instead will not work, since ''systemd'' will [https://superuser.com/questions/688733/start-a-systemd-service-inside-chroot refuse to start services from a chroot] and you need to initialize the pacman keyring prior to installing any packages anyway.)
See [[pacman/Package signing#Initializing the keyring]] for details.


If you prefer generating entropy through system activity and decide to run {{ic|ls -Ra /}} in another console (TTY, terminal, SSH session...), do not be afraid of running it in a loop a few times: five or six runs from the host proved sufficient to generate enough entropy on a remote headless server.
==== Downloading basic tools ====
}}


==== Downloading basic tools ====
[[Mirrors#Force pacman to refresh the package lists|Refresh the package lists]] and [[install]] what you need: {{Pkg|base-devel}}, {{Pkg|parted}} etc.


[[Mirrors#Force_pacman_to_refresh_the_package_lists|Refresh the package lists]] and [[install]] what you need: {{Grp|base-devel}}, {{Pkg|parted}} etc.
{{Style|This error is explained within {{man|8|arch-chroot|DESCRIPTION}}, it should be linked there.}}


{{Note|When you try to install packages with pacman, you might get {{ic|''error: could not determine cachedir mount point /var/cache/pacman/pkg''}}. To workaround it, run {{bc|mount --bind ''directory-to-livecd-or-bootstrap'' ''directory-to-livecd-or-bootstrap''}} before chrooting. See {{Bug|46169}}.}}
{{Note|When you try to install packages with pacman, you might get {{ic|''error: could not determine cachedir mount point /var/cache/pacman/pkg''}}. To workaround it, run {{bc|# mount --bind ''directory-to-livecd-or-bootstrap'' ''directory-to-livecd-or-bootstrap''}} before chrooting. See {{Bug|46169}}.}}


=== Installation tips ===
=== Installation tips ===


You can now proceed to [[Installation guide#Partition the disks]] and follow the rest of the [[Installation guide]].
You can now proceed to [[Installation guide#Mount the file systems]] and follow the rest of the [[Installation guide]].


Some host systems or configurations may require certain extra steps. See the sections below for tips.
Some host systems or configurations may require certain extra steps. See the sections below for tips.
Line 190: Line 196:
On some Debian-based host systems, ''pacstrap'' may produce the following error:
On some Debian-based host systems, ''pacstrap'' may produce the following error:


{{hc|# pacstrap /mnt base|
{{hc|# pacstrap -K /mnt base|
==> Creating install root at /mnt
==> Creating install root at /mnt
mount: mount point /mnt/dev/shm is a symbolic link to nowhere
mount: mount point /mnt/dev/shm is a symbolic link to nowhere
Line 204: Line 210:
While installing {{ic|archlinux-2015.07.01-x86_64}} from a Debian 7 host, the following error prevented both {{man|8|pacstrap}} and [[Change root#Using arch-chroot|arch-chroot]] from working:
While installing {{ic|archlinux-2015.07.01-x86_64}} from a Debian 7 host, the following error prevented both {{man|8|pacstrap}} and [[Change root#Using arch-chroot|arch-chroot]] from working:


{{hc|# pacstrap -i /mnt|
{{hc|# pacstrap -K -i /mnt|
mount: mount point /mnt/dev/pts does not exist
mount: mount point /mnt/dev/pts does not exist
==> ERROR: failed to setup chroot /mnt
==> ERROR: failed to setup chroot /mnt
Line 211: Line 217:
Apparently, this is because these two scripts use a common function. {{ic|chroot_setup()}}[https://github.com/archlinux/arch-install-scripts/tree/master/common#L76] relies on newer features of {{Pkg|util-linux}}, which are incompatible with Debian 7 userland (see {{Bug|45737}}).
Apparently, this is because these two scripts use a common function. {{ic|chroot_setup()}}[https://github.com/archlinux/arch-install-scripts/tree/master/common#L76] relies on newer features of {{Pkg|util-linux}}, which are incompatible with Debian 7 userland (see {{Bug|45737}}).


The solution for ''pacstrap'' is to manually execute its [https://github.com/archlinux/arch-install-scripts/tree/master/pacstrap.in#L77 various tasks], but use the [[Change root#Using_chroot|regular procedure]] to mount the kernel filesystems on the target directory ({{ic|"$newroot"}}):
The solution for ''pacstrap'' is to manually execute its [https://github.com/archlinux/arch-install-scripts/tree/master/pacstrap.in#L77 various tasks], but use the [[Change root#Using chroot|regular procedure]] to mount the kernel filesystems on the target directory ({{ic|"$newroot"}}):


  # newroot=/mnt
  # newroot=/mnt
Line 265: Line 271:


  use_lvmetad = 0
  use_lvmetad = 0
{{Accuracy|Is it the problem with LVM on Debian or with trying to install Arch on LVM?}}
{{Accuracy|Is it the problem with LVM on Debian or with trying to install Arch on LVM?}}
{{Style|poor style}}
{{Style|poor style}}
This will trigger later an error on boot in the initrd stage. Therefore, you have to change it back after the grub generation. In a software RAID + LVM, steps would be the following:
This will trigger later an error on boot in the initrd stage. Therefore, you have to change it back after the grub generation. In a software RAID + LVM, steps would be the following:



Latest revision as of 07:42, 16 March 2024

This document describes the bootstrapping process required to install Arch Linux from a running Linux host system. After bootstrapping, the installation proceeds as described in the Installation guide.

Installing Arch Linux from a running Linux is useful for:

The goal of the bootstrapping procedure is to setup an environment from which the scripts from arch-install-scripts (such as pacstrap and arch-chroot) can be run.

If the host system runs Arch Linux, this can be achieved by simply installing arch-install-scripts. If the host system runs another Linux distribution, you will first need to set up an Arch Linux-based chroot.

Note: This guide requires that the existing host system be able to execute the new target Arch Linux architecture programs. This means it has to be an x86_64 host.
Warning: Please make sure you understand each step before proceeding. It is easy to destroy your system or to lose data!

Backup and preparation

Backup all your data including mails, webservers, etc. Have all information at your fingertips. Preserve all your server configurations, hostnames, etc.

Here is a list of data you will likely need:

  • IP address
  • hostname(s), (note: rootserver are mostly also part of the providers domain, check or save your /etc/hosts before you delete)
  • DNS server (check /etc/resolv.conf)
  • SSH keys (if other people work on your server, they will have to accept new keys otherwise. This includes keys from your Apache, your mail servers, your SSH server and others.)
  • Hardware info (network card, etc. Refer to your pre-installed /etc/modules.conf )
  • Grub configuration files.

In general, it is a good idea to have a local copy of your original /etc directory on your local hard drive.

From a host running Arch Linux

Install the arch-install-scripts package.

Follow Installation guide#Mount the file systems to mount the filesystem that will be used for the root directory as well as all the other needed mount points. If you already use the /mnt directory for something else, just create another directory such as /mnt/install and use it as the mount point base for the rest of the installation.

At this stage, Arch Linux can either be installed from scratch or it can mirror the host installation. The two options are described thereafter.

Create a new Arch installation

Follow Installation guide#Installation.

In the procedure, the first step, Installation guide#Select the mirrors, can be skipped since the host should already have a correct mirrorlist.

Tip:
  • In order to avoid redownloading all the packages, consider following Pacman/Tips and tricks#Network shared pacman cache, or use pacstrap's -c option to use your host machine's package cache.
  • When the grub boot-loader is used, the grub-mkconfig may detect devices incorrectly. This will result in Error:no such device when trying to boot from the stick. To solve this problem, from the host running Arch Linux, mount the newly installed partitions, arch-chroot to the new partition, then install and configure grub. The last step may require disabling lvmetad from /etc/lvm/lvm.conf by setting use_lvmetad=0.

Create a copy of an existing Arch installation

It is possible to replicate an existing Arch Linux installation by copying the host filesystem to the new partition and make some adjustments to it to make it bootable and unique.

The first step is to copy the host files into the mounted new partition, for this, consider using the approach exhibited in rsync#Full system backup.

Then, follow the procedure described in Installation guide#Configure the system with some caveats and additional steps:

If the mirrored Arch installation may be used within a different configuration or with another hardware, consider the following additional operations:

From a host running another Linux distribution

There are multiple tools which automate a large part of the steps described in the following subsections. See their respective homepages for detailed instructions.

The manual way is presented in the following subsections. The idea is to either get pacman working directly on the host system, or to run an Arch system inside the host system, with the actual installation being executed from the Arch system. The nested system is contained inside a chroot.

Using pacman from the host system

Pacman can be compiled on most Linux distributions, and used directly on the host system to bootstrap Arch Linux. The arch-install-scripts should run without issues directly from the downloaded sources on any recent distribution.

Some distributions provide a package for pacman and/or arch-install-scripts in their official repositories which can be used for this purpose. As of July 2020, Void Linux is known to provide the pacman package, and Alpine Linux and Fedora are known to provide both pacman and arch-install-scripts.

Creating a chroot

Two methods to setup and enter the chroot are presented below, from the easiest to the most complicated. Select only one of the two methods. Then, continue at #Using a chroot environment.

Method A: Using the bootstrap tarball (recommended)

Download the bootstrap tarball from a mirror into /tmp/.

Download the bootstrap tarball signature from the download page and place it in the same directory. Do not download it from a mirror.

Verify the signature with GnuPG.

Extract the tarball:

# tar xzf /path-to-bootstrap-image/archlinux-bootstrap-x86_64.tar.gz --numeric-owner

Take note of the final --numeric-owner option, which is important for preserving correct UID and GID numbers of extracted files in case your existing Linux system uses different numbers than Arch Linux.

Select a repository server by editing /tmp/root.x86_64/etc/pacman.d/mirrorlist.

Enter the chroot:

  • If bash 4 or later is installed, and unshare supports the --fork and --pid options:
    # /tmp/root.x86_64/bin/arch-chroot /tmp/root.x86_64/
  • Otherwise, run the following commands:
# mount --bind /tmp/root.x86_64 /tmp/root.x86_64
# cd /tmp/root.x86_64
# cp /etc/resolv.conf etc
# mount -t proc /proc proc
# mount --make-rslave --rbind /sys sys
# mount --make-rslave --rbind /dev dev
# mount --make-rslave --rbind /run run    # (assuming /run exists on the system)
# chroot /tmp/root.x86_64 /bin/bash

Method B: Using the LiveCD image

It is possible to mount the root image of the latest Arch Linux installation media and then chroot into it. This method has the advantage of providing a working Arch Linux installation right within the host system without the need to prepare it by installing specific packages.

Note: Before proceeding, make sure the latest version of squashfs is installed on the host system. Otherwise, errors like the following are to be expected: FATAL ERROR aborting: uncompress_inode_table: failed to read block.

The root image can be found on one of the mirrors under iso/latest/arch/x86_64/. The squashfs format is not editable, so we unsquash the root image and mount it.

To unsquash the root image, run

# unsquashfs airootfs.sfs

Select a repository server by editing squashfs-root/etc/pacman.d/mirrorlist.

Before chrooting to the unsquashed root image, we need to set up some mount points and copy the resolv.conf for networking.

# mount --bind squashfs-root squashfs-root
# mount -t proc none squashfs-root/proc
# mount -t sysfs none squashfs-root/sys
# mount -o bind /dev squashfs-root/dev
# mount -o bind /dev/pts squashfs-root/dev/pts  ## important for pacman (for signature check)
# cp -L /etc/resolv.conf squashfs-root/etc  ## this is needed to use networking within the chroot

Now, everything is prepared to chroot into the newly installed Arch environment:

# chroot squashfs-root bash

Using a chroot environment

The bootstrap environment is really barebones (no nano or lvm2). Therefore, we need to set up pacman in order to download other necessary packages.

Initializing pacman keyring

Before starting the installation, pacman keys need to be setup. Run the following commands:

# pacman-key --init
# pacman-key --populate

See pacman/Package signing#Initializing the keyring for details.

Downloading basic tools

Refresh the package lists and install what you need: base-devel, parted etc.

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

Reason: This error is explained within arch-chroot(8) § DESCRIPTION, it should be linked there. (Discuss in Talk:Install Arch Linux from existing Linux)
Note: When you try to install packages with pacman, you might get error: could not determine cachedir mount point /var/cache/pacman/pkg. To workaround it, run
# mount --bind directory-to-livecd-or-bootstrap directory-to-livecd-or-bootstrap
before chrooting. See FS#46169.

Installation tips

You can now proceed to Installation guide#Mount the file systems and follow the rest of the Installation guide.

Some host systems or configurations may require certain extra steps. See the sections below for tips.

Debian-based host

/dev/shm

On some Debian-based host systems, pacstrap may produce the following error:

# pacstrap -K /mnt base
==> Creating install root at /mnt
mount: mount point /mnt/dev/shm is a symbolic link to nowhere
==> ERROR: failed to setup API filesystems in new root

This is because in some versions of Debian, /dev/shm points to /run/shm while in the Arch-based chroot, /run/shm does not exist and the link is broken. To correct this error, create a directory /run/shm:

# mkdir /run/shm
/dev/pts

While installing archlinux-2015.07.01-x86_64 from a Debian 7 host, the following error prevented both pacstrap(8) and arch-chroot from working:

# pacstrap -K -i /mnt
mount: mount point /mnt/dev/pts does not exist
==> ERROR: failed to setup chroot /mnt

Apparently, this is because these two scripts use a common function. chroot_setup()[1] relies on newer features of util-linux, which are incompatible with Debian 7 userland (see FS#45737).

The solution for pacstrap is to manually execute its various tasks, but use the regular procedure to mount the kernel filesystems on the target directory ("$newroot"):

# newroot=/mnt
# mkdir -m 0755 -p "$newroot"/var/{cache/pacman/pkg,lib/pacman,log} "$newroot"/{dev,run,etc}
# mkdir -m 1777 -p "$newroot"/tmp
# mkdir -m 0555 -p "$newroot"/{sys,proc}
# mount --bind "$newroot" "$newroot"
# mount -t proc /proc "$newroot/proc"
# mount --rbind /sys "$newroot/sys"
# mount --rbind /run "$newroot/run"
# mount --rbind /dev "$newroot/dev"
# pacman -r "$newroot" --cachedir="$newroot/var/cache/pacman/pkg" -Sy base base-devel ... ## add the packages you want
# cp -a /etc/pacman.d/gnupg "$newroot/etc/pacman.d/"       ## copy keyring
# cp -a /etc/pacman.d/mirrorlist "$newroot/etc/pacman.d/"  ## copy mirrorlist

Instead of using arch-chroot for Installation guide#Chroot, simply use:

# chroot "$newroot"
lvmetad

Trying to create LVM logical volumes from an archlinux-bootstrap-2015.07.01-x86_64 environment on a Debian 7 host resulted in the following error:

# lvcreate -L 20G lvm -n root
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /dev/lvm/root: not found: device not cleared
  Aborting. Failed to wipe start of new LV.

(Physical volume and volume group creation worked despite /run/lvm/lvmetad.socket: connect failed: No such file or directory being displayed.)

This could be easily worked around by creating the logical volumes outside the chroot (from the Debian host). They are then available once chrooted again.

The factual accuracy of this article or section is disputed.

Reason: This problem did not arise when installing from a Debian 7 host without lvmetad enabled. The recommended messaround with /etc/lvm/lvm.conf looks rather error prone (2015-07-26). (Discuss in Talk:Install Arch Linux from existing Linux)

Also, if the system you are using has lvm, you might have the following output:

# grub-install --target=i386-pc --recheck /dev/main/archroot
Installing for i386-pc platform.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.

This is because debian does not use lvmetad by default. You need to edit /etc/lvm/lvm.conf and set use_lvmetad to 0:

use_lvmetad = 0

The factual accuracy of this article or section is disputed.

Reason: Is it the problem with LVM on Debian or with trying to install Arch on LVM? (Discuss in Talk:Install Arch Linux from existing Linux)

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

Reason: poor style (Discuss in Talk:Install Arch Linux from existing Linux)

This will trigger later an error on boot in the initrd stage. Therefore, you have to change it back after the grub generation. In a software RAID + LVM, steps would be the following:

  • After installing the system, double check your Mkinitcpio and your bootloader settings. See Arch boot process#Boot loader for a list of bootloaders.
  • You may need to change your /etc/mdadm.conf to reflect your RAID settings (if applicable).
  • You may need to change your HOOKS and MODULES according to your LVM and RAID requirements: MODULES="dm_mod" HOOKS="base udev mdadm_udev ... block lvm2 filesystems ..."
  • You will most likely need to generate new initrd images with mkinitcpio. See Mkinitcpio#Image creation and activation.
  • Set use_lvmetad = 0 in /etc/lvm/lvm.conf.
  • Update your bootloader settings. See your bootloader's wiki page for details.
  • Set use_lvmetad = 1 in /etc/lvm/lvm.conf.

Fedora-based host

On Fedora based hosts and live USBs you may encounter problems when using genfstab to generate your fstab. Remove duplicate entries and the "seclabel" option where it appears, as this is Fedora-specific and will keep your system from booting normally.

Things to check before you reboot

Before rebooting, doublecheck a few details in your installation to achieve a successful installation. To do so, first chroot into the newly-installed system, and then:

  • create a user with password, so you can login via ssh. This is critical since root login is disabled by default since OpenSSH-7.1p2.
  • set a root password so that you can switch to root via su later
  • install a ssh solution and enable its server instance to start automatically at boot.
  • set up your network configuration in order to have a connection started automatically at boot.
  • set up a boot loader and configure it to use the swap partition you appropriated earlier as the root partition. You might want to configure your bootloader to be able to boot into your old system; it is helpful to re-use the server's existing /boot partition in the new system for this purpose.

Replacing the existing system without a LiveCD

Find ~700 MB of free space somewhere on the disk, e.g. by partitioning a swap partition. You can disable the swap partition and set up your system there.

Set old swap partition as new root partition

Check cfdisk, /proc/swaps or /etc/fstab to find your swap partition. Assuming your hard drive is located on sdaX (X will be a number).

Do the following:

Disable the swap space:

# swapoff /dev/sdaX

Create a filesystem on it

# fdisk /dev/sda
(set /dev/sdaX ID field to "Linux" - Hex 83)
# mke2fs -j /dev/sdaX

Create a directory to mount it in

# mkdir /mnt/newsys

Finally, mount the new directory for installing the intermediate system.

# mount -t ext4 /dev/sdaX /mnt/newsys

Installation

Install essentials packages and any other package required to get a system with internet connection up and running in the temporary partition, being careful with the limit of ~700 MB space. When specifying packages to be installed with pacstrap, consider adding the -c flag to avoid filling up valuable space by downloading packages to the host system.

Once the new Arch Linux system is installed, fix the bootloader configuration, then reboot into the newly created system, and rsync the entire system to the primary partition.