[PATCH 0/2] Improvements for mingetty-service-type

  • Done
  • quality assurance status badge
Details
3 participants
  • Ludovic Courtès
  • Maxim Cournoyer
  • Tomas Volf
Owner
unassigned
Submitted by
Tomas Volf
Severity
normal
T
T
Tomas Volf wrote on 24 Nov 15:28 +0100
(address . guix-patches@gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
cover.1732458407.git.~@wolfsden.cz
Some configuration options were missing and some accessors where misnamed.
Ability to depend on arbitrary shepherd service is also added.

Tomas Volf (2):
services: mingetty: Add additional configuration options.
services: mingetty: Support waiting on shepherd services.

doc/guix.texi | 47 ++++++++++++++++++++++-
gnu/services/base.scm | 86 ++++++++++++++++++++++++++++++++++---------
2 files changed, 114 insertions(+), 19 deletions(-)

--
2.46.0
T
T
Tomas Volf wrote on 24 Nov 15:31 +0100
[PATCH 1/2] services: mingetty: Add additional configuration options.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
dea211c308de823bdd8c801807db10f77c0b54fc.1732458407.git.~@wolfsden.cz
Not all aspects of mingetty were configurable, so this commit adds the
additional configuration fields to support that.

It also renames the accessors for all fields except `tty'. They were named
just `mingetty-$FIELD', instead of `mingetty-configuration-$FIELD'. However
the renaming *is* backwards compatible, since in the define-module's #:export
argument the correct (`mingetty-configuration-$FIELD') were used already.
Hence, until now, there was no way to access anything except the `tty' field.

* gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
print-hostname, nice, chdir, chroot fields. Rename accessors for auto-login,
login-program, login-pause?, clear-on-logout?.
(mingetty-shepherd-service): Use the new fields.
(define-module)<#:export>: Export the new accessors.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document the
additional field.

Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
---
doc/guix.texi | 27 ++++++++++++++++++-
gnu/services/base.scm | 62 ++++++++++++++++++++++++++++++++++++-------
2 files changed, 79 insertions(+), 10 deletions(-)

Toggle diff (133 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 1c39628ffa..d689711e80 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19285,7 +19285,32 @@ Base Services
will have to press a key before the log-in shell is launched.
@item @code{clear-on-logout?} (default: @code{#t})
-When set to @code{#t}, the screen will be cleared after logout.
+When set to @code{#t}, the screen will be cleared before showing the
+login prompt. The field name is bit unfortunate, since it controls
+clearing also before the initial login, not just after a logout.
+
+@item @code{delay} (default: @code{#f})
+When set to a number, sleep that many seconds after startup.
+
+@item @code{print-issue} (default: @code{#t})
+When set to @code{#t}, write out a new line and the content of
+@file{/etc/issue}. Value of @code{'no-nl} can be used to suppress the
+new line.
+
+@item @code{print-hostname} (default: @code{#t})
+When set to @code{#t}, print the host name before the login prompt. The
+host name is printed up to the first dot. Can be set to @code{'long} to
+print the full host name.
+
+@item @code{nice} (default: @code{#f})
+When set to a number, change the process priority using @code{nice}.
+
+@item @code{chdir} (default: @code{#f})
+When set to a string, change into that directory before calling the
+login program.
+
+@item @code{chroot} (default: @code{#f})
+When set to a string, call @code{chroot} with that directory.
@item @code{mingetty} (default: @var{mingetty})
The Mingetty package to use.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 6473e1a91a..b3d3553091 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -186,7 +186,12 @@ (define-module (gnu services base)
mingetty-configuration-login-program
mingetty-configuration-login-pause?
mingetty-configuration-clear-on-logout?
- mingetty-configuration-mingetty
+ mingetty-configuration-delay
+ mingetty-configuration-print-issue
+ mingetty-configuration-print-hostname
+ mingetty-configuration-nice
+ mingetty-configuration-chdir
+ mingetty-configuration-chroot
mingetty-configuration?
mingetty-service ; deprecated
mingetty-service-type
@@ -1242,20 +1247,33 @@ (define-record-type* <mingetty-configuration>
mingetty-configuration?
(mingetty mingetty-configuration-mingetty ;file-like
(default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-auto-login ;string | #f
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-configuration-auto-login ;string | #f
(default #f))
- (login-program mingetty-login-program ;gexp
+ (login-program mingetty-configuration-login-program ;gexp
(default #f))
- (login-pause? mingetty-login-pause? ;Boolean
+ (login-pause? mingetty-configuration-login-pause? ;Boolean
(default #f))
- (clear-on-logout? mingetty-clear-on-logout? ;Boolean
- (default #t)))
+ (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
+ (default #t))
+ (delay mingetty-configuration-delay ;Integer | #f
+ (default #f))
+ (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
+ (default #t))
+ (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
+ (default #t))
+ (nice mingetty-configuration-nice ;Integer | #f
+ (default #f))
+ (chdir mingetty-configuration-chdir ;String | #f
+ (default #f))
+ (chroot mingetty-configuration-chroot ;String | #f
+ (default #f)))
(define (mingetty-shepherd-service config)
(match-record config <mingetty-configuration>
- (mingetty tty auto-login login-program
- login-pause? clear-on-logout?)
+ (mingetty tty auto-login login-program
+ login-pause? clear-on-logout? delay
+ print-issue print-hostname nice chdir chroot)
(list
(shepherd-service
(documentation "Run mingetty on an tty.")
@@ -1286,6 +1304,32 @@ (define (mingetty-shepherd-service config)
#~())
#$@(if login-pause?
#~("--loginpause")
+ #~())
+ #$@(if delay
+ #~("--delay" #$(number->string delay))
+ #~())
+ #$@(match print-issue
+ (#t
+ #~())
+ ('no-nl
+ #~("--nonewline"))
+ (#f
+ #~("--noissue")))
+ #$@(match print-hostname
+ (#t
+ #~())
+ ('long
+ #~("--long-hostname"))
+ (#f
+ #~("--nohostname")))
+ #$@(if nice
+ #~("--nice" #$(number->string nice))
+ #~())
+ #$@(if chdir
+ #~("--chdir" #$chdir)
+ #~())
+ #$@(if chroot
+ #~("--chroot" #$chroot)
#~()))))
(stop #~(make-kill-destructor))))))
--
2.46.0
T
T
Tomas Volf wrote on 24 Nov 15:31 +0100
[PATCH 2/2] services: mingetty: Support waiting on shepherd services.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
28d793a8d19605d39db5e05058e3f6218d3a8c97.1732458407.git.~@wolfsden.cz
For auto-login on systems with elogind, dbus-system needs to be started. This
commit adds ability to express that ordering.

* gnu/services/base.scm (<mingetty-configuration>): Add shepherd-requirement
field.
(mingetty-shepherd-service): Use it.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document it.

Change-Id: Iedbdc4375180740379d561aa193d7c63350d2e7b
---
doc/guix.texi | 20 ++++++++++++++
gnu/services/base.scm | 62 ++++++++++++++++++++++++-------------------
2 files changed, 54 insertions(+), 28 deletions(-)

Toggle diff (123 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index d689711e80..e15cfeb39d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19312,6 +19312,26 @@ Base Services
@item @code{chroot} (default: @code{#f})
When set to a string, call @code{chroot} with that directory.
+@item @code{shepherd-requirement}
+List of shepherd requirements. Unless you know what you are doing, it
+is recommended to add to the default list instead of replacing.
+
+For example you can use this field when performing auto-login on a
+system with elogind to wait on @code{'dbus-system}.
+
+@lisp
+(modify-services %base-services
+ (mingetty-service-type config =>
+ (mingetty-configuration
+ (inherit config)
+ ;; Automatically log in as "guest".
+ (auto-login "guest")
+ (shepherd-requirement
+ (cons 'dbus-system
+ (mingetty-configuration-shepherd-requirement
+ config))))))
+@end lisp
+
@item @code{mingetty} (default: @var{mingetty})
The Mingetty package to use.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b3d3553091..6681d5f8d4 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -192,6 +192,7 @@ (define-module (gnu services base)
mingetty-configuration-nice
mingetty-configuration-chdir
mingetty-configuration-chroot
+ mingetty-configuration-shepherd-requirement
mingetty-configuration?
mingetty-service ; deprecated
mingetty-service-type
@@ -1245,44 +1246,49 @@ (define-deprecated (agetty-service config)
(define-record-type* <mingetty-configuration>
mingetty-configuration make-mingetty-configuration
mingetty-configuration?
- (mingetty mingetty-configuration-mingetty ;file-like
- (default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-configuration-auto-login ;string | #f
- (default #f))
- (login-program mingetty-configuration-login-program ;gexp
- (default #f))
- (login-pause? mingetty-configuration-login-pause? ;Boolean
- (default #f))
- (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
- (default #t))
- (delay mingetty-configuration-delay ;Integer | #f
- (default #f))
- (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
- (default #t))
- (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
- (default #t))
- (nice mingetty-configuration-nice ;Integer | #f
- (default #f))
- (chdir mingetty-configuration-chdir ;String | #f
- (default #f))
- (chroot mingetty-configuration-chroot ;String | #f
- (default #f)))
+ (mingetty mingetty-configuration-mingetty ;file-like
+ (default mingetty))
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-configuration-auto-login ;string | #f
+ (default #f))
+ (login-program mingetty-configuration-login-program ;gexp
+ (default #f))
+ (login-pause? mingetty-configuration-login-pause? ;Boolean
+ (default #f))
+ (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
+ (default #t))
+ (delay mingetty-configuration-delay ;Integer | #f
+ (default #f))
+ (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
+ (default #t))
+ (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
+ (default #t))
+ (nice mingetty-configuration-nice ;Integer | #f
+ (default #f))
+ (chdir mingetty-configuration-chdir ;String | #f
+ (default #f))
+ (chroot mingetty-configuration-chroot ;String | #f
+ (default #f))
+ (shepherd-requirement mingetty-configuration-shepherd-requirement
+ ;; Since the login prompt shows the host name, wait
+ ;; for the 'host-name' service to be done. Also wait
+ ;; for udev essentially so that the tty text is not
+ ;; lost in the middle of kernel messages (XXX).
+ (default '(user-processes host-name udev
+ virtual-terminal))))
(define (mingetty-shepherd-service config)
(match-record config <mingetty-configuration>
(mingetty tty auto-login login-program
login-pause? clear-on-logout? delay
- print-issue print-hostname nice chdir chroot)
+ print-issue print-hostname nice chdir chroot
+ shepherd-requirement)
(list
(shepherd-service
(documentation "Run mingetty on an tty.")
(provision (list (symbol-append 'term- (string->symbol tty))))
- ;; Since the login prompt shows the host name, wait for the 'host-name'
- ;; service to be done. Also wait for udev essentially so that the tty
- ;; text is not lost in the middle of kernel messages (XXX).
- (requirement '(user-processes host-name udev virtual-terminal))
+ (requirement shepherd-requirement)
(start #~(make-forkexec-constructor
(list #$(file-append mingetty "/sbin/mingetty")
--
2.46.0
M
M
Maxim Cournoyer wrote on 25 Nov 02:45 +0100
Re: [bug#74508] [PATCH 1/2] services: mingetty: Add additional configuration options.
(name . Tomas Volf)(address . ~@wolfsden.cz)
87jzcsnl1n.fsf@gmail.com
Hello,

Tomas Volf <~@wolfsden.cz> writes:

Toggle quote (9 lines)
> Not all aspects of mingetty were configurable, so this commit adds the
> additional configuration fields to support that.
>
> It also renames the accessors for all fields except `tty'. They were named
> just `mingetty-$FIELD', instead of `mingetty-configuration-$FIELD'. However
> the renaming *is* backwards compatible, since in the define-module's #:export
> argument the correct (`mingetty-configuration-$FIELD') were used already.
> Hence, until now, there was no way to access anything except the `tty' field.

Fun, good catch! I find it odd that Guile doesn't warn or error when
exporting a symbol that isn't defined; I was bit by that recently
myself. Personally I'd have effected that correction in a distinct
commit, to keep your new functionality diff to its bare minimum
(clearer/easier to review).

Toggle quote (4 lines)
> * gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
> print-hostname, nice, chdir, chroot fields. Rename accessors for auto-login,
> login-program, login-pause?, clear-on-logout?.

Are all these expected to be functional on Guix, e.g., the 'chroot' option?

Toggle quote (32 lines)
> (mingetty-shepherd-service): Use the new fields.
> (define-module)<#:export>: Export the new accessors.
> * doc/guix.texi (Base Services)<mingetty-configuration>: Document the
> additional field.
>
> Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
> ---
> doc/guix.texi | 27 ++++++++++++++++++-
> gnu/services/base.scm | 62 ++++++++++++++++++++++++++++++++++++-------
> 2 files changed, 79 insertions(+), 10 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 1c39628ffa..d689711e80 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -19285,7 +19285,32 @@ Base Services
> will have to press a key before the log-in shell is launched.
>
> @item @code{clear-on-logout?} (default: @code{#t})
> -When set to @code{#t}, the screen will be cleared after logout.
> +When set to @code{#t}, the screen will be cleared before showing the
> +login prompt. The field name is bit unfortunate, since it controls
> +clearing also before the initial login, not just after a logout.
> +
> +@item @code{delay} (default: @code{#f})
> +When set to a number, sleep that many seconds after startup.
> +
> +@item @code{print-issue} (default: @code{#t})
> +When set to @code{#t}, write out a new line and the content of
> +@file{/etc/issue}. Value of @code{'no-nl} can be used to suppress the
> +new line.

This sounds useful. Could it be used in place of a 'motd', such as in
our hydra/berlin.scm conf (from the Guix maintenance repo), which is
currently relying on PAM to work (and doesn't currently seem to do
anything, at least on berlin, for unknown reason).

Toggle quote (27 lines)
> +@item @code{print-hostname} (default: @code{#t})
> +When set to @code{#t}, print the host name before the login prompt. The
> +host name is printed up to the first dot. Can be set to @code{'long} to
> +print the full host name.
> +
> +@item @code{nice} (default: @code{#f})
> +When set to a number, change the process priority using @code{nice}.
> +
> +@item @code{chdir} (default: @code{#f})
> +When set to a string, change into that directory before calling the
> +login program.
> +
> +@item @code{chroot} (default: @code{#f})
> +When set to a string, call @code{chroot} with that directory.
>
> @item @code{mingetty} (default: @var{mingetty})
> The Mingetty package to use.
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index 6473e1a91a..b3d3553091 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -186,7 +186,12 @@ (define-module (gnu services base)
> mingetty-configuration-login-program
> mingetty-configuration-login-pause?
> mingetty-configuration-clear-on-logout?
> - mingetty-configuration-mingetty

Why is the above accessor removed?

Toggle quote (84 lines)
> + mingetty-configuration-delay
> + mingetty-configuration-print-issue
> + mingetty-configuration-print-hostname
> + mingetty-configuration-nice
> + mingetty-configuration-chdir
> + mingetty-configuration-chroot
> mingetty-configuration?
> mingetty-service ; deprecated
> mingetty-service-type
> @@ -1242,20 +1247,33 @@ (define-record-type* <mingetty-configuration>
> mingetty-configuration?
> (mingetty mingetty-configuration-mingetty ;file-like
> (default mingetty))
> - (tty mingetty-configuration-tty) ;string
> - (auto-login mingetty-auto-login ;string | #f
> + (tty mingetty-configuration-tty) ;string
> + (auto-login mingetty-configuration-auto-login ;string | #f
> (default #f))
> - (login-program mingetty-login-program ;gexp
> + (login-program mingetty-configuration-login-program ;gexp
> (default #f))
> - (login-pause? mingetty-login-pause? ;Boolean
> + (login-pause? mingetty-configuration-login-pause? ;Boolean
> (default #f))
> - (clear-on-logout? mingetty-clear-on-logout? ;Boolean
> - (default #t)))
> + (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
> + (default #t))
> + (delay mingetty-configuration-delay ;Integer | #f
> + (default #f))
> + (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
> + (default #t))
> + (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
> + (default #t))
> + (nice mingetty-configuration-nice ;Integer | #f
> + (default #f))
> + (chdir mingetty-configuration-chdir ;String | #f
> + (default #f))
> + (chroot mingetty-configuration-chroot ;String | #f
> + (default #f)))
>
> (define (mingetty-shepherd-service config)
> (match-record config <mingetty-configuration>
> - (mingetty tty auto-login login-program
> - login-pause? clear-on-logout?)
> + (mingetty tty auto-login login-program
> + login-pause? clear-on-logout? delay
> + print-issue print-hostname nice chdir chroot)
> (list
> (shepherd-service
> (documentation "Run mingetty on an tty.")
> @@ -1286,6 +1304,32 @@ (define (mingetty-shepherd-service config)
> #~())
> #$@(if login-pause?
> #~("--loginpause")
> + #~())
> + #$@(if delay
> + #~("--delay" #$(number->string delay))
> + #~())
> + #$@(match print-issue
> + (#t
> + #~())
> + ('no-nl
> + #~("--nonewline"))
> + (#f
> + #~("--noissue")))
> + #$@(match print-hostname
> + (#t
> + #~())
> + ('long
> + #~("--long-hostname"))
> + (#f
> + #~("--nohostname")))
> + #$@(if nice
> + #~("--nice" #$(number->string nice))
> + #~())
> + #$@(if chdir
> + #~("--chdir" #$chdir)
> + #~())
> + #$@(if chroot
> + #~("--chroot" #$chroot)
> #~()))))
> (stop #~(make-kill-destructor))))))

Neatly crafted. Could you please send a v2 with my small comments above
addressed, such as splitting in two commits, and not removing the
'mingetty-configuration-mingetty' accessor? Other than that, LGTM.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 25 Nov 02:49 +0100
Re: [bug#74508] [PATCH 2/2] services: mingetty: Support waiting on shepherd services.
(name . Tomas Volf)(address . ~@wolfsden.cz)
87frngnkv0.fsf@gmail.com
Tomas Volf <~@wolfsden.cz> writes:

Toggle quote (10 lines)
> For auto-login on systems with elogind, dbus-system needs to be started. This
> commit adds ability to express that ordering.
>
> * gnu/services/base.scm (<mingetty-configuration>): Add shepherd-requirement
> field.
> (mingetty-shepherd-service): Use it.
> * doc/guix.texi (Base Services)<mingetty-configuration>: Document it.
>
> Change-Id: Iedbdc4375180740379d561aa193d7c63350d2e7b

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail>

--
Thanks,
Maxim
T
T
Tomas Volf wrote on 25 Nov 16:37 +0100
Re: [bug#74508] [PATCH 1/2] services: mingetty: Add additional configuration options.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87ttbve343.fsf@wolfsden.cz
Hi,

thank you for the review of this patch as well. Comments below.

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (17 lines)
> Hello,
>
> Tomas Volf <~@wolfsden.cz> writes:
>
>> Not all aspects of mingetty were configurable, so this commit adds the
>> additional configuration fields to support that.
>>
>> It also renames the accessors for all fields except `tty'. They were named
>> just `mingetty-$FIELD', instead of `mingetty-configuration-$FIELD'. However
>> the renaming *is* backwards compatible, since in the define-module's #:export
>> argument the correct (`mingetty-configuration-$FIELD') were used already.
>> Hence, until now, there was no way to access anything except the `tty' field.
>
> Fun, good catch! I find it odd that Guile doesn't warn or error when
> exporting a symbol that isn't defined; I was bit by that recently
> myself.

I assume there might be historical and/or technical reasons for that,
but that is probably topic for guile-devel. :) I personally am bit torn,
while I can imagine situations when some symbol is by design left
unbound, I had no need for that yet.

Toggle quote (4 lines)
> Personally I'd have effected that correction in a distinct commit, to
> keep your new functionality diff to its bare minimum (clearer/easier
> to review).

Yeah, I agree, will split it.

Toggle quote (8 lines)
>
>> * gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
>> print-hostname, nice, chdir, chroot fields. Rename accessors for auto-login,
>> login-program, login-pause?, clear-on-logout?.
>
> Are all these expected to be functional on Guix, e.g., the 'chroot'
> option?

Sure, why not? I can for example imagine having Alpine Linux installed
in chroot in /opt/alpine, and tty2 would login you into Alpine instead
of GuixSD.

Do I expect the `chroot' to be used often? No. But it *is* a valid
argument to mingetty, so I think it makes sense to add them all and
leave it to the user creativity whether it will be used or not.

Toggle quote (37 lines)
>
>> (mingetty-shepherd-service): Use the new fields.
>> (define-module)<#:export>: Export the new accessors.
>> * doc/guix.texi (Base Services)<mingetty-configuration>: Document the
>> additional field.
>>
>> Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
>> ---
>> doc/guix.texi | 27 ++++++++++++++++++-
>> gnu/services/base.scm | 62 ++++++++++++++++++++++++++++++++++++-------
>> 2 files changed, 79 insertions(+), 10 deletions(-)
>>
>> diff --git a/doc/guix.texi b/doc/guix.texi
>> index 1c39628ffa..d689711e80 100644
>> --- a/doc/guix.texi
>> +++ b/doc/guix.texi
>> @@ -19285,7 +19285,32 @@ Base Services
>> will have to press a key before the log-in shell is launched.
>>
>> @item @code{clear-on-logout?} (default: @code{#t})
>> -When set to @code{#t}, the screen will be cleared after logout.
>> +When set to @code{#t}, the screen will be cleared before showing the
>> +login prompt. The field name is bit unfortunate, since it controls
>> +clearing also before the initial login, not just after a logout.
>> +
>> +@item @code{delay} (default: @code{#f})
>> +When set to a number, sleep that many seconds after startup.
>> +
>> +@item @code{print-issue} (default: @code{#t})
>> +When set to @code{#t}, write out a new line and the content of
>> +@file{/etc/issue}. Value of @code{'no-nl} can be used to suppress the
>> +new line.
>
> This sounds useful. Could it be used in place of a 'motd', such as in
> our hydra/berlin.scm conf (from the Guix maintenance repo), which is
> currently relying on PAM to work

I do not think so. Notice the default value (#t). The issue is printed
by default. When you see a tty login prompt, it looks (by default) like
this:

Toggle snippet (8 lines)
$ISSUE

$HOST login: $USER
Password: $PASSWORD

$MOTD

So in my QEMU test system the "logging screen" looks (roughly) like
this:

Toggle snippet (9 lines)
GNU/Linux test-system x86_64 <--- /etc/issue

login: tester (automatic login)

GuixSD test VM. Welcome. <--- /gnu/store/...-motd

$

Toggle quote (3 lines)
> (and doesn't currently seem to do anything, at least on berlin, for
> unknown reason).

I think this is expected no? I would assume that most people log via
SSH (only Ricardo has physical access?) and there is no `/etc/motd' file
created by `frontend-services'. Consider adding something like this to
the list of services returned by the `frontend-services' procedure:

Toggle snippet (3 lines)
(extra-special-file "/etc/motd" motd)

That should make the message of the day visible even for SSH logins.

Toggle quote (30 lines)
>
>> +@item @code{print-hostname} (default: @code{#t})
>> +When set to @code{#t}, print the host name before the login prompt. The
>> +host name is printed up to the first dot. Can be set to @code{'long} to
>> +print the full host name.
>> +
>> +@item @code{nice} (default: @code{#f})
>> +When set to a number, change the process priority using @code{nice}.
>> +
>> +@item @code{chdir} (default: @code{#f})
>> +When set to a string, change into that directory before calling the
>> +login program.
>> +
>> +@item @code{chroot} (default: @code{#f})
>> +When set to a string, call @code{chroot} with that directory.
>>
>> @item @code{mingetty} (default: @var{mingetty})
>> The Mingetty package to use.
>> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
>> index 6473e1a91a..b3d3553091 100644
>> --- a/gnu/services/base.scm
>> +++ b/gnu/services/base.scm
>> @@ -186,7 +186,12 @@ (define-module (gnu services base)
>> mingetty-configuration-login-program
>> mingetty-configuration-login-pause?
>> mingetty-configuration-clear-on-logout?
>> - mingetty-configuration-mingetty
>
> Why is the above accessor removed?

Good catch, that was not intentional.

Toggle quote (89 lines)
>
>> + mingetty-configuration-delay
>> + mingetty-configuration-print-issue
>> + mingetty-configuration-print-hostname
>> + mingetty-configuration-nice
>> + mingetty-configuration-chdir
>> + mingetty-configuration-chroot
>> mingetty-configuration?
>> mingetty-service ; deprecated
>> mingetty-service-type
>> @@ -1242,20 +1247,33 @@ (define-record-type* <mingetty-configuration>
>> mingetty-configuration?
>> (mingetty mingetty-configuration-mingetty ;file-like
>> (default mingetty))
>> - (tty mingetty-configuration-tty) ;string
>> - (auto-login mingetty-auto-login ;string | #f
>> + (tty mingetty-configuration-tty) ;string
>> + (auto-login mingetty-configuration-auto-login ;string | #f
>> (default #f))
>> - (login-program mingetty-login-program ;gexp
>> + (login-program mingetty-configuration-login-program ;gexp
>> (default #f))
>> - (login-pause? mingetty-login-pause? ;Boolean
>> + (login-pause? mingetty-configuration-login-pause? ;Boolean
>> (default #f))
>> - (clear-on-logout? mingetty-clear-on-logout? ;Boolean
>> - (default #t)))
>> + (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
>> + (default #t))
>> + (delay mingetty-configuration-delay ;Integer | #f
>> + (default #f))
>> + (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
>> + (default #t))
>> + (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
>> + (default #t))
>> + (nice mingetty-configuration-nice ;Integer | #f
>> + (default #f))
>> + (chdir mingetty-configuration-chdir ;String | #f
>> + (default #f))
>> + (chroot mingetty-configuration-chroot ;String | #f
>> + (default #f)))
>>
>> (define (mingetty-shepherd-service config)
>> (match-record config <mingetty-configuration>
>> - (mingetty tty auto-login login-program
>> - login-pause? clear-on-logout?)
>> + (mingetty tty auto-login login-program
>> + login-pause? clear-on-logout? delay
>> + print-issue print-hostname nice chdir chroot)
>> (list
>> (shepherd-service
>> (documentation "Run mingetty on an tty.")
>> @@ -1286,6 +1304,32 @@ (define (mingetty-shepherd-service config)
>> #~())
>> #$@(if login-pause?
>> #~("--loginpause")
>> + #~())
>> + #$@(if delay
>> + #~("--delay" #$(number->string delay))
>> + #~())
>> + #$@(match print-issue
>> + (#t
>> + #~())
>> + ('no-nl
>> + #~("--nonewline"))
>> + (#f
>> + #~("--noissue")))
>> + #$@(match print-hostname
>> + (#t
>> + #~())
>> + ('long
>> + #~("--long-hostname"))
>> + (#f
>> + #~("--nohostname")))
>> + #$@(if nice
>> + #~("--nice" #$(number->string nice))
>> + #~())
>> + #$@(if chdir
>> + #~("--chdir" #$chdir)
>> + #~())
>> + #$@(if chroot
>> + #~("--chroot" #$chroot)
>> #~()))))
>> (stop #~(make-kill-destructor))))))
>
> Neatly crafted. Could you please send a v2 with my small comments above
> addressed, such as splitting in two commits, and not removing the
> 'mingetty-configuration-mingetty' accessor? Other than that, LGTM.

Will polish the commit messages and send v2, thank you once more for the
review.

Have a nice day,
Tomas

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
-----BEGIN PGP SIGNATURE-----

iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmdEmbwOHH5Ad29sZnNk
ZW4uY3oACgkQL7/ufbZ/wamgZA/+IQVtCxK4CdRsHObKgbFawK83gYWfZd8M6vop
vBVzdTRT+Uet1OQVxZqMpODNPBe9diWGdOB4/t2tc2cOnX8eAd6PXIVuXK71BU5U
qDtHPZKA4tg7cz5Z36JgGcsCvJSEv9aXjau3wA61BecNwT27k5qOFx3eeWKbv/aO
wuEshVYCs23KDgA64rkIfxqEP5rpMWcOKnPIZBj6PFBFC3IWCl0HFhpBAA0PbW5E
38xXvmSuwBlW//DyLSjC/R8HZvRgAJWVKBRwZTgC6A+qa+TvIGuw1ciHaJye4RTm
oiiF7cuPYd1UcvHsEwNuIR2eAhKWgFkDz58zRrttdO10b6y9+RTBbXUnsVgHKlYC
B9JEqr3LXPTl9gSvT5tPLtPEokQRbnT1Bes6I+deZbckLquzIEA3yiGfQiURfna/
5eQn+3ZyfXk4sWtaMqqgLYlhC9TAnEG8rKKpeRfhdMKi5S+0/HlOL+j9e0rCiTnY
1izzUQIJU3nscmVOcaefj+6fFDWoHhcUxIe6sTXS9ZCxr8vfYzzP+Kq9ef3uUpID
Ad7tJRvV4mmW5njh8Cl2PP0IQhMWDq/UJ5y20lVVSwChfX79GzlfZygPmJRHLtWw
/BDfEKsgR1fYt9k/Ku/iFUlnTKri0bgu0Qr/2XiRZLIM/mQGf+c2GD8gIHs0bKiq
UNw+m5E=
=zz7R
-----END PGP SIGNATURE-----

T
T
Tomas Volf wrote on 25 Nov 17:05 +0100
[PATCH v2 2/3] services: mingetty: Rename misnamed accessors.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
5d6ae334f3275b2312d2fbce4a8f9552af444331.1732550735.git.~@wolfsden.cz
Rename the accessors to ensure all start with `mingetty-configuration-'
prefix. Some were named just `mingetty-$FIELD', instead of
`mingetty-configuration-$FIELD'.

The renaming *is* backwards compatible, since in the define-module's #:export
argument the correct (`mingetty-configuration-$FIELD') were used already and
thus the accessors were not accessible.

* gnu/services/base.scm (<mingetty-configuration>): Rename accessors for
auto-login, login-program, login-pause?, clear-on-logout?.

Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
---
v2: Now is a separate commit.

gnu/services/base.scm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 9712218bd5..e123226da5 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1248,14 +1248,14 @@ (define-record-type* <mingetty-configuration>
mingetty-configuration?
(mingetty mingetty-configuration-mingetty ;file-like
(default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-auto-login ;string | #f
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-configuration-auto-login ;string | #f
(default #f))
- (login-program mingetty-login-program ;gexp
+ (login-program mingetty-configuration-login-program ;gexp
(default #f))
- (login-pause? mingetty-login-pause? ;Boolean
+ (login-pause? mingetty-configuration-login-pause? ;Boolean
(default #f))
- (clear-on-logout? mingetty-clear-on-logout? ;Boolean
+ (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
(default #t))
(delay mingetty-configuration-delay ;Integer | #f
(default #f))
--
2.46.0
T
T
Tomas Volf wrote on 25 Nov 17:05 +0100
[PATCH v2 3/3] services: mingetty: Support waiting on shepherd services.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
f82360b1d7f46540167992755596aed7219a0e11.1732550735.git.~@wolfsden.cz
For auto-login on systems with elogind, dbus-system needs to be started. This
commit adds ability to express that ordering.

* gnu/services/base.scm (<mingetty-configuration>): Add shepherd-requirement
field.
(mingetty-shepherd-service): Use it.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document it.

Change-Id: Iedbdc4375180740379d561aa193d7c63350d2e7b
---
v2: Just slight formatting changes.

doc/guix.texi | 20 ++++++++++++++
gnu/services/base.scm | 62 ++++++++++++++++++++++++-------------------
2 files changed, 54 insertions(+), 28 deletions(-)

Toggle diff (121 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index c5f9481810..9a8daf52d9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19375,6 +19375,26 @@ Base Services
@item @code{chroot} (default: @code{#f})
When set to a string, call @code{chroot} with that directory.

+@item @code{shepherd-requirement}
+List of shepherd requirements. Unless you know what you are doing, it
+is recommended to add to the default list instead of replacing.
+
+For example you can use this field when performing auto-login on a
+system with elogind to wait on @code{'dbus-system}.
+
+@lisp
+(modify-services %base-services
+ (mingetty-service-type config =>
+ (mingetty-configuration
+ (inherit config)
+ ;; Automatically log in as "guest".
+ (auto-login "guest")
+ (shepherd-requirement
+ (cons 'dbus-system
+ (mingetty-configuration-shepherd-requirement
+ config))))))
+@end lisp
+
@item @code{mingetty} (default: @var{mingetty})
The Mingetty package to use.

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index e123226da5..ecf0322890 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -193,6 +193,7 @@ (define-module (gnu services base)
mingetty-configuration-nice
mingetty-configuration-chdir
mingetty-configuration-chroot
+ mingetty-configuration-shepherd-requirement
mingetty-configuration?
mingetty-service ; deprecated
mingetty-service-type
@@ -1246,44 +1247,49 @@ (define-deprecated (agetty-service config)
(define-record-type* <mingetty-configuration>
mingetty-configuration make-mingetty-configuration
mingetty-configuration?
- (mingetty mingetty-configuration-mingetty ;file-like
- (default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-configuration-auto-login ;string | #f
- (default #f))
- (login-program mingetty-configuration-login-program ;gexp
- (default #f))
- (login-pause? mingetty-configuration-login-pause? ;Boolean
- (default #f))
- (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
- (default #t))
- (delay mingetty-configuration-delay ;Integer | #f
- (default #f))
- (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
- (default #t))
- (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
- (default #t))
- (nice mingetty-configuration-nice ;Integer | #f
- (default #f))
- (chdir mingetty-configuration-chdir ;String | #f
- (default #f))
- (chroot mingetty-configuration-chroot ;String | #f
- (default #f)))
+ (mingetty mingetty-configuration-mingetty ;file-like
+ (default mingetty))
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-configuration-auto-login ;string | #f
+ (default #f))
+ (login-program mingetty-configuration-login-program ;gexp
+ (default #f))
+ (login-pause? mingetty-configuration-login-pause? ;Boolean
+ (default #f))
+ (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
+ (default #t))
+ (delay mingetty-configuration-delay ;Integer | #f
+ (default #f))
+ (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
+ (default #t))
+ (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
+ (default #t))
+ (nice mingetty-configuration-nice ;Integer | #f
+ (default #f))
+ (chdir mingetty-configuration-chdir ;String | #f
+ (default #f))
+ (chroot mingetty-configuration-chroot ;String | #f
+ (default #f))
+ (shepherd-requirement mingetty-configuration-shepherd-requirement
+ ;; Since the login prompt shows the host name, wait
+ ;; for the 'host-name' service to be done. Also wait
+ ;; for udev essentially so that the tty text is not
+ ;; lost in the middle of kernel messages (XXX).
+ (default '( user-processes host-name udev
+ virtual-terminal))))

(define (mingetty-shepherd-service config)
(match-record config <mingetty-configuration>
( mingetty tty auto-login login-program
login-pause? clear-on-logout? delay
- print-issue print-hostname nice chdir chroot)
+ print-issue print-hostname nice chdir chroot
+ shepherd-requirement)
(list
(shepherd-service
(documentation "Run mingetty on an tty.")
(provision (list (symbol-append 'term- (string->symbol tty))))

- ;; Since the login prompt shows the host name, wait for the 'host-name'
- ;; service to be done. Also wait for udev essentially so that the tty
- ;; text is not lost in the middle of kernel messages (XXX).
- (requirement '(user-processes host-name udev virtual-terminal))
+ (requirement shepherd-requirement)

(start #~(make-forkexec-constructor
(list #$(file-append mingetty "/sbin/mingetty")
--
2.46.0
T
T
Tomas Volf wrote on 25 Nov 17:05 +0100
[PATCH v2 1/3] services: mingetty: Add additional configuration options.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
3735b134a382255528e7da6706828ee5d80f50a5.1732550735.git.~@wolfsden.cz
Not all aspects of mingetty were configurable, so this commit adds the
additional configuration fields to support that.

* gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
print-hostname, nice, chdir, chroot fields.
(mingetty-shepherd-service): Use the new fields.
(define-module)<#:export>: Export the new accessors.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document the
additional field.

Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
---
v2: Split the renaming into separate commit (2/3). Do not delete the
mingetty-configuration-mingetty accessor.

doc/guix.texi | 27 ++++++++++++++++++++++-
gnu/services/base.scm | 51 ++++++++++++++++++++++++++++++++++++++++---
2 files changed, 74 insertions(+), 4 deletions(-)

Toggle diff (117 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 26488b41c8..c5f9481810 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19348,7 +19348,32 @@ Base Services
will have to press a key before the log-in shell is launched.

@item @code{clear-on-logout?} (default: @code{#t})
-When set to @code{#t}, the screen will be cleared after logout.
+When set to @code{#t}, the screen will be cleared before showing the
+login prompt. The field name is bit unfortunate, since it controls
+clearing also before the initial login, not just after a logout.
+
+@item @code{delay} (default: @code{#f})
+When set to a number, sleep that many seconds after startup.
+
+@item @code{print-issue} (default: @code{#t})
+When set to @code{#t}, write out a new line and the content of
+@file{/etc/issue}. Value of @code{'no-nl} can be used to suppress the
+new line.
+
+@item @code{print-hostname} (default: @code{#t})
+When set to @code{#t}, print the host name before the login prompt. The
+host name is printed up to the first dot. Can be set to @code{'long} to
+print the full host name.
+
+@item @code{nice} (default: @code{#f})
+When set to a number, change the process priority using @code{nice}.
+
+@item @code{chdir} (default: @code{#f})
+When set to a string, change into that directory before calling the
+login program.
+
+@item @code{chroot} (default: @code{#f})
+When set to a string, call @code{chroot} with that directory.

@item @code{mingetty} (default: @var{mingetty})
The Mingetty package to use.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 6473e1a91a..9712218bd5 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -187,6 +187,12 @@ (define-module (gnu services base)
mingetty-configuration-login-pause?
mingetty-configuration-clear-on-logout?
mingetty-configuration-mingetty
+ mingetty-configuration-delay
+ mingetty-configuration-print-issue
+ mingetty-configuration-print-hostname
+ mingetty-configuration-nice
+ mingetty-configuration-chdir
+ mingetty-configuration-chroot
mingetty-configuration?
mingetty-service ; deprecated
mingetty-service-type
@@ -1250,12 +1256,25 @@ (define-record-type* <mingetty-configuration>
(login-pause? mingetty-login-pause? ;Boolean
(default #f))
(clear-on-logout? mingetty-clear-on-logout? ;Boolean
- (default #t)))
+ (default #t))
+ (delay mingetty-configuration-delay ;Integer | #f
+ (default #f))
+ (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
+ (default #t))
+ (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
+ (default #t))
+ (nice mingetty-configuration-nice ;Integer | #f
+ (default #f))
+ (chdir mingetty-configuration-chdir ;String | #f
+ (default #f))
+ (chroot mingetty-configuration-chroot ;String | #f
+ (default #f)))

(define (mingetty-shepherd-service config)
(match-record config <mingetty-configuration>
- (mingetty tty auto-login login-program
- login-pause? clear-on-logout?)
+ ( mingetty tty auto-login login-program
+ login-pause? clear-on-logout? delay
+ print-issue print-hostname nice chdir chroot)
(list
(shepherd-service
(documentation "Run mingetty on an tty.")
@@ -1286,6 +1305,32 @@ (define (mingetty-shepherd-service config)
#~())
#$@(if login-pause?
#~("--loginpause")
+ #~())
+ #$@(if delay
+ #~("--delay" #$(number->string delay))
+ #~())
+ #$@(match print-issue
+ (#t
+ #~())
+ ('no-nl
+ #~("--nonewline"))
+ (#f
+ #~("--noissue")))
+ #$@(match print-hostname
+ (#t
+ #~())
+ ('long
+ #~("--long-hostname"))
+ (#f
+ #~("--nohostname")))
+ #$@(if nice
+ #~("--nice" #$(number->string nice))
+ #~())
+ #$@(if chdir
+ #~("--chdir" #$chdir)
+ #~())
+ #$@(if chroot
+ #~("--chroot" #$chroot)
#~()))))
(stop #~(make-kill-destructor))))))

--
2.46.0
L
L
Ludovic Courtès wrote on 2 Dec 12:05 +0100
(name . Tomas Volf)(address . ~@wolfsden.cz)
87v7w2wdir.fsf@gnu.org
Hi,

Tomas Volf <~@wolfsden.cz> skribis:

Toggle quote (7 lines)
> +@item @code{chdir} (default: @code{#f})
> +When set to a string, change into that directory before calling the
> +login program.
> +
> +@item @code{chroot} (default: @code{#f})
> +When set to a string, call @code{chroot} with that directory.

How about ‘working-directory’ and ‘root-directory’ for these two, in
line with widespread naming convention?

And instead of “call chroot”, I’d write “use this directory as the
process's root (``chroot'' into it).” (again in an effort to avoid
jargon and abbreviations).

Other than that LGTM!

Ludo’.
T
T
Tomas Volf wrote on 3 Dec 01:11 +0100
[PATCH v3 2/3] services: mingetty: Rename misnamed accessors.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
adac71d33dd2a6a2f7e98cd1181e3717b80bd00e.1733184699.git.~@wolfsden.cz
Rename the accessors to ensure all start with `mingetty-configuration-'
prefix. Some were named just `mingetty-$FIELD', instead of
`mingetty-configuration-$FIELD'.

The renaming *is* backwards compatible, since in the define-module's #:export
argument the correct (`mingetty-configuration-$FIELD') were used already and
thus the accessors were not accessible.

* gnu/services/base.scm (<mingetty-configuration>): Rename accessors for
auto-login, login-program, login-pause?, clear-on-logout?.

Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
---
v2: Now is a separate commit.

gnu/services/base.scm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 798356ed84..f1995640f1 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1248,14 +1248,14 @@ (define-record-type* <mingetty-configuration>
mingetty-configuration?
(mingetty mingetty-configuration-mingetty ;file-like
(default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-auto-login ;string | #f
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-configuration-auto-login ;string | #f
(default #f))
- (login-program mingetty-login-program ;gexp
+ (login-program mingetty-configuration-login-program ;gexp
(default #f))
- (login-pause? mingetty-login-pause? ;Boolean
+ (login-pause? mingetty-configuration-login-pause? ;Boolean
(default #f))
- (clear-on-logout? mingetty-clear-on-logout? ;Boolean
+ (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
(default #t))
(delay mingetty-configuration-delay ;Integer | #f
(default #f))
--
2.46.0
T
T
Tomas Volf wrote on 3 Dec 01:11 +0100
[PATCH v3 1/3] services: mingetty: Add additional configuration options.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
746975a119582d4dc85f1e5615d6b870a81164a9.1733184699.git.~@wolfsden.cz
Not all aspects of mingetty were configurable, so this commit adds the
additional configuration fields to support that.

* gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
print-hostname, nice, chdir, chroot fields.
(mingetty-shepherd-service): Use the new fields.
(define-module)<#:export>: Export the new accessors.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document the
additional field.

Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
---
v2: Split the renaming into separate commit (2/3). Do not delete the
mingetty-configuration-mingetty accessor.
v3: Use working-directory and root-directory instead of chdir and chroot.

doc/guix.texi | 28 ++++++++++++++++-
gnu/services/base.scm | 72 +++++++++++++++++++++++++++++++++++--------
2 files changed, 86 insertions(+), 14 deletions(-)

Toggle diff (139 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 8a6640124c..3432a5d604 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19410,7 +19410,33 @@ Base Services
will have to press a key before the log-in shell is launched.

@item @code{clear-on-logout?} (default: @code{#t})
-When set to @code{#t}, the screen will be cleared after logout.
+When set to @code{#t}, the screen will be cleared before showing the
+login prompt. The field name is bit unfortunate, since it controls
+clearing also before the initial login, not just after a logout.
+
+@item @code{delay} (default: @code{#f})
+When set to a number, sleep that many seconds after startup.
+
+@item @code{print-issue} (default: @code{#t})
+When set to @code{#t}, write out a new line and the content of
+@file{/etc/issue}. Value of @code{'no-nl} can be used to suppress the
+new line.
+
+@item @code{print-hostname} (default: @code{#t})
+When set to @code{#t}, print the host name before the login prompt. The
+host name is printed up to the first dot. Can be set to @code{'long} to
+print the full host name.
+
+@item @code{nice} (default: @code{#f})
+When set to a number, change the process priority using @code{nice}.
+
+@item @code{working-directory} (default: @code{#f})
+When set to a string, change into that directory before calling the
+login program.
+
+@item @code{root-directory} (default: @code{#f})
+When set to a string, use this directory at the process's root
+directory.

@item @code{mingetty} (default: @var{mingetty})
The Mingetty package to use.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 6473e1a91a..798356ed84 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -187,6 +187,12 @@ (define-module (gnu services base)
mingetty-configuration-login-pause?
mingetty-configuration-clear-on-logout?
mingetty-configuration-mingetty
+ mingetty-configuration-delay
+ mingetty-configuration-print-issue
+ mingetty-configuration-print-hostname
+ mingetty-configuration-nice
+ mingetty-configuration-working-directory
+ mingetty-configuration-root-directory
mingetty-configuration?
mingetty-service ; deprecated
mingetty-service-type
@@ -1240,22 +1246,36 @@ (define-deprecated (agetty-service config)
(define-record-type* <mingetty-configuration>
mingetty-configuration make-mingetty-configuration
mingetty-configuration?
- (mingetty mingetty-configuration-mingetty ;file-like
- (default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-auto-login ;string | #f
- (default #f))
- (login-program mingetty-login-program ;gexp
- (default #f))
- (login-pause? mingetty-login-pause? ;Boolean
- (default #f))
- (clear-on-logout? mingetty-clear-on-logout? ;Boolean
- (default #t)))
+ (mingetty mingetty-configuration-mingetty ;file-like
+ (default mingetty))
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-auto-login ;string | #f
+ (default #f))
+ (login-program mingetty-login-program ;gexp
+ (default #f))
+ (login-pause? mingetty-login-pause? ;Boolean
+ (default #f))
+ (clear-on-logout? mingetty-clear-on-logout? ;Boolean
+ (default #t))
+ (delay mingetty-configuration-delay ;Integer | #f
+ (default #f))
+ (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
+ (default #t))
+ (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
+ (default #t))
+ (nice mingetty-configuration-nice ;Integer | #f
+ (default #f))
+ (working-directory mingetty-configuration-working-directory ;String | #f
+ (default #f))
+ (root-directory mingetty-configuration-root-directory ;String | #f
+ (default #f)))

(define (mingetty-shepherd-service config)
(match-record config <mingetty-configuration>
- (mingetty tty auto-login login-program
- login-pause? clear-on-logout?)
+ ( mingetty tty auto-login login-program
+ login-pause? clear-on-logout? delay
+ print-issue print-hostname nice
+ working-directory root-directory)
(list
(shepherd-service
(documentation "Run mingetty on an tty.")
@@ -1286,6 +1306,32 @@ (define (mingetty-shepherd-service config)
#~())
#$@(if login-pause?
#~("--loginpause")
+ #~())
+ #$@(if delay
+ #~("--delay" #$(number->string delay))
+ #~())
+ #$@(match print-issue
+ (#t
+ #~())
+ ('no-nl
+ #~("--nonewline"))
+ (#f
+ #~("--noissue")))
+ #$@(match print-hostname
+ (#t
+ #~())
+ ('long
+ #~("--long-hostname"))
+ (#f
+ #~("--nohostname")))
+ #$@(if nice
+ #~("--nice" #$(number->string nice))
+ #~())
+ #$@(if working-directory
+ #~("--chdir" #$working-directory)
+ #~())
+ #$@(if root-directory
+ #~("--chroot" #$root-directory)
#~()))))
(stop #~(make-kill-destructor))))))

--
2.46.0
T
T
Tomas Volf wrote on 3 Dec 01:11 +0100
[PATCH v3 3/3] services: mingetty: Support waiting on shepherd services.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
09f772e45032200dd462ecb54b39c97ddb3301d6.1733184699.git.~@wolfsden.cz
For auto-login on systems with elogind, dbus-system needs to be started. This
commit adds ability to express that ordering.

* gnu/services/base.scm (<mingetty-configuration>): Add shepherd-requirement
field.
(mingetty-shepherd-service): Use it.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document it.

Change-Id: Iedbdc4375180740379d561aa193d7c63350d2e7b
---
v2: Just slight formatting changes.

doc/guix.texi | 20 ++++++++++++++
gnu/services/base.scm | 61 +++++++++++++++++++++++--------------------
2 files changed, 53 insertions(+), 28 deletions(-)

Toggle diff (121 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 3432a5d604..41b23e4695 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19438,6 +19438,26 @@ Base Services
When set to a string, use this directory at the process's root
directory.

+@item @code{shepherd-requirement}
+List of shepherd requirements. Unless you know what you are doing, it
+is recommended to add to the default list instead of replacing.
+
+For example you can use this field when performing auto-login on a
+system with elogind to wait on @code{'dbus-system}.
+
+@lisp
+(modify-services %base-services
+ (mingetty-service-type config =>
+ (mingetty-configuration
+ (inherit config)
+ ;; Automatically log in as "guest".
+ (auto-login "guest")
+ (shepherd-requirement
+ (cons 'dbus-system
+ (mingetty-configuration-shepherd-requirement
+ config))))))
+@end lisp
+
@item @code{mingetty} (default: @var{mingetty})
The Mingetty package to use.

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index f1995640f1..6a42496599 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -193,6 +193,7 @@ (define-module (gnu services base)
mingetty-configuration-nice
mingetty-configuration-working-directory
mingetty-configuration-root-directory
+ mingetty-configuration-shepherd-requirement
mingetty-configuration?
mingetty-service ; deprecated
mingetty-service-type
@@ -1246,45 +1247,49 @@ (define-deprecated (agetty-service config)
(define-record-type* <mingetty-configuration>
mingetty-configuration make-mingetty-configuration
mingetty-configuration?
- (mingetty mingetty-configuration-mingetty ;file-like
- (default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-configuration-auto-login ;string | #f
- (default #f))
- (login-program mingetty-configuration-login-program ;gexp
- (default #f))
- (login-pause? mingetty-configuration-login-pause? ;Boolean
- (default #f))
- (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
- (default #t))
- (delay mingetty-configuration-delay ;Integer | #f
- (default #f))
- (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
- (default #t))
- (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
- (default #t))
- (nice mingetty-configuration-nice ;Integer | #f
- (default #f))
- (working-directory mingetty-configuration-working-directory ;String | #f
- (default #f))
- (root-directory mingetty-configuration-root-directory ;String | #f
- (default #f)))
+ (mingetty mingetty-configuration-mingetty ;file-like
+ (default mingetty))
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-configuration-auto-login ;string | #f
+ (default #f))
+ (login-program mingetty-configuration-login-program ;gexp
+ (default #f))
+ (login-pause? mingetty-configuration-login-pause? ;Boolean
+ (default #f))
+ (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
+ (default #t))
+ (delay mingetty-configuration-delay ;Integer | #f
+ (default #f))
+ (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
+ (default #t))
+ (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
+ (default #t))
+ (nice mingetty-configuration-nice ;Integer | #f
+ (default #f))
+ (working-directory mingetty-configuration-working-directory ;String | #f
+ (default #f))
+ (root-directory mingetty-configuration-root-directory ;String | #f
+ (default #f))
+ (shepherd-requirement mingetty-configuration-shepherd-requirement
+ ;; Since the login prompt shows the host name, wait
+ ;; for the 'host-name' service to be done. Also wait
+ ;; for udev essentially so that the tty text is not
+ ;; lost in the middle of kernel messages (XXX).
+ (default '( user-processes host-name udev
+ virtual-terminal))))

(define (mingetty-shepherd-service config)
(match-record config <mingetty-configuration>
( mingetty tty auto-login login-program
login-pause? clear-on-logout? delay
print-issue print-hostname nice
- working-directory root-directory)
+ working-directory root-directory shepherd-requirement)
(list
(shepherd-service
(documentation "Run mingetty on an tty.")
(provision (list (symbol-append 'term- (string->symbol tty))))

- ;; Since the login prompt shows the host name, wait for the 'host-name'
- ;; service to be done. Also wait for udev essentially so that the tty
- ;; text is not lost in the middle of kernel messages (XXX).
- (requirement '(user-processes host-name udev virtual-terminal))
+ (requirement shepherd-requirement)

(start #~(make-forkexec-constructor
(list #$(file-append mingetty "/sbin/mingetty")
--
2.46.0
T
T
Tomas Volf wrote on 3 Dec 01:18 +0100
Re: [bug#74508] [PATCH v2 1/3] services: mingetty: Add additional configuration options.
(name . Ludovic Courtès)(address . ludo@gnu.org)
87ldwx39h8.fsf@wolfsden.cz
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (20 lines)
> Hi,
>
> Tomas Volf <~@wolfsden.cz> skribis:
>
>> +@item @code{chdir} (default: @code{#f})
>> +When set to a string, change into that directory before calling the
>> +login program.
>> +
>> +@item @code{chroot} (default: @code{#f})
>> +When set to a string, call @code{chroot} with that directory.
>
> How about ‘working-directory’ and ‘root-directory’ for these two, in
> line with widespread naming convention?
>
> And instead of “call chroot”, I’d write “use this directory as the
> process's root (``chroot'' into it).” (again in an effort to avoid
> jargon and abbreviations).
>
> Other than that LGTM!

I cannot say I particularly agree with that. I would consider both
`chdir' and `chroot' being terms familiar to anyone who would actually
want to configure them, and the terms map cleanly to the mingetty(8).

In any case, I do appreciate the review and I have sent a v3 with the
requested changes.

Have a nice day,
Tomas

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
-----BEGIN PGP SIGNATURE-----

iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmdOTkMOHH5Ad29sZnNk
ZW4uY3oACgkQL7/ufbZ/wamZsQ//Rt3UT6YZ/ATH84SCgK44V8+zhLqwHCxU5yMM
2wM1JV/hzdqAUiJ0tTfwSO8bBEAg/o8tIRhJpUzicqWM+eQrK1AZL+TRF349pDnS
hqHjEaS0cVgKRbLp7wP/GmrRmpG1B68l88eZUywhf3RxhEjWhcu28Wi0z9bFq4tS
ZDxH2gzcZZ2wtVkV7BDfUapSglNSHM+lCeMYgWzO3QPjz32f/lQoJ4v8Id/5027f
HC+Cf5yzK78amm7qtBWrAq9IyH73sPapp0sEJMYy0KI3z6L4sXRNtQ7O0KJiuN3/
sUXaD6cV/0ahcT+LOfYhWNDDOE1ov6jIp0B9NnFzYFWobEk1z2/oGrxw7ncOaXd7
PZXsmjJgru+68W72+s9LGNSmrr8AggNYw7ukEjoXO93j2nU3EarKmcxyiJDyjOib
M9A8TzBtuhrPRxVK0QSrtgH1TguLeKyZ8aIHtmSi1kfZ+FeLSziIvIKNA9W8q1FB
yKE10jZAj6SVN4GEcpL7Jgjc7KAGKEbrJHAFutEAVYJVgszjE3u+amqFtGsDZ2gS
E+LSOc+OpInOemnY1BFkXzvqVSypv+ZYhj5mIxv1Tr+c6dnj1ovVnf7SWn9bTMey
pDEWlkkFDIHlDaet/5+0hvuhYgc5UblH/DhofZZiN1g/a8IZWleqZFBI3/Xm0f97
0cLmU+Y=
=CT3l
-----END PGP SIGNATURE-----

M
M
Maxim Cournoyer wrote on 9 Dec 01:48 +0100
Re: [bug#74508] [PATCH v3 1/3] services: mingetty: Add additional configuration options.
(name . Tomas Volf)(address . ~@wolfsden.cz)
874j3disug.fsf@gmail.com
Hi Tomas,

Tomas Volf <~@wolfsden.cz> writes:

Toggle quote (6 lines)
> Not all aspects of mingetty were configurable, so this commit adds the
> additional configuration fields to support that.
>
> * gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
> print-hostname, nice, chdir, chroot fields.

These have been renamed now :-).

Otherwise, LGTM.

--
Thanks,
Maxim
T
T
Tomas Volf wrote on 13 Dec 17:27 +0100
[PATCH v4 2/3] services: mingetty: Rename misnamed accessors.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
866c4043b1043ace21d5e77751923fad55e3d15c.1734107266.git.~@wolfsden.cz
Rename the accessors to ensure all start with `mingetty-configuration-'
prefix. Some were named just `mingetty-$FIELD', instead of
`mingetty-configuration-$FIELD'.

The renaming *is* backwards compatible, since in the define-module's #:export
argument the correct (`mingetty-configuration-$FIELD') were used already and
thus the accessors were not accessible.

* gnu/services/base.scm (<mingetty-configuration>): Rename accessors for
auto-login, login-program, login-pause?, clear-on-logout?.

Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
---
gnu/services/base.scm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Toggle diff (26 lines)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 798356ed84..f1995640f1 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1248,14 +1248,14 @@ (define-record-type* <mingetty-configuration>
mingetty-configuration?
(mingetty mingetty-configuration-mingetty ;file-like
(default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-auto-login ;string | #f
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-configuration-auto-login ;string | #f
(default #f))
- (login-program mingetty-login-program ;gexp
+ (login-program mingetty-configuration-login-program ;gexp
(default #f))
- (login-pause? mingetty-login-pause? ;Boolean
+ (login-pause? mingetty-configuration-login-pause? ;Boolean
(default #f))
- (clear-on-logout? mingetty-clear-on-logout? ;Boolean
+ (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
(default #t))
(delay mingetty-configuration-delay ;Integer | #f
(default #f))
--
2.46.0
T
T
Tomas Volf wrote on 13 Dec 17:27 +0100
[PATCH v4 1/3] services: mingetty: Add additional configuration options.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
becaab7838edf06bb17b2d34b3cfc7035e01d824.1734107266.git.~@wolfsden.cz
Not all aspects of mingetty were configurable, so this commit adds the
additional configuration fields to support that.

* gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
print-hostname, nice, working-directory, root-directory fields.
(mingetty-shepherd-service): Use the new fields.
(define-module)<#:export>: Export the new accessors.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document the
additional field.

Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
---
v4: Update the commit message.

doc/guix.texi | 28 ++++++++++++++++-
gnu/services/base.scm | 72 +++++++++++++++++++++++++++++++++++--------
2 files changed, 86 insertions(+), 14 deletions(-)

Toggle diff (139 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index a2915de954..f5cd9461a3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19417,7 +19417,33 @@ Base Services
will have to press a key before the log-in shell is launched.

@item @code{clear-on-logout?} (default: @code{#t})
-When set to @code{#t}, the screen will be cleared after logout.
+When set to @code{#t}, the screen will be cleared before showing the
+login prompt. The field name is bit unfortunate, since it controls
+clearing also before the initial login, not just after a logout.
+
+@item @code{delay} (default: @code{#f})
+When set to a number, sleep that many seconds after startup.
+
+@item @code{print-issue} (default: @code{#t})
+When set to @code{#t}, write out a new line and the content of
+@file{/etc/issue}. Value of @code{'no-nl} can be used to suppress the
+new line.
+
+@item @code{print-hostname} (default: @code{#t})
+When set to @code{#t}, print the host name before the login prompt. The
+host name is printed up to the first dot. Can be set to @code{'long} to
+print the full host name.
+
+@item @code{nice} (default: @code{#f})
+When set to a number, change the process priority using @code{nice}.
+
+@item @code{working-directory} (default: @code{#f})
+When set to a string, change into that directory before calling the
+login program.
+
+@item @code{root-directory} (default: @code{#f})
+When set to a string, use this directory at the process's root
+directory.

@item @code{mingetty} (default: @var{mingetty})
The Mingetty package to use.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 6473e1a91a..798356ed84 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -187,6 +187,12 @@ (define-module (gnu services base)
mingetty-configuration-login-pause?
mingetty-configuration-clear-on-logout?
mingetty-configuration-mingetty
+ mingetty-configuration-delay
+ mingetty-configuration-print-issue
+ mingetty-configuration-print-hostname
+ mingetty-configuration-nice
+ mingetty-configuration-working-directory
+ mingetty-configuration-root-directory
mingetty-configuration?
mingetty-service ; deprecated
mingetty-service-type
@@ -1240,22 +1246,36 @@ (define-deprecated (agetty-service config)
(define-record-type* <mingetty-configuration>
mingetty-configuration make-mingetty-configuration
mingetty-configuration?
- (mingetty mingetty-configuration-mingetty ;file-like
- (default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-auto-login ;string | #f
- (default #f))
- (login-program mingetty-login-program ;gexp
- (default #f))
- (login-pause? mingetty-login-pause? ;Boolean
- (default #f))
- (clear-on-logout? mingetty-clear-on-logout? ;Boolean
- (default #t)))
+ (mingetty mingetty-configuration-mingetty ;file-like
+ (default mingetty))
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-auto-login ;string | #f
+ (default #f))
+ (login-program mingetty-login-program ;gexp
+ (default #f))
+ (login-pause? mingetty-login-pause? ;Boolean
+ (default #f))
+ (clear-on-logout? mingetty-clear-on-logout? ;Boolean
+ (default #t))
+ (delay mingetty-configuration-delay ;Integer | #f
+ (default #f))
+ (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
+ (default #t))
+ (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
+ (default #t))
+ (nice mingetty-configuration-nice ;Integer | #f
+ (default #f))
+ (working-directory mingetty-configuration-working-directory ;String | #f
+ (default #f))
+ (root-directory mingetty-configuration-root-directory ;String | #f
+ (default #f)))

(define (mingetty-shepherd-service config)
(match-record config <mingetty-configuration>
- (mingetty tty auto-login login-program
- login-pause? clear-on-logout?)
+ ( mingetty tty auto-login login-program
+ login-pause? clear-on-logout? delay
+ print-issue print-hostname nice
+ working-directory root-directory)
(list
(shepherd-service
(documentation "Run mingetty on an tty.")
@@ -1286,6 +1306,32 @@ (define (mingetty-shepherd-service config)
#~())
#$@(if login-pause?
#~("--loginpause")
+ #~())
+ #$@(if delay
+ #~("--delay" #$(number->string delay))
+ #~())
+ #$@(match print-issue
+ (#t
+ #~())
+ ('no-nl
+ #~("--nonewline"))
+ (#f
+ #~("--noissue")))
+ #$@(match print-hostname
+ (#t
+ #~())
+ ('long
+ #~("--long-hostname"))
+ (#f
+ #~("--nohostname")))
+ #$@(if nice
+ #~("--nice" #$(number->string nice))
+ #~())
+ #$@(if working-directory
+ #~("--chdir" #$working-directory)
+ #~())
+ #$@(if root-directory
+ #~("--chroot" #$root-directory)
#~()))))
(stop #~(make-kill-destructor))))))

--
2.46.0
T
T
Tomas Volf wrote on 13 Dec 17:27 +0100
[PATCH v4 3/3] services: mingetty: Support waiting on shepherd services.
(address . 74508@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
c46a6ef58102022ce4679816c46e51b404aa06c4.1734107266.git.~@wolfsden.cz
For auto-login on systems with elogind, dbus-system needs to be started. This
commit adds ability to express that ordering.

* gnu/services/base.scm (<mingetty-configuration>): Add shepherd-requirement
field.
(mingetty-shepherd-service): Use it.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document it.

Change-Id: Iedbdc4375180740379d561aa193d7c63350d2e7b
---
doc/guix.texi | 20 ++++++++++++++
gnu/services/base.scm | 61 +++++++++++++++++++++++--------------------
2 files changed, 53 insertions(+), 28 deletions(-)

Toggle diff (123 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index f5cd9461a3..5da0716fa7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19445,6 +19445,26 @@ Base Services
When set to a string, use this directory at the process's root
directory.
+@item @code{shepherd-requirement}
+List of shepherd requirements. Unless you know what you are doing, it
+is recommended to add to the default list instead of replacing.
+
+For example you can use this field when performing auto-login on a
+system with elogind to wait on @code{'dbus-system}.
+
+@lisp
+(modify-services %base-services
+ (mingetty-service-type config =>
+ (mingetty-configuration
+ (inherit config)
+ ;; Automatically log in as "guest".
+ (auto-login "guest")
+ (shepherd-requirement
+ (cons 'dbus-system
+ (mingetty-configuration-shepherd-requirement
+ config))))))
+@end lisp
+
@item @code{mingetty} (default: @var{mingetty})
The Mingetty package to use.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index f1995640f1..6a42496599 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -193,6 +193,7 @@ (define-module (gnu services base)
mingetty-configuration-nice
mingetty-configuration-working-directory
mingetty-configuration-root-directory
+ mingetty-configuration-shepherd-requirement
mingetty-configuration?
mingetty-service ; deprecated
mingetty-service-type
@@ -1246,45 +1247,49 @@ (define-deprecated (agetty-service config)
(define-record-type* <mingetty-configuration>
mingetty-configuration make-mingetty-configuration
mingetty-configuration?
- (mingetty mingetty-configuration-mingetty ;file-like
- (default mingetty))
- (tty mingetty-configuration-tty) ;string
- (auto-login mingetty-configuration-auto-login ;string | #f
- (default #f))
- (login-program mingetty-configuration-login-program ;gexp
- (default #f))
- (login-pause? mingetty-configuration-login-pause? ;Boolean
- (default #f))
- (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
- (default #t))
- (delay mingetty-configuration-delay ;Integer | #f
- (default #f))
- (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
- (default #t))
- (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
- (default #t))
- (nice mingetty-configuration-nice ;Integer | #f
- (default #f))
- (working-directory mingetty-configuration-working-directory ;String | #f
- (default #f))
- (root-directory mingetty-configuration-root-directory ;String | #f
- (default #f)))
+ (mingetty mingetty-configuration-mingetty ;file-like
+ (default mingetty))
+ (tty mingetty-configuration-tty) ;string
+ (auto-login mingetty-configuration-auto-login ;string | #f
+ (default #f))
+ (login-program mingetty-configuration-login-program ;gexp
+ (default #f))
+ (login-pause? mingetty-configuration-login-pause? ;Boolean
+ (default #f))
+ (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
+ (default #t))
+ (delay mingetty-configuration-delay ;Integer | #f
+ (default #f))
+ (print-issue mingetty-configuration-print-issue ;Boolean | Symbol
+ (default #t))
+ (print-hostname mingetty-configuration-print-hostname ;Boolean | Symbol
+ (default #t))
+ (nice mingetty-configuration-nice ;Integer | #f
+ (default #f))
+ (working-directory mingetty-configuration-working-directory ;String | #f
+ (default #f))
+ (root-directory mingetty-configuration-root-directory ;String | #f
+ (default #f))
+ (shepherd-requirement mingetty-configuration-shepherd-requirement
+ ;; Since the login prompt shows the host name, wait
+ ;; for the 'host-name' service to be done. Also wait
+ ;; for udev essentially so that the tty text is not
+ ;; lost in the middle of kernel messages (XXX).
+ (default '( user-processes host-name udev
+ virtual-terminal))))
(define (mingetty-shepherd-service config)
(match-record config <mingetty-configuration>
( mingetty tty auto-login login-program
login-pause? clear-on-logout? delay
print-issue print-hostname nice
- working-directory root-directory)
+ working-directory root-directory shepherd-requirement)
(list
(shepherd-service
(documentation "Run mingetty on an tty.")
(provision (list (symbol-append 'term- (string->symbol tty))))
- ;; Since the login prompt shows the host name, wait for the 'host-name'
- ;; service to be done. Also wait for udev essentially so that the tty
- ;; text is not lost in the middle of kernel messages (XXX).
- (requirement '(user-processes host-name udev virtual-terminal))
+ (requirement shepherd-requirement)
(start #~(make-forkexec-constructor
(list #$(file-append mingetty "/sbin/mingetty")
--
2.46.0
M
M
Maxim Cournoyer wrote on 14 Dec 16:39 +0100
Re: [bug#74508] [PATCH v4 1/3] services: mingetty: Add additional configuration options.
(name . Tomas Volf)(address . ~@wolfsden.cz)
87ldwi1dfb.fsf@gmail.com
Hi,

I've taken the freedom to reword some passages in the manual, and pushed
to the master branch.

Closing!

--
Thanks,
Maxim
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 74508@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 74508
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch