[SOLVED]Grub claims it can't find /etc/os-release

Started by seasons, 2025/06/12, 03:27:46

Previous topic - Next topic

seasons

When I run update-grub, I get:
/usr/sbin/grub-mkconfig: 1: /etc/default/grub:  . /etc/os-release : not found


/etc/os-release is a valid file though (link to /usr/lib/os-release)/
It's a good thing I kept the old line, because that still works. Is this a bug or did I do something wrong?

GRUB_DEFAULT=0
GRUB_TIMEOUT=10
#GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Debian} ) 2>/dev/null || echo Debian`
GRUB_DISTRIBUTOR=`( . /etc/os-release && echo ${NAME} )`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""



dibl

Three siduction systems updated so far today -- no problems with any packages including grub.
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.

eriefisher

#2
Just checked and my file is different from yours. Not sure why?
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=6b753de0-cd23-44f9-96d7-8b69f53a09ff systemd.show_status=1"
GRUB_CMDLINE_LINUX=""


What do you get when you run:
. /etc/os-release && echo ${NAME}
I AM CANADIAN!

scholle1

#3
Hi @seasons.
Your query is unclear.
Which is your old line?
The commented-out line contains the better function.

With
# ls -l /etc/os-ralease
you can recognize whether it is a file or a link, or a broken link.

For both lines with "GRUB_DISTRIBUTOR", grub terminates with an error message if /etc/os-ralease is not found. Only the error message differs.
Therefore: Check the files or the link. (/etc/os-ralease and /usr/lib/os-release)
"Pax in terris" - Das ist mein großer, mein einzigster für diese Welt von Herzen kommender Wunsch.
"Friede auf Erden" und alles Weitere erscheint einfach.

seasons

Quote from: scholle1 on 2025/06/12, 20:41:53
Which is your old line?
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Debian} ) 2>/dev/null || echo Debian`

The new line was what I copied when apt prompted me to keep the old version or install the new one (because I increased the timeout).

QuoteWith
# ls -l /etc/os-release
you can recognize whether it is a file or a link, or a broken link.
Yes, /etc/os-release is a valid file (link to /usr/lib/os-release, which is also a valid file).

Quote from: eriefisher on 2025/06/12, 20:40:50
Just checked and my file is different from yours. Not sure why?

I don't know why either, but I just changed it to:
GRUB_DISTRIBUTOR="Debian"
Good enough for me. It seems like this was what the old command was effectively doing anyway since the /etc/os-release thing was failing.

Thanks to all who responded.