You are not logged in.

#1 2021-07-01 19:37:32

remanifest
Member
Registered: 2021-07-01
Posts: 11

[SOLVED] Root device mounted successfully, but /sbin/init does not exi

I recently decided to reinstall my Arch Linux system because I wanted to use luks and experiment with LVM partitions. I stepped through the install process and restored my packages.

I've searched this forum, as well as Google, and I can't seem to pinpoint what the problem is. Hoping you can help.

After selecting the grub entry, I'm met with:

A password is required to access the luks volume:
Enter passphrase for /dev/sda2:

After entering my password, I'm presented with this:

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 ]#

From here, if I look at /dev/mapper, I can see my LVM partitions. I can also mount them, and I see what I expect to see...

Next, I reboot to the installation medium, then mount my root device with

cryptsetup luksOpen /dev/sda2 luks

After I enter my password, the LVM partitions are where they're supposed to be in /dev/mapper, so I mount them and chroot to that environment.

Here is my lsblk layout:

NAME                    FSTYPE            LABEL          UUID                                            MOUNTPOINTS
sda
|─sda1                  ext4              boot           8e4271ae-002f-4263-90ba-cbd6b799f15d            /boot
|─sda2                  crypto_LUKS                      ef7ae879-d772-437d-84da-d1b6a5d68380
│ └─luks                LVM2_member                      T2Ijo2-ZnXB-mIu7-4M2a-RZW4-JsHe-yjprKM                     
│   └─vg0-root          ext4                             d4336759-a678-418c-a93d-8b36a1e5842f            /
│   └─vg0-usr           ext4                             50ac21dd-14ea-4e42-9131-ea2c73206547            /usr
│   └─vg0-var           ext4                             c29d939a-4632-4735-abd2-b0b4fce329aa            /var
│   └─vg0-etc           ext4                             1f385958-038e-4062-817e-a06feefbb22f            /etc
│   └─vg0-opt           ext4                             b4de09e9-7589-44a2-91af-2dd8ee175fa4            /opt
│   └─vg0-home          ext4                             59c18f2e-b7ae-4a96-9e40-daea6ba02e06            /home
└─sda3                  swap                             8604ba12-aa4f-4fd8-8703-ba10d3b1a388            [SWAP]

/etc/fstab:

# /dev/mapper/vg0-root
UUID=d4336759-a678-418c-a93d-8b36a1e5842f       /        ext4        rw,relatime    0 1

# /dev/mapper/vg0-usr
UUID=50ac21dd-14ea-4e42-9131-ea2c73206547       /usr     ext4        rw,relatime    0 2

# /dev/mapper/vg0-var
UUID=c29d939a-4632-4735-abd2-b0b4fce329aa       /var     ext4        rw,relatime    0 2

# /dev/mapper/vg0-opt
UUID=b4de09e9-7589-44a2-91af-2dd8ee175fa4       /opt     ext4        rw,relatime    0 2

# /dev/mapper/vg0-etc
UUID=1f385958-038e-4062-817e-a06feefbb22f       /etc     ext4        rw,relatime    0 2

# /dev/mapper/vg0-home
UUID=59c18f2e-b7ae-4a96-9e40-daea6ba02e06       /home    ext4        rw,relatime    0 2

# /dev/sda1 LABEL=boot
UUID=8e4271ae-002f-4263-90ba-cbd6b799f15d       /boot    ext4        rw,relatime,stripe=4    0 2

# /dev/sda3 swap
UUID=8604ba12-aa4f-4fd8-8703-ba10d3b1a388       none     swap        defaults       0 0

# temp filesystem
tmpfs                                           /tmp     tmpfs       defaults,noatime,mode=1777    0 0

/etc/crypttab:

luks                 UUID=ef7ae879-d772-437d-84da-d1b6a5d68380       none           luks

/etc/mkinitcpio.conf:

HOOKS=(base udev usr keyboard autodetect modconf block keymap encrypt lvm2 filesystems fsck shutdown)

/etc/default/grub - only the changed values are listed. GRUB_CMDLINE_LINUX_DEFAULT is provided for context in case I made any mistake. Everything else not listed is default:

GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"
GRUB_CMDLINE_LINUX="cryptdevice=/dev/sda2:luks:allow-discards"
GRUB_ENABLE_CRYPTODISK=y

I keep going back to these files, making slight changes, running mkinitcpio -p linux, and trying again. So far, each change just takes me to the same place, so I'm hoping for some relief.

Any help you can offer in getting me past this is greatly appreciated.

Last edited by remanifest (2021-07-01 23:32:59)

Offline

#2 2021-07-01 20:38:35

Piri
Member
Registered: 2018-06-02
Posts: 64

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

Never used such a /usr setup but the first logical step would be to check if /usr gets properly mounted.

What's the output of

 [rootfs ]# mount 

(executed in the rescue shell)

Last edited by Piri (2021-07-01 20:39:18)

Offline

#3 2021-07-01 20:48:06

remanifest
Member
Registered: 2021-07-01
Posts: 11

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

Piri wrote:

What's the output of

 [rootfs ]# mount 

(executed in the rescue shell)

Thanks for the help!
Below is the output of mount from the rescue shell:

none on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=4000728k,nr_inodes=1000182,mode=755,inode64)
/dev/mapper/vg0-root on /new_root type ext4 (rw,relatime)

Offline

#4 2021-07-01 20:52:31

Piri
Member
Registered: 2018-06-02
Posts: 64

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

Yeah, your /mnt partition does not get mounted which explains why /sbin/init cannot be found.

I would try moving the `usr` hook after the `fsck` hook. In any case the `usr` hook should be behind the `encrypt` hook. (Don't forget to `mkinitcpio -p linux` after changing the file)

Offline

#5 2021-07-01 21:00:13

remanifest
Member
Registered: 2021-07-01
Posts: 11

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

Updated /etc/mkinitcpio.conf to

HOOKS=(base udev keyboard autodetect modconf block keymap encrypt lvm2 filesystems fsck usr shutdown)

and then ran mkinitcpio -p linux. Sadly still getting the same result.

I don't have a separate /mnt partition, so I'm a bit confused about why it wouldn't be getting picked up when the root filesystem is mounted.

Offline

#6 2021-07-01 22:03:38

Piri
Member
Registered: 2018-06-02
Posts: 64

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

Please post the complete output of the rescue shell. Include the lines before the

ERROR: Root device mounted successfully, but /sbin/init does not exist. 

Additionally post the outputs of following commands in the rescue shell:

[rootfs ]# findmnt -snero source --tab-file="/new_root/etc/fstab" -T /usr
[rootfs ]# findmnt -snero options --tab-file="/new_root/etc/fstab" -T /usr
[rootfs ]# mount /dev/mapper/vg0-usr /new_root/usr -o "rw,realtime"
[rootfs ]# mount | grep usr

(this basically mirrors the commands executed in the usr hook)

Offline

#7 2021-07-01 22:12:57

remanifest
Member
Registered: 2021-07-01
Posts: 11

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

Complete output of the rescue shell:

Starting version 248.3-2-arch

A password is required to access the luks volume:
Enter passphrase for /dev/sda2:
/dev/mapper/vg0-root: clean, 162/1310720 files, 126556/5242880 blocks
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 ]#

Outputs of each respective commands:

[rootfs ]# findmnt -snero source --tab-file="/new_root/etc/fstab" -T /usr

No output

[rootfs ]# findmnt -snero options --tab-file="/new_root/etc/fstab" -T /usr

No output

[rootfs ]# mount /dev/mapper/vg0-usr /new_root/usr -o "rw,realtime"

mount: /new_root/usr: wrong fs type, bad option, bad superblock on /dev/mapper/vg0-usr, missing codepage or helper program, or other error.

Noticed the misspelling, and fixed it to be

[rootfs ]# mount /dev/mapper/vg0-usr /new_root/usr -o "rw,relatime"

No output

[rootfs ]# mount | grep usr

/dev/mapper/vg0-usr on /new_root/usr type ext4 (rw,relatime)

Last edited by remanifest (2021-07-01 22:13:29)

