Manjaro-chroot or chroot manually because btrfs

Finally got myself to setup so I can start a live session from an iso file on my hd.

I needed to adjust the /etc/grub.d/40_custom menu and then update-grub in the live session and reboot but I get an error message (ERROR: mkdir /var/lock/dmraid) when running update-grub and when rebooting, my grub menu never shows.

Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-6.1-x86_64
Found initrd image: /boot/amd-ucode.img /boot/initramfs-6.1-x86_64.img
Found initrd fallback image: /boot/initramfs-6.1-x86_64-fallback.img
Found linux image: /boot/vmlinuz-5.15-x86_64
Found initrd image: /boot/amd-ucode.img /boot/initramfs-5.15-x86_64.img
Found initrd fallback image: /boot/initramfs-5.15-x86_64-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
ERROR: mkdir /var/lock/dmraid
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Found snapshot: 2023-06-23 18:00:01 | timeshift-btrfs/snapshots/2023-06-23_18-00-01/@ | daily    | N/A                                           |
Found snapshot: 2023-06-22 18:00:01 | timeshift-btrfs/snapshots/2023-06-22_18-00-01/@ | daily    | N/A                                           |
Found snapshot: 2023-06-21 18:00:01 | timeshift-btrfs/snapshots/2023-06-21_18-00-01/@ | daily    | N/A                                           |
Found snapshot: 2023-06-20 20:22:27 | timeshift-btrfs/snapshots/2023-06-20_20-22-27/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-06-20 18:00:01 | timeshift-btrfs/snapshots/2023-06-20_18-00-01/@ | daily    | N/A                                           |
Found snapshot: 2023-06-20 17:00:01 | timeshift-btrfs/snapshots/2023-06-20_17-00-01/@ | weekly   | N/A                                           |
Found snapshot: 2023-06-19 18:00:01 | timeshift-btrfs/snapshots/2023-06-19_18-00-01/@ | daily    | N/A                                           |
Found snapshot: 2023-06-18 18:00:02 | timeshift-btrfs/snapshots/2023-06-18_18-00-02/@ | daily    | N/A                                           |
Found snapshot: 2023-06-17 18:00:01 | timeshift-btrfs/snapshots/2023-06-17_18-00-01/@ | daily    | N/A                                           |
Found snapshot: 2023-06-16 21:47:16 | timeshift-btrfs/snapshots/2023-06-16_21-47-16/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-06-15 21:29:16 | timeshift-btrfs/snapshots/2023-06-15_21-29-16/@ | ondemand | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2023-06-13 17:00:01 | timeshift-btrfs/snapshots/2023-06-13_17-00-01/@ | weekly   | N/A                                           |
Found snapshot: 2023-06-06 21:33:25 | timeshift-btrfs/snapshots/2023-06-06_21-33-25/@ | ondemand | N/A                                           |
Found snapshot: 2023-06-06 17:00:01 | timeshift-btrfs/snapshots/2023-06-06_17-00-01/@ | weekly   | N/A                                           |
Found snapshot: 2023-06-05 23:00:08 | timeshift-btrfs/snapshots/2023-06-05_23-00-08/@ | monthly  | N/A                                           |
Found snapshot: 2023-05-30 17:00:01 | timeshift-btrfs/snapshots/2023-05-30_17-00-01/@ | weekly   | N/A                                           |
Found snapshot: 2023-05-30 14:28:02 | timeshift-btrfs/snapshots/2023-05-30_14-28-02/@ | ondemand | N/A                                           |
Found snapshot: 2023-05-29 01:58:22 | timeshift-btrfs/snapshots/2023-05-29_01-58-22/@ | ondemand | N/A                                           |
Found snapshot: 2023-05-29 00:48:57 | timeshift-btrfs/snapshots/2023-05-29_00-48-57/@ | ondemand | N/A                                           |
Found snapshot: 2023-05-25 20:54:40 | timeshift-btrfs/snapshots/2023-05-25_20-54-40/@ | ondemand | N/A                                           |
Found snapshot: 2023-05-05 23:00:02 | timeshift-btrfs/snapshots/2023-05-05_23-00-02/@ | monthly  | N/A                                           |
Found 21 snapshot(s)
Unmount /tmp/grub-btrfs.PpCgm3PZbz .. Success
Found memtest86+ image: /boot/memtest86+/memtest.bin
Found memtest86+ EFI image: /boot/memtest86+/memtest.efi
done

Steps to reproduce: (guide I followed)
Boot into live env from usb or iso file (I have tried both, same result)

sudo mount -o subvol=@ /dev/sda7 /mnt
sudo mount /dev/sda5 /mnt/boot/efi
sudo manjaro-chroot /mnt /bin/bash
update-grub

If use chroot instead of manajro-chroot, update-grub gives:
/usr/bin/grub-probe: error: cannot find a device for / (is /dev mounted?) and does not work at all.

Luckily my system booted right back into my Manjaro 6.1 LTS kernel without stopping at Grub and I could just run sudo update-grub from here and it fixed it.
But what about next time when I REALLY need to chroot into the system to fix something that is completely broken? :grimacing:

inxi (not from live)

System:
  Kernel: 6.1.31-2-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.1.1
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-6.1-x86_64
    root=UUID=700d034d-b99a-482b-880b-9060acf3a6b3 rw rootflags=subvol=@
    nvidia_drm.modeset=1 quiet splash udev.log_priority=3
    resume=UUID=5ae8fbf5-a704-41ea-be6d-bf26b38325ed
  Desktop: KDE Plasma v: 5.27.5 tk: Qt v: 5.15.9 wm: kwin_x11 vt: 1 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Desktop System: Gigabyte product: X670 AORUS ELITE AX v: -CF
    serial: <superuser required>
  Mobo: Gigabyte model: X670 AORUS ELITE AX v: x.x
    serial: <superuser required> UEFI: American Megatrends LLC. v: F9b
    date: 06/01/2023
Battery:
  Message: No system battery data found. Is one present?
