Grub and btrfs subvolumes

I saw this closed topic, but that does not show how.

I try to install Manjaro 2026, on btrfs + LLUKS, but at the end of the installation, Calamares gives a grub error (returns -1).
So when I boot, I first have to give in the passphrase for LUKS, then I get the grub prompt..

grub> ls
(crypro0) (proc) (hd0) (hd1,gpt3) (hd1,gpt2) (hd1,gpt1)

When I do this, I see

grub> ls (crypto0)/
@cache @/ @home/ @log/

grub> ls (crypto0)/@
rootfs-pkgs.txt dev/ run/ boot/ lib desktopfs-pkgs.txt sbin srv/ usr/ opt/ lib64 bin home/ crypto_key.bin etc/var/ tmp/ sys/ mnt/ proc/ root/

grub> set root=(crypto0)/@
grub> ls /
error: net/net. :grub_net_ope_real:1419:no server is specified

When I go on with set root=(crypto0) then

grub> linux /@/boot/vmlinuz-6.18-x86_64 cryptdevice=/dev/nvme0n1p2:root root=/dev/mapper/root
grub> initrd /@/boot/initrd-6.18-x86_64.img
grub> boot

Then I get the error and get into the emergency shell
ERROR Root device mounted successfully, but /sbin/init does not exist.
Bailing out, you are on your own. Good luck.

When I do a df, I see that /dev/mapper/root is mounted on /new_root

/dev/mapper /root 1823997952 5S@B86700 1017441188 8% /new_root

[rootfs "1# 1s -l /new_root/
drwxr—xr-x 1 0   0  252 Jan 12 15:14 @
drwxr—xr—x 1 0   0  118 Jan  4 16:23 @cache
druxr—xr—x 1 0   0    8 Jan 12 15:14 @home
druxr—xr—x 1 0   0  144 Jan 12 15:14 @log

How to do the grub> set root=... for btrfs subvolume @ correctly?

you need grub-btrfs

No, grub-btrfs is for being able to boot into snapshots, although I agree that, with btrfs now being the default, grub-btrfs is probably a better choice for most people.

1 Like

I have almost no experience with LUKS. Sometimes, I can help with the btrfs parts though.

It seems you are missing the subvol option for the root mount. The one the kernel usually gets via parameter.

Obviously, this will be different for you, but in all my grub.cfgs with btrfs, I always have to start:

linux   /@/boot/vmlinuz-6.. root=UUID=XXX-.. rw rootflags=subvol=@ ... 

Looking at rootflags=subvol=@ specifically.

If I mounted that drive without that option, I would see my top level subvolume as well. Which you did here:

Could it be that you are just missing that grub.cfg kernel parameter?

I was hoping a LUKS person would chime in here. Has to happen somewhere along the chain.


Another idea. Every btrfs file system has a default subvolume. (Usually used for mounting.)

You can see it with the command

$ sudo btrfs subvolume get-default /mnt/root
ID 5 (FS_TREE)

If you see that output, subvolid=5 is the reserved top level volume, and I believe the Manjaro default. You can easily change that to: @. Then it will default mount directly to your root.

sudo btrfs subvolume set-default @ /mnt/root
2 Likes

@Molski and others (was not allowed to mention 3 people), thank you for replying!

Since grub-mkconfig fails, there is no grub.cfg, so when I boot I get into the grub prompt.

Adding rootflags=subvol=@ gets me booting from my SSD :-), but I get into the emergency shell:

Mounting /boot/efi...
Mounting /tmp...
Listening on Disk Image Download Service Socket.
Mounted /tmp.
0K 1 Mounted /boot/efi.
ucsi_acpi USBCOEO:80: unknown error 256
Bluetooth: hci@: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
ucsi_acpi USBCOGE:08: unknown error 256
(1 of 2) A start job is running for Cryptography Setup for luks-a7cBaSc7-729a-4cf4-b5d5-06a891193019 (2s / no limit)
[FAILED] Failed to start Cryptography Setup for luks-a7cBaSc7-729a-4cf4-bSd5-06a8911930819.
See 'systemctl status "systemd-cryptsetup@luks\\x2da7cB8aSc7\\x2d729a\\x2d4cf4\\x2db5d5\\x2d06a891193019.service”' for details.

[DEPEND] ependency failed for /dev/mapper/luks-a7cBaSc7-729a-4cf4-bSd5-06a891193019.
[DEPEND] ependency failed for /var/cache.
[DEPEND] ependency failed for CUPS Scheduler.
[DEPEND] ependency failed for Local File Systems.
[DEPEND] ependency failed for /var/log.
[DEPEND] ependency failed for Flush Journal to Persistent Storage.
[DEPEND] ependency failed for Record System Boot/Shutdown in UTMP.
[DEPEND] ependency failed for /home.
[DEPEND] ependency failed for Local Encrypted Volumes.
[  OK  ] Stopped Forward Password Requests to Wall Directory Watch.
[  OK  ] Reached target Block Device Preparation for /dev/mapper/luks-a7c8aSc7-729a~4cf4-b5d5-86a891193019.
[  OK  ] Reached target Timer Units.
[  OK  ] Listening on Boot Entries Service Socket.
[  OK  ] Listening on System Extension Image Management.
[  OK  ] Reached target Sound Card.
[  OK  ] Reached target Bluetooth Support.
[  OK  ] Reached target Network.
[  OK  ] Reached target Path Units.
[  OK  ] Reached target Socket Units.
         Started Emergency Shell.
         Reached target Emergency Mode.
         Starting Tell Plymouth To Write Out Runtime Data...
