LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-31-2020, 05:23 PM   #1
Teso
Member
 
Registered: Apr 2019
Posts: 63

Rep: Reputation: Disabled
Question How to change "--class" in GRUB2 boot loader?


Hello,
how do i change the "-class" in the GRUB2 boot loader?
The "--class" shows wrong pictures, operating systems are not correctly recognized by the GRUB2. I would also like to insert a picture (--class) in the submenu, BIOS/UEFI-menu and remove some of the "--class" entries.
Code:
menuentry "Kubuntu 20.04 - GNU/Linux (kernel-5.4.0.42-generic)" --class ubuntu --class gnu-linux --class gnu --class os
 
Old 08-01-2020, 05:35 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Looking at this page (did you?), "class" is mentioned several times.
What I took away after a few minutes:
  • grub-mkconfig creates the grub menu. It either has direct options to change its behaviour or can be influenced through variables in /etc/default/grub
  • it's possible to override which images are displayed by placing appropriate files in "grub/themes/icons" (my guess: /boot/grub/themes/icons)
 
Old 08-01-2020, 06:08 AM   #3
Teso
Member
 
Registered: Apr 2019
Posts: 63

Original Poster
Rep: Reputation: Disabled
Thank you,
I have this GNU GRUB Manual 2.04 in .pdf.
I don't want to learn GRUB I just want to add or change this one command (class). That's why I'm asking here.

---EDIT---

As I understand it, I have to add this line:
Code:
menuentry title [--class=class …] [--users=users] [--unrestricted] [--hotkey=key] [--id=id] { command; … }
to the "/etc/default/grub" and edit it to get the variable in "/boot/grub/grub.conf" after "update-grub".
What do I have to change now to get the desired result?
I have "Kubuntu OS" and I liked that the right picture is shown in the menu (kubuntu.png).

Code:
menuentry kubuntu [--class=kubuntu …] { command; ???? }

Last edited by Teso; 08-01-2020 at 07:38 AM.
 
Old 08-01-2020, 12:13 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Teso View Post
As I understand it, I have to add this line:
Code:
menuentry title [--class=class …] [--users=users] [--unrestricted] [--hotkey=key] [--id=id] { command; … }
to the "/etc/default/grub" and edit it to get the variable in "/boot/grub/grub.conf" after "update-grub".
No.
You don't edit /boot/grub/grub.cfg manually.
Please check all the variables you can add to /etc/default/grub.
Also check the man pages for grub-mkconfig and/or grub2-mkconfig and/or update-grub.

I don't use grub anymore, so I can't check myself.
 
Old 08-01-2020, 10:41 PM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by ondoho View Post
No.
You don't edit /boot/grub/grub.cfg manually.
Please check all the variables you can add to /etc/default/grub.
I believe that you have to edit grub.cfg manually to change the --class options. Or at least the files in /etc/grub.d. I didn't see anything in /etc/default/grub that impacts class.

Depending on the distro and the type of BIOS, grub.cfg might not be in /boot/grub.

Last edited by berndbausch; 08-01-2020 at 10:42 PM.
 
Old 08-26-2020, 05:17 PM   #6
Teso
Member
 
Registered: Apr 2019
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
I believe that you have to edit grub.cfg manually to change the --class options. Or at least the files in /etc/grub.d. I didn't see anything in /etc/default/grub that impacts class
Yes that's right. The problem is that after every kernel upgrade
Code:
update-grub
is executed, the grub.cfg gets reseted and I have to edit the grub.cfg again.
After executing
Code:
update-grub
I would like to have the right images at the right place automatically.
 
Old 08-26-2020, 05:45 PM   #7
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,413

Rep: Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599
Maybe edit /etc/grub.d/10_linux or the one that has theme in the name. This file may get replaced if there is an update to the grub package.

Last edited by colorpurple21859; 08-26-2020 at 05:46 PM.
 
Old 08-26-2020, 08:02 PM   #8
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,413

Rep: Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599
scatch my other post, edit or add this line to /etc/default/grub:

GRUB_DISTRIBUTOR="Kubuntu"

run update-grub

Last edited by colorpurple21859; 08-26-2020 at 08:26 PM.
 
Old 08-28-2020, 09:57 AM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Teso View Post
Yes that's right. The problem is that after every kernel upgrade
Code:
update-grub
is executed, the grub.cfg gets reseted and I have to edit the grub.cfg again.
After executing
Code:
update-grub
I would like to have the right images at the right place automatically.
That's because you're not supposed to edit that file directly.
I believe it even says so at the top.
/etc/default/grub is what you want to edit.
 
Old 08-29-2020, 01:15 AM   #10
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,764

Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
That's because you're not supposed to edit that file directly.
Some distributions don't update-grub on kernel upgrade, but instead simply symlink the new kernel where the old one used to be.
In which case, there's nothing wrong with editing that file directly. It'll still work as a static file just like menu.lst or lilo.conf.
 
  


Reply

Tags
class, config, grub, grub 2, menu



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change the GRUB2 Boot Loader Background Image? theif519 Linux - Newbie 3 05-01-2011 09:37 PM
[SOLVED] GRUB2 after a minor update of GRUB2 /boot prefix no longer needed?? wikapuki Linux - Software 1 10-24-2010 02:39 PM
I want to remove ubuntu boot loader and use windows boot loader RUshabh55 Linux - Newbie 9 11-29-2009 07:01 PM
How to change from grub boot loader to lilo boot loader linuxjamil Linux - Software 1 05-27-2008 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration