Skip to content

archlinux

If you want a stable rolling distribution, almost all paths lead to archlinux. This is in fact a root distribution (not derived from slackware/debian/redhat...).

At first i downloaded a bare metal image where you must do almost everything by hand, but later on i found a separate image that has a better setup program called archboot.

visit

I have yet to try that out, because i started with the image from archlinux itself.

manual installation

The manual installation is more work but it enables installing archlinux without destroying the disk. So i will explain it in that context here.

Get the iso from : visit Look for a mirror in Netherlands and get the .iso and .iso.sig versions. As you can see these are more up to date then the archboot downloads (2018).

Put the iso on a usb stick :

create usb stick
dd if=archlinux-2019.10.01-x86_64.iso of=/dev/sdX

And boot into the first option : Boot Arch Linux (x86_64) You will get a command prompt and hopefully a working network interface.

test
1
2
3
4
ping archlinux.org  # should work
passwd              # set the root password to be able to login
systemctl start ssdh 
ifconfig            # get the ip to login to ..

Now you are done on the console, and you can login remotely to finish.

disk

Now prepare the disk to be used with something like :

fdisk output
1
2
3
4
fdisk /dev/sda
mkfs.ext4 /dev/sdaX
mkswap /dev/sdaY
swapon /dev/sdaY

Or in my case use the existing partition from a failed debian upgrade (servert) and mount it :

mount
1
2
3
4
mount /dev/sda1 /mnt
# i only want to keep the home directories so 
rm -rf [a-g]*  # be brave !!
rm -rf [i-z]*

Now we have to install some packages without still having a new root, and pacstrap is able to do that. The arguments (after /mnt) are just packages so you can add more if needed.

pacstrap
pacstrap /mnt base base-devel openssh vim tree

This will install base packages like bash etc. Now create an /etc/fstab file with the following command :

genfstab
genfstab -U /mnt >> /mnt/etc/fstab

You should now be able to chroot into the new system:

change root
arch-chroot /mnt
[root@archiso /]#

If needed (to reboot for instance) you can exit chroot with ... exit Now some things an installer would do for you, but since this is a rolling distro you only have to do them once :

setup
1
2
3
4
5
6
ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime 
hwclock --systohc --utc
vim /etc/locale.gen # and comment out en_US.UTF-8 UTF-8
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8

bootloader

We use grub2. Note that installing grub installs grub2, grub-legacy would install grub1. -S means sync.

grub
1
2
3
4
pacman -S grub
grub-install --version # should be > 2.0
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

upgrade

This command is the one that get's you 'rolling'. Since we installed this from a fresh iso file nothing much will be done.

upgrade
pacman -Syu # sync, refresh, sysupgrade

uninstall