[  OK  ] Starting Create System Files and Directories...
[  OK  ] Starting Load JSON user/group Records from Credentials...
[  OK  ] Stopped target Block Device Preparation for /dev/mapper/luks-a7cBaS5c7-729a-4cf4-b5d5-06a891193019.
[  OK  ] Finished Load JSON user/group Records from Credentials.
[  OK  ] Finished Tell Plymouth To Write Out Runtime Data.
[  OK  ] Finished Create System Files and Directories.
         Starting Rebuild Dynamic Linker Cache...
         Starting Rebuild Journal Catalog...
[  OK  ] Finished Rebuild Journal Catalog.
[  OK  ] Finished Rebuild Dynamic Linker Cache.
         Starting Update is Completed...
[  OK  ] Finished Update is Completed.
You are in emergency mode. After logging in, type " journalctl -xb" to view
system logs, “systemctl reboot” to reboot, or "exit”  
to continue bootup.  
Tup het rootwachtwoord voor onderhoud  
(of druk op Ctrl-D om verder te gaan):  

So then I could login with my own root password and get the log from journalctl.
Ctrl-D did not continue unfortunately.
You can get the journalctl.log from my Bitwarden Send, but was not allowed to include links, so PM me and I will give the link.

Just include the link in a code tag, it will be visible but not clickable and this is ok.

1 Like

Thanks!

https://send.bitwarden.com/#5T-NHJeiMUWItbPlAQ0sUQ/fsu6iuJWJ4M0LcaWffI85A

The output of the grub-mkconfig errors would be more useful..

Really need someone with LUKS experience. (It will never touch my boot/root file system!) I have no idea why this errors. But that may be a red herring.

In the chroot, where did grub-mkconfig error and what what was it?

What is the output of:

lsblk -f

Is /boot/efi a FAT32 partition? You can encrypt all your publicly availbile binaries that reside in /boot and other places, except /boot/efi. Your PC has to start somewhere.

No point in even trying to boot if this fails. What was the error?

Inside the chroot:

(Make sure /boot/efi is mounted.)

mount /boot/efi

Do not proceed unless we have that FAT32 partition mounted here. Verify it.

Let’s install grub again, just in case.

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Manjaro

Then build your grub config:

grub-mkconfig -o /boot/grub/grub.cfg

Once everything is working update-grub will be get the job done in the future.

1 Like

I had been thinking about the partial boot from the SSD.
At a certain moment I thought, maybe I can do a grub-install and a update-grub from there…
So I booted again, gave grub the right options and booted into the emergency shell, llooked what was mounted and unmounted /boot/efi because that was mounted to the USB boot stick, and mounted /dev/nvme0n1p1 to it.
/ was mounted from /dev/mapper/root which was good.
I did a grub-config --root=/ /dev/nvme0n1p2 and a update-grub, which gave no errors.
Then I crossed my fingers and pressed Ctrl-D to continue and finally got the login screen :grinning_face:

Doing a power down and a start, brought me back to the emergency shell, /dev/efi was not mounted

to be continued!

Probably the fstab, will check tomorrow

1 Like

The fstab had the wrong UUID for /boot/efi, probably the USB-stick
I changed it for the correctt UUID, still not booting in GUI mode.
Changed it to /dev/nvme0n1p1 also tried LABEL, all with the same result
Mounting /boot/efi by hand and continuing with Ctrl-D brings me in GUI mode.
Errors in dmesg, LABEL seems different

In this case you may need to reinstall grub / recreate grub.cfg
With the wrong uuid for EFI, commands that use this connection may have failed to write to the right place.
:footprints:

I tried reinstalling, but no change.
There is no grub comment and grub-install had no reinstall option.

I will create an new topic on this issue, it looks that it has nothing to do with btrfs and LUKS, but with nvme


Provide system details as described: :point_down:


[MiniHowTo] Provide System Information

Basic details provided by *-fetch type apps might give enough information for someone wishing to buy a computer, however, for Support purposes it’s best to ask your system directly.

Output of the inxi command will generate more useful and detailed information for those who may wish to help:


Suggested inxi command (use either):

inxi -zv8 (short-form)
inxi --filter --verbosity=8 (long-form)

Command output should be presented as pre-formatted text in accordance with forum guidelines. :eyes:


Running inxi within a chroot environment

  • Add --color=0 to the long-form command, or…
  • Change the short-form command to inxi -zv8c0

Your privacy is respected


Place the command output within a scrollable pre-formatted text enclosure according to forum guidelines: :point_down:


[MiniHowTo] Present code or command output

Note: Grave accent (or, backtick) characters are used. :eyes:

For inline code or to show a single command:

  • please follow this simple example: code here.

For multi-line command output:

  • place text beween two rows of three (```) backtick characters to form a scrollable text box, or …
  • use the </> button in the Compose window to achieve the same result.

The empty row between these rows of backtick characters is where to paste any multi-line command output (such as inxi).

An example of a pre-formatted text enclosure:

What is a Quark?

A. In Physics, an elementary particle and fundamental constituent of matter. 
B. A character from the Star Trek: "Deep Space Nine" television series.
C. A soft, creamy, usually unsalted cheese traditional to central Europe.

2 Likes

No grub comment command?

No reinstall option? What did you type?

Most people need:

grub-install --efi-directory=/boot/efi  --target=x86_64-efi --bootloader-id=Manjaro /dev/..

But sometimes people may need to add:

  • --recheck

or more importantly:

  • --removable