LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-08-2018, 07:00 PM   #1
xelidus
LQ Newbie
 
Registered: Jun 2018
Posts: 2

Rep: Reputation: Disabled
Editing grub.cfg for fun - changes aren't applied


I'm exploring how grub works, so I changed one of the lines in grub.cfg (I realize this isn't the way it's done, this is just for fun), to

Code:
echo	'Loading Linux linux ... Hello World!'
and also the text of a couple of other menu entries.

But when I reboot, the changes don't show. The second answer to this question (https://askubuntu.com/questions/4373...-edit-grub-cfg) suggests that this should be possible. Am I overlooking something? I haven't updated grub or the kernel, so grub.cfg has the changes after the reboot. Any ideas?
 
Old 06-08-2018, 08:49 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by gurb.cfg
$ sudo cat /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
#
if you want to put echos in your grub, use /etc/default/grub instead. Then update grub, then reboot, then look for your results. (in that order)

oh yes, 40_custom should work too.

Last edited by BW-userx; 06-08-2018 at 08:53 PM.
 
Old 06-08-2018, 09:12 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
All irrelevant. The OP is trying to learn, and changing the .cfg should certainly work for this purpose.

Maybe the wrong file is being updated.
 
Old 06-08-2018, 09:15 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
no, any changes to grub.cfg will be removed as a new grub.cfg is generated at time of updating it using update-grub. ( grub2)

Last edited by BW-userx; 06-08-2018 at 09:24 PM.
 
Old 06-09-2018, 04:12 AM   #5
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
OP, are you dual-booting?

which file are you editing, and how (sudo...)?

also, it is worth noting that any kernel update will likely trigger an update-grub, which would overwrite your changes.
 
Old 06-09-2018, 06:45 AM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,537

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
Are you doing this on an installed system or are you using a Live DVD or flash drive. If it is a Live system, no changes will be saved on reboot. If it is an installed system and you are making the change in grub.cfg file and saving the change as root (sudo), then the change should be there on reboot. If you run grub-mkconfig after the change is made, it will be lost. A kernel update will usually run grub-mkconfig so any edits to grub.cfg will also be lost in this case.
 
Old 06-09-2018, 09:16 AM   #7
xelidus
LQ Newbie
 
Registered: Jun 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled
@yancek, @BW-userx: This is on an installed system, and I am not running grub-mkconfig, or updating the kernel - grub.cfg has my changes after rebooting, as well.

@ondoho: Yes, I am dual booting, OSX with ArchLinux. I think I changed boot.efi or something to recognize Arch, so it starts with Apple's booting screen, and then it passes on to grub once I select Arch. It's the grub.cfg corresponding to Arch I'm editing (I hope). Could this be a problem?

Also, I'm using sudo emacs grub.cfg.

@syg00: I'm positive I'm changing /boot/grub/grub.cfg, is there any other file that grub takes information from?
 
Old 06-09-2018, 01:46 PM   #8
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
dual booting with another linux might have been important, but i don't think osx uses grub...

editing /boot/grub/grub.cfg should surely show some effect.
are you sure that nothing performs a grub update in between?
if yes, i suggest you keep trying different things with your /boot/grub/grub.cfg until you can see the effect.
BTW, there's a package to preview grub themes, in AUR. so you don't have to reboot.
 
Old 06-09-2018, 02:47 PM   #9
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,537

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
Quote:
I'm positive I'm changing /boot/grub/grub.cfg, is there any other file that grub takes information from?
There are numerous other grub files but none relevant for your purposes. Are you able to boot Arch? If you can you might post the relevant menuentries, at least the section(s) which you changed so we can see where they are entered.
 
Old 06-11-2018, 09:32 AM   #10
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
default/grub

Code:
$ cat /etc/default/grub

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true


echo "BURP"

> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-4.14-x86_64-fallback.img
==> Image generation successful
( 3/20) Updating Grub-Bootmenu
BURP
Generating grub configuration file ...
Found background: /usr/share/grub/background.png
Found linux image: /boot/vmlinuz-4.14-x86_64
it keeps the info
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Files in /etc/grub.d not included in /boot/grub/grub.cfg. stf92 Slackware 21 05-27-2018 04:38 PM
Question about editing grub.cfg Steve W Linux - Software 7 02-06-2013 03:07 PM
Problem editing grub.cfg Vocay2 Linux Mint 4 10-11-2012 06:26 AM
LXer: DRM Drivers On Linux 3.6 Kernel Aren't Too Fun LXer Syndicated Linux News 0 07-26-2012 08:50 AM
[SOLVED] Grub can't find grub.cfg when booting - error: no such device Breagha Linux - Software 8 03-14-2010 12:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:03 PM.

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