Memory:
  System RAM: available: 31.09 GiB used: 2.85 GiB (9.2%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: AMD Ryzen 9 7900X bits: 64 type: MT MCP arch: Zen 4 gen: 5
    level: v4 note: check built: 2022+ process: TSMC n5 (5nm) family: 0x19 (25)
    model-id: 0x61 (97) stepping: 2 microcode: 0xA601203
  Topology: cpus: 1x cores: 12 tpc: 2 threads: 24 smt: enabled cache:
    L1: 768 KiB desc: d-12x32 KiB; i-12x32 KiB L2: 12 MiB desc: 12x1024 KiB
    L3: 64 MiB desc: 2x32 MiB
  Speed (MHz): avg: 3406 high: 5439 min/max: 3000/5733 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 4700 2: 3000
    3: 3000 4: 3000 5: 3000 6: 4700 7: 4700 8: 3000 9: 3000 10: 3000 11: 3000
    12: 5439 13: 3000 14: 3000 15: 3000 16: 3000 17: 3000 18: 3000 19: 3000
    20: 3000 21: 5205 22: 3000 23: 3000 24: 3000 bogomips: 225274
  Flags: 3dnowprefetch abm adx aes amd_lbr_v2 aperfmperf apic arat avic avx
    avx2 avx512_bf16 avx512_bitalg avx512_vbmi2 avx512_vnni avx512_vpopcntdq
    avx512bw avx512cd avx512dq avx512f avx512ifma avx512vbmi avx512vl bmi1
    bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy
    constant_tsc cpb cppc cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total
    cqm_occup_llc cr8_legacy cx16 cx8 de decodeassists erms extapic
    extd_apicid f16c flush_l1d flushbyasid fma fpu fsgsbase fsrm fxsr fxsr_opt
    gfni ht hw_pstate ibpb ibrs ibs invpcid irperf lahf_lm lbrv lm mba mca mce
    misalignsse mmx mmxext monitor movbe msr mtrr mwaitx nonstop_tsc nopl npt
    nrip_save nx ospke osvw overflow_recov pae pat pausefilter pclmulqdq
    pdpe1gb perfctr_core perfctr_llc perfctr_nb perfmon_v2 pfthreshold pge pku
    pni popcnt pse pse36 rapl rdpid rdpru rdrand rdseed rdt_a rdtscp rep_good
    sep sha_ni skinit smap smca smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3
    stibp succor svm svm_lock syscall tce topoext tsc tsc_scale umip
    v_spec_ctrl v_vmsave_vmload vaes vgif vmcb_clean vme vmmcall vpclmulqdq
    wbnoinvd wdt x2apic x2avic xgetbv1 xsave xsavec xsaveerptr xsaveopt xsaves
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA GA102 [GeForce RTX 3090] vendor: eVga.com. driver: nvidia
    v: 530.41.03 alternate: nouveau,nvidia_drm non-free: 530.xx+
    status: current (as of 2023-05) arch: Ampere code: GAxxx
    process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 4 speed: 16 GT/s lanes: 16
    ports: active: none off: HDMI-A-1 empty: DP-1,DP-2,DP-3 bus-ID: 01:00.0
    chip-ID: 10de:2204 class-ID: 0300
  Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.1
    compositor: kwin_x11 driver: X: loaded: nvidia gpu: nvidia,nvidia-nvswitch
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 81 s-size: 602x343mm (23.70x13.50")
    s-diag: 693mm (27.28")
  Monitor-1: HDMI-A-1 mapped: HDMI-0 note: disabled model: Asus VX279
    serial: <filter> built: 2015 res: 1920x1080 hz: 60 dpi: 79 gamma: 1.2
    size: 621x341mm (24.45x13.43") diag: 690mm (27.2") ratio: 16:9 modes:
    max: 1920x1080 min: 640x480
  API: OpenGL v: 4.6.0 NVIDIA 530.41.03 renderer: NVIDIA GeForce RTX
    3090/PCIe/SSE2 direct-render: Yes
Audio:
  Device-1: NVIDIA GA102 High Definition Audio vendor: eVga.com.
    driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 01:00.1 chip-ID: 10de:1aef class-ID: 0403
  Device-2: AMD Family 17h/19h HD Audio vendor: Gigabyte
    driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 15:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.1.31-2-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 0.3.70 status: off with: wireplumber status: active
    tools: pw-cli,wpctl
  Server-3: PulseAudio v: 16.1 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl
Network:
  Device-1: Realtek RTL8125 2.5GbE vendor: Gigabyte driver: r8169 v: kernel
    pcie: gen: 2 speed: 5 GT/s lanes: 1 port: e000 bus-ID: 0e:00.0
    chip-ID: 10ec:8125 class-ID: 0200
  IF: enp14s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  Device-2: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
    driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 1 bus-ID: 0f:00.0
    chip-ID: 14c3:0616 class-ID: 0280
  IF: wlp15s0 state: down mac: <filter>
  WAN IP: <filter>
Bluetooth:
  Device-1: MediaTek Wireless_Device driver: btusb v: 0.8 type: USB rev: 2.1
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-7:5 chip-ID: 0e8d:0616
    class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 4.09 TiB used: 1.52 TiB (37.0%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 980 PRO 1TB
    size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: 5B2QGXA7 temp: 46.9 C
    scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 860 EVO 500GB
    size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    tech: SSD serial: <filter> fw-rev: 4B6Q scheme: GPT
  ID-3: /dev/sdb maj-min: 8:16 vendor: Western Digital
    model: WD30EFRX-68EUZN0 size: 2.73 TiB block-size: physical: 4096 B
    logical: 512 B speed: 6.0 Gb/s tech: HDD rpm: 5400 serial: <filter>
    fw-rev: 0A80 scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 122 GiB size: 122 GiB (100.00%) used: 58.76 GiB (48.2%)
    fs: btrfs dev: /dev/sda7 maj-min: 8:7 label: N/A
    uuid: 700d034d-b99a-482b-880b-9060acf3a6b3
  ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%)
    used: 608 KiB (0.1%) fs: vfat dev: /dev/sda5 maj-min: 8:5 label: N/A
    uuid: AC73-C072
  ID-3: /home raw-size: 104.53 GiB size: 104.53 GiB (100.00%)
    used: 8.83 GiB (8.4%) fs: btrfs dev: /dev/sda8 maj-min: 8:8 label: N/A
    uuid: 2a875645-5701-4450-bd08-adf1f966a07c
  ID-4: /media/diverse raw-size: N/A size: 3.56 TiB used: 1.81 TiB (51.0%)
    fs: cifs dev: /dev/diverse
  ID-5: /media/fil-fitt raw-size: 2.73 TiB size: 2.73 TiB (100.00%)
    used: 1.33 TiB (48.7%) fs: ntfs dev: /dev/sdb2 maj-min: 8:18
    label: Lilla Fil-fitt disken uuid: CE8C0EC38C0EA655
  ID-6: /media/games raw-size: 250 GiB size: 245.02 GiB (98.01%)
    used: 123.76 GiB (50.5%) fs: ext4 dev: /dev/nvme0n1p4 maj-min: 259:4
    label: Games uuid: ccfef3ee-65e0-45e4-aac2-4604ad2e696d
  ID-7: /var/cache raw-size: 122 GiB size: 122 GiB (100.00%)
    used: 58.76 GiB (48.2%) fs: btrfs dev: /dev/sda7 maj-min: 8:7 label: N/A
    uuid: 700d034d-b99a-482b-880b-9060acf3a6b3
  ID-8: /var/log raw-size: 122 GiB size: 122 GiB (100.00%)
    used: 58.76 GiB (48.2%) fs: btrfs dev: /dev/sda7 maj-min: 8:7 label: N/A
    uuid: 700d034d-b99a-482b-880b-9060acf3a6b3
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 38 GiB used: 0 KiB (0.0%) priority: -2
    dev: /dev/sda6 maj-min: 8:6 label: N/A
    uuid: 5ae8fbf5-a704-41ea-be6d-bf26b38325ed
Unmounted:
  ID-1: /dev/nvme0n1p1 maj-min: 259:1 size: 16 MiB fs: <superuser required>
    label: N/A uuid: N/A
  ID-2: /dev/nvme0n1p2 maj-min: 259:2 size: 480 GiB fs: ntfs label: Games
    uuid: 68A4C531A4C50294
  ID-3: /dev/nvme0n1p3 maj-min: 259:3 size: 201.5 GiB fs: ext4 label: backup
    uuid: 2b1e42bb-fe37-4fa1-991e-aab694b6b16f
  ID-4: /dev/sda1 maj-min: 8:1 size: 100 MiB fs: vfat label: WIN-BOOT
    uuid: 5483-0EFB
  ID-5: /dev/sda2 maj-min: 8:2 size: 16 MiB fs: <superuser required>
    label: N/A uuid: N/A
  ID-6: /dev/sda3 maj-min: 8:3 size: 200 GiB fs: ntfs label: windows
    uuid: 6654845D5484323B
  ID-7: /dev/sda4 maj-min: 8:4 size: 633 MiB fs: ntfs label: windows-extra
    uuid: E61A49731A4941B3
  ID-8: /dev/sdb1 maj-min: 8:17 size: 128 MiB fs: <superuser required>
    label: N/A uuid: N/A
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 12 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-2: 2-0:1 info: super-speed hub ports: 5 rev: 3.1
    speed: 20 Gb/s (2.33 GiB/s) lanes: 2 mode: 3.2 gen-2x2 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-3: 3-0:1 info: hi-speed hub with single TT ports: 12 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 3-2:2 info: Areson USB Device type: mouse,HID
    driver: hid-generic,usbhid interfaces: 2 rev: 1.1 speed: 12 Mb/s (1.4 MiB/s)
    lanes: 1 mode: 1.1 power: 100mA chip-ID: e0ff:0005 class-ID: 0300
  Device-2: 3-3:3 info: Microsoft Sidewinder X4 type: keyboard,HID
    driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s)
    lanes: 1 mode: 1.1 power: 500mA chip-ID: 045e:0768 class-ID: 0300
  Device-3: 3-6:4 info: Integrated Express RGB LED Controller type: HID
    driver: hid-generic,usbhid interfaces: 1 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s)
    lanes: 1 mode: 1.1 power: 100mA chip-ID: 048d:5702 class-ID: 0300
  Device-4: 3-7:5 info: MediaTek Wireless_Device type: bluetooth
    driver: btusb interfaces: 3 rev: 2.1 speed: 480 Mb/s (57.2 MiB/s) lanes: 1
    mode: 2.0 power: 100mA chip-ID: 0e8d:0616 class-ID: e001 serial: <filter>
  Hub-4: 4-0:1 info: super-speed hub ports: 5 rev: 3.1
    speed: 20 Gb/s (2.33 GiB/s) lanes: 2 mode: 3.2 gen-2x2 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-5: 5-0:1 info: hi-speed hub with single TT ports: 2 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-6: 6-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-7: 7-0:1 info: hi-speed hub with single TT ports: 2 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-8: 8-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-9: 9-0:1 info: hi-speed hub with single TT ports: 1 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-10: 9-1:2 info: Genesys Logic Hub ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 power: 100mA
    chip-ID: 05e3:0608 class-ID: 0900
  Hub-11: 10-0:1 info: Linux Foundation 3.0 root hub ports: N/A rev: 3.0
    speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 58.4 C mobo: N/A gpu: nvidia temp: 49 C
  Fan Speeds (RPM): N/A gpu: nvidia fan: 0%
Info:
  Processes: 447 Uptime: 11m wakeups: 0 Init: systemd v: 253 default: graphical
  tool: systemctl Compilers: gcc: 13.1.1 clang: 15.0.7 Packages: pm: pacman
  pkgs: 1414 libs: 393 tools: pamac,yay pm: flatpak pkgs: 0 Shell: Zsh v: 5.9
  default: Bash v: 5.1.16 running-in: yakuake inxi: 3.3.27

How is that manjaro-chroot messing up your grub?

You are the one forcibly using it - with manual mount points, etc.

Your problem is … you are doing it wrong and not accounting for your setup.

See … for example this thread:

https://bbs.archlinux.org/viewtopic.php?id=281487

If you’re going to chroot manually, then you need to make sure that /dev, /proc and /sys are mounted in the target root filesystem before chrooting into it. And if it’s a UEFI-native operating system, then you also need to make sure that /sys/firmware/efi/efivars is mounted as well — device efivarfs and type efivarfs.

/dev can be bind-mounted from the source, but the others have to be explicitly mounted with the syntax… :arrow_down:

mount -t type [-o options] device mountpoint

manjaro-chroot does not work with btrfs. A manual chroot is the only option there. It’s doable — I’ve already done it myself a few times — but you have to know what you’re doing. :wink:

2 Likes

I would LOVE to just type sudo manjaro-chroot -a but since I’m on btrfs, that does not work.

Sooooo, this is what I have to do if I want to chroot into a btrfs system?

Is there a wiki or a guide for the whole process since the one I linked to does not mention anything about that?

From where?
Do I check /proc/mounts and do it like there?
I really have no idea how to do this, but I wont give up. :slight_smile:

I will try to figure this out and type down the steps exactly because I can’t be the only one with the need to chroot into a btrfs system. And I find close to nothing about how to do it with my searches, but maybe I’m an idiot. It’s been said about me before… xD
As said, next time I HAVE to chroot this has to work, and imagine if this were to happen if I was in that situation. :open_mouth:

It’s all in my post that you replied to. But first and foremost, you have to make sure that you’re mounting the correct subvolume.

The way Calamares sets up btrfs is that it will mount a subvolume named “@” on the root filesystem to /. This is not the root directory of the btrfs volume, because the root directory is a nameless subvolume with subvolid=5, while the @ subvolume has subvolid=257.

So, your first command should be… :arrow_down:

sudo mount -t btrfs -o subvolid=257 /dev/something /mnt

Then next, you must mount all the other stuff… :arrow_down:

sudo mount --bind /dev /mnt/dev
sudo mount -t proc proc /mnt/proc
sudo mount -t sysfs sysfs /mnt/sys
sudo mount -t efivarfs efivarfs /sys/firmware/efi/efivars
sudo mount -t vfat /dev/something /mnt/boot/efi

And that’s just if you have /boot on the root filesystem, as opposed to on a separate partition, because if you have that separate, then you have to mount that too (to /mnt/boot), before you mount the EFI system partition to /mnt/boot/efi.

1 Like

Thank you, I would prob have figured out what you meant by mount -t type [-o options] device mountpoint but I’m not super versed in this so I HIGHLY appreciate the “code for dummies” version! :hearts:

I will try this out and come back with report and hopefully close the thread. :smiley:

Despite your use of thumbs … I can see you didnt click the link shared … where the user outlines manually mounting multiple points in order to ‘fix’ that ‘error’. But whatevs.

I’m sorry if I hurt you in some way, not my intention. :frowning:
I am not looking for a way to install grub, there was nothing in that link that has to do with chroot that I didn’t mention in my initial post.

When you use chroot - you are creating a confined space - but a space without system references.

manjaro-chroot - is like arch-chroot - in the sense it sets up the hardware environment as well - and that environment is necessary if you want to run e.g. grub-install

Report time:

I booted into a live env and ran:

sudo mount -t btrfs -o subvolid=257 /dev/sda7 /mnt 

Immediately fails on next step because if I ls /mnt it looks like this:

ls /mnt
cups  fontconfig  ldconfig  man  pacman  pkgfile  private  samba  swcatalog

So I umounted and used this instead:

sudo umount /mnt
sudo mount -o subvol=@ /dev/sda7 /mnt

then onwards with:

sudo mount --bind /dev /mnt/dev
sudo mount -t proc proc /mnt/proc

But when trying next step it did not work, because /sysfs is not an existing directory, but /sys is so i mounted it there. Is that correct?

#the line I was given to use that does not work:
sudo mount -t sysfs sys /mnt/sysfs

#I changed the mountpoint from sysfs to sys
sudo mount -t sysfs sys /mnt/sys

For efivars it states it is already mounted. If i ls the efivars directory it is empty though:

sudo mount -t efivarfs efivarfs /sys/firmware/efi/efivars
mount: /sys/firmware/efi/efivars: efivarfs already mounted on /sys/firmware/efi/efivars.
       dmesg(1) may have more information after failed mount system call.

Then successfully mounted my efi boot partition:

sudo mount -t vfat /dev/sda5 /mnt/boot/efi

I then tried to use manjaro-chroot:

sudo manjaro-chroot /mnt /bin/bash
mount: /mnt/sys: sys already mounted on /sys.
       dmesg(1) may have more information after failed mount system call.
==> ERROR: failed to setup API filesystems in chroot /mnt

If I instead use:

sudo chroot /mnt /bin/bash

I get my root promt, but running update grub produces the same error as before:

ERROR: mkdir /var/lock/dmraid

I did some more testing, because of the error message from manjaro-chroot I unmounted /mnt/dev and /mnt/sys and that let me use sudo manjaro-chroot and it brought me to the same root prompt as with chroot, but the error message from update-grub still persists.

This sadly did not fix it.

Any other advice?
I REALLY want to get this straight. Is MY COMPUTER different from other btrfs setups, have I changed something that makes this not work?

Using manjaro-chroot -a should do the heavy lifting for you.

If you have bind mounted the system folders beforehand then running manjaro-chroot will throw errors as you described - simply because the targets are already mounted.

Do you have something else mounted on /mnt?

Quite often you will see that /mnt is mentioned as a temporary mount point - used by various scripts and utilities.

So if you have used /mnt with subfolders for mounting your external devices etc. you may run into weird inexplainable issues.

Aaah, so I should run sudo manjaro-chroot -a instead of sudo manjaro-chroot /mnt /bin/bash after I have mounted all the stuff?

I will try that and come back with another report.
Thank you!

That would work too, yes. It is possible that the subvolid of your @ subvolume differs. On my system it’s 257. :man_shrugging:

Yes — it was a typo in my previous post, which I corrected shortly afterwards, but I guess you did not see the correction.

Don’t do that. manjaro-chroot was not designed to work with btrfs, and the results will be unpredictable.

Is your root filesystem on software RAID, by any chance? If so, then you need to set up the software RAID before mounting the root subvolume to /mnt.

Now I’m conflicted. I got advice to try sudo manjaro-chroot -a after all the mounting (see post above yours).
Are you saying to NEVER use manjaro-chroot but rather chroot?

I do not have any raid or lvm:s or anything like that. Only one disk per btrfs filesystem (no jbod or anything). Just a straight up install in btrfs with ONE difference, my /home is not mounted as a subvol, but that should make no difference in this correct?

I am saying that manjaro-chroot yields unpredictable results when used in combination with btrfs. Many people have already reported on this, because manjaro-chroot was created to work with more conventional filesystems, such as ext4.

So, with btrfs it is better to do the manual chroot.

Yes, that makes no difference. But is the drive set to AHCI in the UEFI? If it’s set to RAID then you’re going to run into issues, and then this here may be one of them.

My extended experience with btfs can be written on the backside of a stamp :slight_smile:

It is new to me though that manjaro-chroot is not working properly with btrfs.

My sincere apologies @bedna as I have no knowledge of @Aragorn statement.

1 Like

It’s in the fact that btrfs uses subvolumes. Every filesystem has a root directory, but btrfs can have multiple root directories within the same physical filesystem, and the layout of these subvolumes can differ greatly between different implementations.

I rebooted into my bios setup just to be sure, and its AHCI (sorry for my dusty monitor xD)

I was thinking it might have something to do with it.

But as I recall the mountpoint is defined in fstab also using btrfs - right?

I did think that advanced usage like splitting of /var /usr to separted partitions and mounting /usr readonly would create obstacles.

I had to increase my knowledge with some hands-on.

I installed my trusty test-gig using btrfs default layout, restarted onto install media and ran manjaro-chroot - it doesn’t work - just as @Aragorn mentioned.

Thank you for the enlightenment :+1:

1 Like

For your information about my mounts:

cat /proc/mounts                                                                                                                                                                                     ✔ 
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sys /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
dev /dev devtmpfs rw,nosuid,relatime,size=16232264k,nr_inodes=4058066,mode=755,inode64 0 0
run /run tmpfs rw,nosuid,nodev,relatime,mode=755,inode64 0 0
efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
/dev/sda7 / btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvolid=308,subvol=/@ 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev,inode64 0 0
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=33,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=23244 0 0
tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0
mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0
fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0
configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0
ramfs /run/credentials/systemd-sysctl.service ramfs ro,nosuid,nodev,noexec,relatime,mode=700 0 0
ramfs /run/credentials/systemd-tmpfiles-setup-dev.service ramfs ro,nosuid,nodev,noexec,relatime,mode=700 0 0
ramfs /run/credentials/systemd-vconsole-setup.service ramfs ro,nosuid,nodev,noexec,relatime,mode=700 0 0
systemd-1 /media/diverse autofs rw,relatime,fd=45,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=21991 0 0
/dev/sda7 /var/log btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@log 0 0
/dev/sda7 /var/cache btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@cache 0 0
/dev/sda8 /home btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/ 0 0
/dev/nvme0n1p4 /media/games ext4 rw,noatime 0 0
tmpfs /tmp tmpfs rw,noatime,inode64 0 0
/dev/sda5 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 0
ramfs /run/credentials/systemd-tmpfiles-setup.service ramfs ro,nosuid,nodev,noexec,relatime,mode=700 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
/dev/sdb2 /media/fil-fitt fuseblk rw,nosuid,nodev,noexec,noatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=3259640k,nr_inodes=814910,mode=700,uid=1000,gid=1000,inode64 0 0
portal /run/user/1000/doc fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0

And fstab:

cat /etc/fstab                                                                                                                                                                                       ✔ 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=AC73-C072                            /boot/efi      vfat    umask=0077 0 2
UUID=700d034d-b99a-482b-880b-9060acf3a6b3 /              btrfs   subvol=/@,defaults,discard=async,ssd 0 0
UUID=700d034d-b99a-482b-880b-9060acf3a6b3 /var/cache     btrfs   subvol=/@cache,defaults,discard=async,ssd 0 0
UUID=700d034d-b99a-482b-880b-9060acf3a6b3 /var/log       btrfs   subvol=/@log,defaults,discard=async,ssd 0 0
UUID=2a875645-5701-4450-bd08-adf1f966a07c /home          btrfs   defaults,discard=async,ssd 0 0
UUID=5ae8fbf5-a704-41ea-be6d-bf26b38325ed none           swap    defaults 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

Edit.
I also have systmd mounts, but they are not involved in his, but you can see them in cat /proc/mounts