@@ -66,9 +66,6 @@ Distribution: Azure Linux
6666
6767
6868%global user_static 1
69- %if 0%{?azl }
70- %global user_static 0
71- %endif
7269
7370%global have_kvm 0
7471%if 0%{?kvm_package:1 }
@@ -435,7 +432,7 @@ Obsoletes: sgabios-bin <= 1:0.20180715git-10.fc38
435432Summary: QEMU is a FAST! processor emulator
436433Name: qemu
437434Version: 9.1.0
438- Release: 5 %{?dist }
435+ Release: 6 %{?dist }
439436License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FSFAP AND GPL-1.0-or-later AND GPL-2.0 -only AND GPL-2.0 -or-later AND GPL-2.0 -or-later WITH GCC-exception-2.0 AND LGPL-2.0 -only AND LGPL-2.0 -or-later AND LGPL-2.1 -only AND LGPL-2.1 -or-later AND MIT AND LicenseRef-Fedora-Public-Domain AND CC-BY-3.0
440437URL: http://www.qemu.org/
441438
@@ -677,7 +674,7 @@ BuildRequires: rutabaga-gfx-ffi-devel
677674%if %{user_static }
678675BuildRequires: glibc-static >= 2.38-19%{?dist }
679676BuildRequires: glib2-static zlib-static
680- BuildRequires: pcre2-static
677+ BuildRequires: pcre2-devel- static
681678%endif
682679
683680# Requires for the Fedora 'qemu' metapackage
@@ -1176,7 +1173,9 @@ Requires(postun): systemd-units
11761173# Temporarily disable to get fedora CI working. Re-enable
11771174# once this CI issue let's us deal with subpackage conflicts:
11781175# https://pagure.io/fedora-ci/general/issue/184
1179- #Conflicts: qemu-user-static
1176+ #
1177+ # introduce conflicts to not install both binfmt rules.
1178+ Conflicts: qemu-user-static
11801179%description user-binfmt
11811180This package provides the user mode emulation of qemu targets
11821181
@@ -1197,8 +1196,10 @@ Requires(postun): systemd-units
11971196# Temporarily disable to get fedora CI working. Re-enable
11981197# once this CI issue let's us deal with subpackage conflicts:
11991198# https://pagure.io/fedora-ci/general/issue/184
1200- #Conflicts: qemu-user-binfmt
1201- #Provides: qemu-user-binfmt
1199+ #
1200+ # introduce conflicts to not install both binfmt rules.
1201+ Conflicts: qemu-user-binfmt
1202+ Provides: qemu-user-binfmt
12021203Requires: qemu-user-static-aarch64
12031204Requires: qemu-user-static-alpha
12041205Requires: qemu-user-static-arm
@@ -1311,7 +1312,6 @@ Summary: QEMU user mode emulation of sh4 qemu targets static build
13111312%description user-static-sh4
13121313This package provides the sh4 user mode emulation of qemu targets built as
13131314static binaries
1314- %endif
13151315
13161316%package user-static-sparc
13171317Summary: QEMU user mode emulation of sparc qemu targets static build
@@ -1331,6 +1331,7 @@ Summary: QEMU user mode emulation of xtensa qemu targets static build
13311331This package provides the xtensa user mode emulation of qemu targets built as
13321332static binaries
13331333
1334+ %endif
13341335
13351336%package system-aarch64
13361337Summary: QEMU system emulator for AArch64
@@ -2045,6 +2046,7 @@ pushd %{static_builddir}
20452046run_configure \
20462047 --enable-attr \
20472048 --enable-linux-user \
2049+ --enable-pie \
20482050 --enable-tcg \
20492051 --disable-install-blobs \
20502052 --static
@@ -2384,96 +2386,190 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
23842386/bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
23852387
23862388%if %{user_static }
2389+ # marker to run systemd-binfmt service only once when installing the meta package qemu-user-static
2390+ %define setbinfmtonce %{_localstatedir }/lib/rpm-state/qemu-user-static-binfmt
2391+
2392+ %define try_run_systemd_binfmt() \
2393+ if ! /bin/systemctl is-active --quiet systemd-binfmt.service; then \
2394+ /bin/systemctl --system restart systemd-binfmt.service &> /dev/null || : \
2395+ else \
2396+ /bin/systemctl --system try-restart systemd-binfmt.service &> /dev/null || : \
2397+ fi \
2398+ %{nil }
2399+
2400+ %pretrans user-static
2401+ touch %{setbinfmtonce }
2402+ exit 0
2403+
2404+ %posttrans user-static
2405+ %try_run_systemd_binfmt
2406+ rm -f %{setbinfmtonce }
2407+ exit 0
2408+
23872409%post user-static-aarch64
2388- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2410+ if [ ! -f %{setbinfmtonce} ]; then
2411+ %try_run_systemd_binfmt
2412+ fi
23892413%postun user-static-aarch64
2390- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2414+ if [ ! -f %{setbinfmtonce} ]; then
2415+ %try_run_systemd_binfmt
2416+ fi
23912417
23922418%post user-static-alpha
2393- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2419+ if [ ! -f %{setbinfmtonce} ]; then
2420+ %try_run_systemd_binfmt
2421+ fi
23942422%postun user-static-alpha
2395- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2423+ if [ ! -f %{setbinfmtonce} ]; then
2424+ %try_run_systemd_binfmt
2425+ fi
23962426
23972427%post user-static-arm
2398- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2428+ if [ ! -f %{setbinfmtonce} ]; then
2429+ %try_run_systemd_binfmt
2430+ fi
23992431%postun user-static-arm
2400- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2432+ if [ ! -f %{setbinfmtonce} ]; then
2433+ %try_run_systemd_binfmt
2434+ fi
24012435
24022436%post user-static-cris
2403- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2437+ if [ ! -f %{setbinfmtonce} ]; then
2438+ %try_run_systemd_binfmt
2439+ fi
24042440%postun user-static-cris
2405- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2441+ if [ ! -f %{setbinfmtonce} ]; then
2442+ %try_run_systemd_binfmt
2443+ fi
24062444
24072445%post user-static-hexagon
2408- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2446+ if [ ! -f %{setbinfmtonce} ]; then
2447+ %try_run_systemd_binfmt
2448+ fi
24092449%postun user-static-hexagon
2410- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2450+ if [ ! -f %{setbinfmtonce} ]; then
2451+ %try_run_systemd_binfmt
2452+ fi
24112453
24122454%post user-static-hppa
2413- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2455+ if [ ! -f %{setbinfmtonce} ]; then
2456+ %try_run_systemd_binfmt
2457+ fi
24142458%postun user-static-hppa
2415- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2459+ if [ ! -f %{setbinfmtonce} ]; then
2460+ %try_run_systemd_binfmt
2461+ fi
24162462
24172463%post user-static-loongarch64
2418- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2464+ if [ ! -f %{setbinfmtonce} ]; then
2465+ %try_run_systemd_binfmt
2466+ fi
24192467%postun user-static-loongarch64
2420- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2468+ if [ ! -f %{setbinfmtonce} ]; then
2469+ %try_run_systemd_binfmt
2470+ fi
24212471
24222472%post user-static-m68k
2423- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2473+ if [ ! -f %{setbinfmtonce} ]; then
2474+ %try_run_systemd_binfmt
2475+ fi
24242476%postun user-static-m68k
2425- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2477+ if [ ! -f %{setbinfmtonce} ]; then
2478+ %try_run_systemd_binfmt
2479+ fi
24262480
24272481%post user-static-microblaze
2428- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2482+ if [ ! -f %{setbinfmtonce} ]; then
2483+ %try_run_systemd_binfmt
2484+ fi
24292485%postun user-static-microblaze
2430- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2486+ if [ ! -f %{setbinfmtonce} ]; then
2487+ %try_run_systemd_binfmt
2488+ fi
24312489
24322490%post user-static-mips
2433- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2491+ if [ ! -f %{setbinfmtonce} ]; then
2492+ %try_run_systemd_binfmt
2493+ fi
24342494%postun user-static-mips
2435- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2495+ if [ ! -f %{setbinfmtonce} ]; then
2496+ %try_run_systemd_binfmt
2497+ fi
24362498
24372499%post user-static-or1k
2438- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2500+ if [ ! -f %{setbinfmtonce} ]; then
2501+ %try_run_systemd_binfmt
2502+ fi
24392503%postun user-static-or1k
2440- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2504+ if [ ! -f %{setbinfmtonce} ]; then
2505+ %try_run_systemd_binfmt
2506+ fi
24412507
24422508%post user-static-ppc
2443- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2509+ if [ ! -f %{setbinfmtonce} ]; then
2510+ %try_run_systemd_binfmt
2511+ fi
24442512%postun user-static-ppc
2445- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2513+ if [ ! -f %{setbinfmtonce} ]; then
2514+ %try_run_systemd_binfmt
2515+ fi
24462516
24472517%post user-static-riscv
2448- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2518+ if [ ! -f %{setbinfmtonce} ]; then
2519+ %try_run_systemd_binfmt
2520+ fi
24492521%postun user-static-riscv
2450- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2522+ if [ ! -f %{setbinfmtonce} ]; then
2523+ %try_run_systemd_binfmt
2524+ fi
24512525
24522526%post user-static-s390x
2453- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2527+ if [ ! -f %{setbinfmtonce} ]; then
2528+ %try_run_systemd_binfmt
2529+ fi
24542530%postun user-static-s390x
2455- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2531+ if [ ! -f %{setbinfmtonce} ]; then
2532+ %try_run_systemd_binfmt
2533+ fi
24562534
24572535%post user-static-sh4
2458- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2536+ if [ ! -f %{setbinfmtonce} ]; then
2537+ %try_run_systemd_binfmt
2538+ fi
24592539%postun user-static-sh4
2460- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2461- %endif
2540+ if [ ! -f %{setbinfmtonce} ]; then
2541+ %try_run_systemd_binfmt
2542+ fi
24622543
24632544%post user-static-sparc
2464- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2545+ if [ ! -f %{setbinfmtonce} ]; then
2546+ %try_run_systemd_binfmt
2547+ fi
24652548%postun user-static-sparc
2466- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2549+ if [ ! -f %{setbinfmtonce} ]; then
2550+ %try_run_systemd_binfmt
2551+ fi
24672552
24682553%post user-static-x86
2469- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2554+ if [ ! -f %{setbinfmtonce} ]; then
2555+ %try_run_systemd_binfmt
2556+ fi
24702557%postun user-static-x86
2471- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2558+ if [ ! -f %{setbinfmtonce} ]; then
2559+ %try_run_systemd_binfmt
2560+ fi
24722561
24732562%post user-static-xtensa
2474- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2563+ if [ ! -f %{setbinfmtonce} ]; then
2564+ %try_run_systemd_binfmt
2565+ fi
24752566%postun user-static-xtensa
2476- /bin/systemctl --system try-restart systemd-binfmt.service & > /dev/null || :
2567+ if [ ! -f %{setbinfmtonce} ]; then
2568+ %try_run_systemd_binfmt
2569+ fi
2570+
2571+ # endif user-static
2572+ %endif
24772573
24782574# endif !tools_only
24792575%endif
@@ -3432,6 +3528,13 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
34323528
34333529
34343530%changelog
3531+ * Tue Apr 14 2026 Sumedh Sharma <sumsharma@microsoft.com> - 9.1.0-6
3532+ - Enable user_static builds for qemu
3533+ - configure user_static with 'enable-pie'
3534+ - manage systemd-binfmt restarts post install/uninstall to avoid start-limit-hit
3535+ - add conflicts between qemu-user-static and qemu-user-binfmt as both
3536+ provide binfmt rules
3537+
34353538* Sun Apr 05 2026 Woojoong Kim <woojoongkim@microsoft.com> - 9.1.0-5
34363539- Add 23 QEMU patches from RHEL qemu-kvm 9.1.0-20 for KubeVirt live migration
34373540- Post-migration networking: fix announce_self ARP/GARP (RHEL-73891),
0 commit comments