You are not logged in.

#1 2020-01-03 13:18:54

bernd_b
Member
Registered: 2013-07-30
Posts: 183

systemd-vconsole-setup works, but not when booting

I did not know where to post this, so I choose the humble Newbie-section:

My boot logs show this:

[root@amd64-archlinux bernd_b]# journalctl -b
.
.
.
Jan 03 13:36:05 amd64-archlinux systemd-vconsole-setup[467]: /usr/bin/setfont failed with exit status 66.
Jan 03 13:36:05 amd64-archlinux systemd-vconsole-setup[467]: /usr/bin/loadkeys failed with exit status 1.
Jan 03 13:36:05 amd64-archlinux systemd-vconsole-setup[467]: Setting source virtual console failed, ignoring remaining ones
Jan 03 13:36:05 amd64-archlinux systemd-udevd[443]: vtcon0: Process '/usr/lib/systemd/systemd-vconsole-setup' failed with exit code 1.
Jan 03 13:36:05 amd64-archlinux systemd-vconsole-setup[502]: /usr/bin/setfont failed with exit status 66.
Jan 03 13:36:05 amd64-archlinux systemd-vconsole-setup[502]: /usr/bin/loadkeys failed with exit status 1.
Jan 03 13:36:05 amd64-archlinux systemd-vconsole-setup[502]: Setting source virtual console failed, ignoring remaining ones
Jan 03 13:36:05 amd64-archlinux systemd-udevd[447]: vtcon1: Process '/usr/lib/systemd/systemd-vconsole-setup' failed with exit code 1.
Jan 03 13:36:05 amd64-archlinux systemd[1]: Condition check resulted in FUSE Control File System being skipped.
Jan 03 13:36:05 amd64-archlinux systemd[1]: Condition check resulted in First Boot Wizard being skipped.
Jan 03 13:36:05 amd64-archlinux systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped.
Jan 03 13:36:05 amd64-archlinux systemd[1]: Condition check resulted in Create System Users being skipped.
Jan 03 13:36:05 amd64-archlinux systemd[1]: Condition check resulted in FUSE Control File System being skipped.
Jan 03 13:36:05 amd64-archlinux systemd[1]: Condition check resulted in First Boot Wizard being skipped.
Jan 03 13:36:05 amd64-archlinux systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped.
Jan 03 13:36:05 amd64-archlinux systemd[1]: Condition check resulted in Create System Users being skipped.
Jan 03 13:36:06 amd64-archlinux systemd-vconsole-setup[535]: /usr/bin/setfont failed with exit status 66.
Jan 03 13:36:06 amd64-archlinux systemd-vconsole-setup[535]: /usr/bin/loadkeys failed with exit status 1.
Jan 03 13:36:06 amd64-archlinux systemd-vconsole-setup[535]: Setting source virtual console failed, ignoring remaining ones
Jan 03 13:36:06 amd64-archlinux systemd-udevd[438]: vtcon0: Process '/usr/lib/systemd/systemd-vconsole-setup' failed with exit code 1.
Jan 03 13:36:06 amd64-archlinux systemd[1]: Started Flush Journal to Persistent Storage.
Jan 03 13:36:06 amd64-archlinux audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-journal-flush comm="systemd" exe="/usr/lib/sys>
Jan 03 13:36:06 amd64-archlinux systemd[1]: Started Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling.
Jan 03 13:36:06 amd64-archlinux audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=lvm2-monitor comm="systemd" exe="/usr/lib/systemd/syst>
Jan 03 13:36:06 amd64-archlinux systemd[1]: Reached target Local File Systems (Pre).
Jan 03 13:36:06 amd64-archlinux systemd[1]: Condition check resulted in Virtual Machine and Container Storage (Compatibility) being skipped.
Jan 03 13:36:06 amd64-archlinux systemd[1]: Starting File System Check on /dev/disk/by-label/Data_bb...
Jan 03 13:36:06 amd64-archlinux systemd[1]: Starting File System Check on /dev/disk/by-label/boot_01...
Jan 03 13:36:06 amd64-archlinux systemd[1]: Starting File System Check on /dev/disk/by-uuid/63d51c8d-a19a-4212-89f0-f67dfc634bf0...
Jan 03 13:36:06 amd64-archlinux systemd-fsck[545]: /usr/bin/fsck.xfs: XFS file system.
Jan 03 13:36:06 amd64-archlinux systemd[1]: Started File System Check on /dev/disk/by-label/Data_bb.
Jan 03 13:36:06 amd64-archlinux audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-fsck@dev-disk-by\x2dlabel-Data_bb comm="system>
Jan 03 13:36:06 amd64-archlinux systemd[1]: Mounting /mnt/Data_bb...

