Installing openSUSE the hard way

Sometimes I encounter people who don’t like installers. They claim when installing a Linux distribution like Gentoo or Arch they learn more.

Well, this certainly could be the case. But I’d argue that most people just follow the install guide/wiki. So for some people this is just an exercise in copy-pasting and adapting minor things.

Others will dive deep though. No doubt.

In any case the assumption that only a disribution like Arch can give you this learning experience is flawed. AFAIK you could choose any Linux distribution and decide to install it without the installer.

Here we will do exactly this using openSUSE.

Preparation

First we will get the current Tumbleweed live ISO:

wget https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-GNOME-Live-x86_64-Current.iso

You could also choose the rescue ISO. Burn this to a disk, put it on a thumb drive or feed it to your virtual machine manager.

Preparing the disks

We will use a simple setup as an example, consisting of 3 partitions.

Let’s start: fdisk /dev/sda

Creating a disk label

Type p to print the current layout. In your example we will assume it’s an empty disk. You might want to use d to remove existing partitions.

Create a new disklabel by typing o.

The boot partition

Press d p 1 ENTER, 256M to create a new 256MB boot partition.

Swap

Press d p 2 ENTER, 4GB t 2 82 to create a new 4GB swap partition and set it to the correct type.

Root

Press d p 3 ENTER, ENTER to create the root partition that will use the remaining disk space.

Press p to check the result: Command (m for help): p Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x7363fb58

Device Boot Start End Sectors Size Id Type /dev/vda1 2048 8390655 8388608 4G 83 Linux /dev/vda2 8390656 16779263 8388608 4G 82 Linux swap / Solaris /dev/vda3 16779264 62914559 46135296 22G 83 Linux

If everything looks fine use w to apply the changes.

Formatting

We will use ext4 as our filesystems for the /boot and / partition: mkfs.ext4 /dev/vda1 mkfs.ext4 /dev/vda3 mkswap /dev/vda2 swapon /dev/vda2

Mounting the partitions

mkdir -p /mnt/os
mount /dev/vda3 /mnt/os
mkdir /mnt/os/boot
mount /dev/vda1 /mnt/os/boot/

mkdir /mnt/os/{proc,sys,dev,run}

mount --types proc /proc /mnt/os/proc
mount --rbind /sys /mnt/os/sys
mount --make-rslave /mnt/os/sys
mount --rbind /dev /mnt/os/dev
mount --make-rslave /mnt/os/dev
mount --bind /run /mnt/os/run
mount --make-slave /mnt/os/run

Installing a base system

I’ll install some packages that I’ll need. You might not want vim or man.

zypper --root /mnt/os ar https://download.opensuse.org/tumbleweed/repo/oss/ oss
zypper --root /mnt/os in kernel-default grub2 zypper bash man vim shadow util-linux
zypper --root /mnt/os in --no-recommends NetworkManager

Chrooting

Now we will chroot to work in the new environment.

chroot /mnt/os /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"

Editing fstab

Let’s use vim to edit /etc/fstab with our disks:

/dev/sda1   /boot        Vfat    defaults,noatime     0 2
/dev/sda2   none         swap    sw                   0 0
/dev/sda3   /            ext4    noatime              0 1

Install grub

mkinitrd
localhost:/ # grub2-install --force /dev/vda1
Installation finished. No error reported.

grub2-mkconfig > /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.17.3-1-default
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done

Booting into the installation

Now we are ready to restart and boot into our new installation:

exit
umount -l /mnt/os/dev{/shm,/pts,}
umount -R /mnt/os
reboot

Final steps

Let’s enable NetworkManager so we can access the internet: systemctl start NetworkManager. It might be that you need to edit /etc/resolv.cof for name resolution.

If you want to keep your system minimal edit /etc/zypp/zypp.conf and change the solver line to: solver.onlyRequires = true.

To make your life easier I would suggest to install some minimal pattern and not install really from scratch. To decide which one look what you have available using: zypper se -t pattern.

basic_desktop, gnome_basic, minimal_base or sway might all be good choices depending on what you like.

Now let’s add a user and be done:

useradd -m michael
usermod -aG users michael

This post was later ported to the openSUSE wiki page Expert Installation.