You are not logged in.

#1 2021-06-15 18:26:51

VVishion
Member
Registered: 2021-06-15
Posts: 9

[SOLVED] Root device mounted successfully, but /sbin/init doesnt exist

I'm fairly new to linux but decided to dive right in with arch-linux 2021.06.01 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
gdisk /dev/sda
o

boot partition

n
↵
↵
+512M
ef00

lvm partition

n
↵
↵
↵
8e00
w

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
genfstab -L /mnt > mnt/etc/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 didn't 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.
So.. what is the problem here? mad
Thanks for your time/help and reading this through.

Addition:

Going back in via the installation medium entering the following commands

cryptsetup open /dev/vg1/cryptroot root
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@ /dev/mapper/root /mnt
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@home /dev/mapper/root /mnt/home
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@snapshots /dev/mapper/root /mnt/.snapshots
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@log /dev/mapper/root /mnt/var/log
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@cache /dev/mapper/root /mnt/var/cache
mount -o noatime,compress=lzo,space_cache=v2,discard=async,subvol=@tmp /dev/mapper/root /mnt/var/tmp
mount /dev/sda1 /mnt/boot
arch-chroot /mnt
ls -l /sbin/init

yields

lrwxrwxrwx 1 root root 22 May 18 12:32 /sbin/init -> ../lib/systemd/systemd

and

ls -l /sbin/../lib/systemd/systemd

yields

-rwxr-xr-x 1 root root 1710216 May 18 12:32 /sbin/../lib/systemd/systemd

Last edited by VVishion (2021-06-16 10:13:48)

Offline

#2 2021-06-16 10:12:53

VVishion
Member
Registered: 2021-06-15
Posts: 9

Re: [SOLVED] Root device mounted successfully, but /sbin/init doesnt exist

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.

If someone knows why I saw many videos (6 months to 1 year old) where this flag was not necessary to add, but for me - I am curious to know.

Offline

#3 2021-06-16 10:22:16

Mr Victory
Member
Registered: 2021-06-10
Posts: 40

Re: [SOLVED] Root device mounted successfully, but /sbin/init doesnt exist

Hello,
if no subvolumes are specified, the default subvolume is mounted. The default subvolume is configurable and it is the root subvolume (/) by default. The /sbin/init (and rest of the os) is under @ so you got that error. Changing the default subvolume to @ would also solve this problem and

rootflags=subvol=@

would not be necessary.

Offline

#4 2021-06-16 10:33:27

VVishion
Member
Registered: 2021-06-15
Posts: 9

Re: [SOLVED] Root device mounted successfully, but /sbin/init doesnt exist

Thanks for that explanation. I've watched many different videos over 2 days to get an idea of possible layouts and technologies (luks, lvm, btrfs) for my setup. But I can't imagine I've missed every time they've set rootflags or made @ the default subvolume.
Is the default subvolume the btrfs subvolume container (all other btrfs subvolumes lay one level below inside the container) or is the default subvolume a subvolume '/' created with btrfs subvolume create /mnt/ which may or may not exist?

Last edited by VVishion (2021-06-16 10:58:27)

Offline

#5 2021-06-16 10:55:02

VVishion
Member
Registered: 2021-06-15
Posts: 9

Re: [SOLVED] Root device mounted successfully, but /sbin/init doesnt exist

Indeed, running

btrfs subvolume get-default /mnt

with the btrfs fs mounted at /mnt like

mount /dev/mapper/root /mnt

yields the btrfs subvolume container

ID 5 (FS_TREE)

Sry, for asking questions I can answer myself. Have a great day.

Last edited by VVishion (2021-06-16 10:58:38)

Offline

Board footer

Powered by FluxBB