Welcome to the Linux Foundation Forum!

grub.cfg on Debian

Hi,

In the following lesson...
https://trainingportal.linuxfoundation.org/learn/course/linux-system-administration-essentials-lfs207/kernel-services-and-configuration/kernel-services-and-configuration?page=3

it's all about using the kernel command line. However, on Debian, if cat the according file i get an output of a huge grub.cfg file and on the top I find...

┌──(alu@nb)-[/boot/grub]
└─$ sudo cat /boot/grub/grub.cfg | head
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
[...]

Actually all the configuration has to be done in /etc/grub.d/* and in /etc/default/grub for a Debian system.

Is this the case only on Debian or has something changed since the course chapter was written?

Thanks,
Urs

Answers

  • luisviveropena
    luisviveropena Posts: 1,233

    Hi Urs,

    It seems that the main config file it's on /boot/grub/grub.cfg or /boot/grub2/grub.cfg, and it's currently pointing to a couple of files, as you mentioned: /etc/grub.d and /etc/default/grub. I checked for Ubuntu 24.04 and CentOS Stream 9. So, yes, it can lead to a confusion.

    Thanks for bringing this up.

    Regards,
    Luis.

  • coop
    coop Posts: 916

    in every modern Linux distro grub.cfg is generated from the files you mention in /etc and is never ever supposed to be hand edited. it is generated by the. update-grub command in every debian-based distribution

  • albiurs
    albiurs Posts: 38

    Hi Luis and Coop,

    Thank you guys for clarification.

    Hence, I'd suggest to update the according lessons in the course, as they suggest to edit the grub.cfg file directly.

    Regards,
    Urs

Categories

Upcoming Training