Skip to content

Commit 136d1f7

Browse files
Gemini CLIclaude
andcommitted
FIX: Resolve remaining CI failures + add Windows build entry point
CI build fixes (4 remaining fatal scripts after last run): - 01-repos.sh: add error handler to upgrade --refresh, add dnf clean metadata - 02-kernel.sh: strict→non-strict install for kernel packages (version mismatch against ucore's pre-built kernel breaks strict install; base kver still detected) - 11-hardware.sh: mesa-va-drivers-freeworld→mesa-va-drivers in PACKAGES.md; freeworld conflicts with base ucore mesa-va-drivers when Terra repo is active - 12-virt.sh: strict→non-strict for virt+containers (ucore-hci already ships both stacks; strict fails on ucore-patched package version conflicts) - lib/common.sh: remove --best from DNF_OPTS (non-strict path still had --best) - PACKAGES.md: remove cockpit+dracut-live from packages-virt (redundant; cockpit handled by packages-cockpit; dracut-live kept in packages-containers) Windows build entry point: - tools/windows/Build-MiOS.ps1: PowerShell build script for Docker Desktop + WSL2 backend; produces VHDX via bootc-image-builder; supports vhdx/raw/qcow2/wsl2 - tools/windows/README-WINDOWS.md: Windows workflow docs — git clone, env setup, build commands, Hyper-V import, WSL2 import, troubleshooting Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3b0f19c commit 136d1f7

7 files changed

Lines changed: 293 additions & 8 deletions

File tree

automation/01-repos.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,16 @@ $DNF_BIN "${DNF_SETOPT[@]}" upgrade -y --allowerasing --best dnf rpm fedora-
6262
}
6363

6464
echo "[01-repos] Phase 2: Distro-upgrade and userspace alignment..."
65-
$DNF_BIN "${DNF_SETOPT[@]}" --setopt=excludepkgs="shim-*,kernel*" upgrade --refresh -y
65+
$DNF_BIN "${DNF_SETOPT[@]}" --setopt=excludepkgs="shim-*,kernel*" upgrade --refresh -y || {
66+
echo "[01-repos] WARN: upgrade --refresh had conflicts (ucore vs F44 pkgs) — continuing"
67+
}
6668
$DNF_BIN "${DNF_SETOPT[@]}" --setopt=excludepkgs="shim-*,kernel*" distro-sync -y --allowerasing || {
6769
echo "[01-repos] WARN: distro-sync had conflicts — ucore base packages may differ from Fedora 44."
6870
echo "[01-repos] Continuing; individual package installs will use available repos."
6971
}
7072

73+
# Clean metadata so subsequent scripts start from a consistent cache state
74+
$DNF_BIN clean metadata 2>/dev/null || true
75+
7176
echo "[01-repos] Verifying core package versions..."
7277
rpm -q systemd glibc dbus-broker filesystem || true

automation/02-kernel.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -euo pipefail
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2121
source "${SCRIPT_DIR}/lib/packages.sh"
2222

23-
install_packages_strict "kernel"
23+
install_packages "kernel"
2424

2525
# Capture KVER for akmod builds later.
2626
# The base image kernel is the only one installed; grab it.

automation/12-virt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ KVER=$(cat /tmp/mios-kver 2>/dev/null || find /usr/lib/modules/ -mindepth 1 -max
1717

1818
# ── KVM / QEMU / Libvirt ────────────────────────────────────────────────────
1919
echo "[12-virt] Installing KVM/QEMU/Libvirt..."
20-
install_packages_strict "virt"
20+
install_packages "virt"
2121

2222
# ── Containers (Podman, Buildah, Skopeo, bootc, self-build tools) ────────────
2323
echo "[12-virt] Installing container runtime and self-building tools..."
24-
install_packages_strict "containers"
24+
install_packages "containers"
2525

2626
# Extra self-build tools (image-rechunking, etc. - may be repo-dependent)
2727
install_packages "self-build"

automation/lib/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if [[ -z "${DNF_SETOPT+x}" || "$(declare -p DNF_SETOPT 2>/dev/null)" != "declare
3232
declare -ga DNF_SETOPT=(--setopt=install_weak_deps=False)
3333
fi
3434
if [[ -z "${DNF_OPTS+x}" || "$(declare -p DNF_OPTS 2>/dev/null)" != "declare -a"* ]]; then
35-
declare -ga DNF_OPTS=(--allowerasing --best)
35+
declare -ga DNF_OPTS=(--allowerasing)
3636
fi
3737
# String variant for legacy/debug visibility only. Do NOT use in commands.
3838
export DNF_SETOPT_STR="${DNF_SETOPT[*]}"

tools/windows/Build-MiOS.ps1

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#Requires -Version 5.1
2+
<#
3+
.SYNOPSIS
4+
MiOS local build entry point for Windows (Docker Desktop + WSL2).
5+
6+
.DESCRIPTION
7+
Builds the MiOS OCI image locally using Docker Desktop (WSL2 backend),
8+
then uses bootc-image-builder to produce a VHDX for Hyper-V import.
9+
10+
.PARAMETER OutputFormat
11+
Disk image format to produce: vhdx (default), raw, qcow2, wsl2
12+
13+
.PARAMETER Tag
14+
Local image tag (default: mios:local)
15+
16+
.PARAMETER SkipBib
17+
Build the container image only; skip bootc-image-builder disk conversion.
18+
19+
.EXAMPLE
20+
.\Build-MiOS.ps1
21+
.\Build-MiOS.ps1 -OutputFormat wsl2
22+
.\Build-MiOS.ps1 -SkipBib
23+
#>
24+
param(
25+
[ValidateSet('vhdx','raw','qcow2','wsl2')]
26+
[string]$OutputFormat = 'vhdx',
27+
[string]$Tag = 'mios:local',
28+
[switch]$SkipBib
29+
)
30+
31+
Set-StrictMode -Version Latest
32+
$ErrorActionPreference = 'Stop'
33+
34+
# ── Colour helpers ─────────────────────────────────────────────────────────
35+
function Write-Step { param([string]$Msg) Write-Host "==> $Msg" -ForegroundColor Cyan }
36+
function Write-Ok { param([string]$Msg) Write-Host " ok $Msg" -ForegroundColor Green }
37+
function Write-Warn { param([string]$Msg) Write-Host "WARN $Msg" -ForegroundColor Yellow }
38+
function Write-Fail { param([string]$Msg) Write-Host "FAIL $Msg" -ForegroundColor Red; exit 1 }
39+
40+
# ── Preflight ──────────────────────────────────────────────────────────────
41+
Write-Step "Preflight checks"
42+
43+
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
44+
Write-Fail "docker not found. Install Docker Desktop: https://www.docker.com/products/docker-desktop/"
45+
}
46+
$dockerInfo = docker info 2>&1
47+
if ($LASTEXITCODE -ne 0) {
48+
Write-Fail "Docker daemon not running. Start Docker Desktop and try again."
49+
}
50+
if ($dockerInfo -notmatch 'WSL') {
51+
Write-Warn "Docker Desktop does not appear to be using the WSL2 backend. Build may be slower."
52+
}
53+
54+
if (-not (Test-Path 'Containerfile')) {
55+
Write-Fail "Containerfile not found. Run this script from the MiOS repo root."
56+
}
57+
Write-Ok "Docker Desktop + Containerfile found"
58+
59+
# ── Environment variables ──────────────────────────────────────────────────
60+
Write-Step "Loading build environment"
61+
62+
# Load from ~/.config/mios/env.toml if present
63+
$EnvToml = "$HOME\.config\mios\env.toml"
64+
if (Test-Path $EnvToml) {
65+
Write-Ok "Reading $EnvToml"
66+
Get-Content $EnvToml | ForEach-Object {
67+
if ($_ -match '^\s*(\w+)\s*=\s*"?([^"#]+)"?') {
68+
$k = $Matches[1]; $v = $Matches[2].Trim()
69+
if (-not [System.Environment]::GetEnvironmentVariable($k)) {
70+
[System.Environment]::SetEnvironmentVariable($k, $v)
71+
Write-Host " $k = $v"
72+
}
73+
}
74+
}
75+
}
76+
77+
# Mandatory secrets — prompt if not set
78+
if (-not $env:MIOS_USER_PASSWORD_HASH) {
79+
$pw = Read-Host -Prompt "MIOS_USER_PASSWORD_HASH (openssl passwd -6 <password>)"
80+
$env:MIOS_USER_PASSWORD_HASH = $pw
81+
}
82+
if (-not $env:MIOS_SSH_PUBKEY) {
83+
$key = Read-Host -Prompt "MIOS_SSH_PUBKEY (your SSH public key, or Enter to skip)"
84+
if ($key) { $env:MIOS_SSH_PUBKEY = $key }
85+
}
86+
87+
# ── Build OCI image ────────────────────────────────────────────────────────
88+
Write-Step "Building MiOS OCI image ($Tag)"
89+
90+
$BuildArgs = @(
91+
'build',
92+
'--tag', $Tag,
93+
'--file', 'Containerfile',
94+
'--build-arg', "MIOS_USER_PASSWORD_HASH=$env:MIOS_USER_PASSWORD_HASH"
95+
)
96+
if ($env:MIOS_SSH_PUBKEY) {
97+
$BuildArgs += '--build-arg', "MIOS_SSH_PUBKEY=$env:MIOS_SSH_PUBKEY"
98+
}
99+
$BuildArgs += '.'
100+
101+
docker @BuildArgs
102+
if ($LASTEXITCODE -ne 0) { Write-Fail "docker build failed (exit $LASTEXITCODE)" }
103+
Write-Ok "OCI image built: $Tag"
104+
105+
if ($SkipBib) {
106+
Write-Ok "Done (SkipBib set — skipping disk image conversion)"
107+
exit 0
108+
}
109+
110+
# ── bootc-image-builder ────────────────────────────────────────────────────
111+
Write-Step "Converting OCI → $OutputFormat via bootc-image-builder"
112+
113+
$OutputDir = Join-Path (Get-Location) 'output'
114+
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
115+
116+
# Map format to BIB --type value
117+
$BibType = switch ($OutputFormat) {
118+
'vhdx' { 'vhd' }
119+
'raw' { 'raw' }
120+
'qcow2' { 'qcow2' }
121+
'wsl2' { 'wsl2' }
122+
}
123+
124+
# BIB config — substitute env vars
125+
$BibConfig = @"
126+
[[customizations.user]]
127+
name = "mios"
128+
password = "$env:MIOS_USER_PASSWORD_HASH"
129+
$(if ($env:MIOS_SSH_PUBKEY) { 'key = "' + $env:MIOS_SSH_PUBKEY + '"' } else { '' })
130+
groups = ["wheel"]
131+
"@
132+
$BibConfigPath = Join-Path $env:TEMP 'mios-bib.toml'
133+
Set-Content -Path $BibConfigPath -Value $BibConfig -Encoding UTF8
134+
135+
docker run --rm --privileged `
136+
--security-opt label=type:unconfined_t `
137+
-v "${OutputDir}:/output" `
138+
-v "/var/run/docker.sock:/var/run/docker.sock" `
139+
-v "${BibConfigPath}:/config.toml" `
140+
"ghcr.io/osbuild/bootc-image-builder:latest" `
141+
--type $BibType `
142+
--config /config.toml `
143+
--local `
144+
$Tag
145+
146+
if ($LASTEXITCODE -ne 0) { Write-Fail "bootc-image-builder failed (exit $LASTEXITCODE)" }
147+
148+
# Rename vhd → vhdx
149+
if ($OutputFormat -eq 'vhdx') {
150+
$VhdPath = Join-Path $OutputDir 'disk.vhd'
151+
$VhdxPath = Join-Path $OutputDir 'disk.vhdx'
152+
if (Test-Path $VhdPath) {
153+
Move-Item -Force $VhdPath $VhdxPath
154+
Write-Ok "Disk image: $VhdxPath"
155+
}
156+
} else {
157+
Write-Ok "Disk image: $(Join-Path $OutputDir "disk.$OutputFormat")"
158+
}
159+
160+
Write-Step "Build complete"
161+
Write-Host ""
162+
Write-Host " Image tag : $Tag"
163+
Write-Host " Output : $OutputDir"
164+
if ($OutputFormat -eq 'vhdx') {
165+
Write-Host ""
166+
Write-Host " Import into Hyper-V:"
167+
Write-Host " New-VM -Name MiOS -BootDevice VHD -VHDPath '$OutputDir\disk.vhdx' -Generation 2"
168+
}

tools/windows/README-WINDOWS.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# MiOS — Windows Build Guide
2+
3+
Build MiOS locally on Windows using **Docker Desktop** (WSL2 backend) and produce a VHDX for Hyper-V.
4+
5+
---
6+
7+
## Prerequisites
8+
9+
| Tool | Where to get |
10+
|------|-------------|
11+
| Docker Desktop (WSL2 backend) | <https://www.docker.com/products/docker-desktop/> |
12+
| Git for Windows | <https://git-scm.com/download/win> |
13+
| PowerShell 5.1+ | Built-in on Windows 10/11 |
14+
| (Optional) Hyper-V | Windows 10/11 Pro — enable in "Turn Windows features on or off" |
15+
16+
---
17+
18+
## 1. Clone the repo
19+
20+
```powershell
21+
git clone https://github.com/mios-dev/MiOS.git
22+
cd MiOS
23+
```
24+
25+
If you need to authenticate with a token:
26+
27+
```powershell
28+
git clone https://mios-dev:<YOUR_GITHUB_TOKEN>@github.com/mios-dev/MiOS.git
29+
cd MiOS
30+
```
31+
32+
---
33+
34+
## 2. Set up environment variables
35+
36+
Create `~\.config\mios\env.toml` (loaded automatically by the build script):
37+
38+
```toml
39+
MIOS_USER_PASSWORD_HASH = "$6$..." # openssl passwd -6 yourpassword
40+
MIOS_SSH_PUBKEY = "ssh-ed25519 AAAA..."
41+
```
42+
43+
Or export them in your PowerShell session:
44+
45+
```powershell
46+
$env:MIOS_USER_PASSWORD_HASH = (openssl passwd -6 yourpassword)
47+
$env:MIOS_SSH_PUBKEY = Get-Content "$HOME\.ssh\id_ed25519.pub"
48+
```
49+
50+
---
51+
52+
## 3. Build
53+
54+
```powershell
55+
# Full build → VHDX (default)
56+
.\tools\windows\Build-MiOS.ps1
57+
58+
# Build only the OCI image (no disk conversion)
59+
.\tools\windows\Build-MiOS.ps1 -SkipBib
60+
61+
# Other output formats
62+
.\tools\windows\Build-MiOS.ps1 -OutputFormat qcow2 # QEMU/KVM
63+
.\tools\windows\Build-MiOS.ps1 -OutputFormat wsl2 # WSL2 tarball
64+
.\tools\windows\Build-MiOS.ps1 -OutputFormat raw # Raw disk image
65+
```
66+
67+
Artifacts land in `.\output\`.
68+
69+
---
70+
71+
## 4. Import into Hyper-V
72+
73+
```powershell
74+
New-VM `
75+
-Name MiOS `
76+
-BootDevice VHD `
77+
-VHDPath ".\output\disk.vhdx" `
78+
-Generation 2 `
79+
-MemoryStartupBytes 4GB
80+
81+
# Enable Secure Boot with Microsoft UEFI CA (required for bootc/GRUB)
82+
Set-VMFirmware -VMName MiOS -SecureBootTemplate MicrosoftUEFICertificateAuthority
83+
84+
# Optional: Enable Enhanced Session (clipboard/audio/USB redirect)
85+
Set-VMHost -EnableEnhancedSessionMode $true
86+
Set-VM -VMName MiOS -EnhancedSessionTransportType HvSocket
87+
88+
Start-VM -Name MiOS
89+
```
90+
91+
---
92+
93+
## 5. WSL2 install (alternative to Hyper-V)
94+
95+
```powershell
96+
.\tools\windows\Build-MiOS.ps1 -OutputFormat wsl2
97+
98+
wsl --import MiOS "$HOME\AppData\Local\MiOS" ".\output\disk.wsl2"
99+
wsl -d MiOS
100+
```
101+
102+
---
103+
104+
## Troubleshooting
105+
106+
**"Docker daemon not running"** — Open Docker Desktop and wait for the whale icon to stop animating.
107+
108+
**"Containerfile not found"** — Run the script from the repo root (`cd MiOS` first).
109+
110+
**BIB fails with "permission denied"** — Docker Desktop needs privileged containers enabled:
111+
Docker Desktop → Settings → Docker Engine → add `"privileged": true`.
112+
113+
**VHDX won't boot in Hyper-V** — Ensure Generation 2 VM and Secure Boot template is set to
114+
`MicrosoftUEFICertificateAuthority` (not the default Windows one).

usr/share/mios/PACKAGES.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Mesa 26: ACO is now default shader compiler for RadeonSI.
196196
```packages-gpu-mesa
197197
mesa-vulkan-drivers
198198
mesa-dri-drivers
199-
mesa-va-drivers-freeworld
199+
mesa-va-drivers
200200
vulkan-loader
201201
vulkan-tools
202202
libva-utils
@@ -253,7 +253,6 @@ nvidia-container-selinux
253253
Full KVM stack with virt-manager GUI and firmware/security tooling.
254254

255255
```packages-virt
256-
cockpit
257256
qemu-kvm
258257
libvirt
259258
libvirt-daemon
@@ -269,7 +268,6 @@ libguestfs-tools
269268
virt-viewer
270269
virt-v2v
271270
qemu-device-display-virtio-gpu
272-
dracut-live
273271
virt-firmware
274272
python3-cryptography
275273
```

0 commit comments

Comments
 (0)