.
.
.

And without adding the hooks "systemd and sd-vconsole" as described here, I have us keyboard layout in every TTY* or vconsole.

After boot, I get

[root@amd64-archlinux bernd_b]#  systemctl --state=failed
0 loaded units listed.


[root@amd64-archlinux bernd_b]#  journalctl -fp err
-- Logs begin at Fri 2019-05-03 11:05:55 CEST. --
Jan 03 13:36:05 amd64-archlinux systemd-vconsole-setup[502]: /usr/bin/loadkeys failed with exit status 1.
Jan 03 13:36:06 amd64-archlinux systemd-vconsole-setup[535]: /usr/bin/setfont failed with exit status 66.
Jan 03 13:36:06 amd64-archlinux systemd-vconsole-setup[535]: /usr/bin/loadkeys failed with exit status 1.

.
.
.

[root@amd64-archlinux bernd_b]# systemctl status systemd-vconsole-setup
● systemd-vconsole-setup.service - Setup Virtual Console
     Loaded: loaded (/usr/lib/systemd/system/systemd-vconsole-setup.service; static; vendor preset: disabled)
     Active: inactive (dead)
       Docs: man:systemd-vconsole-setup.service(8)
             man:vconsole.conf(5)

[root@amd64-archlinux bernd_b]# cat /etc/vconsole.conf 
KEYMAP=de-latin1
FONT=eurlatgr

The funny thing is:
Starting the service systemd-vconsole-setup from a terminal in my running xfce-desktop seems to work without problems, indeed I can change the keyboard layout in vconsole (not in the X11-emulated terminals) with

systemctl start systemd-vconsole-setup

It changes the keyboard layout from "us",e.g., to german layout. If I have not gone mad, it doesn't work the other way round, meaning setting KEYMAP=us in vconsole.conf and running "systemctl start systemd-vconsole-setup". Indeed, regardless of what layout I put in vconsole.conf, running

systemctl start systemd-vconsole-setup

changes the keyboard layout back to german layout?!

Offline

#2 2020-01-04 18:35:26

shudouken
Member
Registered: 2015-03-27
Posts: 8

Re: systemd-vconsole-setup works, but not when booting

The only way I got vconsole.conf to work is by adding "keymap" to the hooks array in /etc/mkinitcpio.conf and then running:

mkinitcpio -p linux

See: https://wiki.archlinux.org/index.php/Mkinitcpio

The arch linux installation guide really should mention this, but it's not open for edits.

Offline

#3 2020-01-04 19:06:07

bernd_b
Member
Registered: 2013-07-30
Posts: 183

Re: systemd-vconsole-setup works, but not when booting

This didn't seem sufficient to me. I added "systemd" and "sd-vconsole" as well, systemd seems to be needed by sd-vconsole.

This gives me the intended keyboard layout in vconsole after boot but the mystery of the error messages while booting about setfont and loadkeys failing still remains.

Offline

#4 2021-08-10 09:42:29

simonzack
Member
Registered: 2014-01-18
Posts: 22

Re: systemd-vconsole-setup works, but not when booting

I had a very similar annoying bug, where my custom font appeared rather late in the booting process, after I switched from busybox init to using the systemd init with the sd-vconsole build hook.

The boot logs really lacked detail, making me take quite a long time to figure out how to fix this.

I know this is an old post, but when I was googling my issue I often encountered this thread. I thought I'd post my solution to help others who encounter the same bug. Perhaps my solution is relevant to you as well.

My logs were as follows:

$ journalctl --boot=0
...
Aug 09 20:46:44 archlinux systemd-udevd[239]: vtcon0: Process '/usr/lib/systemd/systemd-vconsole-setup' failed with exit code 1.
Aug 09 20:46:44 archlinux systemd-udevd[240]: vtcon1: Process '/usr/lib/systemd/systemd-vconsole-setup' failed with exit code 1.
...

At some point I ran lsinitcpio /boot/initramfs-linux.img, as I wondered if the boot image was simply missing some files.

Indeed it was. My /etc/vconsole.conf has a custom KEYMAP=/usr/local/share/kbd/keymaps/personal. This keymap and it's include files were missing.

The keymap is processed by the build hook /usr/lib/initcpio/install/sd-vconsole. Looking at the script, it assumes the keymap isn't a custom one, and assumes that it's the name of a file located in /usr/share/kbd/keymaps/

