On 4 March 2016 at 14:40, Anton Zinoviev <an...@lml.bas.bg> wrote: > On Fri, Mar 04, 2016 at 11:23:54AM -0300, Felipe Sateler wrote: >> >> There is still keyboard-configuration.sh in runlevel S. So this >> problem is still present. > > Yes. The problem however is much smaller because this script does not > require $remote_fs.
Right. The real problem however, is that rcS support is a debian-specific patch, and the systemd maintainers would like to drop it to decrease maintainance workload. >> I suggest including a service file like this: > > OK. > > Unfortunately, I will not be able to maintain this file or to update it > in accordance with future changes in systemd. So I suppose that unless > you or somebody else volunteers to maintain it, it will be better to > continue without it. As long as the initscript does simple things, it should require very little maintainance. While I can't commit to maintain it (I am no expert in console matters), feel free to CC pkg-systemd-maintainers or myself if you ever receive a bug about this. > >> Description=Set preliminary keymap > > 'Set the console keyboard layout' is a better description. The new > console-setup is better optimized for speed and configures the keyboard > only once. > >> Before=local-fs-pre.target >> Wants=local-fs-pre.target > > What is the meaning of these two? This ensures it is run before systemd attempts to fsck and mount any local filesystems. It is therefore a relatively appropriate replacement for the checkroot dependency. > >> After=udev.service keymap.service These two were copied as-is from the LSB headers > > The reason for keymap.service is that the keymap of console-setup can > take precedence to the keymap provided by the package kbd (I am not sure > this package still configures the keyboard, in the past it did). There does not appear to be a keymap init script: % apt-file search etc/init.d/key console-setup-freebsd: /etc/init.d/keyboard-setup.sh console-setup-linux: /etc/init.d/keyboard-setup.sh keystone: /etc/init.d/keystone This can be dropped then. > > The keyboard configuration depends on the existence of /dev/null and > /dev/tty[1-6]. I have no idea whether this small dependency requires > udeb.service. These are created by the kernel when devtmpfs is mounted, and systemd mounts /dev before starting any units, so they should be available, yes. > >> EnvironmentFile=-/etc/default/locale > > What does this do? This file is used (optionally) only in abnormal > situations. It reads the key-value pairs from the file (if it exists), and exports them as environment variables. Shell commands are not supported, only assignments. > >> ExecStart=/bin/setupcon --keyboard-only > > One novelty in version 1.138 is that it is unnecessary to run setupcon > in order to configure the console. It is OK to configure the keyboard > in this way, but this usually will be slower than what the script > keyboard-setup.sh does -- instead of setupcon it runs > /etc/console-setup/cached_setup_keyboard.sh and reverts to using > setupcon only when this script doesn't exist of fails. IMO, the init script should be as dumb as possible, as it is a conffile. Therefore all program logic should move outside the script and into a helper script that lives in /lib. This way, improvements are guaranteed to be shipped to users. I don't think it is reasonable to try to replicate the logic in keyboard-configuration.sh via systemd dependencies. I would instead split out a script as mentioned, and invoke that (instead of setupcon) in the ExecStart line. If you do not want to extract the logic to a separate script, then the course of action should be to drop the EnvironmentFile, and have ExecStart=/etc/init.d/keyboard-setup.sh start to delegate all the logic to the init script. Note that the important part for us is not the amount of work a given runlevel S script does, but rather that the dependencies are defined by the systemd unit, and not autoguessed from the LSB headers. The resulting unit would be: [Unit] Description=Set the console keyboard layout DefaultDependencies=no Before=local-fs-pre.target Wants=local-fs-pre.target ConditionPathExists=/bin/setupcon [Service] Type=oneshot ExecStart=/etc/init.d/keyboard-setup.sh start # Alternatively, if the setup logic is split to a separate script: #ExecStart=/lib/console-setup/keyboard-setup.sh RemainAfterExit=yes [Install] WantedBy=sysinit.target -- Saludos, Felipe Sateler