FS#24685 - [mkinitcpio] add support for systemd when using keymap and consolefont HOOKS
Attached to Project:
Arch Linux
Opened by Jamie Nguyen (jnguyen) - Saturday, 11 June 2011, 12:41 GMT
Last edited by Dave Reisner (falconindy) - Wednesday, 05 October 2011, 00:13 GMT
Opened by Jamie Nguyen (jnguyen) - Saturday, 11 June 2011, 12:41 GMT
Last edited by Dave Reisner (falconindy) - Wednesday, 05 October 2011, 00:13 GMT
|
Details
PREFACE
======= I noticed that my LUKS encryption key failed on bootup after installing systemd. It worked after editing KEYMAP within /etc/rc.conf to match the systemd config files and regenerating the mkinitcpio image. DESCRIPTION =========== Arch has always revolved around /etc/rc.conf, which is used by mkinitcpio for two HOOKS: consolefont HOOK parses /etc/rc.conf for CONSOLEFONT keymap HOOK parses /etc/rc.conf for LOCALE and KEYMAP Now with the introduction of systemd, there now exists another way to configure and boot your system. Two of the new configuration files are: /etc/locale.conf where LANG is set (replaces LOCALE in /etc/rc.conf) /etc/vconsole.conf where KEYMAP and FONT are set (replaces KEYMAP and CONSOLEFONT in /etc/rc.conf) The only reason for /etc/locale.conf and /etc/vconsole.conf to exist is because the user has setup systemd, and so they will be managing LOCALE/KEYMAP/FONT in these files instead of /etc/rc.conf. I therefore propose that if these files exist, then mkinitcpio should parse them in preference to /etc/rc.conf. This has no effect on users that have not switched to systemd. PROPOSED SOLUTION ================= I propose the small patch against mkinitcpio 0.6.13-1 that I have attached. systemd users will no longer have to manage LOCALE/KEYMAP/FONT in several places, and running mkinitcpio will no longer give an error message if /etc/rc.conf does not exist (running a system without /etc/rc.conf is not at all supported, but may well be a supported option in the future). With this patch, mkinitcpio will thus parse /etc/locale.conf and /etc/vconsole.conf if they exist in preference to /etc/rc.conf. I have also updated the messages printed by "mkinitcpio -H [HOOKNAME]". |
This task depends upon
Closed by Dave Reisner (falconindy)
Wednesday, 05 October 2011, 00:13 GMT
Reason for closing: Implemented
Wednesday, 05 October 2011, 00:13 GMT
Reason for closing: Implemented
1) optdepend on initscripts (somewhat silly, imo).
2) not assume that rc.conf exists, and error out when it does (most pragmatic).
3) implement another way to provide KEYMAP and CONSOLEFONT variables (awkward).
I don't think I mentioned your packaging :)
edit: hmm well actually I did in the comment just above :rolleyes: But just to clarify that it wasn't a criticism of your packaging, but more of a reason to change mkinitcpio. I mentioned it because now a user can very plausibly decide to remove initscripts, whereas before your change it was less likely for a user to do this. This is somewhat important because mkinitcpio still expects rc.conf to exist.
If you take a look at the patch, it allows mkinitcpio to parse systemd's /etc/locale.conf and /etc/vconsole.conf, instead of initscripts /etc/rc.conf (if locale.conf and vconsole.conf exist that is). This way systemd users who need those hooks don't need to manage their KEYMAP in two different places.
The problem with patching mkinitcpio is where do you stop adding files to parse. If initscripts and systemd are the only two options, then it's not so bad, but if more init systems get introduced then you might have a problem deciding which files have precedence. In the patch I proposed, the systemd files have precedence since they require a user to create them manually. If you or Thomas decide not to patch, then I'll be happy if mkinitcpio just provides some kind of meaningful error message (although some users may be more obsessed than I am with cleansing initscripts from their system). In fact, one can uninstall initscripts and just have an rc.conf with 3 lines containing the 3 variables, though you would still have to manage those variables in two separate places (not that it really matter that much... just thought I'd throw this patch out there and see what you both think :)
#
# rc.conf
#
. /etc/vconsole.conf
. /etc/locale.conf
CONSOLEFONT=$FONT
CONSOLEMAP=$KEYMAP
LOCALE=$LANG
This requires some support in the hooks so that we actually source /etc/rc.conf instead of just doing an eval $(grep..), but I'm willing to add that. I'm inclined to say that we should probably favor the init system in core, or else we end up on a slippery slope.
Patchwork on my working branch:
https://github.com/falconindy/mkinitcpio/commits/working