installationarchlinuxbtrfs

Arch Linux Installation: ERROR: Root device mounted successfully, but /sbin/init does not exist


I'm fairly new to linux but decided to dive right in with arch-linux to become familiar with everything. Unfortunatelly I can't even finish the installation - shame on me.

The error while booting after setting arch up is:

ERROR: Root device mounted successfully, but /sbin/init does not exist.
Bailing out, you are on your own. Good luck.

I went for btrfs on luks on lvm

The layout looks like this

sda
 |- sda1          512MB     fat32 /boot
 `- sda2          remaining lvm
     |- cryptswap 4GB       swap
     |- crypttmp  2GB       tmp   /tmp
     `- cryptroot remaining btrfs
         |- @                     /
         |- @home                 /home
         |- @snapshots            /.snapshots
         |- @log                  /var/log
         |- @cache                /var/cache
         `- @tmp                  /var/tmp

Those are the commands and configurations I used to setup arch:

dd status=progress if=/dev/zero of=/dev/sda wipe disk

gdisk /dev/sda

o clear gpt table

boot partition

n
↵
↵
+512M
ef00

lvm partition

n
↵
↵
↵
8e00

w write partition changes

setup lvm

pvcreate /dev/sda2
vgcreate vg1 /dev/sda2
lvcreate -L 4G -n cryptswap vg1
lvcreate -L 2G -n crypttmp vg1
lvcreate -l 100%FREE cryptroot vg1

setup encryption

cryptsetup luksFormat /dev/vg1/cryptroot
cryptsetup open /dev/vg1/cryptroot root

make filesystems

mkfs.fat -F32 -n BOOT /dev/sda1
mkfs.btrfs --label ROOT /dev/mapper/root

create btrfs subvolumes

mount /dev/mapper/root /mnt
cd /mnt

btrfs subvolume create @
btrfs subvolume create @home
btrfs subvolume create @snapshots
btrfs subvolume create @log
btrfs subvolume create @cache
btrfs subvolume create @tmp

cd ..
umount /mnt

mount btrfs subvolumes and BOOT partition

mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@ /dev/mapper/root /mnt

mkdir /mnt/home
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@home /dev/mapper/root /mnt/home

mkdir /mnt/.snapshots
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@snapshots /dev/mapper/root /mnt/.snapshots

mkdir /mnt/var
mkdir /mnt/var/log
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@log /dev/mapper/root /mnt/var/log

mkdir /mnt/var/cache
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@cache /dev/mapper/root /mnt/var/cache

mkdir /mnt/var/tmp
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@tmp /dev/mapper/root /mnt/var/tmp

mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

pacstrap /mnt base linux linux-firmware lvm2 btrfs-progs amd-ucode vim install necessities

genfstab -L /mnt > mnt/etc/fstab generate fstab

arch-chroot /mnt

basic configuration

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
hwclock --systohc
vim /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo "KEYMAP=de-latin1" >> /etc/vconsole.conf
echo "devstation" >> /etc/hostname
vim /etc/hosts

vim /etc/mkinitcpio.conf

the mkinitcpio.conf content:

MODULES=(btrfs)
HOOKS=(base udev autodetect keyboard keymap consolefont modconf block lvm2 encrypt filesystems fsck)

mkinitcpio -p linux

bootctl install

echo "default arch" > /boot/loader/loader.conf

vim /boot/loader/entries/arch.conf

the arch.conf content

title   Arch Linux
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
options cryptdevice=UUID={/dev/vg1/cryptroot uuid inserted here}:root root=/dev/mapper/root rw

exit

umount -a

poweroff

Pulling the arch installation medium out of the computer and starting it.

The booting output

:: running early hook [udev]
Starting version 248.3-2-arch
:: running hook [udev]
:: Triggering uevents...
:: running hook [keymap]
:: Loading keymap...done.
:: running hook [encrypt]

A password is requires to acces the root volume:
Enter passphrase for /dev/mapper/vg1-cryptroot: {inserting passphrase}
:: performing fsck on '/dev/mapper/root'
:: mounting '/dev/mapper/root' on real root
:: running cleanup hook [udev]
ERROR: Root device mounted successfully, but /sbin/init does not exist.
Bailing out, you are on your own. Good luck.

sh: can't access tty; job control turned off
[rootfs ]#

Obviously I didnt setup cryptswap and crypttmp, yet. Those will be setup with crypttab and fstab. I am just mentioning this, and highly doubt it is part of the problem, because they are just partitions not recognized by anything at the moment, aren't they.

I hope I didn't miss any command or configuration I did - I am typing off videos I watched and from head, because no single video I found had the btrfs, luks, lvm config I went with. Thanks for your time/help and reading this through.


Solution

  • Adding rootflags=subvol=@ to /boot/loader/entries/arch.conf like so

    title   Arch Linux
    linux   /vmlinuz-linux
    initrd  /initramfs-linux.img
    options cryptdevice=UUID={/dev/vg1/cryptroot uuid inserted here}:root root=/dev/mapper/root rootflags=subvol=@ rw
    

    did the trick.