Difference between revisions of "Arch Linux"

From PrgmrWiki
m ({{u}})
(Explain enabling ipv6)
 
(42 intermediate revisions by 14 users not shown)
Line 1: Line 1:
Installing arch guide
+
The purpose of this document is to provide the minimum necessary information to get Arch up and reasonably secure.
I'm going to assume some familiarity and being comfortable in linux.
 
  
Thanks to the netbsd guide, for the inital help. The first couple steps will be repeat from that guide.
+
The Arch Wiki has a page devoted to [https://wiki.archlinux.org/index.php/Install_from_existing_Linux installing Arch Linux from within an existing Linux], which effectively describes the underlying steps being performed here. The following steps apply that process to a VM on prgmr.
  
Boot up your current install, and copy some information from it. I tossed it all into a text document for easy reference.
+
== Accessing the Management Console ==
  
Files i copied.
+
You need to access the Management Console for your VM. If you're not familiar with this, please see [[Management Console]]. The following instructions assume that you are NOT using the legacy console.
  
<pre>
+
== Boot from rescue image ==
/etc/fstab
 
/etc/network/interfaces (debian,dont use cent)
 
/etc/resolv.conf
 
Output of ifconfig for eth0.
 
</pre>
 
Those should be the core items. Reboot your vps, and select the CentOS rescue image.
 
 
 
If you don't change the partition skip to the mkfs part.
 
  
Repartition the hard drive if you want. I left it as is, but do as you please. (note I'm assuming you know fdisk)
+
The install will be performed from a Rescue image. This is equivalent to booting off a Rescue CD or USB stick, except the process is fully remote. We must configure the VM to boot off the Rescue image, which we will use as a starting point for installing Arch into the VM disk. For more information, see [[accessing your guest from the rescue image]]. After install has completed, the VM will be switched back to booting directly from its main disk which contains the new Arch installation.
  
Once your partitioning is done and written. Format the drives, CentOS only comes with ext2/3 so that will be the file system.
+
=== Shut down the machine ===
  
 +
Check if the machine is currently running by looking at the <code>Current status</code> at the top of the Management Console's main menu. If it's currently running, it needs to be shut down. You may use option 4 in the main menu to force it to power off. It's about to be reformatted so a clean shutdown isn't really necessary.
 
<pre>
 
<pre>
/sbin/mkfs.ext3 /dev/xvda*
+
4. force power off (destroy/hard shutdown)
 
</pre>
 
</pre>
  
Do this for each of your partitions.
+
=== Switch to rescue mode ===
 
 
Mount the selected drives, this will vary based on your partition scheme.
 
 
 
Note /mnt is the new root system, so when i refer to root directory it will be /mnt
 
  
 +
Now that the machine is shut down, you should configure its bootloader to use the rescue image. For example, from the main menu the options would be something like this:
 
<pre>
 
<pre>
mount /dev/xvda1 /mnt
+
6. set bootloader or rescue mode
 
</pre>
 
</pre>
 
Now to get pacman(package manager) going.
 
 
You will need two files, download these and extract them to the root directory. Or you can create a static directory in the root folder (/mnt/static), I will just go with downloading and extracting to /mnt.
 
 
 
<pre>
 
<pre>
cd /mnt
+
3. Linux-based Live Rescue
wget http://repo.archlinux.fr/x86_64/pacman-static-3.2.2-1.pkg.tar.gz
 
wget ftp://ftp.archlinux.org/core/os/x86_64/pacman-mirrorlist-20090616-1-x86_64.pkg.tar.gz
 
 
</pre>
 
</pre>
 
 
I recommend putting the config files for static pacman in a separate location I used /mnt/config.
 
 
<pre>
 
<pre>
mkdir /mnt/config
+
2. Linux Live Rescue, 64 bit
tar -xvf pacman-static-3.2.2-1.pkg.tar.gz -C /mnt/config
 
tar -xvf pacman-mirrorlist-20090616-1-x86_64.pkg.tar.gz -C /mnt/config
 
 
 
If you just do tar without -C.
 
mv -fv /etc/pacman* /mnt/config
 
 
</pre>
 
</pre>
  
You will need to edit these files a bit, pacman.conf isn't even included so we will create that.
+
After selecting the rescue image you will be prompted about adding SSH keys. This is optional, and is only necessary if you intend to SSH into the rescue image while it's running. This is not required for setting up Arch.
  
(Note. I don't use vi so i just copy and pasted these in, or remotely download them.)
+
After enabling the rescue image, hit 0 a couple times until you're back at the main menu again.
  
<pre>
+
=== Start in rescue mode ===
vi /mnt/config/pacman.conf
 
</pre>
 
  
pacman.conf  (Just bare essentials right now, once pacman is installed it is well commented)
+
Now that you have enabled booting into the rescue image, the machine can be started again. Select option 2 from the main menu:
 
<pre>
 
<pre>
RootDir    = /mnt
+
2. create/start, opens OOB console (try this if the machine is not running)
DBPath      = /mnt/var/lib/pacman/
 
CacheDir    = /mnt/var/cache/pacman/pkg/
 
LogFile    = /mnt/var/log/pacman.log
 
 
 
[core]
 
Include = /mnt/config/pacman.d/mirrorlist
 
 
 
[extra]
 
Include = /mnt/config/pacman.d/mirrorlist
 
 
 
[community]
 
Include = /mnt/config/pacman.d/mirrorlist
 
 
</pre>
 
</pre>
  
Next is the mirror list, i haven't scanned which is the fastest so I left in all US mirrors. You can either edit it with vi and uncomment all mirrors in the united states list, or remove it and paste in the list below. '''*NOTE you need to change the i686 at the end to x86_64*'''
+
At this point the machine will be booted into the rescue image configured above. If you are presented with a GRUB prompt, you should select the option that looks like <code>Debian GNU/Linux, kernel <version>-amd64 Live Rescue</code>. If you don't see any GRUB prompt then don't worry about it.
  
 +
After a minute or two of startup output, you should be presented with a login prompt:
 
<pre>
 
<pre>
vi /mnt/config/pacman.d/mirrorlist
+
Debian GNU/Linux 8 rescue ttyS0
</pre>
 
  
Or paste in this
+
rescue login:
 
 
<pre>
 
# United States
 
Server = http://mirror.archlinux.com.ve/$repo/os/
 
Server = http://archlinux.unixheads.org/$repo/os/x86_64
 
Server = ftp://mirror.cs.vt.edu/pub/ArchLinux/$repo/os/x86_64
 
Server = http://mirror.cs.vt.edu/pub/ArchLinux/$repo/os/x86_64
 
Server = ftp://mirrors.easynews.com/linux/archlinux/$repo/os/x86_64
 
Server = http://mirrors.easynews.com/linux/archlinux/$repo/os/x86_64
 
Server = ftp://ftp.archlinux.org/$repo/os/x86_64
 
Server = http://mirrors.gigenet.com/archlinux/$repo/os/x86_64
 
Server = ftp://ftp.gtlib.gatech.edu/pub/linux/distributions/archlinux/$repo/os/x86_64
 
Server = http://www.gtlib.gatech.edu/pub/linux/distributions/archlinux/$repo/os/x86_64
 
Server = ftp://mirrors.hosef.org/archlinux/$repo/os/x86_64
 
Server = http://mirrors.hosef.org/archlinux/$repo/os/x86_64
 
Server = ftp://ibiblio.org/pub/linux/distributions/archlinux/$repo/os/x86_64
 
Server = http://distro.ibiblio.org/pub/linux/distributions/archlinux/$repo/os/x86_64
 
Server = ftp://locke.suu.edu/linux/dist/archlinux/$repo/os/x86_64
 
Server = ftp://mirror.rit.edu/archlinux/$repo/os/x86_64
 
Server = http://mirror.rit.edu/archlinux/$repo/os/x86_64
 
Server = http://schlunix.org/archlinux/$repo/os/x86_64
 
Server = http://mirror.sourceshare.org/archlinux/$repo/os/x86_64
 
Server = http://archlinux.umflint.edu/$repo/os/x86_64
 
Server = http://mirror.umoss.org/archlinux/$repo/os/x86_64
 
 
</pre>
 
</pre>
  
Okay we are getting close to installing the system.
+
Log in as <code>root</code> with no password.
  
Make the necessary directories for pacman.
+
== Install Arch ==
  
<pre>
+
You are now booted into a rescue image. Your VM's hard drive is located at <code>/dev/xvda</code> while the rescue image itself is located at <code>/dev/xvdz</code>. Installation of Arch can now proceed against <code>/dev/xvda</code>.
mkdir -p /mnt/var/lib/pacman
 
</pre>
 
  
Now we can install
+
If you wished to do so, at this point you could [https://wiki.archlinux.org/index.php/Install_from_existing_Linux install Arch by hand], but for the purposes of this guide, we will use some helper scripts which greatly simplify the initial setup. Feel free to examine and customize the scripts to meet your needs. For example, the scripts default to a single large root partition, while you may instead wish to have a customized partition table.
  
Sync the repositories
+
=== Download/run install scripts ===
  
Now I'm lazy and that is a rather long command.
+
The scripts are provided in [https://github.com/prgmrcom/archinstall-scripts this repo] and can be installed as follows (or see the <code>README</code> within the repo):
<pre>
 
alias pacman='
 
/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf'
 
</pre>
 
If you do that you can just type pacman :).
 
  
<pre>
+
'''WARNING: This is the point of no return. The script will destroy any and all data in your VM. Did you make backups? Did you check that the backups are good?'''
/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf -Sy
 
</pre>
 
Install the base.
 
  
 
<pre>
 
<pre>
/mnt/usr/bin/pacman.static -r /mnt --config /mnt/config/pacman.conf -Sf base base-devel
+
cd /tmp
 +
wget https://github.com/prgmrcom/archinstall-scripts/archive/master.zip
 +
unzip master.zip
 +
cd archinstall-scripts-master/
 +
./archinstall.sh
 
</pre>
 
</pre>
  
Once that is done we can chroot into the new install and finish up the basics.
+
When the script has finished, it should display a message like the following before exiting:
  
 
<pre>
 
<pre>
mount -t proc none /mnt/proc
+
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
mount -o bind /dev /mnt/dev
+
finished
mount -o bind /sys /mnt/sys
+
********
cat /etc/resolv.conf > /mnt/etc/resolv.conf
+
root ~ #
chroot /mnt
 
source /etc/profile.
 
 
</pre>
 
</pre>
  
Note i was having an issue with, makepkg tar complaining about a time issue. I just exited and chrooted back in and it worked. This may not work. You can extract ahead of time, and pass the -e option to makepkg see below.
+
=== Follow install guide ===
  
Okay into the new system use, your editor of choice, i will be using nano (so replace nano with your editor).
+
The scripts should have taken care of the hardware aspects of configuring an Arch install, however you will still need to set up timezones, user accounts, passwords and so forth. For that you should follow the Arch [https://wiki.archlinux.org/index.php/Installation_guide Installation Guide], specifically starting where it has an <code>arch-chroot</code> command to switch into the Arch environment. In our case we can just perform a regular <code>chroot</code>:
 
 
First thing is setting the locales.
 
  
 
<pre>
 
<pre>
nano /etc/locale.gen
+
chroot /mnt
 
</pre>
 
</pre>
  
Choose your locales (probably uncomment the two en_US. entries near the top)
+
Continue with the Arch installation guide from that point. Once you have finished the installation (and BEFORE restarting the system), see below for a few final steps.
 
 
Run locale-gen
 
<pre>locale-gen</pre>
 
  
Make sure there are no updates.
+
If you do accidentally restart at the wrong time and find yourself with an unbootable system, you can [[#Recover from unbootable instance|regain access]] using the rescue image.
  
<pre>
+
== Finalize installation ==
pacman -Suy
 
</pre>
 
  
Now for the kernel. There are two options.
+
Once you have installed everything you need (for now), a couple additional steps are needed before you can reboot into the new image.
Follow the guide here for building a stock kernel or use A package from aur. I had plenty of issues with the kernel so I went ahead with one from AUR.
 
 
[http://book.xen.prgmr.com/mediawiki/index.php/Using_a_kernel.org_kernel_under_xen Stock Kernel]
 
  
[http://aur.archlinux.org/packages.php?ID=16087 AUR Package]
+
=== Enable serial access ===
  
Copy the link for the tarball.
+
In order for your Arch image to be accessible via the Management Console, you must enable serial access via GRUB and the Linux console. Without these changes, it will not be accessible via the Management Console and it will appear to be unresponsive when booting up. These instructions assume that you're using GRUB2 (the default) and not GRUB Legacy.
  
 +
Edit <code>/etc/default/grub</code> as follows:
 
<pre>
 
<pre>
wget tarball-link
+
GRUB_TERMINAL_INPUT=serial
tar -xvf kernel26-xen.tar.gz
+
GRUB_TERMINAL_OUTPUT=serial
cd kernel26-xen
+
GRUB_SERIAL_COMMAND="serial --speed 115200 --unit=0 --word=8 --parity=no --stop=1"
makepkg --asroot
 
</pre>
 
 
 
Now as stated you may run into some issues between tar and time. You can untar the sources by hand, and then tell makepkg to skip extraction. This can still be a pain.
 
  
<pre>
+
GRUB_CMDLINE_LINUX_DEFAULT="YOUR_OPTIONS_HERE console=ttyS0,115200n8"
cd package-dir(if your not in it)
 
tar -xvf  linux-2.6.29.tar.bz2 -C src
 
cp -auxfv patch-2.6.29.4-1-ARCH.bz2 src
 
cd src
 
bzip2 -d -k patch-2.6.29.4-1-ARCH.bz2
 
makepkg --asroot -e
 
 
</pre>
 
</pre>
  
Make sure you can remotely log in after reboot.
+
The above settings will do the following:
 +
* The <code>GRUB_TERMINAL_INPUT</code> and <code>GRUB_TERMINAL_OUTPUT</code> lines tell GRUB to output to the Management Console during system startup. These default to <code>console</code>.
 +
* The <code>GRUB_SERIAL_COMMAND</code> setting configures that serial output from GRUB. It shouldn't be strictly required but it silences a configuration warning about default options. This setting is not present by default.
 +
* The added <code>console=...</code> parameter to the <code>GRUB_CMDLINE_LINUX_DEFAULT</code> tells the Linux kernel to enable terminal access via the Management Console. This parameter should be included in addition to any others that you specify, for example <code>"quiet console=ttyS0,115200n8"</code>.
  
 +
The above changes will only take effect after you have regenerated your GRUB configuration as follows:
 
<pre>
 
<pre>
pacman -S openssh
+
grub-mkconfig -o /boot/grub/grub.cfg
nano /etc/hosts.allow
 
 
</pre>
 
</pre>
  
<pre>
+
=== Enable IPv6 ===
 
+
The helper scripts do not currently enable IPv6 for you. To do this, first [[Setting_up_IPv6|fetch your IPv6 address]].
# /etc/hosts.allow
 
#
 
sshd:ALL
 
# End of file
 
</pre>
 
 
 
Or for now comment out the paranoid entry in /etc/hosts.deny
 
  
 +
Using the example from the linked page with user cnryhilln, we would append the following lines to <code>/etc/systemd/network/prgmrDhcp.network</code> below <code>[Network]</code>
 
<pre>
 
<pre>
# /etc/hosts.deny
+
Address=2605:2700:0:17::4713:9b0f/64
#
+
Gateway=2605:2700:0:17::1
 
 
#ALL: ALL: DENY
 
 
 
# End of file
 
 
</pre>
 
</pre>
  
Edit ssh config for root login, or add a user to forgo root login. Of course now is a good time to secure up ssh.  
+
If you've already rebooted into Arch, then <code>systemctl restart systemd-networkd.service && ip link set dev eth0 down && ip link set dev eth0 up</code>. Otherwise, just continue to follow the instructions below.
nano /etc/ssh/sshd_config
 
  
Uncomment
+
=== Boot from Arch ===
<pre>
 
PermitRootLogin yes
 
</pre>
 
  
and if it's set to no change it to yes.
+
Once you have finished configuring your new Arch system (including enabling serial access), you can now switch the boot process from the Rescue disk back to Arch.
 
 
Edit rc.conf, I'm not going to go into rc.conf completely, just enough to get you started. Look through arch's wiki for more info.
 
 
 
Configure eth0.
 
  
 +
# After you've installed and configured everything (don't forget to enable [[#configure serial access|serial access]]!), shut down the system with <code>shutdown -h now</code>. If you are in a chrooted environment then you may need to first exit that with <code>Ctrl+D</code>
 +
# Exit back to the Management Console with <code>Ctrl+]</code>
 +
# From the main menu of the Management Console, set the bootloader to boot from disk:
 
<pre>
 
<pre>
eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
+
6. set bootloader or rescue mode
gateway="default gw 192.168.0.1"
 
ROUTES=(gateway) (Remove  the exclamation mark, that disables the gateway.
 
 
</pre>
 
</pre>
 
Obviously replace the ip, broadcast, netmask and gateway with your info. If you came from debian and copied down /etc/network/interfaces, that will have all the info. But will be just as easy to get from the ifconfig output. If you want to just use dhcp.
 
 
DHCP eth0
 
 
<pre>
 
<pre>
eth0="default"
+
1. Boot from disk
gateway="default gw 192.168.0.1"
 
ROUTES=(!gateway) (Remove  the exclamation mark, that disables the gateway)
 
 
</pre>
 
</pre>
 
+
# Go back to the main menu of the Management Console by pressing 0, then start the system again. If it's currently running (did you run <code>shutdown</code>?) then you can just reboot it first.
Startup daemons, simply add ssh to the startup.
 
 
 
 
<pre>
 
<pre>
DAEMONS=(syslog-ng network netfs crond sshd)
+
2. create/start, opens OOB console (try this if the machine is not running)
 
</pre>
 
</pre>
  
Edit fstab for proper file system, again this will depend on partition layout, but should be pretty straight forward.  But for example
+
At this point you should boot into your new Arch system. If it fails to boot, you don't need to start over again, instead you can just switch back to the rescue image and make any needed repairs:
  
<pre>
+
== Recover from unbootable instance ==
/dev/xvda1 / ext3 defaults 0 1
 
</pre>
 
  
Repeat for your partitions.
+
If you forgot to do something when setting up your Arch image, it's possible that it will be left in an unbootable state when you attempt to boot into it. These steps will allow you to access and repair the instance without needing to reinstall from scratch:
  
Edit grub my grub entry looks like this. There is an issue with the console for xen. I'm not familiar enough with xen. The issue is that it shows, the init level however, you cant get a root login console. Hence why setting up ssh is so important
+
# Follow the [[#Switch to rescue mode|above instructions]] to switch the VM's bootloader back to the rescue image, and then log into the rescue image (again).
 +
# From the rescue image, you can mount your Arch disk as follows (assuming that your root partition is at <code>/dev/xvda1</code>):
  
 
<pre>
 
<pre>
nano /boot/grub/menu.lst
+
mount /dev/xvda1 /mnt
</pre>
 
  
Grub entry
+
mount --rbind /proc /mnt/proc
 +
mount --rbind /sys /mnt/sys
 +
mount --rbind /dev /mnt/dev
 +
mount --rbind /run /mnt/run
  
<pre>
+
chroot /mnt
# (0) Arch Linux
 
title  Arch Linux  [/boot/vmlinuz26]
 
root  (hd0,0)
 
kernel /boot/vmlinuz26-xen-dom0 root=/dev/xvda1 ro console=/dev/xvc0
 
initrd /boot/kernel26-xen-dom0.img
 
 
</pre>
 
</pre>
  
Grub should be still installed into your root directory. So there should be no need to install
+
From here you should be able to make any needed repairs to your Arch image.
 
Set roots password
 
 
 
<pre>
 
passwd
 
</pre>
 
  
Hope all goes well and reboot.
+
== Bibliography ==
  
 +
Some reference info that you may find useful. In general, the [https://wiki.archlinux.org Arch Wiki] is an extremely useful resource for getting your new system up and running, even if you aren't necessarily running Arch.
  
{{u}} {{distros}}
+
* [https://wiki.archlinux.org/index.php/General_recommendations#Users_and_groups Setting Up a New User] -- Definitely should do this!!
 +
* [https://wiki.archlinux.org/index.php/General_recommendations#Networking Networking]
 +
* [https://wiki.archlinux.org/index.php/General_recommendations#Console_improvements Console Improvements]
 +
* [https://wiki.archlinux.org/index.php/List_of_applications Available Applications]
 +
* [[Accessing your guest from the rescue image|Booting into the rescue image]]

Latest revision as of 08:29, 21 September 2018

The purpose of this document is to provide the minimum necessary information to get Arch up and reasonably secure.

The Arch Wiki has a page devoted to installing Arch Linux from within an existing Linux, which effectively describes the underlying steps being performed here. The following steps apply that process to a VM on prgmr.

Accessing the Management Console

You need to access the Management Console for your VM. If you're not familiar with this, please see Management Console. The following instructions assume that you are NOT using the legacy console.

Boot from rescue image

The install will be performed from a Rescue image. This is equivalent to booting off a Rescue CD or USB stick, except the process is fully remote. We must configure the VM to boot off the Rescue image, which we will use as a starting point for installing Arch into the VM disk. For more information, see accessing your guest from the rescue image. After install has completed, the VM will be switched back to booting directly from its main disk which contains the new Arch installation.

Shut down the machine

Check if the machine is currently running by looking at the Current status at the top of the Management Console's main menu. If it's currently running, it needs to be shut down. You may use option 4 in the main menu to force it to power off. It's about to be reformatted so a clean shutdown isn't really necessary.

4. force power off (destroy/hard shutdown)

Switch to rescue mode

Now that the machine is shut down, you should configure its bootloader to use the rescue image. For example, from the main menu the options would be something like this:

6. set bootloader or rescue mode
3. Linux-based Live Rescue
2. Linux Live Rescue, 64 bit

After selecting the rescue image you will be prompted about adding SSH keys. This is optional, and is only necessary if you intend to SSH into the rescue image while it's running. This is not required for setting up Arch.

After enabling the rescue image, hit 0 a couple times until you're back at the main menu again.

Start in rescue mode

Now that you have enabled booting into the rescue image, the machine can be started again. Select option 2 from the main menu:

2. create/start, opens OOB console (try this if the machine is not running)

At this point the machine will be booted into the rescue image configured above. If you are presented with a GRUB prompt, you should select the option that looks like Debian GNU/Linux, kernel <version>-amd64 Live Rescue. If you don't see any GRUB prompt then don't worry about it.

After a minute or two of startup output, you should be presented with a login prompt:

Debian GNU/Linux 8 rescue ttyS0

rescue login:

Log in as root with no password.

Install Arch

You are now booted into a rescue image. Your VM's hard drive is located at /dev/xvda while the rescue image itself is located at /dev/xvdz. Installation of Arch can now proceed against /dev/xvda.

If you wished to do so, at this point you could install Arch by hand, but for the purposes of this guide, we will use some helper scripts which greatly simplify the initial setup. Feel free to examine and customize the scripts to meet your needs. For example, the scripts default to a single large root partition, while you may instead wish to have a customized partition table.

Download/run install scripts

The scripts are provided in this repo and can be installed as follows (or see the README within the repo):

WARNING: This is the point of no return. The script will destroy any and all data in your VM. Did you make backups? Did you check that the backups are good?

cd /tmp
wget https://github.com/prgmrcom/archinstall-scripts/archive/master.zip
unzip master.zip
cd archinstall-scripts-master/
./archinstall.sh

When the script has finished, it should display a message like the following before exiting:

~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
finished
********
root ~ #

Follow install guide

The scripts should have taken care of the hardware aspects of configuring an Arch install, however you will still need to set up timezones, user accounts, passwords and so forth. For that you should follow the Arch Installation Guide, specifically starting where it has an arch-chroot command to switch into the Arch environment. In our case we can just perform a regular chroot:

chroot /mnt

Continue with the Arch installation guide from that point. Once you have finished the installation (and BEFORE restarting the system), see below for a few final steps.

If you do accidentally restart at the wrong time and find yourself with an unbootable system, you can regain access using the rescue image.

Finalize installation

Once you have installed everything you need (for now), a couple additional steps are needed before you can reboot into the new image.

Enable serial access

In order for your Arch image to be accessible via the Management Console, you must enable serial access via GRUB and the Linux console. Without these changes, it will not be accessible via the Management Console and it will appear to be unresponsive when booting up. These instructions assume that you're using GRUB2 (the default) and not GRUB Legacy.

Edit /etc/default/grub as follows:

GRUB_TERMINAL_INPUT=serial
GRUB_TERMINAL_OUTPUT=serial
GRUB_SERIAL_COMMAND="serial --speed 115200 --unit=0 --word=8 --parity=no --stop=1"

GRUB_CMDLINE_LINUX_DEFAULT="YOUR_OPTIONS_HERE console=ttyS0,115200n8"

The above settings will do the following:

  • The GRUB_TERMINAL_INPUT and GRUB_TERMINAL_OUTPUT lines tell GRUB to output to the Management Console during system startup. These default to console.
  • The GRUB_SERIAL_COMMAND setting configures that serial output from GRUB. It shouldn't be strictly required but it silences a configuration warning about default options. This setting is not present by default.
  • The added console=... parameter to the GRUB_CMDLINE_LINUX_DEFAULT tells the Linux kernel to enable terminal access via the Management Console. This parameter should be included in addition to any others that you specify, for example "quiet console=ttyS0,115200n8".

The above changes will only take effect after you have regenerated your GRUB configuration as follows:

grub-mkconfig -o /boot/grub/grub.cfg

Enable IPv6

The helper scripts do not currently enable IPv6 for you. To do this, first fetch your IPv6 address.

Using the example from the linked page with user cnryhilln, we would append the following lines to /etc/systemd/network/prgmrDhcp.network below [Network]

Address=2605:2700:0:17::4713:9b0f/64
Gateway=2605:2700:0:17::1

If you've already rebooted into Arch, then systemctl restart systemd-networkd.service && ip link set dev eth0 down && ip link set dev eth0 up. Otherwise, just continue to follow the instructions below.

Boot from Arch

Once you have finished configuring your new Arch system (including enabling serial access), you can now switch the boot process from the Rescue disk back to Arch.

  1. After you've installed and configured everything (don't forget to enable serial access!), shut down the system with shutdown -h now. If you are in a chrooted environment then you may need to first exit that with Ctrl+D
  2. Exit back to the Management Console with Ctrl+]
  3. From the main menu of the Management Console, set the bootloader to boot from disk:
6. set bootloader or rescue mode
1. Boot from disk
  1. Go back to the main menu of the Management Console by pressing 0, then start the system again. If it's currently running (did you run shutdown?) then you can just reboot it first.
2. create/start, opens OOB console (try this if the machine is not running)

At this point you should boot into your new Arch system. If it fails to boot, you don't need to start over again, instead you can just switch back to the rescue image and make any needed repairs:

Recover from unbootable instance

If you forgot to do something when setting up your Arch image, it's possible that it will be left in an unbootable state when you attempt to boot into it. These steps will allow you to access and repair the instance without needing to reinstall from scratch:

  1. Follow the above instructions to switch the VM's bootloader back to the rescue image, and then log into the rescue image (again).
  2. From the rescue image, you can mount your Arch disk as follows (assuming that your root partition is at /dev/xvda1):
mount /dev/xvda1 /mnt

mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --rbind /dev /mnt/dev
mount --rbind /run /mnt/run

chroot /mnt

From here you should be able to make any needed repairs to your Arch image.

Bibliography

Some reference info that you may find useful. In general, the Arch Wiki is an extremely useful resource for getting your new system up and running, even if you aren't necessarily running Arch.