systemd / mkosi

💽 Build Bespoke OS Images
https://mkosi.systemd.io/
1.2k stars 325 forks source link

Dracut always embeds its scripts into UKIs, even non-initramfs ones #2080

Closed Winterhuman closed 1 year ago

Winterhuman commented 1 year ago

Host OS: Arch Linux uname: Linux 6.6.1-arch1-1 #1 SMP PREEMPT_DYNAMIC x86_64 GNU/Linux mkosi: v19

Description

Including dracut in the Packages value causes various boot-up scripts and other code to be embedded at the beginning of the UKI. For example, here's an lsinitrd output:

OS Release: Arch Linux (arch-rolling)
Kernel Version: 6.6.1-arch1-1 (linux@archlinux) #1 SMP PREEMPT_DYNAMIC Wed, 08 Nov 2023 16:05:38 +0000
Command line:
systemd.volatile=overlay
========================================================================
/usr/bin/lsinitrd: line 368: warning: command substitution: ignored null byte in input
Version: #!/bin/bash
#
# functions used by dracut and other tools.
#
# Copyright 2005-2009 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
export LC_MESSAGES=C

The problem is that it always does this, even for Format=uki & MakeInitrd=no output, which isn't necessary since those images aren't intended to be initramfs' which transition to a "real" system.

Ideally, MakeInitrd=no (maybe in combination with Format=uki if that's too broad) would skip this content being included.

Configs

See the config in this comment as an example, and use lsinitrd /path/to/uki | less to see the included dracut content at the beginning of the UKI.

Winterhuman commented 1 year ago

It turns out lsinitrd just prints dracut's scripts and code at the beginning, and that content isn't actually embedded at the start of the UKI as it makes it seem. Closing issue.