You are not logged in.

#1 2023-04-28 15:33:10

tzhuang
Member
Registered: 2017-05-23
Posts: 41

[solved] mkinitcpio hangs on keymap during update of the linux package

When I update the linux package with pacman, it seems to hang the the keymap build hook:

sudo pacman -S linux
warning: linux-6.2.12.arch1-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) linux-6.2.12.arch1-1

Total Installed Size:  174.24 MiB
Net Upgrade Size:        0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                                                                  [########################################################################################] 100%
(1/1) checking package integrity                                                                                                                [########################################################################################] 100%
(1/1) loading package files                                                                                                                     [########################################################################################] 100%
(1/1) checking for file conflicts                                                                                                               [########################################################################################] 100%
(1/1) checking available disk space                                                                                                             [########################################################################################] 100%
:: Processing package changes...
(1/1) reinstalling linux                                                                                                                        [########################################################################################] 100%
:: Running post-transaction hooks...
(1/4) Arming ConditionNeedsUpdate...
(2/4) Updating module dependencies...
(3/4) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: '6.2.12-arch1-1'
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: 'xhci_pci'
  -> Running build hook: [keymap]
^C
Interrupt signal received
error: command terminated by signal 2: Interrupt
(4/4) i3status-rust.hook

The operation hangs there until I cancel it. Running the mkinitcpio operation manually works fine for me:

sudo mkinitcpio -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: '6.2.12-arch1-1'
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: 'xhci_pci'
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [resume]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: '/boot/initramfs-linux.img'
==> Image generation successful

locale.conf:

cat /etc/{vconsole,locale}.conf
cat: /etc/vconsole.conf: No such file or directory
LANG=en_US.UTF-8

mkinitcipio.conf:

cat /etc/mkinitcpio.conf
# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(usbhid xhci_hcd)
MODULES=()

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES=()

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No RAID, lvm2, or encrypted root is needed.
#    HOOKS=(base)
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS=(base udev autodetect modconf block filesystems fsck)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev modconf block filesystems fsck)
#
##   This setup assembles a mdadm array with an encrypted root file system.
##   Note: See 'mkinitcpio -H mdadm_udev' for more information on RAID devices.
#    HOOKS=(base udev modconf keyboard keymap consolefont block mdadm_udev encrypt filesystems fsck)
#
##   This setup loads an lvm2 volume group.
#    HOOKS=(base udev modconf block lvm2 filesystems fsck)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr and fsck hooks.
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems resume fsck)

# COMPRESSION
# Use this to compress the initramfs image. By default, zstd compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="zstd"
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()

# MODULES_DECOMPRESS
# Decompress kernel modules during initramfs creation.
# Enable to speedup boot process, disable to save RAM
# during early userspace. Switch (yes/no).
#MODULES_DECOMPRESS="yes"

Last edited by tzhuang (2023-05-31 14:56:12)

Offline

#2 2023-04-30 20:32:38

tzhuang
Member
Registered: 2017-05-23
Posts: 41

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

Bump as this is still an issue for me if anyone has a solution.

Offline

#3 2023-04-30 22:08:33

seth
Member
Registered: 2012-09-03
Posts: 61,330

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

Sinces you don't set a KEYMAP in /etc/vconsole.conf, you could simply remove the keymap hook from the mkinitcpio.conf
Alternatively
a) what if you do add /etc/vconsole.conf

KEYMAP=us

b) "set -x" a the top of /usr/lib/initcpio/install/keymap to hopefully debug where it stalls.

Online

#4 2023-05-01 00:09:39

tzhuang
Member
Registered: 2017-05-23
Posts: 41

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

Thanks seth. The tip on "set -x" will be helpful to debug it next time. Marking it as solved as I can no longer reproduce the issue after a reboot. Without any changes, installing the linux package now proceeds past the keymap hook. I was initially hesitant to reboot after the update because the boot image re-generation failed, but as I mentioned, I was able to generate the image manually using mkinitcpio.

Offline

#5 2023-05-31 01:02:43

tzhuang
Member
Registered: 2017-05-23
Posts: 41

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

seth wrote:

Sinces you don't set a KEYMAP in /etc/vconsole.conf, you could simply remove the keymap hook from the mkinitcpio.conf
Alternatively
a) what if you do add /etc/vconsole.conf

KEYMAP=us

b) "set -x" a the top of /usr/lib/initcpio/install/keymap to hopefully debug where it stalls.

I ran into this issue again during an update. Adding

KEYMAP=us

to /etc/vconsole.conf did not seem to have any effect. This is the out put of the script with

set -x

at the top:

  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: 'xhci_pci'
++ ((  0  ))
+ declare -f build
+ ((  _optquiet  ))
+ msg2 'Running build hook: [%s]' keymap
+ local 'mesg=Running build hook: [%s]'
+ shift
+ printf '  -> Running build hook: [%s]\n' keymap
  -> Running build hook: [keymap]
++ ((  0  ))
+ build
+ local KEYMAP KEYMAP_TOGGLE FONT FONT_MAP FONT_UNIMAP XKBLAYOUT XKBMODEL XKBVARIANT XKBOPTIONS
+ loadkeys_opts=('-q')
+ l=en_US.UTF-8
+ unset LANG
+ for cfg in /etc/{vconsole,locale}.conf
+ [[ -s /etc/vconsole.conf ]]
+ . /etc/vconsole.conf
++ KEYMAP=us
++ ((  0  ))
+ for cfg in /etc/{vconsole,locale}.conf
+ [[ -s /etc/locale.conf ]]
+ . /etc/locale.conf
++ LANG=en_US.UTF-8
++ ((  0  ))
+ [[ -n en_US.UTF-8 ]]
+ LOCALE=en_US.UTF-8
+ LANG=en_US.UTF-8
+ [[ en_US.UTF-8 == *[Uu][Tt][Ff]?(-)8 ]]
+ touch /tmp/mkinitcpio.GHdC8Y/root/keymap.utf8
+ loadkeys_opts+=('-u')
+ loadkeys -q -u us -b

Running the last command manually on the command line produces some output:

$ loadkeys -q -u us -b
bkeymap234567890-=	q
                         w
                          e
                           r
                            t
                             y
                              u
                               i
                                o
                                 p
                                  []a
                                     s
                                      d
                                       f
                                        g
                                         h
                                          j
                                           k
                                            l
                                             ;'`\z
                                                  x
                                                   c
                                                    v
                                                     b
                                                      n
                                                       m
                                                        ,./
                                                           		

<

#$%^&*()_+	Q
                W
                 E
                  R
                   T
                    Y
                     U
                      I
                       O
                        P
                         {}A
                            S
                             D
                              F
                               G
                                H
                                 J
                                  K
                                   L
                                    :"~|Z
                                         X
                                          C
                                           V
                                            B
                                             N
                                              M
                                               <>?

	

> !

${[]}\	q
         w
          e
           r
            t
             y
              u
               i
                o
                 p
                  ~a
                    s
                     d
                      f
                       g
                        h
                         j
                          k
                           l
                            z
                             x
                              
                               b
                                n
                                 m
                                  	 									
                                                                                                                	
	                                                                                                                	
	|				



"#$%&'()*+

,-      	



	

		



	



/      ]
						
                                			
				<

+       ?
      	

>



		

which exits normally.

Running the mkinitcpio script manually also works fine:

$ sudo mkinitcpio -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: '6.3.5-arch1-1'
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: 'xhci_pci'
++ ((  0  ))
+ declare -f build
+ ((  _optquiet  ))
+ msg2 'Running build hook: [%s]' keymap
+ local 'mesg=Running build hook: [%s]'
+ shift
+ printf '  -> Running build hook: [%s]\n' keymap
  -> Running build hook: [keymap]
++ ((  0  ))
+ build
+ local KEYMAP KEYMAP_TOGGLE FONT FONT_MAP FONT_UNIMAP XKBLAYOUT XKBMODEL XKBVARIANT XKBOPTIONS
+ loadkeys_opts=('-q')
+ l=en_US.UTF-8
+ unset LANG
+ for cfg in /etc/{vconsole,locale}.conf
+ [[ -s /etc/vconsole.conf ]]
+ for cfg in /etc/{vconsole,locale}.conf
+ [[ -s /etc/locale.conf ]]
+ . /etc/locale.conf
++ LANG=en_US.UTF-8
++ ((  0  ))
+ [[ -n en_US.UTF-8 ]]
+ LOCALE=en_US.UTF-8
+ LANG=en_US.UTF-8
+ [[ en_US.UTF-8 == *[Uu][Tt][Ff]?(-)8 ]]
+ touch /tmp/mkinitcpio.iw7bjI/root/keymap.utf8
+ loadkeys_opts+=('-u')
+ loadkeys -q -u us -b
+ add_runscript
+ local fn script hookname=keymap
+ local -a funcs
++ PATH=/etc/initcpio/hooks:/usr/lib/initcpio/hooks
++ type -P keymap
+ script=/usr/lib/initcpio/hooks/keymap
+ [[ -L /usr/lib/initcpio/hooks/keymap ]]
+ add_file /usr/lib/initcpio/hooks/keymap /hooks/keymap 755
+ local src=/usr/lib/initcpio/hooks/keymap dest=/hooks/keymap mode=755 srcrealpath
+ [[ ! -f /usr/lib/initcpio/hooks/keymap ]]
+ [[ -L /usr/lib/initcpio/hooks/keymap ]]
...

