You are not logged in.

#1 2025-03-30 00:21:26

dabrown645
Member
Registered: 2025-03-29
Posts: 3

arch-chroot /mnt cmd not working

I am working on project to automate my arch installation and am running into issues where commands run via "arch-chroot /mnt cmd" don't work.

grub-install and grub-mkconfig in particular

arch-chroot /mnt
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Arch
grub-mkconfig -o /boot/grub/grub.cfg

gives me a working bootable system

arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Arch
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg

gives me following on reboot

BdsDxe: failed to load Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x9.0x0): Not Found

I have had similar problems with other commands timedatectl for example but have been able to work around them

Offline

#2 2025-03-30 00:32:20

mackin_cheese
Member
Registered: 2025-01-07
Posts: 445

Re: arch-chroot /mnt cmd not working

I'm lost, why is arch-chroot showing up twice in your script? it should only be there once no?

Offline

#3 2025-03-30 12:41:21

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,564

Re: arch-chroot /mnt cmd not working

According to the man page it is a supported use , but are you sure grub-install & grub-mkconfig can function without a shell like /bin/bash ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#4 2025-03-30 23:42:06

dabrown645
Member
Registered: 2025-03-29
Posts: 3

Re: arch-chroot /mnt cmd not working

arch-chroot /mnt cmd

is issued for script in arch live environment to run the command in the new system being installed so it has to be there for each command executed by the script

Offline

#5 2025-03-31 07:14:30

seth
Member
Registered: 2012-09-03
Posts: 63,021

Re: arch-chroot /mnt cmd not working

So, I barely speak english, but I can't make hats and nails out of what you're trying to say there.
Just have your script chroot into the system and continue there?

Offline

#6 2025-03-31 08:22:57

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: arch-chroot /mnt cmd not working

@seth: I think the OP is trying to create an installation script that uses arch-chroot to run individual commands in the installation environment.

dabrown645 wrote:
BdsDxe: failed to load Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x9.0x0): Not Found

Please share the content of /boot/grub/grub.cfg and the output of

efibootmgr -u

^ That can be run from any live ISO.

Does the system boot if you add the --removable flag to the grub-install command in your script?


Jin, Jîyan, Azadî

Offline

#7 2025-03-31 13:07:37

seth
Member
Registered: 2012-09-03
Posts: 63,021

Re: arch-chroot /mnt cmd not working

ftr, I understand what the OP is trying to do, but not the chosen approach nor it's explanation (assuming #4 is supposd to be that)

Offline

#8 2025-04-01 00:37:30

dabrown645
Member
Registered: 2025-03-29
Posts: 3

Re: arch-chroot /mnt cmd not working

Requested output:

cat /mnt/archinstall/boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod btrfs
search --no-floppy --fs-uuid --set=root bf05b68d-7be5-4f38-9eca-ef82e79cf7a4
    font="/@/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-bf05b68d-7be5-4f38-9eca-ef82e79cf7a4' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root bf05b68d-7be5-4f38-9eca-ef82e79cf7a4
        echo    'Loading Linux linux-zen ...'
        linux   /@/boot/vmlinuz-linux-zen root=UUID=bf05b68d-7be5-4f38-9eca-ef82e79cf7a4 rw rootflags=subvol=@  loglevel=3 quiet
        echo    'Loading initial ramdisk ...'
        initrd  /@/boot/intel-ucode.img /@/boot/initramfs-linux-zen.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-bf05b68d-7be5-4f38-9eca-ef82e79cf7a4' {
        menuentry 'Arch Linux, with Linux linux-zen' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-zen-advanced-bf05b68d-7be5-4f38-9eca-ef82e79cf7a4' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                search --no-floppy --fs-uuid --set=root bf05b68d-7be5-4f38-9eca-ef82e79cf7a4
                echo    'Loading Linux linux-zen ...'
                linux   /@/boot/vmlinuz-linux-zen root=UUID=bf05b68d-7be5-4f38-9eca-ef82e79cf7a4 rw rootflags=subvol=@  loglevel=3 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /@/boot/intel-ucode.img /@/boot/initramfs-linux-zen.img
        }
        menuentry 'Arch Linux, with Linux linux-zen (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-zen-fallback-bf05b68d-7be5-4f38-9eca-ef82e79cf7a4' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                search --no-floppy --fs-uuid --set=root bf05b68d-7be5-4f38-9eca-ef82e79cf7a4
                echo    'Loading Linux linux-zen ...'
                linux   /@/boot/vmlinuz-linux-zen root=UUID=bf05b68d-7be5-4f38-9eca-ef82e79cf7a4 rw rootflags=subvol=@  loglevel=3 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /@/boot/intel-ucode.img /@/boot/initramfs-linux-zen-fallback.img
        }
        menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-bf05b68d-7be5-4f38-9eca-ef82e79cf7a4' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                search --no-floppy --fs-uuid --set=root bf05b68d-7be5-4f38-9eca-ef82e79cf7a4
                echo    'Loading Linux linux ...'
                linux   /@/boot/vmlinuz-linux root=UUID=bf05b68d-7be5-4f38-9eca-ef82e79cf7a4 rw rootflags=subvol=@  loglevel=3 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /@/boot/intel-ucode.img /@/boot/initramfs-linux.img
        }
        menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-bf05b68d-7be5-4f38-9eca-ef82e79cf7a4' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                search --no-floppy --fs-uuid --set=root bf05b68d-7be5-4f38-9eca-ef82e79cf7a4
                echo    'Loading Linux linux ...'
                linux   /@/boot/vmlinuz-linux root=UUID=bf05b68d-7be5-4f38-9eca-ef82e79cf7a4 rw rootflags=subvol=@  loglevel=3 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /@/boot/intel-ucode.img /@/boot/initramfs-linux-fallback.img
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/25_bli ###
if [ "$grub_platform" = "efi" ]; then
  insmod bli
