fix(boot): clean up bare/mini boot warnings and errors

- init: add condition_path_exists so optional-daemon units (dbus, seatd,
  thermald, evdevd) are silently skipped when their binary is absent in a
  minimal image, instead of emitting [FAILED] 'No such file or directory' on
  the bare target. Boot-critical units omit the field and still hard-fail.
- ahcid: an empty ATAPI/optical drive (QEMU's default DVD-ROM, most bare-metal
  optical bays) failed READ CAPACITY and logged 4 ERROR lines every boot;
  register it with a zero block count as a normal no-media state and drop the
  HBA register dump to debug level.
- netstack: a machine with no NIC (bare, or an unsupported NIC) logged an ERROR
  and exited non-zero; treat 'no network adapter' as a normal idle state
  (info + clean exit).
- dhcpd: cut the socket timeout 30s -> 8s so the network stage fails fast when
  no DHCP server answers instead of stalling boot.
This commit is contained in:
Red Bear OS
2026-07-18 00:29:43 +09:00
parent 324172abaf
commit 1769b083ab
9 changed files with 65 additions and 11 deletions
+11 -2
View File
@@ -2,7 +2,7 @@
extern crate log;
use std::process;
use anyhow::{anyhow, bail, Context, Result};
use anyhow::{anyhow, Context, Result};
use event::{EventFlags, EventQueue};
use libredox::flag::{O_NONBLOCK, O_RDWR};
use libredox::Fd;
@@ -36,7 +36,12 @@ fn get_all_network_adapters() -> Result<Vec<String>> {
}
if adapters.is_empty() {
bail!("no network adapter found");
// No NIC present is a normal state on a diskless/headless/bare machine,
// or simply before an unsupported NIC's driver attaches. Report it as
// info and let the caller exit cleanly instead of emitting a spurious
// ERROR + non-zero exit on every boot of a NIC-less system.
info!("no network adapter found; network stack idle");
return Ok(adapters);
}
info!("Found {} network adapter(s): {:?}", adapters.len(), adapters);
Ok(adapters)
@@ -44,6 +49,10 @@ fn get_all_network_adapters() -> Result<Vec<String>> {
fn run(daemon: daemon::Daemon) -> Result<()> {
let adapters = get_all_network_adapters()?;
if adapters.is_empty() {
// Nothing to service; exit cleanly (see get_all_network_adapters).
return Ok(());
}
trace!("found {} network adapter(s)", adapters.len());
let mut network_fds = Vec::new();