Mastodon

Blog de Alkahan

Créer une instance OPNSense dans incus

  30/04/2026 [incus opnsense freebsd] - 600 mots


J’ai configuré une VM sous incus pour y installer un OPNSense, mais lors du démarrage, je me retrouve sur une console de debug avec le message : cannot find a large enough size. Voici comment j’ai corrigé le problème.

J’ai créé ma VM de la manière suivante :

architecture: x86_64
config:
  limits.memory: 4GiB
  security.secureboot: "false"
devices:
  disk-device-1:
    source: agent:config
    type: disk
  eth-0:
    network: incusbr0
    type: nic
  eth-1:
    network: my-network
    type: nic
  iso-volume:
    boot.priority: "10"
    pool: data2
    source: OPNsense-26.1.6-dvd-amd64.iso
    type: disk
  root:
    path: /
    pool: data2
    size: 40GiB
    type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""

rien de compliqué nous avons un disque, l’image ISO pour l’installation, deux interfaces réseaux. J’ai défini 4Go de RAM et désactivé le secureboot.

On démarre la VM et là c’est le drame :

---<<BOOT>>---
Copyright (c) 1992-2023 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 14.3-RELEASE-p10 stable/26.1-n272047-4ad47b697b0a SMP amd64
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)
SRAT: Ignoring local APIC ID 1 (too high)
SRAT: Ignoring local APIC ID 2 (too high)
SRAT: Ignoring local APIC ID 3 (too high)
SRAT: Ignoring local APIC ID 4 (too high)
SRAT: Ignoring local APIC ID 5 (too high)
SRAT: Ignoring local APIC ID 6 (too high)
SRAT: Ignoring local APIC ID 7 (too high)
SRAT: Ignoring local APIC ID 8 (too high)
SRAT: Ignoring local APIC ID 9 (too high)
SRAT: Ignoring local APIC ID 10 (too high)
SRAT: Ignoring local APIC ID 11 (too high)
SRAT: Ignoring local APIC ID 12 (too high)
SRAT: Ignoring local APIC ID 13 (too high)
SRAT: Ignoring local APIC ID 14 (too high)
SRAT: Ignoring local APIC ID 15 (too high)
SRAT: Ignoring memory at addr 0x10080000000
panic: cannot find a large enough size

cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff82799d60
vpanic() at vpanic+0x161/frame 0xffffffff82799e90
panic() at panic+0x43/frame 0xffffffff82799ef0
vm_phys_early_alloc() at vm_phys_early_alloc+0x1b2/frame 0xffffffff82799f20
pmap_page_array_startup() at pmap_page_array_startup+0x2e0/frame 0xffffffff82799f60
vm_page_startup() at vm_page_startup+0xad6/frame 0xffffffff82799fc0
vm_mem_init() at vm_mem_init+0x1a/frame 0xffffffff82799fd0
mi_startup() at mi_startup+0xb5/frame 0xffffffff82799ff0
KDB: enter: panic
[ thread pid 0 tid 0 ]
Stopped at      kdb_enter+0x33: movq    $0,0x11ade02(%rip)
db> 

En premier lieu j’ai fait une recherche sur le web et je suis tombé sur l’articleRunning OPNSense in Incus qui date de avril 2024 et propose la configuration suivante:

raw.qemu: |
    -cpu host
raw.qemu.conf: |
    [device "dev-qemu_rng"]
security.secureboot: 'false'

Mais pour ma part ça n’a pas corrigé le problème. Il est possible que cela ne soit plus nécessaire, incus ayant amélioré le support de FreeBSD sur les dernières versions.

Le message important est : cannot find a large enough size

A noter que lorsque je lance la VM avec seulement 2Go de RAM je n’ai pas le problème.

Le problème à avoir avec le PCI hole . C’est un héritage de l’architecture 32bits de nos PC qui réserve une partie de la mémoire entre 2.5 et 3.5 Go aux périphériques PCI. Dans notre contexte qemu fournit 4Go de ram en deux morceaux avec un trou au milieu. Et ça FreeBSD n’aime pas et veut une zone continue.

Pour corriger le problème on passe des arguments à qemu pour lui dire de désactiver

incus config set opnsense raw.qemu='-m 4096,slots=0,maxmem=4096M'

La VM boot, j’accède bien au programme d’installation.