Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use /run/issue.d for generated issue snippets #7

Closed
rfairley opened this issue Nov 14, 2018 · 7 comments · Fixed by #91
Closed

Use /run/issue.d for generated issue snippets #7

rfairley opened this issue Nov 14, 2018 · 7 comments · Fixed by #91
Assignees
Labels
jira for syncing to jira

Comments

@rfairley
Copy link
Contributor

rfairley commented Nov 14, 2018

Currently, the default in Fedora is to have agetty search /etc/issue.d/ for issue files to display before login at the serial console.

issuegen generates an issue at runtime, and places the generated file in /run/issue.d/. To have agetty display this, a symlink from /etc/issue.d/ to /run/issue.d/ is needed.

It would be preferable not to need a symlink, and instead have agetty search /run/issue.d/ by default (in addition to /etc/issue.d/. This requires changing upstream code that will go into Fedora. SELinux policy changes may be needed as well to allow agetty to read other directories (related).

The change would implement near equivalent functionality of a similar change in pam_motd.

Alternatively, the pam_issue module could be modified to support a list of issue paths, and have the Fedora default way of displaying issue files changed from agetty to a service that uses pam_issue. But changing the Fedora default is a lot more significant than the first option, and unlikely to be adopted just for the console-login-helper-messages package.

@rfairley rfairley added kind/enhancement New feature or request type/upstream labels Nov 14, 2018
@dustymabe
Copy link
Member

has the upstream source changed any?

@rfairley
Copy link
Contributor Author

It seems there is now support for /run/issue{.d}, /usr/lib/issue{.d}, and util-linux-2.35 is available in Fedora >= 32.

We can have c-l-h-m in Fedora use /run/issue.d for the snippet it writes (currently it writes into /run/console-login-helper-messages), and have this change in a new release of c-l-h-m timed after Fedora 32 is officially released. For backwards compatibility for systems with a util-linux version below 2.35, a command line option like issuegen --legacy could be available to keep using the private directory.

@dustymabe
Copy link
Member

WDYT about go ahead and modify the sources now and do a new release and we can just build it for f32+ ?

@dustymabe
Copy link
Member

the fedora cloud base image uses c-l-h-m already so we can test it there and we have a next stream coming in Fedora CoreOS that can go ahead and take advantage of it

@rfairley
Copy link
Contributor Author

rfairley commented Apr 1, 2020

SGTM to make the change now! I will start on changing the source, and should have a PR today or tomorrow.

@rfairley rfairley changed the title Have either agetty or linux-pam support a list of issue directories Use /run/issue.d for generated issue messages Apr 1, 2020
@rfairley rfairley changed the title Use /run/issue.d for generated issue messages Use /run/issue.d feature in agetty for generated issue snippets Apr 1, 2020
@rfairley rfairley removed component/upstream kind/enhancement New feature or request labels Apr 15, 2020
rfairley pushed a commit to rfairley/console-login-helper-messages that referenced this issue Apr 20, 2020
Split out `if_snippets_gen` from the `issuegen` script. This makes
the udev rule `90-console-login-helper-messages-if_snippets_gen.rules`
responsible only for writing snippets with information about network
interfaces to the runtime issue snippets directory
(`/run/console-login-helper-messages/issue.d`) read by `issuegen`
to generate the final `/run/console-login-helper-messages/40_console-login-helper-messages.issue`
file read by the serial terminal (agetty). This is beneficial as
it helps avoid situations where multiple invocations of `issuegen`
are executed concurrently (leading to bugs like coreos#35). This is also
a first step towards making the shown information more configurable
(coreos#15). Also preparation for coreos#7, which will involve making the
`issuegen` script more configurable by accepting a `--legacy` flag
(coreos#7 (comment)),
by reducing the number places in the code that the `issuegen`
function is called (so less downstream patching to pass in a
`--legacy` flag required).

Add `console-login-helper-messages.path`, so that `issuegen` is run
whenever snippets are written to `/run/console-login-helper-messages/issue.d`.
This should be the main way of triggering a run of `issuegen` (first
trigger the path, which starts the service, which will run
`issuegen`). The only other time the `issuegen` service is invoked
is on boot (if the unit is enabled). Note, enablement of the path
unit is required upon installation.
rfairley pushed a commit to rfairley/console-login-helper-messages that referenced this issue Apr 20, 2020
Split out `if_snippets_gen` from the `issuegen` script. This makes
the udev rule `90-console-login-helper-messages-if_snippets_gen.rules`
responsible only for writing snippets with information about network
interfaces to the runtime issue snippets directory
(`/run/console-login-helper-messages/issue.d`) read by `issuegen`
to generate the final `/run/console-login-helper-messages/40_console-login-helper-messages.issue`
file read by the serial terminal (agetty).

This is beneficial as it helps avoid situations where multiple
invocations of `issuegen` are executed concurrently (leading to
bugs like coreos#35). This is also a first step towards making the shown
information more configurable (coreos#15).

Preparation also for coreos#7, reducing the number of places in the code
that `issuegen` is called directly, reducing potential downstream
patching needed to pass in a `--legacy` option to the script
(coreos#7 (comment)).

Add `console-login-helper-messages.path`, so that `issuegen` is run
whenever snippets are written to `/run/console-login-helper-messages/issue.d`.
This should be the main way of triggering a run of `issuegen` (first
trigger the path, which starts the service, which will run
`issuegen`). The only other time the `issuegen` service is invoked
is on boot (if the unit is enabled). Note, enablement of the path
unit is required upon installation.
@rfairley rfairley changed the title Use /run/issue.d feature in agetty for generated issue snippets Use /run/issue.d for generated issue snippets May 18, 2020
@rfairley
Copy link
Contributor Author

With the updated util-linux, the current logic is that /run/issue and /run/issue.d will only be searched if /etc/issue is not present. Reference: util-linux/util-linux@456bcbc#diff-1a88921242270a199a0c569fd343b41fR357 (also tried locally). For now, I'll leave the symlink from /etc/issue.d to the location under /run in place.

It may be feasible to modify agetty with an option to override this behavior and display multiple issue paths - opened an issue for this: util-linux/util-linux#1041

@kelvinfan001
Copy link
Member

Option in agetty to override this behavior and display multiple issue paths is now in util-linux release 2.36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira for syncing to jira
Projects
None yet
3 participants