fi
### END /etc/grub.d/25_bli ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
if [ "$grub_platform" = "efi" ]; then
        fwsetup --is-supported
        if [ "$?" = 0 ]; then
                menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
                        fwsetup
                }
        fi
fi
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###


efibootmgr -u
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0008,0000,0001,0002,0003,0004,0005,0006,0007
Boot0000* UiApp    FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* UEFI QEMU DVD-ROM QM00001     PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0,65535,0)걎脈鼑䵙຅᫢ⱒ뉙
Boot0002* UEFI Misc Device    PciRoot(0x0)/Pci(0x9,0x0)걎脈鼑䵙຅᫢ⱒ뉙
Boot0003* UEFI PXEv4 (MAC:525400123456)    PciRoot(0x0)/Pci(0x8,0x0)/MAC(525400123456,1)/IPv4(0.0.0.0,0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0)걎脈鼑䵙຅᫢ⱒ뉙
Boot0004* UEFI PXEv6 (MAC:525400123456)    PciRoot(0x0)/Pci(0x8,0x0)/MAC(525400123456,1)/IPv6([::],0,Static,[::],[::],64)걎脈鼑䵙຅᫢ⱒ뉙
Boot0005* UEFI HTTPv4 (MAC:525400123456)    PciRoot(0x0)/Pci(0x8,0x0)/MAC(525400123456,1)/IPv4(0.0.0.0,0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0)/Uri()걎脈鼑䵙຅᫢ⱒ뉙
Boot0006* UEFI HTTPv6 (MAC:525400123456)    PciRoot(0x0)/Pci(0x8,0x0)/MAC(525400123456,1)/IPv6([::],0,Static,[::],[::],64)/Uri()걎脈鼑䵙຅᫢ⱒ뉙
Boot0007* EFI Internal Shell    FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
Boot0008* Arch    HD(1,GPT,095f914a-8299-4508-bafa-478105ce9f57,0x800,0x200000)/\EFI\Arch\grubx64.efi

Offline

#9 2025-04-01 06:18:02

seth
Member
Registered: 2012-09-03
Posts: 63,021

Re: arch-chroot /mnt cmd not working

Please use [code][/code] tags. Edit your post in this regard.

And explain why you're trying to chroot every command individually, in doubt use https://deepl.com/

Offline

#10 2025-04-01 14:37:48

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,842
Website

Re: arch-chroot /mnt cmd not working

@OP: try deactivating the problematic boot entry:

# efibootmgr --inactive 1

You didn't answer my question: does the --removable flag for grub-install allow you to boot the drive?

Note that grub-install doesn't actually need arch-chroot:

grub-install --target=x86_64-efi --boot-directory=/mnt/boot --efi-directory=/mnt/boot/efi --bootloader-id=Arch --removable

Jin, Jîyan, Azadî

Offline

Board footer

Powered by FluxBB