Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

grub-mkconfig fails: version_find_latest command not found #458

Closed
irfanhakim-as opened this issue Aug 19, 2022 · 14 comments
Closed

grub-mkconfig fails: version_find_latest command not found #458

irfanhakim-as opened this issue Aug 19, 2022 · 14 comments

Comments

@irfanhakim-as
Copy link

irfanhakim-as commented Aug 19, 2022

Issue

During installation, linux-holoiso was chosen, since the default linux-neptune does not support WiFi on my machine. However at every boot, the system will boot into the first entry in grub, which is "SteamOS" and defaults to linux-neptune.

I'm sure if this is the expected behaviour, many others have the same issue as me too - where I'd have to manually get to my keyboard during boot and get into Advanced options and select the linux-holoiso submenu entry before it boots straight to linux-neptune.

I'm hoping someone can teach me the proper way for me to point grub to boot to linux-holoiso by default, instead of linux-neptune so that everything, including WiFi, works when I get into SteamOS.

I managed to do this previously using grub-customizer available on the Discover store in what I'm sure was a stupid, improper way and while it worked for a while, after the latest update, opening the app or manually running sudo grub-mkconfig returns the following error:

### BEGIN /etc/grub.d/LS_linux ###
/etc/grub.d/proxifiedScripts/linux: line 200: version_find_latest: command not found

Your device's full specs

CPU (and graphics): Ryzen 5 5600G
Mobo (including WiFi and Bluetooth): Gigabyte B550I Aorus Pro AX

Your OS version

Kernel: 5.18.1-arch1_testHoloISO_20220606.1811
OS variant: snapshot20220819.0846
OS version: 3.3
OS build: Stable (780b383a56)

@irfanhakim-as irfanhakim-as changed the title How to boot to linux-holoiso by default rather than linux-neptune grub-mkconfig fails: version_find_latest command not found Aug 19, 2022
@DaMushroomCloud
Copy link

DaMushroomCloud commented Aug 21, 2022

Device used: Aya Neo Retro Power (Same as Aya Neo 2021 Pro)

It seems that with any change that we apply on a user/system level for grub will be overwritten with a kernel update.

From my research, it seems that the grub files are being managed and updated from two other files, grub.d/proxifiedScripts/linux and grub, alongside kernel updates. It seems in this new kernel version we are unable to edit the grub.cfg file on our own because at the top it says the following:

grub.cfg

Command: sudo vim /boot/grub/grub.cfg

DO NOT EDIT THIS FILE

It is automatically generated by grub-mkconfig
using templates from /etc/grub.d and seetings from /etc/default/grub

Template N.o. 1 - grub

Command: sudo vim /etc/default/grub

GRUB_TIMEOUT=5

# Device specific configs
DEVICENAME=$(cat /sys/devices/virtual/dmi/id/product_name)
# OXP Devices
OXP_LIST="ONE XPLAYER:ONEXPLAYER 1 T08:ONEXPLAYER 1S A08:ONEXPLAYER 1S T08:ONEXPLAYER mini A07:ONEXPLAYER mini GA72:ONEXPLAYER mini GT72:ONEXPLAYER GUNDAM GA72:ONEXPLAYER 2 ARP23"
# AYANEO AIR Devices
AIR_LIST="AIR:AIR Pro"
# AYANEO Gen 1 Devices
AYA_LIST="Next:Some fucking thing i don't own right now"

# Define default cmdlines for each device family
if [ "${DEVICENAME}" == "Win600" ]; then
        GRUB_CMDLINE_LINUX_DEFAULT="video=efifb fbcon=rotate:1 quiet splash loglevel=3 rd.udev.log_priority=3 vt.global_cursor_default=0"
elif [[ ":$AIR_LIST:" =~ ":$DEVICENAME:"  ]]; then
        GRUB_CMDLINE_LINUX_DEFAULT="video=efifb fbcon=rotate:3 quiet splash loglevel=3 rd.udev.log_priority=3 vt.global_cursor_default=0"
elif [ "${DEVICENAME}" == "Jupiter 1" ]; then
        GRUB_CMDLINE_LINUX_DEFAULT="video=efifb fbcon=rotate:1 quiet splash loglevel=3 rd.udev.log_priority=3 vt.global_cursor_default=0"
elif [[ ":$OXP_LIST:" =~ ":$DEVICENAME:"  ]]; then
        GRUB_CMDLINE_LINUX_DEFAULT="video=efifb fbcon=rotate:3 quiet splash loglevel=3 rd.udev.log_priority=3 vt.global_cursor_default=0"
else
        GRUB_CMDLINE_LINUX_DEFAULT="quiet splash loglevel=3 rd.udev.log_priority=3 vt.global_cursor_default=0"
fi

# Define "breeze" Steam Deck GRUB Theme here
GRUB_THEME="/usr/share/grub/themes/breeze/theme.txt"

Template N.o. 2 - grub.d (Actual file in here is proxifiedScripts/linux)

Command: sudo vim /etc/grub.d
image

