public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] GRUB: Configuring a softlevel for grub
@ 2016-06-30 17:51 Ian Zimmerman
  2016-06-30 18:39 ` Neil Bothwick
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Zimmerman @ 2016-06-30 17:51 UTC (permalink / raw
  To: gentoo-user

I followed the Handbook page [1] to set up an additional runlevel for a
different network environment.  The first part, adding and customizing
the services with rc-update in the new level, went swimmingly.  Now I'm
at the line

> Edit the bootloader configuration and add a new entry for the offline
> runlevel. In that entry, add softlevel=offline as a boot parameter.

In my case the bootloader is grub2.  Looking at the way
/boot/grub/grub.cfg is generated, the Linux menu entries come from
/etc/grub.d/10_linux, and that script is hardwired to create exactly one
normal entry per kernel version, plus maybe a rescue entry that boots
into single user.  There is no provision for additional multiuser
entries.  So I have to create my own, but this seems to imply I have to
do one of:

1. modify 10_linux itself: huge, complex, dangerous

2. copy 10_linux into a new file and edit just the single line with boot
params: ugly, fragile if 10_linux changes

Any other way?  I dream of somehow "referencing" 10_linux with just the
GRUB_CMDLINE_LINUX_DEFAULT variable changed.

[1]
https://wiki.gentoo.org/wiki/Handbook:AMD64/Working/Initscripts#Using_softlevel

-- 
Please *no* private copies of mailing list or newsgroup messages.
Why does the arrow on Hillary signs point to the right?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] GRUB: Configuring a softlevel for grub
  2016-06-30 17:51 [gentoo-user] GRUB: Configuring a softlevel for grub Ian Zimmerman
@ 2016-06-30 18:39 ` Neil Bothwick
  2016-06-30 19:33   ` [gentoo-user] " Ian Zimmerman
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Bothwick @ 2016-06-30 18:39 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]

On Thu, 30 Jun 2016 10:51:13 -0700, Ian Zimmerman wrote:

> > Edit the bootloader configuration and add a new entry for the offline
> > runlevel. In that entry, add softlevel=offline as a boot parameter.  
> 
> In my case the bootloader is grub2.  Looking at the way
> /boot/grub/grub.cfg is generated, the Linux menu entries come from
> /etc/grub.d/10_linux, and that script is hardwired to create exactly one
> normal entry per kernel version, plus maybe a rescue entry that boots
> into single user.  There is no provision for additional multiuser
> entries.  So I have to create my own, but this seems to imply I have to
> do one of:
> 
> 1. modify 10_linux itself: huge, complex, dangerous
> 
> 2. copy 10_linux into a new file and edit just the single line with boot
> params: ugly, fragile if 10_linux changes
> 
> Any other way?  I dream of somehow "referencing" 10_linux with just the
> GRUB_CMDLINE_LINUX_DEFAULT variable changed.

Use the 40_custom file, renumbering it if you need to change the order.

Or you can replace 10_linux with your own script. It's just a shell
script that spits out menuentry stanzas. 10_linux is quite complex
because it has to handle everything, but something customised for your
own needs can be much simpler.

Or run grub2-mkconfig then hand edit grub.cfg to add the extra entries.

There are always plenty of choices with GRUB.


-- 
Neil Bothwick

If at first you do succeed, try to hide your astonishment.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user] Re: GRUB: Configuring a softlevel for grub
  2016-06-30 18:39 ` Neil Bothwick
@ 2016-06-30 19:33   ` Ian Zimmerman
  2016-06-30 21:37     ` Neil Bothwick
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Zimmerman @ 2016-06-30 19:33 UTC (permalink / raw
  To: gentoo-user

On 2016-06-30 19:39 +0100, Neil Bothwick wrote:

> Use the 40_custom file, renumbering it if you need to change the order.

Well, this is basically my item 2.  I did see the custom files ...

I was hoping for something along the lines of

>> hypothetical /etc/grub.d/99_local

#! /bin/bash

GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} softlevel=offline"
GRUB_DISTRIBUTOR="Gentoo Offline"
. /etc/grub.d/10_linux

<<

... but there's plenty that could go wrong with this.  I don't know
grub in enough detail to understand how the /etc/default/grub variable
values are patched in.  That was why I asked here.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Why does the arrow on Hillary signs point to the right?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Re: GRUB: Configuring a softlevel for grub
  2016-06-30 19:33   ` [gentoo-user] " Ian Zimmerman
@ 2016-06-30 21:37     ` Neil Bothwick
  2016-06-30 23:31       ` Ian Zimmerman
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Bothwick @ 2016-06-30 21:37 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

On Thu, 30 Jun 2016 12:33:27 -0700, Ian Zimmerman wrote:

> I was hoping for something along the lines of
> 
> >> hypothetical /etc/grub.d/99_local  
> 
> #! /bin/bash
> 
> GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT}
> softlevel=offline" GRUB_DISTRIBUTOR="Gentoo Offline"
> . /etc/grub.d/10_linux
> 
> <<
> 
> ... but there's plenty that could go wrong with this.  I don't know
> grub in enough detail to understand how the /etc/default/grub variable
> values are patched in.  That was why I asked here.

That may well work, although you may need to export the variables. You've
nothing to lose by trying as you can have grub2-mkconfig send its output
anywhere, so you don't need to touch your existing grub.cfg while testing.


-- 
Neil Bothwick

Law of Mechanical Repair: After your hands become coated with
grease, your nose will begin to itch.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user] Re: GRUB: Configuring a softlevel for grub
  2016-06-30 21:37     ` Neil Bothwick
@ 2016-06-30 23:31       ` Ian Zimmerman
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Zimmerman @ 2016-06-30 23:31 UTC (permalink / raw
  To: gentoo-user

On 2016-06-30 22:37 +0100, Neil Bothwick wrote:

> > >> hypothetical /etc/grub.d/99_local  

> That may well work

Indeed it does.  Thanks for the assistance.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Why does the arrow on Hillary signs point to the right?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-30 23:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-30 17:51 [gentoo-user] GRUB: Configuring a softlevel for grub Ian Zimmerman
2016-06-30 18:39 ` Neil Bothwick
2016-06-30 19:33   ` [gentoo-user] " Ian Zimmerman
2016-06-30 21:37     ` Neil Bothwick
2016-06-30 23:31       ` Ian Zimmerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox