You are not logged in.

#1 2020-03-26 20:43:23

Stargarth
Member
Registered: 2020-02-08
Posts: 21

[SOLVED] Add "system setup" option to GRUB

Hi fellow archers!

Back in the old days, when I was using Ubuntu GRUB had this nice option "system setup". It reboots the machine and gets you to UEFI bios.

When I reinstalled my system with arch, my grub doesn't have this option anymore.
Do you guys know how to set my GRUB so I have this option again?
It looks something like this: https://i.stack.imgur.com/6UTmy.jpg

Last edited by Stargarth (2020-03-26 22:17:12)

Offline

#2 2020-03-26 21:02:34

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Add "system setup" option to GRUB

https://gist.github.com/Head-on-a-Stick … c094874903

^ Put that in /etc/grub.d/ and run grub-mkconfig(8).

Or just use this if you make your own grub.cfg:

menuentry 'System setup' {
   fwsetup
}

Offline

#3 2020-03-26 21:49:15

Stargarth
Member
Registered: 2020-02-08
Posts: 21

Re: [SOLVED] Add "system setup" option to GRUB

Hi Head, thanks for the reply!

I took following steps:
1. I took your script from github and I've put it into /etc/grub.d/ . I gave it exactly the same name "30_uefi-firmware"
2. I made "30_uefi-firmware" executable via chmod +x
3. I've run "sudo grub-mkconfig -o /boot/grub/grub.cfg". Before that I backed up and removed my old grub.cfg

Unfortunately that didn't work. I don't have that additional "system setup" entry. It just stopped detecting my dual boot windows installation (I backed up my old config so np).

----------------------------------UPDATE----------------------------------

I just added this to the end of my grub.cfg file:

menuentry 'System setup' {
   fwsetup
}

I guess it's a sub-optimal solution, since this code will disappear when I will generate new grub.cfg. However, this is good enough for me, so case closed.

I post my grub.cfg just in case somebody else would have any problems:

#
# 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 ext2
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  c8953a0e-d91c-4261-b425-4637a941dd24
else
  search --no-floppy --fs-uuid --set=root c8953a0e-d91c-4261-b425-4637a941dd24
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
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-c8953a0e-d91c-4261-b425-4637a941dd24' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod fat
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  FAB1-5D84
        else
          search --no-floppy --fs-uuid --set=root FAB1-5D84
        fi

        echo    'Loading Linux linux ...'
        linux   /vmlinuz-linux root=UUID=c8953a0e-d91c-4261-b425-4637a941dd24 rw  loglevel=3 quiet
        echo    'Loading initial ramdisk ...'
        initrd  /amd-ucode.img /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-c8953a0e-d91c-4261-b425-4637a941dd24' {
        menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-c8953a0e-d91c-4261-b425-4637a941dd24' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod fat
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  FAB1-5D84
                else
                  search --no-floppy --fs-uuid --set=root FAB1-5D84
                fi
                echo    'Loading Linux linux ...'
                linux   /vmlinuz-linux root=UUID=c8953a0e-d91c-4261-b425-4637a941dd24 rw  loglevel=3 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /amd-ucode.img /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-c8953a0e-d91c-4261-b425-4637a941dd24' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod fat
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  FAB1-5D84
                else
                  search --no-floppy --fs-uuid --set=root FAB1-5D84
                fi
                echo    'Loading Linux linux ...'
                linux   /vmlinuz-linux root=UUID=c8953a0e-d91c-4261-b425-4637a941dd24 rw  loglevel=3 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /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/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-efi-5293-060D' {
        insmod part_gpt
        insmod fat
        set root='hd0,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  5293-060D
        else
          search --no-floppy --fs-uuid --set=root 5293-060D
        fi
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_os-prober ###

menuentry 'System setup' {
   fwsetup
}

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

Last edited by Stargarth (2020-03-26 22:15:13)

Offline

#4 2020-03-26 22:03:09

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Add "system setup" option to GRUB

Oh dear, that is disappointing. I just ripped the file from Ubuntu's grub-common package, didn't test it at all (I write my own grub.cfg).

Remove /etc/grub.d/30_uefi-firmware, regenerate your grub.cfg to get back your Windows entry and then add my posted three line stanza to /boot/grub/custom.cfg — I've tested that on my machine and it works.

See also https://wiki.archlinux.org/index.php/GR … UEFI_only)

Offline

#5 2020-03-26 22:16:46

Stargarth
Member
Registered: 2020-02-08
Posts: 21

Re: [SOLVED] Add "system setup" option to GRUB

Head_on_a_Stick wrote:

Oh dear, that is disappointing. I just ripped the file from Ubuntu's grub-common package, didn't test it at all (I write my own grub.cfg).

Remove /etc/grub.d/30_uefi-firmware, regenerate your grub.cfg to get back your Windows entry and then add my posted three line stanza to /boot/grub/custom.cfg — I've tested that on my machine and it works.

See also https://wiki.archlinux.org/index.php/GR … UEFI_only)

Hah, I did exactly that just before your reply big_smile. I've updated my previous post just in case if somebody else would have the same problem.
Thanks for the help!

Last edited by Stargarth (2020-03-26 22:17:29)

Offline

#6 2020-03-26 22:21:26

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Add "system setup" option to GRUB

Stargarth wrote:

I guess this is a sub-optimal solution, since this code will disappear when I will generate new grub.cfg.

Use /boot/grub/custom.cfg instead, that file is sourced by /etc/grub.d/41_custom and so will survive future updates.

Offline

#7 2020-03-26 22:44:38

Stargarth
Member
Registered: 2020-02-08
Posts: 21

Re: [SOLVED] Add "system setup" option to GRUB

uhhh I think I messed up. I renamed grub.cfg to custom.cfg and I rebooted the system. It now boots into grub console. Could you please help me to solve that Head_on_a_Stick ;/ ?

Offline

#8 2020-03-26 22:46:34

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Add "system setup" option to GRUB

Stargarth wrote:

I renamed grub.cfg to custom.cfg

No, I meant that you should add custom.cfg as well as grub.cfg rather than instead of.

You'll have to restore grub.cfg, either from your backup or by (arch-)chrooting in from a live ISO and using grub-mkconfig.

EDIT: or boot your system from the GRUB prompt then use grub-mkconfig.

Last edited by Head_on_a_Stick (2020-03-26 22:48:28)

Offline

#9 2020-03-26 23:02:30

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,864
Website

Re: [SOLVED] Add "system setup" option to GRUB

I haven't used grub in years, but can't you just load the config file at the prompt?

https://www.gnu.org/software/grub/manua … configfile


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#10 2020-03-26 23:06:09

Stargarth
Member
Registered: 2020-02-08
Posts: 21

Re: [SOLVED] Add "system setup" option to GRUB

Sorry for trouble guys! I managed to recover from live ISO. I mounted my partitions, found unfortunate "custom.cfg" and renamed it back to grub.cfg.
Oh well, maybe those posts will save somebody else from doing that :-) .

Offline

Board footer

Powered by FluxBB