This actually looks like a navigational menu of some sort...what is interesting is inside the "proxifiedScripts/" section is where I think all the grub magic happens within the holoiso project team. There are some notes in there as what to fix and what is causing some issues.

Unfortunately, I fit into your same situation with trying to use Grub Customizer and I think we just have to wait and use a manual keyboard until this is fixed because our changes may be overwritten. Unless someone else has a solution. Manually editing the grub.cfg will break something for sure....

@theVakhovskeIsTaken
Copy link
Collaborator

Does this fix your issue?

holoiso-eol/grub-holoiso-pkgbuild@dea0956

@Muha0644
Copy link

@DaMushroomCloud :

This actually looks like a navigational menu of some sort...

No, it's a folder. When you pass a folder as an argument to vim it lets you traverse it. Whenever you see a .d in the name, it's a folder (d stands for directory)
grub-mkconfig uses all the files it finds inside that folder to generate the config file.

As name might suggest, /etc/default/grub is the template used to generate the UI. Then scripts found in the folder are run, which alter the template. The result is stored in /boot/grub/grub.cfg and is read on startup.
Manually editing /boot/grub/grub.cfg won't break anything, but will be overwritten whenever grub-mkconfig is run.
I recommend you RTFM

The error is very self explanatory: /etc/grub.d/proxifiedScripts/linux: line 200: version_find_latest: command not found: on line 200 there is a call to version_find_latest which does not exist anywhere.
A very simple fix is to just replace that line with

linux=`echo $list | tr ' ' '\n' | sort -V | head -1 | cat`

You can probably just delete that directory completely though, but I haven't tested that...

@DaMushroomCloud
Copy link

DaMushroomCloud commented Aug 24, 2022

Solution Found!

Note: If this solution does not work for you, download the latest holoiso image and try these steps with a fresh image.

TL;DR - Steps to fix (at least for Aya Neo 2021 Pro Model)

Note: You can skip steps 1-7 if you can't find the file in the directory or the entire directory in/etc/grub.d/proxifiedScripts/linux

  1. cd to /etc/grub.d/proxifiedScripts

  2. sudo vim etc/grub.d/proxifiedScripts/linux

  3. press esc and type :set number to see line numbers.

  4. Press 'i' key for insert mode

  5. Comment out line 200 or replace it with linux=`echo $list | tr ' ' '\n' | sort -V | head -1 | cat`
    the fix from the previous comment

  6. press esc and type :wq to save changes

  7. Exit Grub Customizer and launch it again to see if you can save changes.

  8. sudo vim /etc/default/grub

  9. press esc and type :set number

  10. navigate to lines 12-27 and comment them out with #

  11. press esc and type :wq to save the file

  12. launch Grub Customizer and make the changes by moving the steamos-holoiso to the top and moving steamos (neptune kernel) to the submenu


Details

Thanks for the suggestion. So the process I attempted was to replace line 200 in the
/etc/grub.d/proxifiedScripts/linux File from /etc/grub.d/proxifiedScripts/linux
to your line fix. saved the file using vim.

Then I ran sudo grub-mkconfig and launched Grub Customizer. I was able to get in. It gave me the error upon making trying to save changes.

The error said this:

Failed Saving grub configuration!

please take a look at the command line output.below. If you thik this is a bug of Grub Customizer, please create one at https://launchpad.net/grub-customizer! Generally Grub Customizer should prevent errors like this.

Failed running grub-mkconfig -o "/boot/grub/grub.cfg" output:
/etc/default/grub: line 15: syntax error near unexpected token elif

I went into that file /etc/default/grub and commented out all lines in the section header: # Define default cmdlines for each device family (lines 12-27)

I was able to save the configuration of moving SteamOS, with Linux-holoiso to the top, I already had it at the top from the previous config before the update anyway, and in Grub Customizer I saved it and rebooted. successfully. See image attached.

For the dev

Just default it to the linux-holoiso kernel. Removing your if-else statements based on which device it is seemed to allow grub-customizer to work. I'm no expert but this was a solution. Make an image with linux-neptune, and an image with linux-holoiso. I'm not totally on the same page as your mindset for how you designed this for other users who are NVIDIA or INTEL but for us AMD users, I can confirm that doing this fixed our problem on my Aya Neo 2021 Pro. Might be something to look into for future updates.

20220824_094516

@ConvexTlc97
Copy link

ConvexTlc97 commented Aug 31, 2022

Solution Found!

Note: If this solution does not work for you, download the latest holoiso image and try these steps with a fresh image.

TL;DR - Steps to fix (at least for Aya Neo 2021 Pro Model)

Note: You can skip steps 1-7 if you can't find the file in the directory or the entire directory in/etc/grub.d/proxifiedScripts/linux

  1. cd to /etc/grub.d/proxifiedScripts
  2. sudo vim etc/grub.d/proxifiedScripts/linux
  3. press esc and type :set number to see line numbers.
  4. Press 'i' key for insert mode
  5. Comment out line 200 or replace it with linux=`echo $list | tr ' ' '\n' | sort -V | head -1 | cat`
    the fix from the previous comment
  6. press esc and type :wq to save changes
  7. Exit Grub Customizer and launch it again to see if you can save changes.
  8. sudo vim /etc/default/grub
  9. press esc and type :set number
  10. navigate to lines 12-27 and comment them out with #
  11. press esc and type :wq to save the file
  12. launch Grub Customizer and make the changes by moving the steamos-holoiso to the top and moving steamos (neptune kernel) to the submenu

