Bug#1125296: mkosi: Mkosi kernel install script throwing "unknown level" error

Val Markovic val at markovic.io
Mon Jan 12 09:32:10 GMT 2026


Package: mkosi
Version: 25.3-7
Severity: normal
X-Debbugs-Cc: val at markovic.io

Dear Maintainer,

The file /usr/lib/kernel/install.d/50-mkosi.install appears to be throwing
ValueErrors due to unknown log levels when a kernel package is being installed
IFF SYSTEMD_LOG_LEVEL is set to an empty string.

I was debugging a separate issue and was setting SYSTEMD_LOG_LEVEL to 'debug'.
I then wanted to turn off the additional systemd logs so I set
SYSTEMD_LOG_LEVEL to an empty string. I probably should have just unset the env
var, but setting it to an empty string shouldn't cause such a severe issue (new
kernel packages cannot be installed, UKIs cannot be built, etc).

Here is the relevant part of the error logs:

Updating kernel version 6.12.63+deb13-amd64 in systemd-boot...
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mkosi/run.py", line 71, in
uncaught_exception_handler
    yield
  File "/usr/lib/python3.13/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/usr/lib/kernel/install.d/50-mkosi.install", line 57, in main
    log_setup(default_log_level="info" if context.verbose else "warning")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mkosi/log.py", line 85, in log_setup
    logging.getLogger().setLevel(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        logging.getLevelName(os.getenv("SYSTEMD_LOG_LEVEL",
default_log_level).upper())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/logging/__init__.py", line 1495, in setLevel
    self.level = _checkLevel(level)
                 ~~~~~~~~~~~^^^^^^^
  File "/usr/lib/python3.13/logging/__init__.py", line 210, in _checkLevel
    raise ValueError("Unknown level: %r" % level)
ValueError: Unknown level: 'Level '
/usr/lib/kernel/install.d/50-mkosi.install failed with exit status 1.
run-parts: /etc/initramfs/post-update.d//systemd-boot exited with return code 1
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mkosi/run.py", line 71, in
uncaught_exception_handler
    yield
  File "/usr/lib/python3.13/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/usr/lib/kernel/install.d/50-mkosi.install", line 57, in main
    log_setup(default_log_level="info" if context.verbose else "warning")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mkosi/log.py", line 85, in log_setup
    logging.getLogger().setLevel(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        logging.getLevelName(os.getenv("SYSTEMD_LOG_LEVEL",
default_log_level).upper())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/logging/__init__.py", line 1495, in setLevel
    self.level = _checkLevel(level)
                 ~~~~~~~~~~~^^^^^^^
  File "/usr/lib/python3.13/logging/__init__.py", line 210, in _checkLevel
    raise ValueError("Unknown level: %r" % level)
ValueError: Unknown level: 'Level '
/usr/lib/kernel/install.d/50-mkosi.install failed with exit status 1.
run-parts: /etc/kernel/postinst.d/zz-systemd-boot exited with return code 1


-- System Information:
Debian Release: 13.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.12.63+deb13-amd64 (SMP w/20 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to C.UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages mkosi depends on:
ii  apt                     3.0.3
ii  btrfs-progs             6.14-1
ii  cpio                    2.15+dfsg-2
ii  cryptsetup-bin          2:2.7.5-2
ii  debian-archive-keyring  2025.1
ii  dosfstools              4.2-1.2
ii  e2fsprogs               1.47.2-3+b7
ii  efitools                1.9.2-3.5
ii  erofs-utils             1.8.6-1
ii  fdisk                   2.41-5
ii  gnupg                   2.4.7-21+deb13u1
ii  jq                      1.7.1-6+deb13u1
ii  kmod                    34.2-2
ii  mtools                  4.0.48-1
ii  openssl                 3.5.4-1~deb13u1
ii  pesign                  116-8.1
ii  python3                 3.13.5-1
ii  python3-cryptography    43.0.0-3
ii  python3-pefile          2024.8.26-2.1
ii  squashfs-tools          1:4.6.1-1
ii  systemd                 257.9-1~deb13u1
ii  systemd-boot-efi        257.9-1~deb13u1
ii  systemd-boot-tools      257.9-1~deb13u1
ii  systemd-container       257.9-1~deb13u1
ii  systemd-repart          257.9-1~deb13u1
ii  systemd-ukify           257.9-1~deb13u1
ii  tpm2-tools              5.7-1
ii  ubuntu-keyring          2023.11.28.1-0.2
ii  xz-utils                5.8.1-1
ii  zstd                    1.5.7+dfsg-1

Versions of packages mkosi recommends:
ii  archlinux-keyring       0~20250430-1
ii  debian-archive-keyring  2025.1
ii  distribution-gpg-keys   1.115+ds-1~deb13u1
ii  dnf                     4.23.0-1
ii  ipxe-qemu               1.21.1+git20250501.dad20602+dfsg-1
ii  ovmf                    2025.02-8+deb13u1
ii  pacman-package-manager  7.0.0-1+b1
ii  qemu-system             1:10.0.7+ds-0+deb13u1+b1
ii  systemd-timesyncd       257.9-1~deb13u1
ii  ubuntu-keyring          2023.11.28.1-0.2
ii  uidmap                  1:4.17.4-2
ii  virtiofsd               1.13.2-1+deb13u1
ii  zypper                  1.14.89-1

mkosi suggests no packages.

-- no debconf information



More information about the Pkg-systemd-maintainers mailing list