You are not logged in.

#1 2018-02-21 02:22:10

MountainX
Member
Registered: 2016-02-08
Posts: 371

mkinitcpio in chroot ERROR: failed to detect root filesystem

In an arch-chroot environment, I'm manually updating my initramfs image.
With

mkinitcpio -p linux

I'm getting this error:

ERROR: failed to detect root filesystem

With

pacman -S linux

I'm getting this error:

error: could not determine root mount point /

My question is, What is behind this error (what could cause it)? Where should I be looking for the problem?

Offline

#2 2018-02-21 02:25:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

Why are you in a chroot?  And how exactly did you set up the chroot?

The errors are pretty clear: your root is not (properly) mounted.  So in addition the answers to the above, you could post the output of `mount`.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-02-21 02:27:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

I'm assuming it's the same problem as https://bugs.archlinux.org/task/57251

If so, you're not on a setup you're going to be booting anyway, so why are you updating the initramfs?

Offline

#4 2018-02-21 03:39:20

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

Trilby wrote:

Why are you in a chroot?

I'm restoring a btrfs snapshot that doesn't include a snapshot of /boot. I need to manually update the boot files to match the snapshot.

Trilby wrote:

And how exactly did you set up the chroot?

arch-chroot /mnt
mount /dev/sda2 /boot
Trilby wrote:

The errors are pretty clear: your root is not (properly) mounted.  So in addition the answers to the above, you could post the output of `mount`.

Even with the error, after I exited the chroot environment and booted the system, it booted without errors. Once booted into the real system, I ran `mkinitcpio -p linux` again just to be sure, but there are no problems now. However, I want to understand the error. What I have gathered so far is that while in the chroot environment, I could have examined:

1. the output of `mount`
2. the contents of /etc/mtab

I am assuming I should expect to see something mounted at / in /etc/mtab while in chroot -- correct? However, the fact that in the above case, `mkinitcpio -g /boot/initramfs-linux.img -k 4.15.3-2-ARCH` created a bootable image in spite of the error probably means the root file system was actually mounted. Any thoughts? (Again, the issue is resolved in the since that my system booted up properly, but my reason for asking the question is to gain some understanding of what I should have been looking for.) Thanks

Last edited by MountainX (2018-02-21 03:41:14)

Offline

#5 2018-02-21 03:40:23

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

Not an Installation issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2018-02-21 11:46:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

MountainX wrote:
arch-chroot /mnt
mount /dev/sda2 /boot

That's clearly incomplete.  The arch-chroot command would have simply failed.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2018-02-21 13:37:46

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

Trilby wrote:
MountainX wrote:
arch-chroot /mnt
mount /dev/sda2 /boot

That's clearly incomplete.  The arch-chroot command would have simply failed.

See https://wiki.archlinux.org/index.php/Change_root

Enter a chroot

Run arch-chroot with the new root directory as first argument:

# arch-chroot /location/of/new/root

For example, in the installation guide this directory would be /mnt:

# arch-chroot /mnt

What's incomplete? I'm not sure what I'm missing or why you expect the command to have failed.

Offline

#8 2018-02-21 13:39:37

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

See my post, I already correctly identified the issue, it seems.

Offline

#9 2018-02-21 14:06:49

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

Scimmia wrote:

...you're not on a setup you're going to be booting anyway...

Your comment threw me. My setup is indeed intended to boot (and it does boot). I believe your second post implies that you think the issue reported at that link is still relevant even with those facts.

Scimmia wrote:

See my post, I already correctly identified the issue, it seems.

That bug report mentions:

run arch-chroot to a pacstrabbed directory, and / is missing from mtab.

I couldn't find any discussion of what a pacstrabbed directory is. In my case, /mnt contains a root file system on a mounted BTRFS subvolume. In that filesystem, boot is empty and it is mounted separately, as I showed.

However, my problem did start around the time of that bug report.

The bug report mentions that it is repeatable. In my case, I have seen it every time I have done this process in recent weeks. The process is restoring a BTRFS snapshot of a root filesystem where boot is on a separate volume and the kernel needs to be updated to match the root filesystem.

Last edited by MountainX (2018-02-21 14:20:48)

Offline

#10 2018-02-21 14:16:48

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

pacstrabbed was a typo, they meant pacstrapped. Essentially, if your root isn't a mountpoint, arch-chroot no longer takes care of that automatically for you.

Offline

#11 2018-02-21 14:24:29

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

Scimmia wrote:

pacstrabbed was a typo, they meant pacstrapped. Essentially, if your root isn't a mountpoint, arch-chroot no longer takes care of that automatically for you.

OK, thanks. I have a guess. If the contents of /etc/fstab in the mounted filesystem are important for mounting root, and both the running and the chroot environment use labels in fstab, and those labels are the same, maybe that causes the problem.

Can I manually mount the root filesystem once in the chroot environment?

Last edited by MountainX (2018-02-21 14:26:32)

Offline

#12 2018-02-24 09:39:50

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

When using arch-chroot, the root filesystem is being mounted at /etc/resolv.conf

The `mount` command shows:

/dev/mapper/rootsys on /etc/resolv.conf type btrfs (rw,noatime,nodiratime,compress=lzo,space_cache,subvolid=282,subvol=/@/etc/resolv.conf)

Last edited by MountainX (2018-02-24 09:45:17)

Offline

#13 2018-02-24 12:12:13

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: mkinitcpio in chroot ERROR: failed to detect root filesystem

Which is correct and has nothing to do with your issue.

Offline

Board footer

Powered by FluxBB