Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #274054
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Grub menu entry for a system on a second drive. |
| Date | 2024-10-25 21:10 +0200 |
| Message-ID | <JBxR7-4bwF-9@gated-at.bofh.it> (permalink) |
| References | <JBcWl-3YAB-9@gated-at.bofh.it> <JBd61-3YE2-1@gated-at.bofh.it> <JBvvX-49ZN-7@gated-at.bofh.it> <JBwLn-4aEm-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri 25 Oct 2024 at 13:51:06 (-0400), Felix Miata wrote:
> My actual custom stanzas are in /boot/grub2/custom.cfg, because I use only one
> bootloader per PC, no matter how many installations it contains, which averages in
> excess of 20, and I use whatever version of Grub2 that Tumbleweed provides,
> usually the latest available. That shouldn't make any difference in Debian use,
> other than the "2" in directory name.
>
> In /etc/grub.d/ I copy 41_custom to 07_custom. Then I empty 41_custom and make it
> immutable so that the entries 07_custom refers to are not duplicated by 41_custom
> after every time whatever Grub package providing it is updated.
Do you mean that the previously inserted copies of custom.cfg are
preserved, and a new copy inserted, each time grub-mkconfig runs?
If that's not the case, then does it really matter that you have
the same menuentry contents at positions 07 and 41?
> Details of 40_custom use I'm completely unfamiliar with, as I've never used it,
> though I empty and lock it the same it as I do 41_custom.
It's static, and just gets inserted as is, which you can see from
any grub.cfg created in the normal manner. Mine currently contains:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Install Debian via HTTP" {
search --no-floppy --label --set=root noah03
linux /boot/vmlinuz priority=low
initrd /boot/initrd.gz
}
on a machine that can't reliably boot from a USB stick,
particularly a Debian netinst confection. (The two files come from
http://http.us.debian.org/debian/dists/<codename>/main/install
er-i386/current/images/hd-media/
rather than
https://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/
)
I also use 07_custom on the same machine, avoiding the
filename versioning in the system-generated entries:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'My bullseye' $menuentry_id_option 'custom' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --set=root --label noah03
echo 'Load /vmlinuz …'
linux /vmlinuz root=LABEL=noah03 ro systemd.show_status=true quiet
echo 'Load initial ramdisk /initrd.img …'
initrd /initrd.img
}
> Manual editing of /boot/grub/grub.cfg does not persist. Every kernel addition or
> removal causes its regeneration anew based upon the content of /etc/default/grub
> and the regeneration script(s), same as running grub-mkconfig.
FTR, editing the Grub menu itself is, of course, totally ephemeral.
Type whatever you like, boot from it, and the edits are gone for good.
But editing /boot/grub/grub.cfg does persist as long as
that particular grub.cfg is not reconfigured with
grub-mkconfig/update-grub, which is done by kernel upgrades,
and, of course, the very occasional Grub upgrades.
I postprocess my grub.cfg files as a matter of routine, mainly
to convert UUIDs to LABELs, but also to uniquify them, if I may
use that word. In the OP's case, I would do just that: after
grub-mkconfig/update-grub runs, I would edit grub.cfg to add
something, anything, to one or more menuentry labels; say,
Debian 2024-10-25 A GNU/Linux so that you can correlate
the menu you later see with the file you earlier wrote.
Cheers,
David.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-10-24 22:50 +0200
Re: Grub menu entry for a system on a second drive. Felix Miata <mrmazda@earthlink.net> - 2024-10-24 23:00 +0200
Re: Grub menu entry for a system on a second drive. David Wright <deblis@lionunicorn.co.uk> - 2024-10-25 05:30 +0200
Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-10-25 17:50 +0200
Re: Grub menu entry for a system on a second drive. Joe <joe@jretrading.com> - 2024-10-25 18:10 +0200
Re: Grub menu entry for a system on a second drive. Max Nikulin <manikulin@gmail.com> - 2024-10-25 18:40 +0200
Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-10-25 21:00 +0200
Re: Grub menu entry for a system on a second drive. David Wright <deblis@lionunicorn.co.uk> - 2024-10-25 21:20 +0200
Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-10-25 22:50 +0200
Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-11-10 02:30 +0100
Re: Grub menu entry for a system on a second drive. David Wright <deblis@lionunicorn.co.uk> - 2024-11-12 05:00 +0100
Re: Grub menu entry for a system on a second drive. Greg Wooledge <greg@wooledge.org> - 2024-10-25 18:50 +0200
Re: Grub menu entry for a system on a second drive. David Wright <deblis@lionunicorn.co.uk> - 2024-10-25 20:20 +0200
Re (2): Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-10-25 18:40 +0200
Re: Grub menu entry for a system on a second drive. Felix Miata <mrmazda@stanis.net> - 2024-10-25 20:00 +0200
Re: Grub menu entry for a system on a second drive. David Wright <deblis@lionunicorn.co.uk> - 2024-10-25 21:10 +0200
Re: Grub menu entry for a system on a second drive. Felix Miata <mrmazda@stanis.net> - 2024-10-25 22:50 +0200
Re: Grub menu entry for a system on a second drive. Felix Miata <mrmazda@stanis.net> - 2024-10-26 06:00 +0200
Re: Grub menu entry for a system on a second drive. David Wright <deblis@lionunicorn.co.uk> - 2024-10-26 07:10 +0200
Re: Re (2): Grub menu entry for a system on a second drive. Tim Woodall <debianuser@woodall.me.uk> - 2024-10-25 23:40 +0200
[solved, partly] Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-10-27 05:20 +0100
Re: [solved, partly] Re: Grub menu entry for a system on a second drive. David Wright <deblis@lionunicorn.co.uk> - 2024-10-27 16:00 +0100
Re: [solved, partly] Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-10-27 19:50 +0100
Re: [solved, partly] Re: Grub menu entry for a system on a second drive. Greg Wooledge <greg@wooledge.org> - 2024-10-28 12:10 +0100
Re: [solved, partly] Re: Grub menu entry for a system on a second drive. Greg Wooledge <greg@wooledge.org> - 2024-11-01 12:10 +0100
Re: [solved, partly] Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-10-28 17:30 +0100
Re: [solved, more] Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-11-02 16:10 +0100
Re: [solved, more] Re: Grub menu entry for a system on a second drive. David Wright <deblis@lionunicorn.co.uk> - 2024-11-04 05:50 +0100
Re: [solved, more] Re: Grub menu entry for a system on a second drive. peter@easthope.ca - 2024-11-10 04:00 +0100
Re: [solved, more] Re: Grub menu entry for a system on a second drive. Dan Purgert <dan@djph.net> - 2024-11-04 13:50 +0100
Re: [solved, partly] Re: Grub menu entry for a system on a second drive. Max Nikulin <manikulin@gmail.com> - 2024-11-03 03:50 +0100
csiph-web