Simply uninstalling is done with -R (remove) but use the second format (

uninstalling
pacman -R virtualbox # will not re-ask the module question on install
pacman -Rns virtualbox # this will : -native -search

While we are at it, to install virtualbox, use the second choice on installation.

pacman
1
2
3
4
pacman -S virtualbox
modprobe vboxdrv
modprobe vboxnetadp
modprobe vboxnetflt

All these are needed before virtualbox starts up. Find a way to get these modules loaded at boot (todo).

network

If you reboot now there will be no network, so :

network setup
ip link # show the interfaces
1: lo: [visit](LOOPBACK,UP,LOWER_UP) mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0f0: [visit](BROADCAST,MULTICAST,UP,LOWER_UP) mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 10:60:4b:96:e7:88 brd ff:ff:ff:ff:ff:ff
3: enp3s0f1: [visit](NO-CARRIER,BROADCAST,MULTICAST,UP) mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 10:60:4b:96:e7:8a brd ff:ff:ff:ff:ff:ff
4: enp4s0f0: [visit](NO-CARRIER,BROADCAST,MULTICAST,UP) mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 10:60:4b:96:d7:f0 brd ff:ff:ff:ff:ff:ff
5: enp4s0f1: [visit](NO-CARRIER,BROADCAST,MULTICAST,UP) mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 10:60:4b:96:d7:f2 brd ff:ff:ff:ff:ff:ff

One of the interfaces should say UP, so that's the one with cable attached. Create a file with that name in :

/etc/systemd/network/enp3s0f0.network
1
2
3
4
5
6
vim /etc/systemd/network/enp3s0f0.network
# and add these lines 
[Match]
name=en*
[Network]
DHCP=yes

Also you will need DNS so vim /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4
enable network
1
2
3
4
5
6
systemctl enable systemd-networkd
passwd # again.. this time for the new system
systemctl enable sshd # 
vi /etc/sshd/sshd-config # change PermitRootLogin = yes
ctrl-D  # leave chroot
reboot

I forgot the sshd lines so these are not actually tested. Now you probably will get another ip address than the one during installation, so try one higher or look at the console to see.

If this is an external system maybe better revert the PermitRootLogin when you have users added.

If everything went ok you now have a new (rolling) system and still have your home directory.

useradd

This command actually worked because the first user id on archlinux is 1000 just as in debian, and i again was the first user added so :

add users
1
2
3
4
5
6
7
ls -l /home
drwxr-xr-x 67 1000 1000 4096 Nov  1 17:40 kees
adduser -m -d /home/kees
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
ls -l /home
drwxr-xr-x 67 kees kees 4096 Nov  1 17:40 kees

After this i could login without a passwd, but this makes sense since my ~/.ssh directory was now in place !

Now if you suspect some of the skel directory is needed you can find it in /etc/skel. However note that the annoying tab completion is set in those files.

pacman

As mentioned before this command should be run frequently to update the system:

package manager
pacman -Syu

For package installations you should use -S

package manager
pacman -S tree screen

The -y is the 'refresh' flag and seems the equivalent of apt-get update :

package manager
pacman -Sy
pacman -Syy # read database even if up to date

Removing packages can be done with -R, but with -Rns you avoid orphaned dependencies and erase global configuration so :

package manager
pacman -Rns networkmanager

Listing the installed packages is :

list packages
pacman -Q
pacman -Qi # long format

But listing from the repo is another -S (sync) command :

sync
pacman -Ss package

This matches all packages that hold the name, so you could do something like :

find
pacman -Ss build | grep tools

Though that one does not get what you want, its base-devel. This is a meta-package which shows at the start what packages are in it.

AUR

Arch linux User Repository, for packages built from source. As an example I will try to get debtap via AUR.

debtap is a DEBian To Arch Packager.

You can find it on the repository site : visit

First check the dependencies and install if needed via pacman, then download the files :

arch user repo
1
2
3
4
5
6
pacman -S pkgfile git
git clone https://aur.archlinux.org/debtap.git

cd debtap # enter the git directory
makepkg   # make a archlinux package
makepkg -Acs # alternative that installs the missing deps and cleans up

The package will be called something like debtap-3.2.2-1-any.pkg.tar.xz, install it with pacman :

debian to arch packager
1
2
3
4
su
pacman -U debtap-3.2.2-1-any.pkg.tar.xz
debtap -u 
debtap hp-scripting-tools_10.20-44_amd64.deb

In this case it failed with a dependency error, so you should then find that package as well, and do the same path, but i bailed out here. If all goes well you should have an .xy package that can be installed with pacman -U

postgres

postgres
1
2
3
4
sudo pacman -S postgresql
sudo -u postgres -i initdb --locale $LANG -E UTF8 -D /var/lib/postgres/data
sudo systemctl start postgresql.service
sudo systemctl enable postgresql.service

For more initialization, this is the url I got this from : visit

install from existing linux

This is an attempt to install without live usb stick. So this could be done entirely over ssh ! If you have the opportunity to boot with an usb stick it will be less work !

You cannot 'overtake' a running partition because it will not release /dev etc.

This taken from : visit

I tried doing parted resizing on the active partition, but it does ruin your main system, so just don't try this unless you have a clean and unused partition to install to !!. If you don't : use an usb image, see previous chapters.

get bootstrap image

We need an archlinux system to install the actual system, but we also have to mount the main partition at some point, and then we lose the bootstrap system. So to solve that we use the swap partition to install the temporary bootstrapper and revive the swap later on.

Double check your partition names in all commands below !!!

bootstrap the image
1
2
3
4
sudo su
cd /mnt
wget http://mirror.i3d.net/pub/archlinux/iso/2019.11.01/archlinux-bootstrap-2019.11.01-x86_64.tar.gz
tar zxvf archlinux-bootstrap-2019.11.01-x86_64.tar.gz

Select a repository

You will have to do this outside of the chroot because you have no descent editor there :

repo
vim /mnt/root.x86_64/etc/pacman.d/mirrorlist
# uncomment some Netherlands mirror

bootstrap the installer

Now we have to chroot into the system, because we need commands like pacman, genfstab etc. But it will give errors if we don't do this command first :

bootstrap installer
1
2
3
# this command will suppress an error given my arch-root  
mount --bind /mnt/bootstrap/root.x86_64 /mnt/bootstrap/root.x86_64 
/mnt/bootstrap/root.x86_64/bin/arch-chroot /mnt/bootstrap/root.x86_64/

We are now inside an archlinux system capable of installing the actual system. Inside it we initialize some stuff :

initialize
1
2
3
4
5
6
7
8
9
pacman-key --init
pacman-key --populate archlinux
pacman -Syyuu

echo "nameserver 8.8.8.8" >> /etc/resolv.conf

pacman -Syy
pacstrap /mnt base base-devel
genfstab -U /mnt/ >> /mnt/etc/fstab

The steps from here on are like the usb-install (search for pacstrap above).

installation of system

Whenever you got a running system, here is how to get it functional. This one is from scratch using vagrant.

system install
1
2
3
vagrant init archlinux/archlinux
vagrant up 
vagrant ssh

Now setting up the key ring.

key ring
1
2
3
# this will solve 'key X could not be looked up remotely'
pacman -S archlinux-keyring
pacman -Syu  # update the system

Now install mate :

mate desktop
1
2
3
4
5
pacman -S xorg xorg-server
pacman -S mate mate-extra
pacman -S lightdm-gtk-greeter
systemctl enable lightdm.service
systemctl start lightdm.service

Since this will give you a login screen, but not fullscreen. So you will need to install the guest-additions to get it to full resolution.

virtualbox fullscreen
1
2
3
4
vagrant plugin install vagrant-vbguest
# when you get errors about setup command not found do 
vagrant plugin update vagrant-vbguest
vagrant vbguest --do install

This will help in getting full resolution. Now you have a start system to install further.

tools
1
2
3
# some much needed tools
pacman -S vim tree screen
pacman -S base-devel # build essentials