In order to fix this, I created my custom build hook /etc/initcpio/install/sd-vconsole-custom. I added this to the HOOKS array in /etc/mkinitcpio.conf for it to run.

#!/bin/bash

get_decompressor() {
    case "$1" in
        *.gz)
            cat=zcat
            of=${1%.gz}
            ;;
        *.bz2)
            cat=bzcat
            of=${1%.bz2}
            ;;
        *)
            cat=cat
            of=$1
            ;;
    esac
}

add_keymap_file() {
    local cat cmd rest f of

    while read f; do
        get_decompressor "$f"
        while read -r cmd rest; do
            if [[ $cmd == include ]]; then
                eval set $rest
                add_keymap_file "$1"
            fi
        done < <($cat "$f")
        add_dir "${of%/*}"
        $cat "$f" > "$BUILDROOT/$of"
    done < <(
        (
            find /usr/share/kbd/keymaps/ -type f -regex ".*/$1\(\.inc\)?\(\.gz\|\.bz2\)?" ;
            find ${1%/*} -maxdepth 1 -type f -regex "$1\(\.inc\)?\(\.gz\|\.bz2\)?" 2>/dev/null
        ) | cat
    )
}

build() {
    # subshell to avoid namespace pollution
    (
        shopt -s nullglob

        [[ -s /etc/vconsole.conf ]] && . /etc/vconsole.conf

        [[ $KEYMAP ]] && add_keymap_file $KEYMAP.map
        [[ $KEYMAP_TOGGLE ]] && add_keymap_file $KEYMAP_TOGGLE.map
    )
}

build

help() {
    cat <<HELPEOF
This hook adds custom keymap(s) specified in vconsole.conf to the image and loads them during early userspace.
HELPEOF
}

Now after running sudo mkinitcpio --allpresets, my custom font is included in /boot/initramfs-linux.img. However it still didn't get loaded on boot, and the same error was still there, which was really quite frustrating.

I tried to minimize the contents of my /etc/vconsole.conf to see exactly which part causes the error. Turns out it's this line:

FONT_MAP=8859-2

After removing this line, everything finally works as it should.

Last edited by simonzack (2021-08-10 09:49:04)

Offline

#5 2023-10-04 15:57:30

gcb
Member
Registered: 2014-02-12
Posts: 189

Re: systemd-vconsole-setup works, but not when booting

Just adding more to the solution, as this is still a problem with a systemd-vconsold system:

if you happen to only have a font, but an empty keymap, e.g.

$ cat /etc/vconsole.conf
FONT=iso01-12x22
$ lsinitcpio /boot/initramfs-linux.img  | grep us.map
(nothing)

it will assume you use the `us` keymap, and because `mkinitcpio` hooks for vconsole only add explicit listed font/keymaps from that config file, it means the `us` keymap will NOT be included, which will give an error on startup if you use remote root or encrypted root (as you should). e.g.

-- Boot --
 systemd[1]: Starting Virtual Console Setup...
 systemd-vconsole-setup[230]: loadkeys: Unable to open file: us: No such file or directory
 systemd-vconsole-setup[218]: /usr/bin/loadkeys failed with exit status 1.
 systemd[1]: systemd-vconsole-setup.service: Main process exited, code=exited, status=1/FAILURE
 systemd[1]: systemd-vconsole-setup.service: Failed with result 'exit-code'.
 systemd[1]: Failed to start Virtual Console Setup.

to solve that `Unable to open file: us: No such file or directory` error, explicitly set the keymap in that file, which you can with `localectl`

# localectl set-keymap us
# cat /etc/vconsole.conf
FONT=iso01-12x22
KEYMAP=us
XKBLAYOUT=us
XKBMODEL=pc105+inet
XKBOPTIONS=terminate:ctrl_alt_bksp

it adds the keymap (and some other things) to that file. now your `mkinitcp` hooks will include the necessary stuff on you initd file and you will not get errors on boot.

$ lsinitcpio /boot/initramfs-linux.img  | grep us.map
usr/share/kbd/keymaps/i386/qwerty/us.map

Last edited by gcb (2023-10-04 15:58:15)

Offline

#6 2023-10-09 22:26:46

Justmoon
Member
Registered: 2023-10-09
Posts: 1

Re: systemd-vconsole-setup works, but not when booting

Found this thread while searching for the same error messages. In my case, the problem was that I forgot to add the sd-vconsole to the HOOKS in my mkinitcpio.conf file. Hope this saves somebody some time.

Offline

Board footer

Powered by FluxBB