Details

Thanks for the suggestion. So the process I attempted was to replace line 200 in the /etc/grub.d/proxifiedScripts/linux File from /etc/grub.d/proxifiedScripts/linux to your line fix. saved the file using vim.

Then I ran sudo grub-mkconfig and launched Grub Customizer. I was able to get in. It gave me the error upon making trying to save changes.

The error said this:

Failed Saving grub configuration!

please take a look at the command line output.below. If you thik this is a bug of Grub Customizer, please create one at https://launchpad.net/grub-customizer! Generally Grub Customizer should prevent errors like this.

Failed running grub-mkconfig -o "/boot/grub/grub.cfg" output: /etc/default/grub: line 15: syntax error near unexpected token elif

I went into that file /etc/default/grub and commented out all lines in the section header: # Define default cmdlines for each device family (lines 12-27)

I was able to save the configuration of moving SteamOS, with Linux-holoiso to the top, I already had it at the top from the previous config before the update anyway, and in Grub Customizer I saved it and rebooted. successfully. See image attached.

For the dev

Just default it to the linux-holoiso kernel. Removing your if-else statements based on which device it is seemed to allow grub-customizer to work. I'm no expert but this was a solution. Make an image with linux-neptune, and an image with linux-holoiso. I'm not totally on the same page as your mindset for how you designed this for other users who are NVIDIA or INTEL but for us AMD users, I can confirm that doing this fixed our problem on my Aya Neo 2021 Pro. Might be something to look into for future updates.

20220824_094516

I had to define line 29 as well in the grub file to be able to edit and save with grub customizer! But this temp fix is working for me. Not on a Neo myself but still this helped.

@frazar
Copy link

frazar commented Sep 3, 2022

I did some digging. Apperently the cause of the issue is that the /etc/grub.d/proxifiedScripts/linux script used the version_find_latest() function, which has been removed in GRUB on 2022-07-04.

@frazar
Copy link

frazar commented Sep 3, 2022

Here is the commit in the GRUB repo showing how to replace the calls to the version_find_latest() function.

I attach a patch based on these edits to apply the fixes automatically.
Use as follows:

# cd /etc/grub.d/proxifiedScripts
# sudo patch -p0 < /path/to/downloaded/etc_grub.d_proxifiedScripts_linux.patch

@ktnlikeasmallcat
Copy link

I'm getting this in linux.orig as well, after applying this patch.

@frazar
Copy link

frazar commented Sep 6, 2022

You may try to making a backup copy and apply the same changes to the linux.orig file.

@ktnlikeasmallcat
Copy link

ktnlikeasmallcat commented Sep 6, 2022

Thank you! Trying that now. Are there any changes other than these?

202 is_top_level=true
203 #while [ "x$list" != "x" ] ; do
204 #  linux=`version_find_latest $list`
205 #  gettext_printf "Found linux image: %s\n" "$linux" >&2
206 #  basename=`basename $linux`
207 for linux in ${reverse_sorted_list}; do
208   gettext_printf "Found linux image: %s\n" "$linux" >&2
209   basename=`basename $linux`
210   dirname=`dirname $linux`

@frazar
Copy link

frazar commented Sep 6, 2022

Yes there are! You can open the .patch with your text editor and see exactly which lines should be removed (lines starting with -) and which should be added (lines starting with +).

@ktnlikeasmallcat
Copy link

ktnlikeasmallcat commented Sep 6, 2022

I tried re-running the patch on the first file earlier before coming here for some reason, before seeing that linux.orig needed the patch, and it seems it did something to / created / im-not-sure /etc/grub.d/LS_linux.rej which is a bash script that just calls /etc/grub.d/proxifiedScripts/linux.rej when it detected I was trying to re-apply a patch that has already been applied.

I'm now getting after running update-grub

/etc/grub.d/LS_linux.rej: line 2: /etc/grub.d/proxifiedScripts/linux.rej: Permission denied 

Do I need this linux.rej file or is it just come kind of log? Do I need to chmod +x it? It looks a lot like etc_grub.d_proxifiedScripts_linux.patch. I'm going to test just moving it to .bkp and seeing if update grub runs.

Also just for context I'm having to start LightDM manually from TTY1, because something it going haywire with my boot.

@ktnlikeasmallcat
Copy link

After doing # mv linux.rej linux.rej.bkp and removing etc/grub.d/LS_linux.rej , LS_linux.rej is recreated. /etc/grub.d/proxifiedScripts/linux.rej has on second glance the same contents as the patch.
After removing both the .rej files, I can update-grub.

Hopefully this extra documentation can save someone a confuse.

@abudis
Copy link

abudis commented Nov 12, 2023

The patch was failing for me, because the contents were slightly different, so I had to manually find and replace the lines from the patch in the linux file. Hope this helps someone!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants