feat(installer): install on disks hidden behind Intel RST

On most recent laptops the BIOS ships set to "RST" (also called "Optane" or
"RAID") rather than AHCI: the NVMe drive is no longer on the PCIe bus
directly, it sits behind an Intel VMD controller which creates its own PCI
domain. FWS could not install on those machines.

The advice found everywhere -- switch the BIOS to AHCI -- is both unnecessary
and often impossible. Unnecessary because the kernel has read those drives
through the vmd module since 4.5, and it is in Arch's kernel. Impossible
because plenty of BIOSes expose no such toggle at all, and because on a
dual-boot machine the change stops Windows from booting. FWS therefore never
asks for it first; it is the last resort, and the Windows consequence is
spelled out when it comes to that.

Where this really bit was the reboot, not the install. The live medium sees
the drive because its kernel loads vmd, the install runs to completion, and
then the installed machine does not come up: the initramfs has no vmd, so the
root device cannot be found before it is mounted. A silent failure, invisible
during the install itself.

fws-intel-rst holds all the logic, the way fws-setup-hardware holds the driver
logic, so there is only one detection to keep correct. It reads sysfs rather
than lspci: always present, works inside the %post chroot, and it is the only
source that gives the PCI domain, which is what proves an NVMe really is
behind the VMD rather than plugged in directly. Controllers are matched on
class plus vendor, not on device IDs, which change every generation.

The %pre loads the module before anything else, and that is the step that
makes the whole thing automatic. run_pre_scripts() is called by
/usr/bin/anaconda before the kickstart is even parsed, so before the disk
inventory and long before the UI. Without it the lsblk just below found no
drive, the target fell back to its /dev/sda default, a disk that does not
exist on these machines, and clearpart aimed at nothing, leaving no safe
default. The --ensure mode returns immediately on a machine with no VMD: no
PCI rescan, no waiting, since this sits on the startup path of every install.

The %post writes vmd and nvme into the target's MODULES before mkinitcpio
runs, and adds the mdadm_udev hook for firmware RAID volumes. Both modules are
declared explicitly instead of being left to autodetect, which works from the
modules loaded at image build time: missing vmd there shows up only at reboot,
on a machine that no longer starts.

The new installer screen, fws_rst.py, is the fallback for when even that
failed. It never shows on an ordinary machine: completed returns True as soon
as the engine says there is nothing to do, and _instantiateAction destroys any
completed standalone without displaying it. Machines with no VMD controller,
or with a working one, see nothing, so there is no extra box to understand for
the majority that needs none. When it does show, it explains the situation in
plain French with one button, and no VMD, initramfs or modprobe in any visible
string. Continue stays enabled and Précédent leads back to the network screen,
so the chain back to the keyboard choice stays whole; the wizard now resolves
that chain to the last standalone actually on the stack instead of a fixed
name.

Verified on synthetic sysfs trees, 27 cases: the four hardware states, both
false-positive guards (an Intel audio controller and a non-Intel RAID
controller), initramfs rewriting including idempotence, and the display
decision with Anaconda stubbed out. A missing engine or an unexpected exit
code shows nothing rather than worrying the user. The modprobe and PCI rescan
themselves are untested, there being no VMD controller on this machine.

Signed-off-by: nocode <suzuku295@gmail.com>
This commit is contained in:
nocode committed 2026-09-14 10:57:47 +02:00
1 parent 75ae6d4885
commit 042d6b6df6
8 files changed
+891 -8

No files matched your search

@@ -0,0 +1,294 @@
# FWS — Écran « Prise en charge du disque » (Intel RST / VMD).
#
# POURQUOI ICI (airootfs, pas dans le paquet anaconda) : même mécanisme que
# fws_network.py / fws_desktop.py / fws_recap.py — Anaconda découvre les spokes
# au RUNTIME dans ce dossier → l'overlay airootfs suffit, AUCUN rebuild du
# paquet anaconda. Le glade associé est dans
# /usr/share/anaconda/ui/spokes/fws_rst.glade.
#
# LE PROBLÈME. Sur beaucoup de portables récents, le BIOS est réglé sur
# « Intel RST » (aussi appelé « Optane » ou « RAID ») : le SSD n'est plus
# branché en direct, il est caché derrière un contrôleur Intel VMD. Réponse
# habituelle sur les forums : « bascule le BIOS en AHCI ». FWS ne dit PAS ça —
# c'est souvent impossible (aucune bascule exposée) et ça empêche Windows de
# démarrer sur une machine en dual-boot. Le noyau Linux sait lire ce disque
# via son module « vmd » : il suffit de le charger.
#
# CE QUE FAIT CET ÉCRAN. Il ne décide rien : toute la détection et toute
# l'activation vivent dans /usr/local/bin/fws-intel-rst, le même moteur que le
# %post du kickstart appelle pour rendre le système installé démarrable. Il n'y
# a donc qu'une seule logique à maintenir (même choix d'architecture que
# fws-drivers / fws-setup-hardware).
#
# QUAND IL APPARAÎT. JAMAIS sur une machine ordinaire : « completed » renvoie
# True dès que le moteur dit qu'il n'y a rien à faire, et _instantiateAction
# SAUTE tout standalone « completed » (il le détruit sans l'afficher). C'est ce
# qui répond à « propose l'option seulement si elle est nécessaire » : pas une
# case de plus à comprendre pour les 95 % de machines qui n'en ont pas besoin.
#
# PLACEMENT DANS LE FLUX : standalone « preForHub », priorité 15 —
# WelcomeLanguageSpoke (priority=0) → FWSNetworkStandaloneSpoke (10)
# → CE spoke (15) → SummaryHub (l'assistant) → fws_recap → installation
# Il est avant le hub À DESSEIN : le disque doit être visible AVANT que l'écran
# « Destination de l'installation » ne liste les disques.
#
# ⚠ Chemin couplé à la version de Python d'Arch (3.14), comme les autres spokes.
import subprocess
import threading
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GLib, Gtk
from pyanaconda.anaconda_loggers import get_module_logger
from pyanaconda.ui.gui.hubs.summary import SummaryHub
from pyanaconda.ui.gui.spokes import StandaloneSpoke
log = get_module_logger(__name__)
__all__ = ["FWSIntelRSTStandaloneSpoke"]
_ENGINE = "/usr/local/bin/fws-intel-rst"
# Codes de retour du moteur (cf. l'en-tête de fws-intel-rst). Les nommer ici
# évite des nombres nus dans le code.
_RC_ABSENT = 0
_RC_OK = 10
_RC_BLOCKED = 11
_RC_RAID = 12
# Couleurs des messages (markup Pango), identiques à fws_network.py.
_GREEN = "#1e7145"
_RED = "#b3261e"
_GREY = "#555555"
# Le vrai recours de dernier ressort, et ses conséquences. Dit en clair : une
# utilisatrice débutante a qualifié de « flippant » le fait de ne pas savoir ce
# qui se passait — l'inverse de rassurer, c'est cacher, pas expliquer.
_BIOS_FALLBACK = (
"Il reste une solution, dans le BIOS de la machine : cherche le réglage de "
"stockage (souvent « SATA Mode », « Intel RST » ou « Optane ») et choisis "
"« AHCI », puis redémarre sur la clé FWS.\n\n"
"À savoir si Windows est installé sur cette machine : après ce changement, "
"Windows ne démarrera plus tant que le réglage n'est pas remis comme avant. "
"Si tu veux garder Windows, mieux vaut demander de l'aide avant d'y toucher."
)
def _run_engine(args, timeout=180):
"""Lance le moteur. Renvoie (code, sortie). Jamais d'exception vers l'UI."""
try:
proc = subprocess.run([_ENGINE] + args, capture_output=True,
text=True, timeout=timeout)
return proc.returncode, (proc.stdout or "") + (proc.stderr or "")
except FileNotFoundError:
log.warning("FWS: %s absent — écran Intel RST inactif.", _ENGINE)
return _RC_ABSENT, ""
except Exception as exc: # pylint: disable=broad-except
log.warning("FWS: échec de %s : %s", _ENGINE, exc)
return _RC_ABSENT, ""
class FWSIntelRSTStandaloneSpoke(StandaloneSpoke):
"""Rend visible un disque caché derrière un contrôleur Intel VMD/RST."""
builderObjects = ["fwsRSTWindow", "rstTitle", "rstIntro", "rstFixButton",
"rstStatusBox", "rstSpinner", "rstStatus", "rstFallback",
"rstExpander", "rstScroll", "rstLog"]
mainWidgetName = "fwsRSTWindow"
uiFile = "spokes/fws_rst.glade"
preForHub = SummaryHub
priority = 15
@staticmethod
def get_screen_id():
"""Identifiant unique de cet écran."""
return "fws-intel-rst-configuration"
def __init__(self, *args):
StandaloneSpoke.__init__(self, *args)
# La détection est faite ICI, pas dans initialize() : Anaconda lit
# « completed » juste après __init__ et AVANT initialize() (cf.
# _instantiateAction), donc un état calculé plus tard arriverait trop
# tard pour décider si l'écran doit s'afficher.
self._status, self._details = self._detect()
self._busy = False
self._resolved = False
# -------------------------------------------------------------- moteur --
@staticmethod
def _detect():
code, out = _run_engine(["--detect"], timeout=60)
status = {
_RC_ABSENT: "absent",
_RC_OK: "ok",
_RC_BLOCKED: "blocked",
_RC_RAID: "raid",
}.get(code)
if status is None:
# Code inattendu : on n'affiche RIEN plutôt que d'inquiéter sans
# raison. Le %post posera quand même le module dans l'initramfs.
log.warning("FWS: code de retour inattendu de fws-intel-rst : %s", code)
status = "absent"
log.info("FWS: Intel RST — état détecté « %s ».", status)
return status, out
# ------------------------------------------------------------------ UI --
@property
def completed(self):
# True = Anaconda saute l'écran sans même l'afficher. C'est le cas
# normal : soit la machine n'a pas de contrôleur VMD, soit il fonctionne
# déjà. On ne montre cet écran QUE s'il y a quelque chose à faire.
return self._status in ("absent", "ok")
def initialize(self):
StandaloneSpoke.initialize(self)
self._title = self.builder.get_object("rstTitle")
self._intro = self.builder.get_object("rstIntro")
self._button = self.builder.get_object("rstFixButton")
self._spinner = self.builder.get_object("rstSpinner")
self._status_label = self.builder.get_object("rstStatus")
self._fallback = self.builder.get_object("rstFallback")
self._log = self.builder.get_object("rstLog")
self._button.connect("clicked", self._on_fix_clicked)
self._title.set_markup(
'<span size="x-large"><b>%s</b></span>'
% GLib.markup_escape_text(self._headline()))
self._intro.set_text(self._explanation())
self._append(self._details)
# « Précédent » vers l'écran réseau, comme depuis la première étape de
# l'assistant : la chaîne de retour reste complète jusqu'à la langue.
try:
from pyanaconda.ui.gui.spokes.fws_wizard import add_back_button
add_back_button(self, "FWSNetworkStandaloneSpoke")
except Exception: # pylint: disable=broad-except
log.warning("FWS: « Précédent » non ajouté à l'écran Intel RST.")
def refresh(self):
StandaloneSpoke.refresh(self)
# Continuer reste TOUJOURS possible : si la prise en charge échoue,
# l'utilisateur doit pouvoir avancer (l'écran « Destination » dira
# qu'aucun disque n'a été trouvé) ou revenir en arrière. Un écran dont
# on ne peut pas sortir est un cul-de-sac.
if hasattr(self.window, "set_may_continue"):
self.window.set_may_continue(True)
def apply(self):
pass
def _headline(self):
if self._status == "raid":
return "Tes disques sont regroupés en RAID Intel"
return "Ton disque n'est pas encore visible"
def _explanation(self):
if self._status == "raid":
return (
"Sur cette machine, plusieurs disques sont regroupés en un seul "
"volume par la carte mère (« RAID Intel »). FWS sait s'en servir, "
"mais il doit d'abord préparer ce qu'il faut pour que la machine "
"redémarre dessus après l'installation.\n\n"
"Clique sur le bouton : rien n'est effacé à cette étape, et tu "
"n'as rien à changer dans le BIOS.")
return (
"Cette machine range son disque derrière une technologie Intel "
"appelée RST (elle s'appelle parfois « Optane » ou « RAID » dans le "
"BIOS). C'est pour ça qu'aucun disque n'apparaît pour l'instant.\n\n"
"FWS sait s'en occuper : clique sur le bouton. Rien n'est effacé à "
"cette étape, et tu n'as rien à changer dans le BIOS.")
# ----------------------------------------------------------- affichage --
def _set_status(self, text, color=_GREY):
self._status_label.set_markup(
'<span foreground="%s">%s</span>'
% (color, GLib.markup_escape_text(text)))
def _append(self, text):
if not text:
return
buf = self._log.get_buffer()
buf.insert(buf.get_end_iter(), text if text.endswith("\n") else text + "\n")
# ------------------------------------------------------------- actions --
def _on_fix_clicked(self, _button):
if self._busy:
return
self._busy = True
self._button.set_sensitive(False)
self._fallback.hide()
self._spinner.show()
self._spinner.start()
self._set_status("Préparation du disque… quelques secondes, il n'y a "
"rien à faire.")
threading.Thread(target=self._work, daemon=True).start()
def _work(self):
"""Hors du thread graphique : le moteur, puis un nouveau scan disques."""
code, out = _run_engine(["--enable"], timeout=180)
GLib.idle_add(self._append, out)
# Liste BLANCHE volontaire : « tout sauf bloqué » compterait un code
# inattendu (moteur absent, erreur de shell) comme une réussite et
# afficherait « c'est bon » sur une machine sans disque.
# ok/raid : le disque répond ; « raid » reste « raid » après coup,
# c'est --persist qui posera le hook mdadm_udev.
# absent : le disque est apparu hors du domaine VMD — visible aussi.
if code in (_RC_ABSENT, _RC_OK, _RC_RAID):
# Le moteur a rendu la main sur un état exploitable : Anaconda doit
# REFAIRE son inventaire, sinon l'écran « Destination » resterait
# sur la liste vide construite au démarrage de l'installateur.
GLib.idle_add(self._set_status,
"Le disque répond. Mise à jour de la liste des "
"disques…", _GREY)
rescanned = self._rescan_storage()
GLib.idle_add(self._finish, True, rescanned)
else:
GLib.idle_add(self._finish, False, False)
def _rescan_storage(self):
"""Relance l'inventaire disques d'Anaconda. True si l'appel a abouti."""
try:
from pyanaconda.ui.lib.storage import reset_storage
# scan_all : on vient de faire APPARAÎTRE un périphérique, la liste
# des disques « exclusifs » retenue au démarrage ne le contient pas.
reset_storage(scan_all=True, retry=False)
return True
except Exception as exc: # pylint: disable=broad-except
# Pas bloquant : l'écran « Destination » a son propre bouton de
# ré-analyse, et le disque est de toute façon visible du noyau.
log.warning("FWS: nouveau scan des disques impossible : %s", exc)
GLib.idle_add(self._append,
"[FWS] nouveau scan automatique impossible : %s" % exc)
return False
def _finish(self, success, rescanned):
self._busy = False
self._spinner.stop()
self._spinner.hide()
if success:
self._resolved = True
message = "C'est bon, ton disque est visible."
if not rescanned:
# Honnête plutôt que faussement rassurant : on dit quoi faire.
message += (" Si l'écran suivant ne le montre pas, utilise "
"« Ré-analyser les disques » à cette étape.")
else:
message += " Tu peux continuer."
self._set_status(message, _GREEN)
self._intro.set_text(
"FWS se souviendra de ce réglage pour le système installé : la "
"machine redémarrera bien sur son disque après l'installation.")
self._button.hide()
else:
self._set_status(
"FWS n'a pas réussi à rendre le disque visible.", _RED)
self._fallback.set_text(_BIOS_FALLBACK)
self._fallback.show()
self._button.set_sensitive(True)
self._button.set_label("Réessayer")
@@ -80,11 +80,21 @@ _DONE_BUTTON_NAME = "anaconda-spoke-window-done"
_WAIT_MSG = "Analyse du matériel en cours, l'écran suivant s'ouvre tout seul…"
# Écran standalone situé JUSTE AVANT le bloc du hub : c'est là que « Précédent »
# doit mener depuis la première étape de l'assistant. De là, son propre bouton
# « Précédent » ramène à l'écran de langue — donc au choix du clavier, qui en
# découle. La chaîne de retour est ainsi complète du dernier écran au premier.
_PREVIOUS_STANDALONE = "FWSNetworkStandaloneSpoke"
# Écrans standalone situés JUSTE AVANT le bloc du hub : c'est là que
# « Précédent » doit mener depuis la première étape de l'assistant. De là, leur
# propre bouton « Précédent » ramène à l'écran de langue — donc au choix du
# clavier, qui en découle. La chaîne de retour est ainsi complète du dernier
# écran au premier.
#
# Dans l'ORDRE D'AFFICHAGE (= priorité croissante du spoke) : on revient sur le
# DERNIER de ces écrans réellement montré. Celui d'Intel RST ne s'affiche que
# sur les machines qui en ont besoin (cf. fws_rst.py) — sur toutes les autres il
# n'entre jamais dans la pile, et « Précédent » mène alors à l'écran réseau.
# Lister les deux évite d'avoir à savoir, ici, ce qui a été affiché.
_PREVIOUS_STANDALONES = (
"FWSNetworkStandaloneSpoke", # Connexion à Internet (priority=10)
"FWSIntelRSTStandaloneSpoke", # Prise en charge du disque (priority=15)
)
# --------------------------------------------------------------------------
@@ -538,8 +548,9 @@ def _install_wizard():
# reculer jusqu'à la langue et donc au clavier. Au retour, l'assistant
# reprendra à cette même première étape.
self._fws_resume_index = 0
if go_back_to_standalone(self, _PREVIOUS_STANDALONE):
return
for _target in reversed(_PREVIOUS_STANDALONES):
if go_back_to_standalone(self, _target):
return
# Écran précédent introuvable : on se contente de rouvrir l'étape,
# jamais d'écran vide.
self._fws_resume_index = None
@@ -0,0 +1,199 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- FWS — page « Prise en charge du disque » (Intel RST / VMD), cf. fws_rst.py.
Squelette calqué sur fws_recap.glade : AnacondaStandaloneWindow avec ses
enfants internes (nav_box/nav_area, alignment/action_area).
Cette page ne s'affiche QUE si la machine en a besoin (cf. « completed »
dans fws_rst.py) : sur une machine ordinaire, l'utilisateur ne la voit
jamais. -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="AnacondaWidgets" version="3.0"/>
<object class="AnacondaStandaloneWindow" id="fwsRSTWindow">
<property name="can_focus">False</property>
<property name="window_name" translatable="yes">PRISE EN CHARGE DU DISQUE</property>
<child internal-child="main_box">
<object class="GtkBox" id="AnacondaStandaloneWindow-main_box1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="nav_box">
<object class="GtkEventBox" id="AnacondaStandaloneWindow-nav_box1">
<property name="can_focus">False</property>
<child internal-child="nav_area">
<object class="GtkGrid" id="AnacondaStandaloneWindow-nav_area1">
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="alignment">
<object class="GtkAlignment" id="AnacondaStandaloneWindow-alignment1">
<property name="can_focus">False</property>
<property name="yalign">0</property>
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<property name="top_padding">6</property>
<child internal-child="action_area">
<object class="GtkBox" id="fwsRSTWindow-actionArea">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="rstTitle">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Ton disque n'est pas encore visible</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="rstIntro">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="wrap">True</property>
<property name="max_width_chars">80</property>
<property name="label" translatable="yes">Analyse en cours…</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="rstFixButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Rendre mon disque visible</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="rstStatusBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<property name="spacing">8</property>
<child>
<object class="GtkSpinner" id="rstSpinner">
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="rstStatus">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="wrap">True</property>
<property name="max_width_chars">80</property>
<property name="label" translatable="yes"></property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="rstFallback">
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="wrap">True</property>
<property name="max_width_chars">80</property>
<property name="label" translatable="yes"></property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkExpander" id="rstExpander">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="expanded">False</property>
<property name="label" translatable="yes">Afficher les détails techniques</property>
<child>
<object class="GtkScrolledWindow" id="rstScroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="height_request">160</property>
<child>
<object class="GtkTextView" id="rstLog">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="cursor_visible">False</property>
<property name="monospace">True</property>
<property name="left_margin">8</property>
<property name="right_margin">8</property>
<property name="top_margin">8</property>
<property name="bottom_margin">8</property>
<property name="wrap_mode">word-char</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>