Offline

#8 2021-07-01 22:16:35

Piri
Member
Registered: 2018-06-02
Posts: 64

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

remanifest wrote:

Complete output of the rescue shell:

[rootfs ]# findmnt -snero source --tab-file="/new_root/etc/fstab" -T /usr

No output

Interesting post the contents of

/new_root/etc/fstab

Offline

#9 2021-07-01 22:18:43

remanifest
Member
Registered: 2021-07-01
Posts: 11

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

Ahhh, etc is not mounted - should I adjust my fstab (above, first post) to mount etc right after root? Or is it a mistake for me to have /etc in its own partition?

EDIT: I did change the order in fstab - same issue.

I went ahead and mapped the partitions from /dev/mapper manually, and attached them to their respective paths in /new_root

After doing that:

[rootfs ]# findmnt -snero source --tab-file="/new_root/etc/fstab" -T /usr

/dev/mapper/vg0-usr

[rootfs ]# findmnt -snero options --tab-file="/new_root/etc/fstab" -T /usr

rw,relatime

Last edited by remanifest (2021-07-01 22:32:32)

Offline

#10 2021-07-01 22:38:21

Piri
Member
Registered: 2018-06-02
Posts: 64

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

:facepalm: I did overlook that you have a separate /etc partition...

No adjusting the fstab will do little, that's the reason of the usr hook in the first place.



If you want to keep your /etc a seperate partition then  the probably easiest but also dirtiest approach would be to write your own hook that "hardcodes" your mountpoint.
For this you would need to create two files. They could look something like this, again this is not the cleanest code:

/etc/initcpio/hooks/myusr

#!/usr/bin/ash

run_latehook() {
    msg ":: mounting '/dev/mapper/vg0-usr' on /usr"
    mount /dev/mapper/vg0-usr /new_root/usr -o "rw,realtime"
}

# vim: set ft=sh ts=4 sw=4 et:

/etc/initcpio/install/myusr

#!/bin/bash

build() {
    add_binary findmnt
    add_runscript
}

help() {
    cat <<HELPEOF
This provides a support for mounting /usr via a late running hook. Configuration is needed. Useful if /etc is not present at runtime.
HELPEOF
}

# vim: set ft=sh ts=4 sw=4 et:

And then replace the hook in the mkinitcpio and rebuild the initramfs

HOOKS=(base udev keyboard autodetect modconf block keymap encrypt lvm2 filesystems fsck myusr shutdown)

Keep in mind that the mountoptions are also hardcoded, I'm not quite sure if it will get remounted by systemd later. This point is only relevant if you change the fstab down the road. In general this setup is a little bit more maintenance in case you change your mapper names / fstab configuration.

(EDIT: this of course is only needed if you want to keep your /etc as a seperate partition)
(EDIT2: did the realtime typo again)

Last edited by Piri (2021-07-01 22:51:25)

Offline

#11 2021-07-01 22:57:33

Piri
Member
Registered: 2018-06-02
Posts: 64

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

On second thought having /etc seperate seems like a bad idea to begin with, you will probably face issues later with systemd because it will most likely also complain if /etc is not present from the getgo.

Offline

#12 2021-07-01 23:32:17

remanifest
Member
Registered: 2021-07-01
Posts: 11

Re: [SOLVED] Root device mounted successfully, but /sbin/init does not exi

Piri wrote:

On second thought having /etc seperate seems like a bad idea to begin with, you will probably face issues later with systemd because it will most likely also complain if /etc is not present from the getgo.

Thank you so much for working through this with me. I really appreciate it. Here's what wound up working for me:

  • Rebooted into the Arch Install system

  • Mounted my filesystems and chrooted into the environment

  • Used rsync -avHx /etc/ /newetc to move all of the contents of etc over to a new folder

  • du -cs /etc && du -cs /newetc to compare the folders

  • umount /etc

  • mv /newetc /etc

  • Commented out the etc mount point in /etc/fstab

  • Rebooted

  • Achieved glory

Last edited by remanifest (2021-07-01 23:33:44)

Offline

Board footer

Powered by FluxBB