← 返回命令列表

Linux command

mkosi 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

mkosi summary

Build an image

mkosi build --distribution [fedora|debian|ubuntu|arch|opensuse]

Example

mkosi shell

Boot an image

mkosi vm

Force rebuild

mkosi -f build

Clean

mkosi clean

Example

mkosi help

说明

mkosi builds customized, modern Linux OS images. It wraps package managers (dnf, apt, pacman, zypper) to generate disk images, container images, and unified kernel images with extensive customization options. Supported output formats include raw GPT disk images, plain directories, tar and CPIO archives, unified kernel images (UKI), and OCI-compatible images. The tool supports multiple distributions and can create bootable images with systemd-boot or GRUB. Configuration is read from mkosi.conf files, allowing declarative image definitions with support for profiles, conditional sections, and modular configurations.

参数

build
Generate the image (default if no verb specified)
shell
Interactive shell in built image via systemd-nspawn container
boot
Boot systemd in image container
vm (alias: qemu)
Boot image in virtual machine (QEMU by default).
ssh
Connect to booted VM via SSH
clean
Remove build artifacts
summary
Display human-readable configuration overview
cat-config
Output all loaded configuration file contents
burn _device_
Write image to block device
genkey
Generate SecureBoot keypairs
-f, --force
Replace existing output; repeat for cache purge
-i, --incremental
Enable caching between builds
-C, --directory _dir_
Change to directory before processing
--distribution _distro_
Target distribution: fedora, debian, ubuntu, arch, opensuse, etc.
--release _version_
Specific distribution version
--format _type_
Output type: directory, tar, disk, uki, etc.
--debug
Enable verbose output

FAQ

What is the mkosi command used for?

mkosi builds customized, modern Linux OS images. It wraps package managers (dnf, apt, pacman, zypper) to generate disk images, container images, and unified kernel images with extensive customization options. Supported output formats include raw GPT disk images, plain directories, tar and CPIO archives, unified kernel images (UKI), and OCI-compatible images. The tool supports multiple distributions and can create bootable images with systemd-boot or GRUB. Configuration is read from mkosi.conf files, allowing declarative image definitions with support for profiles, conditional sections, and modular configurations.

How do I run a basic mkosi example?

Run `mkosi summary` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does build do in mkosi?

Generate the image (default if no verb specified)