Seems like it's just an issue with the mkinitcpio script from when pacman updates the linux package somehow?

Last edited by tzhuang (2023-05-31 01:05:58)

Offline

#6 2023-05-31 06:59:15

seth
Member
Registered: 2012-09-03
Posts: 61,330

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

/usr/lib/initcpio/install/keymap

loadkeys "${loadkeys_opts[@]}" "${KEYMAP:-us}" -b > "$BUILDROOT/keymap.bin"

When it hangs, is anything written to /tmp/mkinitcpio.*/root/keymap.bin ?

Online

#7 2023-05-31 13:19:25

tzhuang
Member
Registered: 2017-05-23
Posts: 41

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

seth wrote:

/usr/lib/initcpio/install/keymap

loadkeys "${loadkeys_opts[@]}" "${KEYMAP:-us}" -b > "$BUILDROOT/keymap.bin"

When it hangs, is anything written to /tmp/mkinitcpio.*/root/keymap.bin ?

Hmm how does BUILDROOT get set? I'm not sure what its value is.

Offline

#8 2023-05-31 13:31:00

seth
Member
Registered: 2012-09-03
Posts: 61,330

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

It's a tempdir, "man mktemp", the path is /tmp/mkinitcpio.<random>/root - therefore check all of them (or reference the script log)

Online

#9 2023-05-31 14:55:50

tzhuang
Member
Registered: 2017-05-23
Posts: 41

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

seth wrote:

It's a tempdir, "man mktemp", the path is /tmp/mkinitcpio.<random>/root - therefore check all of them (or reference the script log)

I'll have to wait until the next time I notice it happen again. After the manual image generation and a reboot the issue no longer appears for me. I wonder if it's related to multiple kernel upgrades without a reboot. I didn't think much of it because I have kernel-modules-hook installed.

Offline

#10 2023-05-31 14:59:11

seth
Member
Registered: 2012-09-03
Posts: 61,330

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

tzhuang wrote:

I wonder if it's related to … kernel-modules-hook

Online

#11 2023-09-05 11:38:18

besen
Member
Registered: 2017-03-11
Posts: 13

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

I have the same error right now. I also have kernel-modules-hook installed.

$ cat /etc/{vconsole,locale}.conf
KEYMAP=de
LANG=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
$ paru -S linux
warning: linux-6.4.12.arch1-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) linux-6.4.12.arch1-1

Total Installed Size:  125.56 MiB
Net Upgrade Size:        0.00 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                                     [------------------------------------------------] 100%
(1/1) checking package integrity                                                   [------------------------------------------------] 100%
(1/1) loading package files                                                        [------------------------------------------------] 100%
(1/1) checking for file conflicts                                                  [------------------------------------------------] 100%
(1/1) checking available disk space                                                [------------------------------------------------] 100%
:: Running pre-transaction hooks...
(1/1) Saving Linux kernel modules...
:: Processing package changes...
(1/1) reinstalling linux                                                           [------------------------------------------------] 100%
:: Running post-transaction hooks...
(1/6) Restoring Linux kernel modules...
++ uname -r
+ KVER=6.4.12-arch1-1
+ test -e /usr/lib/modules/backup/6.4.12-arch1-1
+ rsync -AHXal --ignore-existing /usr/lib/modules/backup/6.4.12-arch1-1 /usr/lib/modules/
+ rm -rf /usr/lib/modules/backup
(2/6) Arming ConditionNeedsUpdate...
(3/6) Updating module dependencies...
(4/6) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
==> Using configuration file: '/etc/mkinitcpio.conf'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: '6.4.12-arch1-1'
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: 'xhci_pci'
  -> Running build hook: [keymap]

Offline

#12 2023-12-05 20:49:12

mitch_feaster
Member
From: San Diego, CA
Registered: 2011-02-27
Posts: 55
Website

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

Same issue here, but it doesn't happen every time (I can't reproduce it right now, for example). But when it happens I always see a zombie gzip process as the child to the mkinitcpio process.

Offline

#13 2023-12-06 07:56:39

seth
Member
Registered: 2012-09-03
Posts: 61,330

Re: [solved] mkinitcpio hangs on keymap during update of the linux package

And you also have the kernel-modules-hook installed?

Online

Board footer

Powered by FluxBB