* question about pty,agetty for an intermediate virtual server image
@ 2017-03-31 12:59 ng0
2017-03-31 23:43 ` Leo Famulari
0 siblings, 1 reply; 19+ messages in thread
From: ng0 @ 2017-03-31 12:59 UTC (permalink / raw)
To: guix-devel
Hi,
before I go ahead and create an intermediate image - I'd like to explore
the option of getting IN-Berlin closer into the creation of the 'deploy'
process of Guix which is being worked on - I need to find out how the
redirection to "/sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt102"
can be honored.
As far as I understand, we use mingetty which according to the mingetty
manpages is not suited for tasks agetty can do.
IN-Berlin runs a Consoleserver which redirects ssh logins to it via
"virsh console $vserver" to the /sbin/agetty (on debian vservers) on
your server. The KVM configuration can be seen below.
How can I achieve this (the agetty part) with GuixSD?
----- Forwarded message from Andreas Herrmann -----
Date: Fri, 31 Mar 2017 14:26:25 +0200
From: Andreas Herrmann
To: ng0, Kontakt fuer neue Teilnehmer
Subject: Re: [info] server image format?
Hallo,
On 31.03.2017 13:39, ng0 wrote:
> Ich glaube als vorrübergehende, individuelle Lösung würde das
> funktionieren. Das "aber" folgt weiter unten.
> Da stellt sich mir jetzt nur die Frage zu dem Konsolenserver. Muss ich
> da irgendwas besonderes beachten damit ich nicht versehentlich ein Image
> generiere was gar nicht mehr ansprechbar ist? Könnt ihr mir da die Daten
> geben welche ich beachten muss, oder hängt das nur von normalen,
> unspezifizierten virtuellen konsolen ab? Da haben wir standardmäßig die
> services 'term-tty1' bis 'term-tty6' welches soweit ich weiss über mingetty
> kommt (https://www.gnu.org/software/guix/manual/guix.html#index-mingetty_002dconfiguration).
>
> man mingetty sagt allerdings:
> mingetty is a minimal getty for use on virtual consoles. Unlike
> agetty(8), mingetty is not suitable for serial lines. I recommend using
> mgetty(8) for this purpose.
>
Der "Konsolenserver" ist ein direkte Umleitung auf ein
"/sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt102"
auf deinem VServer via
virsh console $vserver
Die VServer haben in dazu KVM folgendes konfiguriert:
<console type='pty'>
<target type='serial' port='0'/>
</console>
Gruß, Andreas
----- End forwarded message -----
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: question about pty,agetty for an intermediate virtual server image
2017-03-31 12:59 question about pty,agetty for an intermediate virtual server image ng0
@ 2017-03-31 23:43 ` Leo Famulari
2017-04-01 7:27 ` ng0
0 siblings, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2017-03-31 23:43 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1861 bytes --]
On Fri, Mar 31, 2017 at 12:59:56PM +0000, ng0 wrote:
> before I go ahead and create an intermediate image - I'd like to explore
> the option of getting IN-Berlin closer into the creation of the 'deploy'
> process of Guix which is being worked on - I need to find out how the
> redirection to "/sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt102"
> can be honored.
> As far as I understand, we use mingetty which according to the mingetty
> manpages is not suited for tasks agetty can do.
>
> IN-Berlin runs a Consoleserver which redirects ssh logins to it via
> "virsh console $vserver" to the /sbin/agetty (on debian vservers) on
> your server. The KVM configuration can be seen below.
>
> How can I achieve this (the agetty part) with GuixSD?
You can use the agetty-service, like this
(kernel-arguments
;; Adjust these arguments as desired.
'("console=ttyS0,115200n8 gfxpayload=text earlyprintk=serial,tty,115200"))
(services
(cons (agetty-service (agetty-configuration
(tty "ttys0")
(term "vt102")
(keep-baud? #t)
(baud-rate "115200,38400,9600)))
%base-services))
And you will probably want a non-graphical GRUB menu as well (this
should be parameterized eventually...):
diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
index b18b8be6d..d94b1a266 100644
--- a/gnu/system/grub.scm
+++ b/gnu/system/grub.scm
@@ -197,7 +197,7 @@ system string---e.g., \"x86_64-linux\"."
insmod efi_uga
fi
- terminal_output gfxterm
+ terminal_output console
"
""))
Finally, you can test it in QEMU by appending '-serial pty' to the
QEMU invocation. When it starts, QEMU will tell you which pty it's
using, and you can connect to it with something like `screen`.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: question about pty,agetty for an intermediate virtual server image
2017-03-31 23:43 ` Leo Famulari
@ 2017-04-01 7:27 ` ng0
2017-04-01 18:33 ` Leo Famulari
2017-04-01 20:29 ` Leo Famulari
0 siblings, 2 replies; 19+ messages in thread
From: ng0 @ 2017-04-01 7:27 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
Leo Famulari transcribed 2.8K bytes:
> On Fri, Mar 31, 2017 at 12:59:56PM +0000, ng0 wrote:
> > before I go ahead and create an intermediate image - I'd like to explore
> > the option of getting IN-Berlin closer into the creation of the 'deploy'
> > process of Guix which is being worked on - I need to find out how the
> > redirection to "/sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt102"
> > can be honored.
> > As far as I understand, we use mingetty which according to the mingetty
> > manpages is not suited for tasks agetty can do.
> >
> > IN-Berlin runs a Consoleserver which redirects ssh logins to it via
> > "virsh console $vserver" to the /sbin/agetty (on debian vservers) on
> > your server. The KVM configuration can be seen below.
> >
> > How can I achieve this (the agetty part) with GuixSD?
>
> You can use the agetty-service, like this
>
> (kernel-arguments
> ;; Adjust these arguments as desired.
> '("console=ttyS0,115200n8 gfxpayload=text earlyprintk=serial,tty,115200"))
>
> (services
> (cons (agetty-service (agetty-configuration
> (tty "ttys0")
> (term "vt102")
> (keep-baud? #t)
> (baud-rate "115200,38400,9600)))
> %base-services))
>
> And you will probably want a non-graphical GRUB menu as well (this
> should be parameterized eventually...):
Yeah, that would be useful as it is not uncommon for servers.
> diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
> index b18b8be6d..d94b1a266 100644
> --- a/gnu/system/grub.scm
> +++ b/gnu/system/grub.scm
> @@ -197,7 +197,7 @@ system string---e.g., \"x86_64-linux\"."
> insmod efi_uga
> fi
>
> - terminal_output gfxterm
> + terminal_output console
> "
> ""))
>
> Finally, you can test it in QEMU by appending '-serial pty' to the
> QEMU invocation. When it starts, QEMU will tell you which pty it's
> using, and you can connect to it with something like `screen`.
Thanks! I'll give it a try and get back to you when I run into problems.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: question about pty,agetty for an intermediate virtual server image
2017-04-01 7:27 ` ng0
@ 2017-04-01 18:33 ` Leo Famulari
2017-04-01 20:29 ` Leo Famulari
1 sibling, 0 replies; 19+ messages in thread
From: Leo Famulari @ 2017-04-01 18:33 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 642 bytes --]
On Sat, Apr 01, 2017 at 07:27:40AM +0000, ng0 wrote:
> Leo Famulari transcribed 2.8K bytes:
> > And you will probably want a non-graphical GRUB menu as well (this
> > should be parameterized eventually...):
>
> Yeah, that would be useful as it is not uncommon for servers.
I'm working on it today...
> > Finally, you can test it in QEMU by appending '-serial pty' to the
> > QEMU invocation. When it starts, QEMU will tell you which pty it's
> > using, and you can connect to it with something like `screen`.
>
> Thanks! I'll give it a try and get back to you when I run into problems.
Hopefully it's "if", not "when" ;)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: question about pty,agetty for an intermediate virtual server image
2017-04-01 7:27 ` ng0
2017-04-01 18:33 ` Leo Famulari
@ 2017-04-01 20:29 ` Leo Famulari
2017-04-02 16:31 ` question about pty, agetty " myglc2
1 sibling, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2017-04-01 20:29 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 352 bytes --]
On Sat, Apr 01, 2017 at 07:27:40AM +0000, ng0 wrote:
> Leo Famulari transcribed 2.8K bytes:
> > And you will probably want a non-graphical GRUB menu as well (this
> > should be parameterized eventually...):
>
> Yeah, that would be useful as it is not uncommon for servers.
Here's a patch that works in my tests:
https://bugs.gnu.org/26334
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: question about pty, agetty for an intermediate virtual server image
2017-04-01 20:29 ` Leo Famulari
@ 2017-04-02 16:31 ` myglc2
2017-04-02 21:06 ` Non-graphical GRUB configuration Leo Famulari
0 siblings, 1 reply; 19+ messages in thread
From: myglc2 @ 2017-04-02 16:31 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
On 04/01/2017 at 16:29 Leo Famulari writes:
> On Sat, Apr 01, 2017 at 07:27:40AM +0000, ng0 wrote:
>> Leo Famulari transcribed 2.8K bytes:
>> > And you will probably want a non-graphical GRUB menu as well (this
>> > should be parameterized eventually...):
>>
>> Yeah, that would be useful as it is not uncommon for servers.
>
> Here's a patch that works in my tests:
>
> https://bugs.gnu.org/26334
Hi Leo,
I gather you are focused on KVM deployment, so this may be off-
topic. But FWIW, the patch that I use to run GRUB menus both locally on
the console and over IPMI SOL (serial over LAN) on an headless ASRock
server (MT-c224 w/ ASPEED 2300 BMC controller) is attached below.
The important point is that 'terminal_output console' displays grub
menus on _both_ the local console and via serial ... but ... grub does
not receive the serial inputs ... unless ... 'terminal_input serial
console' is also specified.
I don't recall the exact rationale for 'serial --unit=0 --speed=115200',
but I am pretty sure it was needed. I can check on that if you like.
So... it would sure be "nice" if you could expand your patch to also
support this use case.
Best, George
diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
index 4f9bde6a6..8199f6f0b 100644
--- a/gnu/system/grub.scm
+++ b/gnu/system/grub.scm
@@ -199,7 +199,8 @@ system string---e.g., \"x86_64-linux\"."
insmod vga
fi
- terminal_output gfxterm
+ serial --unit=0 --speed=115200
+ terminal_input serial console; terminal_output console
"
""))
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Non-graphical GRUB configuration
2017-04-02 16:31 ` question about pty, agetty " myglc2
@ 2017-04-02 21:06 ` Leo Famulari
2017-04-02 22:13 ` Leo Famulari
` (2 more replies)
0 siblings, 3 replies; 19+ messages in thread
From: Leo Famulari @ 2017-04-02 21:06 UTC (permalink / raw)
To: myglc2; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 2876 bytes --]
On Sun, Apr 02, 2017 at 12:31:19PM -0400, myglc2 wrote:
> I gather you are focused on KVM deployment, so this may be off-
> topic. But FWIW, the patch that I use to run GRUB menus both locally on
> the console and over IPMI SOL (serial over LAN) on an headless ASRock
> server (MT-c224 w/ ASPEED 2300 BMC controller) is attached below.
I think we can make it work on KVM and bare metal in the same commit :)
> The important point is that 'terminal_output console' displays grub
> menus on _both_ the local console and via serial ... but ... grub does
> not receive the serial inputs ... unless ... 'terminal_input serial
> console' is also specified.
Okay, but your diff only selects the "console" terminal_output. Is that
because the native console is accessed over the serial line? Or should
it be 'terminal_output console serial'?
> diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
> index 4f9bde6a6..8199f6f0b 100644
> --- a/gnu/system/grub.scm
> +++ b/gnu/system/grub.scm
> @@ -199,7 +199,8 @@ system string---e.g., \"x86_64-linux\"."
> insmod vga
> fi
>
> - terminal_output gfxterm
> + serial --unit=0 --speed=115200
> + terminal_input serial console; terminal_output console
> "
> ""))
>
Based on the GRUB manual [0], how about this plan?
We'd add these fields to (grub-configuration):
terminal-outputs: One or more symbols: console, serial, gfxterm,
ofconsole, vga_text. Default gfxterm.
terminal-inputs: One or more symbols: console, serial, ofconsole,
at_keyboard,usb_keyboard. Default unset.
serial-unit: An integer from {0,1,2,3}, default 0
serial-port: ??? I don't know which values are accepted
serial-speed: GRUB default is 9600. Should this be an arbitrary
integer, or should we offer a list of values?
serial-word: An integer from {5,6,7,8}, default 8
serial-stop: An integer from {1,2}, default 1
serial-parity: A symbol from {no, odd, even}, default no
They would correspond to the GRUB configuration keys
GRUB_TERMINAL_OUTPUT, GRUB_TERMINAL_INPUT, and GRUB_SERIAL_COMMAND,
respectively. [0]
If 'terminal-inputs' or 'serial-*' are unset, we do what we do now:
nothing. If 'terminal-outputs' is unset, we also do the same thing we
now, which is set it to gfxterm.
If any of them are set, we'd insert the corresponding text into the
generated grub.cfg.
If terminal-outputs does not include the symbol 'gfxterm', we'd disable
the "setup_gfxterm" function.
We can use the `grub-script-check` program to check the syntax of the
generated grub.cfg.
[0]
https://www.gnu.org/software/grub/manual/html_node/Simple-configuration.html
https://www.gnu.org/software/grub/manual/html_node/terminal_005foutput.html
https://www.gnu.org/software/grub/manual/html_node/terminal_005finput.html
https://www.gnu.org/software/grub/manual/html_node/serial.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-02 21:06 ` Non-graphical GRUB configuration Leo Famulari
@ 2017-04-02 22:13 ` Leo Famulari
2017-04-03 0:31 ` myglc2
2017-04-03 0:16 ` myglc2
2017-04-05 11:59 ` Leo Famulari
2 siblings, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2017-04-02 22:13 UTC (permalink / raw)
To: myglc2; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
On Sun, Apr 02, 2017 at 05:06:20PM -0400, Leo Famulari wrote:
> Based on the GRUB manual [0], how about this plan?
>
> We'd add these fields to (grub-configuration):
[...]
NixOS has the user provide a string:
https://nixos.org/nixos/manual/options.html#opt-boot.loader.grub.extraConfig
It is much simpler than my plan...
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-02 21:06 ` Non-graphical GRUB configuration Leo Famulari
2017-04-02 22:13 ` Leo Famulari
@ 2017-04-03 0:16 ` myglc2
2017-04-05 11:59 ` Leo Famulari
2 siblings, 0 replies; 19+ messages in thread
From: myglc2 @ 2017-04-03 0:16 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
On 04/02/2017 at 21:06 Leo Famulari writes:
> On Sun, Apr 02, 2017 at 12:31:19PM -0400, myglc2 wrote:
>> I gather you are focused on KVM deployment, so this may be off-
>> topic. But FWIW, the patch that I use to run GRUB menus both locally on
>> the console and over IPMI SOL (serial over LAN) on an headless ASRock
>> server (MT-c224 w/ ASPEED 2300 BMC controller) is attached below.
>
> I think we can make it work on KVM and bare metal in the same commit :)
>
>> The important point is that 'terminal_output console' displays grub
>> menus on _both_ the local console and via serial ... but ... grub does
>> not receive the serial inputs ... unless ... 'terminal_input serial
>> console' is also specified.
>
> Okay, but your diff only selects the "console" terminal_output. Is that
> because the native console is accessed over the serial line? Or should
> it be 'terminal_output console serial'?
I grant you it seems odd, but with 'terminal_output console serial', the
grub output on the serial line is "garbled" in the sense that each line
is "doubled". Meanwhile, the appearance on the local console (on the
attached VGA display) is fine.
I don't know if this behavior is peculiar to this motherboard, or if
this is typical.
>> diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
>> index 4f9bde6a6..8199f6f0b 100644
>> --- a/gnu/system/grub.scm
>> +++ b/gnu/system/grub.scm
>> @@ -199,7 +199,8 @@ system string---e.g., \"x86_64-linux\"."
>> insmod vga
>> fi
>>
>> - terminal_output gfxterm
>> + serial --unit=0 --speed=115200
>> + terminal_input serial console; terminal_output console
>> "
>> ""))
>>
>
> Based on the GRUB manual [0], how about this plan?
>
> We'd add these fields to (grub-configuration):
>
> terminal-outputs: One or more symbols: console, serial, gfxterm,
> ofconsole, vga_text. Default gfxterm.
Yes
> terminal-inputs: One or more symbols: console, serial, ofconsole,
> at_keyboard,usb_keyboard. Default unset.
Yes
> serial-unit: An integer from {0,1,2,3}, default 0
yes
> serial-port: ??? I don't know which values are accepted
I don't think this is required.
> serial-speed: GRUB default is 9600. Should this be an arbitrary
> integer, or should we offer a list of values?
An integer is probably OK.
> serial-word: An integer from {5,6,7,8}, default 8
> serial-stop: An integer from {1,2}, default 1
> serial-parity: A symbol from {no, odd, even}, default no
I think you can skip these.
> They would correspond to the GRUB configuration keys
> GRUB_TERMINAL_OUTPUT, GRUB_TERMINAL_INPUT, and GRUB_SERIAL_COMMAND,
> respectively. [0]
>
> If 'terminal-inputs' or 'serial-*' are unset, we do what we do now:
> nothing. If 'terminal-outputs' is unset, we also do the same thing we
> now, which is set it to gfxterm.
>
> If any of them are set, we'd insert the corresponding text into the
> generated grub.cfg.
>
> If terminal-outputs does not include the symbol 'gfxterm', we'd disable
> the "setup_gfxterm" function.
>
> We can use the `grub-script-check` program to check the syntax of the
> generated grub.cfg.
>
> [0]
> https://www.gnu.org/software/grub/manual/html_node/Simple-configuration.html
> https://www.gnu.org/software/grub/manual/html_node/terminal_005foutput.html
> https://www.gnu.org/software/grub/manual/html_node/terminal_005finput.html
> https://www.gnu.org/software/grub/manual/html_node/serial.html
This seems very fine to me! Thanks - George
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-02 22:13 ` Leo Famulari
@ 2017-04-03 0:31 ` myglc2
2017-04-03 8:39 ` Ludovic Courtès
0 siblings, 1 reply; 19+ messages in thread
From: myglc2 @ 2017-04-03 0:31 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
On 04/02/2017 at 22:13 Leo Famulari writes:
> On Sun, Apr 02, 2017 at 05:06:20PM -0400, Leo Famulari wrote:
>> Based on the GRUB manual [0], how about this plan?
>>
>> We'd add these fields to (grub-configuration):
>
> [...]
>
> NixOS has the user provide a string:
>
> https://nixos.org/nixos/manual/options.html#opt-boot.loader.grub.extraConfig
>
> It is much simpler than my plan...
I agree this is also workable. It actually is more flexible since it
allows access to all grub config features.
If you go this way, the guix doc should point the user to the relevant
grub doc. Since one needs to install grub in order to read the grub doc
in guix, it might be helpful for the guix doc to mention that as well.
HTH - George
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-03 0:31 ` myglc2
@ 2017-04-03 8:39 ` Ludovic Courtès
0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2017-04-03 8:39 UTC (permalink / raw)
To: myglc2; +Cc: guix-devel
myglc2 <myglc2@gmail.com> skribis:
> On 04/02/2017 at 22:13 Leo Famulari writes:
>
>> On Sun, Apr 02, 2017 at 05:06:20PM -0400, Leo Famulari wrote:
>>> Based on the GRUB manual [0], how about this plan?
>>>
>>> We'd add these fields to (grub-configuration):
>>
>> [...]
>>
>> NixOS has the user provide a string:
>>
>> https://nixos.org/nixos/manual/options.html#opt-boot.loader.grub.extraConfig
>>
>> It is much simpler than my plan...
>
> I agree this is also workable. It actually is more flexible since it
> allows access to all grub config features.
>
> If you go this way, the guix doc should point the user to the relevant
> grub doc. Since one needs to install grub in order to read the grub doc
> in guix, it might be helpful for the guix doc to mention that as well.
Agreed.
I’m fine either way, but an escape hatch like this is always going to be
useful so it can’t hurt.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-02 21:06 ` Non-graphical GRUB configuration Leo Famulari
2017-04-02 22:13 ` Leo Famulari
2017-04-03 0:16 ` myglc2
@ 2017-04-05 11:59 ` Leo Famulari
2017-04-05 15:14 ` myglc2
2017-04-17 13:44 ` myglc2
2 siblings, 2 replies; 19+ messages in thread
From: Leo Famulari @ 2017-04-05 11:59 UTC (permalink / raw)
To: myglc2; +Cc: guix-devel
[-- Attachment #1.1: Type: text/plain, Size: 1240 bytes --]
On Sun, Apr 02, 2017 at 05:06:20PM -0400, Leo Famulari wrote:
> Based on the GRUB manual [0], how about this plan?
>
> We'd add these fields to (grub-configuration):
>
> terminal-outputs: One or more symbols: console, serial, gfxterm,
> ofconsole, vga_text. Default gfxterm.
>
> terminal-inputs: One or more symbols: console, serial, ofconsole,
> at_keyboard,usb_keyboard. Default unset.
>
> If 'terminal-inputs' or 'serial-*' are unset, we do what we do now:
> nothing. If 'terminal-outputs' is unset, we also do the same thing we
> now, which is set it to gfxterm.
>
> If any of them are set, we'd insert the corresponding text into the
> generated grub.cfg.
>
> If terminal-outputs does not include the symbol 'gfxterm', we'd disable
> the "setup_gfxterm" function.
Here's a WIP patch that I'd like some advice about. It does insert the
relevant text into grub.cfg, although I recommend testing it in a
virtual machine for now.
Questions:
1) In general, is this approach okay?
2) I think that (grub-setup-io) should be used in
(grub-configuration-file) instead of (eye-candy). But, when I try
calling it there, in the builder, it has no effect on grub.cfg. Any
suggestions for debugging this?
[-- Attachment #1.2: 0001-system-grub-Expose-GRUB-settings-for-interactive-int.patch --]
[-- Type: text/plain, Size: 6733 bytes --]
From c1d081d111fb4778b6a0625abbdd8cc540ae630f Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Sun, 2 Apr 2017 22:18:00 -0400
Subject: [PATCH] system: grub: Expose GRUB settings for interactive
interfaces.
WIP: Does not validate input and setup-io is used in the wrong place
* gnu/system/grub.scm (<grub-configuration>): Add new fields
terminal-outputs, terminal-inputs, serial-unit, and serial-speed.
(grub-setup-io, setup-gfxterm): New procedures.
* doc/guix.texi (GRUB Configuration): Document the new fields.
---
doc/guix.texi | 17 ++++++++++++
gnu/system/grub.scm | 75 +++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 75 insertions(+), 17 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index aa779e38e..8107872bc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14920,6 +14920,23 @@ The @code{grub-theme} object describing the theme to use.
@item @code{grub} (default: @code{grub})
The GRUB package to use.
+
+@item @code{terminal-outputs} (default: @code{'gfxterm})
+The output terminals used for the GRUB boot menu, as a list of symbols.
+
+@item @code{terminal-inputs} (default: @code{'()})
+The input terminals used for the GRUB boot menu, as a list of symbols.
+The default is the native platform terminal as determined by GRUB at
+run-time.
+
+@item @code{serial-unit} (default: @code{#f})
+The serial unit used by GRUB, as an integer from 0 to 3. The default
+value is deferred to GRUB; currently GRUB choosese 0, which corresponds
+to COM1.
+
+@item @code{serial-speed} (default: @code{#f})
+The speed of the serial interface, as an integer. The default value is
+deferred to GRUB; currently GRUB chooses 9600bps.
@end table
@end deftp
diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
index 4f9bde6a6..8a516f05f 100644
--- a/gnu/system/grub.scm
+++ b/gnu/system/grub.scm
@@ -107,17 +107,25 @@ denoting a file name."
(define-record-type* <grub-configuration>
grub-configuration make-grub-configuration
grub-configuration?
- (grub grub-configuration-grub ; package
- (default (@ (gnu packages bootloaders) grub)))
- (device grub-configuration-device) ; string
- (menu-entries grub-configuration-menu-entries ; list
- (default '()))
- (default-entry grub-configuration-default-entry ; integer
- (default 0))
- (timeout grub-configuration-timeout ; integer
- (default 5))
- (theme grub-configuration-theme ; <grub-theme>
- (default %default-theme)))
+ (grub grub-configuration-grub ; package
+ (default (@ (gnu packages bootloaders) grub)))
+ (device grub-configuration-device) ; string
+ (menu-entries grub-configuration-menu-entries ; list
+ (default '()))
+ (default-entry grub-configuration-default-entry ; integer
+ (default 0))
+ (timeout grub-configuration-timeout ; integer
+ (default 5))
+ (theme grub-configuration-theme ; <grub-theme>
+ (default %default-theme))
+ (terminal-outputs grub-configuration-terminal-outputs ; list of symbols
+ (default '(gfxterm)))
+ (terminal-inputs grub-configuration-terminal-inputs ; list of symbols
+ (default '()))
+ (serial-unit grub-configuration-serial-unit ; integer | #f
+ (default #f))
+ (serial-speed grub-configuration-serial-speed ; integer | #f
+ (default #f)))
(define-record-type* <menu-entry>
menu-entry make-menu-entry
@@ -198,11 +206,16 @@ system string---e.g., \"x86_64-linux\"."
insmod vbe
insmod vga
fi
-
- terminal_output gfxterm
"
""))
+ (define (setup-gfxterm config font-file)
+ (if (memq 'gfxterm (grub-configuration-terminal-outputs config))
+ #~(format #f "if loadfont ~a; then
+ setup_gfxterm
+fi~%" #$font-file)
+ ""))
+
(define (theme-colors type)
(let* ((theme (grub-configuration-theme config))
(colors (type theme)))
@@ -221,9 +234,8 @@ function setup_gfxterm {~a}
# Set 'root' to the partition that contains /gnu/store.
~a
-if loadfont ~a; then
- setup_gfxterm
-fi
+~a
+~a
insmod png
if background_image ~a; then
@@ -235,7 +247,8 @@ else
fi~%"
#$setup-gfxterm-body
#$(grub-root-search store-device font-file)
- #$font-file
+ #$(grub-setup-io config)
+ #$(setup-gfxterm config font-file)
#$(strip-mount-point store-mount-point image)
#$(theme-colors grub-theme-color-normal)
@@ -246,6 +259,34 @@ fi~%"
;;; Configuration file.
;;;
+(define (grub-setup-io config)
+ "Return GRUB commands to configure the input / output interfaces. The result
+is a string that can be inserted in grub.cfg.
+TODO Check the bounds of unit, and compare outputs and inputs to a list of
+valid interfaces taken from the GRUB manual."
+ (let* ((symbols->string (lambda (list)
+ (string-join (map symbol->string list) " ")))
+ (outputs (grub-configuration-terminal-outputs config))
+ (inputs (grub-configuration-terminal-inputs config))
+ (unit (grub-configuration-serial-unit config))
+ (speed (grub-configuration-serial-speed config))
+ (io (string-append
+ "terminal_output " (symbols->string outputs) "\n"
+ (if (null? inputs)
+ ""
+ (string-append "terminal_input "
+ (symbols->string inputs) "\n"))
+ (if (or unit speed)
+ (string-append "serial"
+ (if unit
+ (string-append " --unit="
+ (number->string unit)) "")
+ (if speed
+ (string-append " --speed="
+ (number->string speed)) ""))
+ ""))))
+ (format #f "~a" io)))
+
(define (grub-root-search device file)
"Return the GRUB 'search' command to look for DEVICE, which contains FILE,
a gexp. The result is a gexp that can be inserted in the grub.cfg-generation
--
2.12.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-05 11:59 ` Leo Famulari
@ 2017-04-05 15:14 ` myglc2
2017-04-05 16:07 ` Leo Famulari
2017-04-17 13:44 ` myglc2
1 sibling, 1 reply; 19+ messages in thread
From: myglc2 @ 2017-04-05 15:14 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
On 04/05/2017 at 11:59 Leo Famulari writes:
> Questions:
>
> 1) In general, is this approach okay?
Hi Leo,
This LGTM, but I was unable to test it because my 'system build' hangs
as reported in bug#26370. Running your commit produced a similar hang
but I think it is not caused by your changes so I reported against the
origin/master commit.
I interpreted your doc to say I should use something like this ...
(bootloader (grub-configuration (device "/dev/nvme0n1")
(serial-speed 115200)
(terminal-inputs '(serial console))
(terminal-outputs '(console))))
... to produce something like this in my grub config ...
serial --unit=0 --speed=115200
terminal_input serial console; terminal_output console
Does that look right?
If so, it may be nice to include an example like this in the doc.
Once I get the system build working I will test further.
TIA - George
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-05 15:14 ` myglc2
@ 2017-04-05 16:07 ` Leo Famulari
2017-04-05 20:43 ` myglc2
0 siblings, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2017-04-05 16:07 UTC (permalink / raw)
To: myglc2; +Cc: guix-devel
On Wed, Apr 05, 2017 at 11:14:06AM -0400, myglc2 wrote:
> I interpreted your doc to say I should use something like this ...
>
> (bootloader (grub-configuration (device "/dev/nvme0n1")
> (serial-speed 115200)
> (terminal-inputs '(serial console))
> (terminal-outputs '(console))))
Right, except...
> ... to produce something like this in my grub config ...
>
> serial --unit=0 --speed=115200
> terminal_input serial console; terminal_output console
... you won't get '--unit=0' unless you specify (serial-unit 0) in your
GuixSD configuration. However, GRUB defaults to '0', according to its
manual.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-05 16:07 ` Leo Famulari
@ 2017-04-05 20:43 ` myglc2
2017-04-06 15:18 ` Leo Famulari
0 siblings, 1 reply; 19+ messages in thread
From: myglc2 @ 2017-04-05 20:43 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
On 04/05/2017 at 12:07 Leo Famulari writes:
> On Wed, Apr 05, 2017 at 11:14:06AM -0400, myglc2 wrote:
>> I interpreted your doc to say I should use something like this ...
>>
>> (bootloader (grub-configuration (device "/dev/nvme0n1")
>> (serial-speed 115200)
>> (terminal-inputs '(serial console))
>> (terminal-outputs '(console))))
>
> Right, except...
>
>> ... to produce something like this in my grub config ...
>>
>> serial --unit=0 --speed=115200
>> terminal_input serial console; terminal_output console
>
> ... you won't get '--unit=0' unless you specify (serial-unit 0) in your
> GuixSD configuration. However, GRUB defaults to '0', according to its
> manual.
Yes I noticed. I was operating on the hope that less would be more ;-)
After following Marius Bakke's advice to revert
dfee7daedb760f1b1d7506829ca31633f4173356 "gnu: bc: Update to 1.07" I can
confirm that this works on an ASRock MT-C224 motherboard over IPMI SOL.
Please let me know if there is anything else you need me to test.
- George
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-05 20:43 ` myglc2
@ 2017-04-06 15:18 ` Leo Famulari
2017-04-06 17:34 ` myglc2
0 siblings, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2017-04-06 15:18 UTC (permalink / raw)
To: myglc2; +Cc: guix-devel
On Wed, Apr 05, 2017 at 04:43:32PM -0400, myglc2 wrote:
> > ... you won't get '--unit=0' unless you specify (serial-unit 0) in your
> > GuixSD configuration. However, GRUB defaults to '0', according to its
> > manual.
>
> Yes I noticed. I was operating on the hope that less would be more ;-)
I decided against hard-coding the current GRUB defaults into this code.
I'd rather take them from GRUB at run-time, and accept the upstream
changes as they come. Plus, we won't have to update our code as often :)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-06 15:18 ` Leo Famulari
@ 2017-04-06 17:34 ` myglc2
0 siblings, 0 replies; 19+ messages in thread
From: myglc2 @ 2017-04-06 17:34 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
On 04/06/2017 at 11:18 Leo Famulari writes:
> On Wed, Apr 05, 2017 at 04:43:32PM -0400, myglc2 wrote:
>> > ... you won't get '--unit=0' unless you specify (serial-unit 0) in your
>> > GuixSD configuration. However, GRUB defaults to '0', according to its
>> > manual.
>>
>> Yes I noticed. I was operating on the hope that less would be more ;-)
>
> I decided against hard-coding the current GRUB defaults into this code.
> I'd rather take them from GRUB at run-time, and accept the upstream
> changes as they come. Plus, we won't have to update our code as often :)
Nice!
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-05 11:59 ` Leo Famulari
2017-04-05 15:14 ` myglc2
@ 2017-04-17 13:44 ` myglc2
2017-04-17 19:51 ` Leo Famulari
1 sibling, 1 reply; 19+ messages in thread
From: myglc2 @ 2017-04-17 13:44 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
On 04/05/2017 at 07:59 Leo Famulari writes:
> On Sun, Apr 02, 2017 at 05:06:20PM -0400, Leo Famulari wrote:
>> Based on the GRUB manual [0], how about this plan?
>>
>> We'd add these fields to (grub-configuration):
>>
>> terminal-outputs: One or more symbols: console, serial, gfxterm,
>> ofconsole, vga_text. Default gfxterm.
>>
>> terminal-inputs: One or more symbols: console, serial, ofconsole,
>> at_keyboard,usb_keyboard. Default unset.
>>
>> If 'terminal-inputs' or 'serial-*' are unset, we do what we do now:
>> nothing. If 'terminal-outputs' is unset, we also do the same thing we
>> now, which is set it to gfxterm.
>>
>> If any of them are set, we'd insert the corresponding text into the
>> generated grub.cfg.
>>
>> If terminal-outputs does not include the symbol 'gfxterm', we'd disable
>> the "setup_gfxterm" function.
>
> Here's a WIP patch that I'd like some advice about. It does insert the
> relevant text into grub.cfg, although I recommend testing it in a
> virtual machine for now.
>
> Questions:
>
> 1) In general, is this approach okay?
>
> 2) I think that (grub-setup-io) should be used in
> (grub-configuration-file) instead of (eye-candy). But, when I try
> calling it there, in the builder, it has no effect on grub.cfg. Any
> suggestions for debugging this?
Hey Leo, As reported earlier, this works for me. IMO it is good to
go. If there is anything I can do to help, please let me know.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Non-graphical GRUB configuration
2017-04-17 13:44 ` myglc2
@ 2017-04-17 19:51 ` Leo Famulari
0 siblings, 0 replies; 19+ messages in thread
From: Leo Famulari @ 2017-04-17 19:51 UTC (permalink / raw)
To: myglc2; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 541 bytes --]
On Mon, Apr 17, 2017 at 09:44:06AM -0400, myglc2 wrote:
> Hey Leo, As reported earlier, this works for me. IMO it is good to
> go. If there is anything I can do to help, please let me know.
I'm glad to hear it!
Because this change would make it possible to break your GuixSD system
in new ways, I do want to add some input validation and grub.cfg syntax
checking before I push it to the master branch.
I'd like to finish it this week, but help is always welcome. If anyone
plans to help, please reply here so we don't duplicate effort :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2017-04-17 19:51 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-31 12:59 question about pty,agetty for an intermediate virtual server image ng0
2017-03-31 23:43 ` Leo Famulari
2017-04-01 7:27 ` ng0
2017-04-01 18:33 ` Leo Famulari
2017-04-01 20:29 ` Leo Famulari
2017-04-02 16:31 ` question about pty, agetty " myglc2
2017-04-02 21:06 ` Non-graphical GRUB configuration Leo Famulari
2017-04-02 22:13 ` Leo Famulari
2017-04-03 0:31 ` myglc2
2017-04-03 8:39 ` Ludovic Courtès
2017-04-03 0:16 ` myglc2
2017-04-05 11:59 ` Leo Famulari
2017-04-05 15:14 ` myglc2
2017-04-05 16:07 ` Leo Famulari
2017-04-05 20:43 ` myglc2
2017-04-06 15:18 ` Leo Famulari
2017-04-06 17:34 ` myglc2
2017-04-17 13:44 ` myglc2
2017-04-17 19:51 ` Leo Famulari
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).