LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
Disks: auto-read from Open in Disks, emulated disks get no verdict, docs and screenshots
Federico Pereiradcd28dbb5506
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d1df8cb..972ec4e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,32 @@ suffix (`-beta`) and are published on GitHub as pre-releases. Each section belowof the matching [GitHub release](https://github.com/lordbasex/LordOS/releases), generated by`tools/release/release-notes.sh` (see [docs/RELEASING.md](docs/RELEASING.md)).+## [0.8.2] - Unreleased++### Added++- **Monitor → Disks: each disk's temperature and health.** The Disks tab now shows every physical+ disk's live temperature, read from the kernel without root: NVMe and M.2 drives through the nvme+ driver's own sensor (also on a Raspberry Pi 5 with an M.2 HAT), SATA disks through the `drivetemp`+ module, which the `lordos` package now loads at boot. Memory cards, virtual disks and adapters+ without a sensor say "No sensor", never a made-up value. The chosen disk gets a 30-minute+ temperature chart with the drive's own limits when it reports them, and an OK / Check / Failing+ light from a cached SMART summary, with "Open in Disks". Spinning disks are only read while they+ are in use, so a resting disk is never woken up+ ([docs/MONITOR.md](docs/MONITOR.md#disk-temperature-and-health-082)).+- **Disks: the full SMART report with smartmontools.** The first time, the health card offers to+ install Debian's smartmontools through the Store's package engine (an administrator). Then it+ shows the overall health and why in plain words, temperature and limits, SSD wear (% of its rated+ life used), power-on hours and cycles, reallocated and pending sectors, every attribute with a plain+ name, the NVMe health log, the error log, the disk's own temperature history, and short and long+ self-tests with progress and results. USB disks behind adapters that pass SMART through work too.+ `smartctl` runs only through four new closed, validated root helper actions (`smart-info`,+ `smart-health`, `smart-test`, `smart-abort`) on real whole disks, at a fixed path, with JSON output+ ([docs/SYSTEM.md](docs/SYSTEM.md#smart-with-smartmontools-082)).+- **Notifications when a disk gets too hot or its health gets worse**, at most once per disk every+ 30 minutes for heat, and only when the health is worse than last seen. On by default, with a switch+ in Monitor → Disks.+## [Unreleased]### Addeddiff --git a/apps/disks/health.jsx b/apps/disks/health.jsxindex 48790a9..4a6449b 100644--- a/apps/disks/health.jsx+++ b/apps/disks/health.jsx@@ -72,7 +72,7 @@ function Bar({ frac, color }) {// ---- the card -----export function HealthCard({ disk, isAdmin }) {+export function HealthCard({ disk, isAdmin, autoCheck }) {const t = useTheme();const tr = useTr();const [st, setSt] = useState(() => cache.get(disk.name) || null);@@ -95,6 +95,8 @@ export function HealthCard({ disk, isAdmin }) {if (ok && can) { setSt({ loading: true }); readFull(disk.name).then(save, (e) => save({ error: e.message })); } // the full report right away}, (e) => setInst({ error: e.message }));};+ // opened from the Monitor or a notice ("Open in Disks"): the user asked for this disk's health+ useEffect(() => { if (autoCheck && ownCan && !cache.get(disk.name)) check(); }, [autoCheck]);const m = st && st.src === 'smartctl' ? st.m : null;const own = st && st.src === 'own' ? st.summary : null;const health = m ? m.health : own ? own.health : null;@@ -102,7 +104,7 @@ export function HealthCard({ disk, isAdmin }) {<View key="head" style={{ minHeight: 44, flexDirection: 'row', alignItems: 'center', gap: spacing.m, paddingVertical: spacing.s }}>{health ? <View style={{ width: 10, height: 10, borderRadius: 5, backgroundColor: HEALTH_COLOR[health] || HEALTH_COLOR.unknown }} /> : null}<View style={{ flex: 1, minWidth: 0, gap: 2 }}>- <Text style={{ fontSize: typeScale.body, fontWeight: 600, color: t.text, textAlign: 'start' }}>{health ? tr(`disks.healthState.${health}`) : tr('disks.health')}</Text>+ <Text style={{ fontSize: typeScale.body, fontWeight: 600, color: t.text, textAlign: 'start' }}>{health ? tr(`disks.healthState.${health}`) : tr('disks.notChecked')}</Text>{m && !m.supported ? <Dim>{m.messages.find((x) => x.severity === 'error') ? tr('disks.smart.unsupportedBridge') : tr('disks.noSmart')}</Dim>: health ? <Dim>{tr(`disks.healthHint.${health}`)}</Dim>: !ownCan ? <Dim>{tr('disks.noSmart')}</Dim>@@ -116,7 +118,7 @@ export function HealthCard({ disk, isAdmin }) {const footer = st && st.ms != null && !st.loading ? (m ? tr('disks.smart.readWith', { ms: `${st.ms} ms` }) : tr('disks.readIn', { ms: st.ms })) : null;return (<View style={{ gap: spacing.l }}>- <GroupBox footer={footer}>+ <GroupBox title={tr('disks.health')} footer={footer}>{[head, ...(m ? fullRows(tr, m) : own ? ownRows(tr, own) : []), own && st.attrs.length ? <OwnAttrs key="oa" attrs={st.attrs} /> : null].filter(Boolean)}</GroupBox>{ownCan && !installed ? <InstallBox isAdmin={isAdmin} inst={inst} onInstall={install} /> : null}diff --git a/apps/disks/index.jsx b/apps/disks/index.jsxindex 22e6593..88b046f 100644--- a/apps/disks/index.jsx+++ b/apps/disks/index.jsx@@ -203,7 +203,7 @@ function DiskToolbar({ disk, part, onDialog, run, busy }) {);}-function Details({ disk, part, onDialog }) {+function Details({ disk, part, onDialog, autoCheck }) {const t = useTheme();const { isAdmin } = useCanTouch();const { t: tr } = useLocale();@@ -261,7 +261,7 @@ function Details({ disk, part, onDialog }) {<Row key="parts" label={tr('disks.partitions')} value={String(disk.partitions.length)} />,]}</GroupBox>- {!part ? <HealthCard disk={disk} isAdmin={isAdmin} /> : null}+ {!part ? <HealthCard disk={disk} isAdmin={isAdmin} autoCheck={autoCheck} /> : null}{target.ro ? <Text style={{ fontSize: typeScale.caption, color: t.textDim, textAlign: 'start' }}>{tr('disks.readOnlyNote')}</Text> : null}</View></ScrollView>@@ -286,7 +286,7 @@ export default function Disks() {return (<View style={{ flex: 1, flexDirection: 'row' }}><Sidebar list={list} sel={{ disk: disk && disk.name, part: part && part.name }} onSel={setSel} />- {disk ? <Details key={disk.name} disk={disk} part={part} onDialog={(d) => setDialog({ ...d, disk, part })} />+ {disk ? <Details key={disk.name} disk={disk} part={part} onDialog={(d) => setDialog({ ...d, disk, part })} autoCheck={args?.disk === disk.name ? args.nonce || 1 : null} />: <EmptyState icon={<DisksIcon size={56} />} title={tr('disks.none')} />}{dialog ? <DiskDialog {...dialog} tools={tools} onClose={() => { setDialog(null); reload(); }} /> : null}</View>diff --git a/apps/monitor/DisksTab.jsx b/apps/monitor/DisksTab.jsxindex a1280fc..bbaedf4 100644--- a/apps/monitor/DisksTab.jsx+++ b/apps/monitor/DisksTab.jsx@@ -132,8 +132,7 @@ function DiskDetail({ d, sum, h }) {format={(v) => formatNumber(Math.round(v), 0)} times={series.times} capacity={DISK_TEMP_HISTORY} height={130} bg={card.bg} />) : null}</Card>- <Card icon="disk" title={tr('monitor.health.title')} style={{ flex: 2 }}- right={<View onClick={open}><Text style={{ fontSize: 11, color: t.accent, whiteSpace: 'nowrap' }}>{tr('monitor.health.openDisks')}</Text></View>}>+ <Card icon="disk" title={tr('monitor.health.title')} style={{ flex: 2 }}><View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}><HealthDot health={health} size={12} /><Text style={{ fontSize: 20, fontWeight: 600, color: t.text }}>{smart.smartable(d.name) ? (sum && !sum.idle ? tr(`monitor.health.${health}`) : '—') : tr('monitor.health.none')}</Text>@@ -148,7 +147,7 @@ function DiskDetail({ d, sum, h }) {</Text><View style={{ flexDirection: 'row', gap: 8 }}><Stat label={tr('monitor.health.hours')} value={sum?.hours != null ? formatNumber(sum.hours, 0) : '—'} unit={sum?.hours != null ? tr('monitor.health.hoursUnit') : null} />- <Stat label={tr('monitor.health.wear')} value={sum?.wear != null ? formatNumber(sum.wear, 0) : '—'} unit={sum?.wear != null ? '%' : null} />+ {!d.rota ? <Stat label={tr('monitor.health.wear')} value={sum?.wear != null ? formatNumber(sum.wear, 0) : '—'} unit={sum?.wear != null ? '%' : null} /> : null}</View>{!smart.installed() && smart.smartable(d.name) ? <Text style={{ fontSize: 11, color: t.textDim, lineHeight: 1.4, textAlign: 'start' }}>{tr('monitor.health.basic')}</Text> : null}<Button small label={tr('monitor.health.openDisks')} onClick={open} />diff --git a/assets/locales/en/disks.json b/assets/locales/en/disks.jsonindex 5136c02..ea5e0bd 100644--- a/assets/locales/en/disks.json+++ b/assets/locales/en/disks.json@@ -270,5 +270,6 @@"attr.a226": "Load-in time","attr.a232": "Reserved space left","attr.a240": "Head flying hours",- "attr.a254": "Free fall events"+ "attr.a254": "Free fall events",+ "notChecked": "Not checked yet"}diff --git a/assets/locales/es/disks.json b/assets/locales/es/disks.jsonindex 05412c6..7512235 100644--- a/assets/locales/es/disks.json+++ b/assets/locales/es/disks.json@@ -270,5 +270,6 @@"attr.a226": "Tiempo de carga","attr.a232": "Espacio de reserva libre","attr.a240": "Horas de vuelo del cabezal",- "attr.a254": "Caídas detectadas"+ "attr.a254": "Caídas detectadas",+ "notChecked": "Todavía sin revisar"}diff --git a/assets/locales/pt/disks.json b/assets/locales/pt/disks.jsonindex 0bf66ef..8d07424 100644--- a/assets/locales/pt/disks.json+++ b/assets/locales/pt/disks.json@@ -270,5 +270,6 @@"attr.a226": "Tempo de carga","attr.a232": "Espaço reserva livre","attr.a240": "Horas de voo da cabeça",- "attr.a254": "Quedas detectadas"+ "attr.a254": "Quedas detectadas",+ "notChecked": "Ainda não verificado"}diff --git a/docs/MONITOR.md b/docs/MONITOR.mdindex 6204235..240ec53 100644--- a/docs/MONITOR.md+++ b/docs/MONITOR.md@@ -8,8 +8,9 @@ The Network tab takes the shape of a per-app network monitor (apps on the left,the right).Phase 1 was read-only. Since then the Network tab holds per-app firewall rules (Phase 2) and, in-0.8.1, the Processes tab can stop a process and show its details ("Process actions"). There is no-saved history and there are no alerts.+0.8.1, the Processes tab can stop a process and show its details ("Process actions"). In 0.8.2 the+Disks tab shows each disk's temperature and health, and the session can notify when a disk gets too+hot or less healthy ("Disk temperature and health"). There is no saved history.## Tabs@@ -19,7 +20,7 @@ saved history and there are no alerts.| CPU | total usage (big chart), one chart per core, 1/5/15 load, temperature and tasks || Memory | stacked bar (used, file cache, free), swap and a 60 s chart || Network | apps with connections, map, summary or detail of the chosen app (see below) |-| Disks | total read and write and one row per disk (model, `/dev`, size, rates) |+| Disks | total read and write; one row per disk (model, `/dev`, size, temperature, health, rates); the chosen disk's temperature over the last 30 minutes and its health, with "Open in Disks" (see "Disk temperature and health") || Processes | sortable table (CPU, memory, threads, PID, user), search, "Mine" / "All"; Stop and Get Info for the selected process (see "Process actions") |Charts pause with the mouse over them and show a crosshair with the values at that instant, as in@@ -171,6 +172,65 @@ protected list, a stale start time refused while the process survives, TERM andchildren, the session and PID 1 refused, and the Get Info JSON (a pipe and a listening TCP socketamong the open files; no private parts when not the owner; "gone" for another start time).+## Disk temperature and health (0.8.2)++ ++**Temperature, from the kernel, without root.** Each physical disk's temperature comes from its+hwmon sensor, which the session reads like any other sysfs file (`server/src/monitor/disktemp.c`):++| Disk | Sensor | Where it sits in sysfs |+|---|---|---|+| NVMe / M.2 (also an M.2 drive on a Raspberry Pi 5 HAT) | the nvme driver's own (`CONFIG_NVME_HWMON`, on in Debian's and LordOS's Pi kernel) | `/sys/block/nvme0n1/device` is the controller; the sensor is its child `hwmonN` (name `nvme`). With native multipath the block device's `device` is the `nvme-subsysN`, and the sensor is found through the controllers it lists |+| SATA | `drivetemp` (`CONFIG_SENSORS_DRIVETEMP=m`), loaded at boot by `/usr/lib/modules-load.d/lordos-drivetemp.conf` from the `lordos` package (migration `003-0.8.2-drivetemp` loads it once on an upgraded running system) | `/sys/block/sda/device` is the SCSI device; the sensor is in its glue folder `hwmon/hwmonN` (name `drivetemp`) |+| microSD / eMMC cards, virtual disks (virtio, QEMU), optical drives, most USB bridges | none | the tab says **No sensor**: there is never a made-up value |++Only chips named `nvme` or `drivetemp` count, `temp1_input` is the drive's main temperature+("Composite" on NVMe) and a reading outside −40…150 °C is "no value". The drive's own limits come+from `temp1_max` (warning) and `temp1_crit` (critical) when it exposes them; otherwise the tab says+"the drive does not report its own" and uses a conservative default: 75 °C for NVMe, 70 °C for a SATA+SSD and 55 °C for a spinning disk (`diskTempLimit` in `sdk/smart.js`).++**Cost.** The temperatures are read by the Monitor's own sampling thread (`mon.c`), never on the screen+thread: every 3 s (one sysfs read per disk) while the Monitor is open. The chart keeps the last 600+readings (30 minutes) in `diskTempHistory` (`sdk/monitor.js`), drawn with the same `Chart.jsx` as+Cooling. **A spinning disk is only read while it is awake** (I/O in the last minute, from+`/proc/diskstats`): asking a resting drive for its temperature can keep it from spinning down+(drivetemp sends it an ATA command), so it shows **Resting** until it is used again.++**Health light: OK / Check / Failing.** Each row and the chosen disk's card show the health from a+cached SMART summary (`smartSummaries`, `smart.refresh` in `sdk/smart.js`):++- with smartmontools installed: the root helper's `smart-health` action (`smartctl -n standby -i -H+ -A -c -l selftest`), which **never wakes a resting disk** (`-n standby`: smartctl only asks the+ power mode, and a disk in standby keeps its previous summary);+- without it: LordOS's own reader (`disk-smart`, see `SYSTEM.md`), only for flash disks and for+ spinning disks that are awake;+- at most once every 5 minutes per disk, one disk at a time, and only for disks that can have+ SMART (`sd*`, `hd*`, `nvme*n*`). Cards, optical drives and virtual disks say **No SMART** or **No+ data**.++The verdict is the one in "SMART with smartmontools" (`SYSTEM.md`): **Failing** when the disk says+so (overall status, a pre-fail attribute below its threshold, NVMe reliability or read-only+bits), **Check** with reallocated, pending or uncorrectable sectors, low NVMe spare, media errors or+more than 90 % of its rated life used. "Open in Disks" opens the Disks app on that disk.++**Notifications** (`sdk/diskwatch.js`, started by `startShell`), on by default, with a switch at the+bottom of the tab (`settings.monitor.diskAlerts`):++- **too hot:** while the Monitor is closed, `lord.monitor.watchDisks(true)` lets the sampling thread+ wake every 30 s and read only the disk list and their sensors (spinning disks only when awake);+ the session polls `lord.monitor.diskTemps()` every 30 s, which does not keep the 4 Hz sampling+ alive. A notice when a disk reaches its limit ("critical temperature", and it stays on screen, at+ its critical limit), at most one per disk every 30 minutes and again only after it has cooled+ 3 °C below the limit;+- **health got worse:** 3 minutes after login and then every 6 hours the summaries are refreshed+ (the same `smart-health`, never waking a disk). A notice only when a disk is worse than the last+ time it was seen (remembered by model and serial in `settings.monitor.diskHealth`), with "Open in+ Disks";+- notices go through the session's notifications, so Do Not Disturb and Settings → Notifications+ apply. With the switch off, the background reading stops too.+## Architecture```@@ -178,10 +238,14 @@ apps/monitor/ index.jsx (tabs), Network.jsx (Network), MapView.jsx (mTrafficChart.jsx (mirrored sent/received chart), draw.js (pixels),icons.jsx, Privacy.jsx, countries.js (generated)apps/monitor/Processes.jsx the Processes tab, its context menu, the stop sheet and Get Info+apps/monitor/DisksTab.jsx the Disks tab: rates, temperature and health per disk, the chosen disk's cards+sdk/smart.js, sdk/smartparse.js SMART summaries and smartctl's JSON → one model (Disks app too)+sdk/diskwatch.js notices when a disk gets too hot or less healthysdk/monitor.js useMonitor(), stores monitorSamples / monitorProcesses / monitorConnections /monitorDetail; monitor.watchProcess(), monitor.stopProcess()server/src/ui/js_monitor.c lord.monitor (read-only, validated API)server/src/monitor/mon.c sampling thread: /proc, /sys, processes+server/src/monitor/disktemp.c which hwmon sensor belongs to which disk (nvme, drivetemp)server/src/monitor/conn.c connections via sock_diag + inode → processserver/src/monitor/mmdb.c our own MaxMind DB reader (IP → country)server/src/monitor/map.c vector map, on its own thread@@ -207,6 +271,12 @@ tests/mmdb_test.c, tests/map_bench.c reader test and map benchmark| `detail(pid, st)` | Get Info: the process the thread describes once per second (`0, 0`: none) || `detailInfo()` | its latest details, or `null` if there is nothing new; `{ pid, gone: true }` once it ended || `signal(pid, st, 'TERM' \| 'KILL')` | stops one of the user's own processes: `null`, or an error code (`proc.gone`, `proc.protected…`, `proc.notOwn`, `proc.denied`) |+| `watchDisks(on)` | (0.8.2) with the Monitor closed, the thread wakes every 30 s and reads only the disk sensors |+| `diskTemps()` | (0.8.2) `{ t, disks: [{ name, model, rota, sensor, temp, tempT, tempMax, tempCrit, tempIdle, awake }] }` or `null` if nothing new; it does not keep the 4 Hz sampling alive |++Each disk in `sample().disk.disks` carries the same fields (`sensor`: `"nvme"`, `"drivetemp"` or+`null`; `temp` in °C or `null`; `tempT`: when it was read; `tempIdle`: a spinning disk at rest, not+read; `awake`: I/O in the last minute).No function takes paths or commands: the only arguments are booleans, a language code (letters,digits, `-` and `_`, up to 15), a PID with its start time (integers) and `'TERM'` or `'KILL'`.@@ -218,7 +288,8 @@ digits, `-` and `_`, up to 15), a PID with its start time (integers) and `'TERM'(total and per-core CPU), `/proc/meminfo`, `/proc/loadavg`, `/proc/uptime`, `/proc/net/dev`,`/proc/diskstats` (only whole disks from `/sys/block` with `device/`), and the temperature andfans from `/sys/class/hwmon` (chip `coretemp`, `k10temp`, `zenpower`, `cpu_thermal`…; if there- is none, `/sys/class/thermal`).+ is none, `/sys/class/thermal`); every 3 s, the disks' own sensors (see "Disk temperature and+ health").- Processes (`/proc/<pid>/stat`, `cmdline`, and `exe` for the user's own) and connections: **onceper second**, and only if the tab that shows them is open.- The thread leaves the JSON ready; the screen thread only copies and converts it@@ -484,6 +555,11 @@ It runs outside the frame. While it draws, the screen shows the previous frame s- **Sensors:** the VM has no CPU `hwmon` or fans, so temperature and fan show "—". Still needstesting on real hardware (the code looks for `coretemp`, `k10temp`, `zenpower`, `cpu_thermal`and `pwmfan`).+- **Disk temperatures on real hardware:** the code paths and the sysfs layouts are tested on fake+ trees (`build/disktemp-test`), and on VM 119 every disk correctly says "No sensor" (QEMU's SATA disk+ has neither SCT nor attribute 194, so `drivetemp` does not bind to it). A real NVMe drive (a PC, or+ a Pi 5 with an M.2 HAT) and a real SATA disk with `drivetemp` loaded are still to be checked, and+ with them the "too hot" notice.- **Phase 2:** what's in the "Phase 2" section.## Attributionsdiff --git a/docs/SYSTEM.md b/docs/SYSTEM.mdindex d4ea88c..6a990b8 100644--- a/docs/SYSTEM.md+++ b/docs/SYSTEM.md@@ -16,7 +16,8 @@ The LordOS disk utility, like GNOME Disks.- the actions;- the details: device, model, serial number, capacity, connection, type, partition table, filesystem, label, UUID, mount point;- - the **Disk health (SMART)** card.+ - the **Disk health (SMART)** card and, with smartmontools, the self-tests, the error log, the+ temperature history and every attribute (see "SMART with smartmontools").- **Refresh without polling:** the list updates by itself on mount, unmount, plug-in or format.| | |@@ -35,6 +36,8 @@ The LordOS disk utility, like GNOME Disks.| `server/src/disk/disk.c` | The list, without root, from three sources. **`/sys/block`:** size, removable, read-only, rotational, model. **The udev database** (`/run/udev/data/b<major>:<minor>`): file system, label, UUID, partition table and bus; udev already probed them, so the device is never opened. **`/proc/self/mountinfo`:** where each one is mounted. It also recognizes the system disk and watches for changes. || `server/src/disk/smart.c` | ATA SMART and NVMe health log parsers: pure functions, no I/O || `server/src/disk/disk_admin.c` | The helper's `disk-*` actions (root) |+| `server/src/disk/smartctl_admin.c`, `smartctl.c` | The helper's `smart-*` actions (smartmontools, root) and their pure checks |+| `sdk/smart.js`, `sdk/smartparse.js` | `smart.info/health/test/abort/install`, the summaries the Monitor shows, and smartctl's JSON turned into one model || `server/src/ui/js_disk.c`, `sdk/disks.js` | `lord.disks.list()`, `tools()`, `watch(on)`; in the SDK, `useDisks()` and `disks` || `apps/disks/` | The app: `index.jsx`, `health.jsx` (SMART), `dialogs.jsx` (format, rename, erase, bootable USB), `icons.jsx` |@@ -66,6 +69,10 @@ All are in the closed table of `admin.c` (macro `DISK_ADMIN_ACTIONS` in `disk/di| `disk-erase` | `device\nquick\|zero` | `quick`: wipes the signatures (first and last MiB) and rereads the table. `zero`: writes zeros everywhere, with progress, cancellable || `disk-write-image` | `disk\npath` | Copies an ISO/IMG image to the whole disk and verifies it || `disk-cancel` | `disk` | Stops a `zero` erase or a copy in progress. Only whoever started it, or an administrator |+| `smart-info` | `disk` | (0.8.2) `smartctl -j -x`: the full report. Anyone |+| `smart-health` | `disk` | (0.8.2) `smartctl -j -n standby -i -H -A -c -l selftest`: the summary, without waking a resting disk. Anyone |+| `smart-test` | `disk\nshort\|long` | (0.8.2) `smartctl -j -t short\|long`: starts a self-test. Internal disks: an administrator; removable: any session user |+| `smart-abort` | `disk` | (0.8.2) `smartctl -j -X`: stops a running self-test. Same rule as `smart-test` |Long actions send `LOG progress phase=<table|mkfs|erase|write|verify> done=<n> total=<n>`, whichthe app shows as a bar.@@ -80,7 +87,8 @@ the app shows as a bar.- **The system disk is never touched** (`disk_is_system`). It is the disk of any partition thatholds `/`, `/usr`, `/var`, `/home`, `/boot`, `/boot/efi`, `/efi`, the live medium(`/run/live/medium`…) or an active swap. For a dm/md (LVM, LUKS, RAID), `slaves/` is followed- down to the real disks. Only `disk-smart` accepts it, because it only reads.+ down to the real disks. Only `disk-smart` and the `smart-*` actions accept it: they only read,+ or start the disk's own self-test, which does not change data.- **Who can:**- internal disks, only an administrator (group `sudo`);- removable ones (USB, `removable=1`, `mmc` cards), any session user, like udisks with active@@ -174,6 +182,75 @@ stalls.Over USB, many adapters don't pass ATA PASS-THROUGH, and the app explains that. Virtual disks(virtio, loop) have no SMART.+### SMART with smartmontools (0.8.2)++| | |+|---|---|+|  |  |+| The full report through smartmontools, dark | The same, light |+|  |  |+| First use: "Install smartmontools" (an administrator) | A short self-test running, with its progress |++Our own reader (above) stays: it needs nothing installed and gives the basic health. The rest — the+self-tests, the error log, the SCT temperature history, the drive database that names each+vendor's attributes, USB bridges — is what Debian's **smartmontools** (`smartctl`) already does well,+so 0.8.2 uses it instead of growing our own:++- **Installed on first use.** If `/usr/sbin/smartctl` is missing (`lord.disks.tools().smartctl`),+ the card offers **Install smartmontools**, which goes through the Store's package engine+ (`admin.run('pkg-install', 'smartmontools')`, fetching the package lists first if there are none),+ exactly like Settings → Sharing installs the SSH server. Only an administrator can. Once installed,+ the full report is read right away.+- **Four closed actions** in the root helper (`server/src/disk/smartctl_admin.c`, table above).+ - The disk name must be a whole disk smartctl understands: `sd<letters>`, `hd<letters>` or+ `nvme<N>n<M>` (`smartctl_valid_disk`). Partitions, `loop`, `dm-*`, `md*`, `zram*`, `mmcblk*`,+ `sr*` and anything with a path character are refused before anything runs.+ - Then the same `target()` check as the `disk-*` actions: it exists in sysfs, it is not a+ partition, and `/dev/<disk>` is a block device (`lstat`) with the same major:minor.+ - One program at a fixed path, `/usr/sbin/smartctl`, with an argument list built in C; the only+ variable parts are the validated `/dev/<disk>` and `short`/`long`. No shell, no generic runner,+ no options from the app.+ - A USB disk whose bridge smartctl does not know ("Unknown USB bridge") is retried once with+ `-d sat`.+ - The JSON (`-j`) is compacted (whitespace outside strings dropped, `smartctl_compact`) and sent as+ `LOG` lines of at most 900 bytes cut on UTF-8 boundaries, like `proc-info`; `OK <lines> <exit+ status>` ends it (smartctl's exit status is a bit mask the app reads: bit 3 is "disk failing").+ Output is capped at 1 MiB.+- **Parsing in the session**, not as root: `sdk/smartparse.js` turns smartctl's JSON into one model+ (every number checked, every string cut and only shown as text):+ - overall health and why, in plain words: **Failing** if the disk says so (overall status, a+ pre-fail attribute below its threshold now, NVMe "reliability degraded" or "read-only"); **Check**+ (shown as "With warnings") with reallocated, pending or uncorrectable sectors, grown defects, NVMe+ spare below its threshold, temperature or backup warnings, media errors, a pre-fail attribute+ that failed in the past, or more than 90 % of the rated life used. A device that says it has no+ SMART gets no verdict;+ - temperature and the drive's limits, power-on hours, power cycles, data read and written;+ - **SSD wear** (% of the rated life used): the NVMe health log, the ATA device statistics+ ("Percentage Used Endurance Indicator"), or attributes 231/233/202/177 counting down from 100;+ - every attribute with a plain name (by smartctl's attribute name, not by id: vendors reuse ids+ and smartctl's drive database already knows them), with smartctl's own name under it;+ - for NVMe, the whole health log (spare, % used, data units, commands, busy time, unsafe+ shutdowns, media errors, time above the warning and critical temperatures);+ - the error log (NVMe drives also log harmless events, so its count does not change the health),+ the SCT temperature history (ATA) as a small bar chart, and the self-test log;+ - **self-tests**: Short and Long buttons with the drive's own estimate in minutes; while one runs,+ `smart-health` every 15 s gives the progress (ATA: "remaining percent"; NVMe: "completion+ percent"), with **Stop the test**; when it ends, the full report is read again.+- The result also updates the Monitor's cached summary (see `MONITOR.md`).+- **Tests:** `tests/smart_parse_test.mjs` (92 checks, in `make test` when node is there) with real+ smartctl 7.4 output captured on VM 119 (`tests/smart/`: a QEMU SATA disk before and after two+ self-tests, the health command, a virtio-scsi disk, a USB gadget with an unknown bridge and the+ `-d sat` retry, a started test) and, in the same schema with edited values, a worn SSD, a failing+ disk, a running self-test, a disk in standby and NVMe drives (healthy, and failing with a test+ running). `build/smartctl-test` checks the names (48 cases) and the compaction.++**smartd:** the package also brings Debian's `smartd` monitoring daemon. Its maintainer script+enables `smartmontools.service`, which starts at the next boot (on VM 119 it was enabled but not+started right after the install). Debian's default configuration checks each disk every 30+minutes with `-n standby` (a resting disk is not woken) and mails root, which goes nowhere on a+desktop. LordOS's own notices (`MONITOR.md`) don't need it; an administrator can turn it off with+`systemctl disable --now smartmontools`.+### Measured on VM 119| | |@@ -229,6 +306,7 @@ Tested on VM 119:| `exfatprogs` | exFAT (`mkfs.exfat`, `exfatlabel`) | added to the ISO list || `e2fsprogs` | ext4 (`mkfs.ext4`, `e2label`) | already in Debian base || `ntfs-3g` | NTFS (`mkfs.ntfs`, `ntfslabel`) | optional: without it, the app does not offer NTFS |+| `smartmontools` | the full SMART report and self-tests (`smartctl`) | no: installed from the app the first time (0.8.2) |Mounting needs no package: `vfat`, `exfat`, `ntfs3`, `ext4` and `iso9660` are Debian kernelmodules.@@ -245,7 +323,9 @@ modules.- **Test NVMe with a real disk.** The parser has a test, but the VM has no NVMe: Proxmox does notoffer it without `args`. SMART over a USB adapter that passes it through (SAT) was not testedeither.-- **SMART self-test** (short/long) and health history.+- **SMART on real hardware** (0.8.2): the smartctl path is tested on VM 119 (QEMU SATA, virtio-scsi,+ a USB gadget). A real NVMe drive, a real SATA SSD and HDD, a self-test that takes minutes and a USB+ enclosure that passes SAT through are still to be checked. Health history over time is not kept.- **Pick the image with the system file picker:** today there is a list of the `.iso`/`.img` filesin the home folder and a field for the path.diff --git a/docs/VM-SETUP.md b/docs/VM-SETUP.mdindex 03f5f28..2af2ce7 100644--- a/docs/VM-SETUP.md+++ b/docs/VM-SETUP.md@@ -1142,3 +1142,22 @@ folder `~/LordOS-monred`, installed into `/usr/local/lib/lordos` as in step 15 (`lord-qmp-input.py 118 2987 1067` (the VM has two heads, see "Several displays").- The session language, theme and accent were changed for the screenshots and restored from`~/.config-lordos-backup-monred` afterwards.++## Step 29 — Disk temperatures and SMART with smartmontools (VM 119 `lordos-spot`, October 19)++See `MONITOR.md` ("Disk temperature and health") and `SYSTEM.md` ("SMART with smartmontools").++- **Deploy:** the `v082-disks` tree built in `~/LordOS-dt082`; only `lord-server`, the themes and+ `assets/locales` were installed in `/usr/lib/lordos`, after a backup+ (`/var/tmp/disktemp082-backup/lordos-before.tgz`), and put back from it afterwards.+- **Test user:** `disktest` ("Disk Test", in the `sudo` group, a test-only password), created so the+ login screen could be used without touching `lord`'s password; removed afterwards+ (`userdel -r disktest`).+- **`drivetemp`** was loaded by hand (`modprobe drivetemp`) to check that QEMU's SATA disk gets no+ sensor (it has neither SCT nor attribute 194); unloaded afterwards.+- **smartmontools** was installed twice from the Disks app's "Install smartmontools" (the package+ engine's `pkg-install`), as the feature does, and purged afterwards (`apt-get purge+ smartmontools`), so the next test starts from "not installed" again. Before that, the fixtures in+ `server/tests/smart/` were captured with a `smartctl` unpacked into `/tmp/smx` (`apt-get download`+ + `dpkg -x`, never installed).+- Nothing else changed: no Proxmox setting, no network setting.diff --git a/docs/disks-monitor-dark.png b/docs/disks-monitor-dark.pngnew file mode 100644index 0000000..a728760Binary files /dev/null and b/docs/disks-monitor-dark.png differdiff --git a/docs/disks-monitor-light.png b/docs/disks-monitor-light.pngnew file mode 100644index 0000000..1231468Binary files /dev/null and b/docs/disks-monitor-light.png differdiff --git a/docs/disks-smart-dark.png b/docs/disks-smart-dark.pngnew file mode 100644index 0000000..bedfd6cBinary files /dev/null and b/docs/disks-smart-dark.png differdiff --git a/docs/disks-smart-install.png b/docs/disks-smart-install.pngnew file mode 100644index 0000000..455ada8Binary files /dev/null and b/docs/disks-smart-install.png differdiff --git a/docs/disks-smart-light.png b/docs/disks-smart-light.pngnew file mode 100644index 0000000..68ae1a0Binary files /dev/null and b/docs/disks-smart-light.png differdiff --git a/docs/disks-smart-selftest.png b/docs/disks-smart-selftest.pngnew file mode 100644index 0000000..794863bBinary files /dev/null and b/docs/disks-smart-selftest.png differdiff --git a/sdk/smartparse.js b/sdk/smartparse.jsindex b3def01..3738110 100644--- a/sdk/smartparse.js+++ b/sdk/smartparse.js@@ -237,7 +237,8 @@ export function parseSmartctl(j, exit = 0) {supported: !!kind && smartAvail,enabled: obj(j.smart_support) ? j.smart_support.enabled !== false : true,standby,- passed: obj(j.smart_status) ? j.smart_status.passed !== false : null,+ // a device that says it has no SMART (an emulated disk) gets no verdict, whatever -H printed+ passed: obj(j.smart_status) && !(obj(j.smart_support) && j.smart_support.available === false) ? j.smart_status.passed !== false : null,temp: temp != null && temp > -40 && temp < 150 && !(kind === 'scsi' && temp === 0) ? temp : null,tempMax: lim.max, tempCrit: lim.crit,hours: num(obj(j.power_on_time)?.hours) ?? nvme?.hours ?? null,diff --git a/server/src/disk/smartctl_admin.c b/server/src/disk/smartctl_admin.cindex cf14b39..0351c47 100644--- a/server/src/disk/smartctl_admin.c+++ b/server/src/disk/smartctl_admin.c@@ -2,7 +2,7 @@* SMART section and the Monitor's health summary, through Debian's smartmontools.** smart-info <disk> smartctl -j -x (everything: attributes, logs, tests)- * smart-health <disk> smartctl -j -n standby -H -A -c -l selftest+ * smart-health <disk> smartctl -j -n standby -i -H -A -c -l selftest* (the summary; a resting disk is not woken up)* smart-test <disk>\nshort|long smartctl -j -t short|long (starts a self-test)* smart-abort <disk> smartctl -j -X (stops a running self-test)@@ -81,7 +81,7 @@ static void act(const AdminReq *r, const char *arg, size_t len, int mode) {v[k++] = "-j";if (sat) { v[k++] = "-d"; v[k++] = "sat"; }if (mode == 'i') v[k++] = "-x";- else if (mode == 'h') { v[k++] = "-n"; v[k++] = "standby"; v[k++] = "-H"; v[k++] = "-A"; v[k++] = "-c"; v[k++] = "-l"; v[k++] = "selftest"; }+ else if (mode == 'h') { v[k++] = "-n"; v[k++] = "standby"; v[k++] = "-i"; v[k++] = "-H"; v[k++] = "-A"; v[k++] = "-c"; v[k++] = "-l"; v[k++] = "selftest"; }else if (mode == 't') { v[k++] = "-t"; v[k++] = !strcmp(word, "long") ? "long" : "short"; }else v[k++] = "-X";v[k++] = dev;diff --git a/server/tests/smart/ata-qemu-health.json b/server/tests/smart/ata-qemu-health.jsonindex e720263..239f918 100644--- a/server/tests/smart/ata-qemu-health.json+++ b/server/tests/smart/ata-qemu-health.json@@ -17,6 +17,7 @@"-j","-n","standby",+ "-i","-H","-A","-c",@@ -30,8 +31,8 @@"exit_status": 0},"local_time": {- "time_t": 1792378099,- "asctime": "Sun Oct 18 23:48:19 2026 -03"+ "time_t": 1792380107,+ "asctime": "Mon Oct 19 00:21:47 2026 -03"},"device": {"name": "/dev/sdb",@@ -39,6 +40,30 @@"type": "sat","protocol": "ATA"},+ "model_name": "QEMU HARDDISK",+ "serial_number": "QM00015",+ "firmware_version": "2.5+",+ "user_capacity": {+ "blocks": 16777216,+ "bytes": 8589934592+ },+ "logical_block_size": 512,+ "physical_block_size": 512,+ "trim": {+ "supported": true,+ "deterministic": true,+ "zeroed": false+ },+ "in_smartctl_database": false,+ "ata_version": {+ "string": "ATA/ATAPI-7, ATA/ATAPI-5 published, ANSI NCITS 340-2000",+ "major_value": 240,+ "minor_value": 22+ },+ "smart_support": {+ "available": true,+ "enabled": true+ },"smart_status": {"passed": true},@@ -247,7 +272,35 @@"ata_smart_self_test_log": {"standard": {"revision": 1,- "count": 0+ "table": [+ {+ "type": {+ "value": 1,+ "string": "Short offline"+ },+ "status": {+ "value": 0,+ "string": "Completed without error",+ "passed": true+ },+ "lifetime_hours": 4660+ },+ {+ "type": {+ "value": 1,+ "string": "Short offline"+ },+ "status": {+ "value": 0,+ "string": "Completed without error",+ "passed": true+ },+ "lifetime_hours": 4660+ }+ ],+ "count": 2,+ "error_count_total": 0,+ "error_count_outdated": 0}}}diff --git a/server/tests/smart/scsi-qemu-health.json b/server/tests/smart/scsi-qemu-health.jsonnew file mode 100644index 0000000..8e48b9a--- /dev/null+++ b/server/tests/smart/scsi-qemu-health.json@@ -0,0 +1,75 @@+{+ "json_format_version": [+ 1,+ 0+ ],+ "smartctl": {+ "version": [+ 7,+ 4+ ],+ "pre_release": false,+ "svn_revision": "5530",+ "platform_info": "x86_64-linux-6.12.113+deb13-amd64",+ "build_info": "(local build)",+ "argv": [+ "smartctl",+ "-j",+ "-n",+ "standby",+ "-i",+ "-H",+ "-A",+ "-c",+ "-l",+ "selftest",+ "/dev/sda"+ ],+ "exit_status": 4+ },+ "local_time": {+ "time_t": 1792380107,+ "asctime": "Mon Oct 19 00:21:47 2026 -03"+ },+ "device": {+ "name": "/dev/sda",+ "info_name": "/dev/sda",+ "type": "scsi",+ "protocol": "SCSI"+ },+ "scsi_vendor": "QEMU",+ "scsi_product": "QEMU HARDDISK",+ "scsi_model_name": "QEMU QEMU HARDDISK",+ "scsi_revision": "2.5+",+ "scsi_version": "SPC-3",+ "user_capacity": {+ "blocks": 67108864,+ "bytes": 34359738368+ },+ "logical_block_size": 512,+ "scsi_lb_provisioning": {+ "name": "thin provisioned",+ "value": 2,+ "management_enabled": {+ "name": "LBPME",+ "value": -1+ },+ "read_zeros": {+ "name": "LBPRZ",+ "value": 0+ }+ },+ "rotation_rate": 0,+ "device_type": {+ "scsi_terminology": "Peripheral Device Type [PDT]",+ "scsi_value": 0,+ "name": "disk"+ },+ "smart_support": {+ "available": false+ },+ "temperature": {+ "current": 0,+ "drive_trip": 0+ }+}diff --git a/server/tests/smart_parse_test.mjs b/server/tests/smart_parse_test.mjsindex b4b6ee1..a5fd723 100644--- a/server/tests/smart_parse_test.mjs+++ b/server/tests/smart_parse_test.mjs@@ -3,7 +3,8 @@// Fixtures in tests/smart/:// real smartctl 7.4 output captured on VM 119 (Debian 13):// ata-qemu-x.json (smartctl -j -x, QEMU SATA disk), ata-qemu-health.json (the smart-health-// command), scsi-qemu-x.json (virtio-scsi disk: no SMART), usb-unknown-bridge.json (a USB+// command), scsi-qemu-x.json (virtio-scsi disk: no SMART), scsi-qemu-health.json (smart-health on+// it: -H prints "passed", -i says SMART is not available), usb-unknown-bridge.json (a USB// gadget smartctl does not know), usb-sat-nodata.json (the same retried with -d sat),// ata-test-started.json (smartctl -j -t short), ata-qemu-x-selftests.json (the same disk after// two short self-tests run from the Disks app: the self-test log)@@ -71,6 +72,8 @@ eq('scsi unsupported', m.supported, false);eq('scsi temp 0 is no value', m.temp, null);eq('scsi health unknown', m.health, 'unknown');eq('scsi model', m.model, 'QEMU QEMU HARDDISK');+m = parseSmartctl(load('scsi-qemu-health.json'));+eq('emulated disk: no verdict from -H', [m.passed, m.health, m.supported], [null, 'unknown', false]);m = parseSmartctl(load('usb-unknown-bridge.json'));eq('usb bridge', [m.kind, m.supported, m.health], [null, false, 'unknown']);eq('usb bridge message', m.messages[0].text, '/dev/sdc: Unknown USB bridge [0x0525:0xa4a5 (0x612)]');