jetson-headless-mode

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Jetson Headless Mode

Jetson 无头模式

Plan-then-apply for safe, reversible user-space memory reclamation: switch the default systemd target away from
graphical.target
and disable a curated set of non-essential daemons. This is the highest-yield, lowest-risk memory win on Jetson.
采用先规划后应用的方式,安全、可逆地回收用户空间内存:将默认systemd目标从
graphical.target
切换为其他目标,并禁用一组经过筛选的非必要守护进程。这是Jetson上收益最高、风险最低的内存优化方案。

Purpose

用途

Build a user-approved headless-mode plan from live audit data, then apply only safe, reversible user-space changes that reduce desktop and daemon memory use on Jetson.
基于实时审计数据制定用户认可的无头模式方案,然后仅应用安全、可逆的用户空间更改,以减少Jetson上桌面和守护进程的内存占用。

When to use

适用场景

  • "Free as much memory as possible — I don't need the GUI."
  • "I'm shipping this Jetson as an inference appliance / edge node."
  • After
    jetson-memory-audit
    shows
    default_systemd_target=graphical.target
    or shows
    gdm3
    /
    lightdm
    /
    sddm
    active on a system the user describes as headless.
  • "尽可能释放内存——我不需要GUI。"
  • "我要将该Jetson作为推理设备/边缘节点部署。"
  • jetson-memory-audit
    显示
    default_systemd_target=graphical.target
    ,或显示
    gdm3
    /
    lightdm
    /
    sddm
    在用户描述为无头的系统上处于活跃状态时。

When NOT to use

不适用场景

  • The user needs the local desktop, display output, kiosk UI, or any X/Wayland session. In that case, do not recommend disabling the graphical target or display manager; use
    jetson-memory-audit
    for a read-only view and suggest non-GUI memory options instead.
  • You do not have current audit data. Run
    jetson-memory-audit
    first, or ask the user for its output, before proposing changes or estimating savings.
Use live device data as the source of truth. Jetson family, SKU/variant, memory totals, active display services, and savings estimates must come from
jetson-diagnostic/scripts/detect_jetson.sh
,
audit.json
, or a fresh
jetson-memory-audit
run. If a value is not available, say it is unknown instead of guessing. The savings numbers below are upper bounds; the real delta is whatever a before/after audit reports.
  • 用户需要本地桌面、显示输出、信息亭UI或任何X/Wayland会话。这种情况下,请勿建议禁用图形目标或显示管理器;应使用
    jetson-memory-audit
    获取只读视图,并建议非GUI相关的内存优化选项。
  • 没有当前审计数据。在提出更改建议或估算内存节省量之前,请先运行
    jetson-memory-audit
    ,或向用户索要其输出结果。
以设备实时数据为事实依据。Jetson系列、SKU/型号、总内存、活跃显示服务以及内存节省估算必须来自
jetson-diagnostic/scripts/detect_jetson.sh
audit.json
或最新的
jetson-memory-audit
运行结果。如果某个值不可用,请说明未知,不要猜测。以下节省数值为上限;实际差值以审计前后的报告为准。

Prerequisites

前提条件

  • Start from a current
    jetson-memory-audit
    JSON snapshot.
  • Confirm the user does not need the local desktop, display output, kiosk UI, or X/Wayland session.
  • Mutating changes require
    sudo
    and explicit user approval; dry-run first unless approval was already given in the same prompt.
  • Run on the Jetson host or in a host-visible sandbox with access to systemd state.
  • 从最新的
    jetson-memory-audit
    JSON快照开始。
  • 确认用户不需要本地桌面、显示输出、信息亭UI或X/Wayland会话。
  • 变更操作需要
    sudo
    权限和用户明确批准;除非在同一提示中已获得批准,否则先执行试运行。
  • 在Jetson主机或可访问systemd状态的主机可见沙箱中运行。

Available Scripts

可用脚本

ScriptPurposeArguments
scripts/plan.sh
Reads a memory audit JSON and emits a plan containing safe, reversible recommendations.
--audit PATH
or
--audit -
, plus
--human
.
scripts/apply.sh
Prints or applies the safe commands from a plan JSON. Dry-run by default.
--plan PATH
or
--plan -
,
--apply
,
--reboot
,
--drop-caches
.
If your agent runtime supports
run_script
, use it to run
scripts/plan.sh
and
scripts/apply.sh
and summarize the returned output. Otherwise run the scripts with
bash
from the repository root.
脚本用途参数
scripts/plan.sh
读取内存审计JSON并输出包含安全、可逆建议的方案。
--audit PATH
--audit -
,加上
--human
scripts/apply.sh
打印或应用方案JSON中的安全命令。默认处于试运行模式。
--plan PATH
--plan -
--apply
--reboot
--drop-caches
如果你的Agent运行时支持
run_script
,请使用它来运行
scripts/plan.sh
scripts/apply.sh
并总结返回的输出。否则,从仓库根目录使用
bash
运行这些脚本。

Instructions

操作步骤

  1. Run
    scripts/plan.sh
    to read
    audit.json
    (from
    jetson-memory-audit
    ) and emit a plan with only
    safety: safe
    knobs (target switch, display managers, audio, print, modem, etc.).
  2. Show the plan to the user and confirm.
  3. Run
    scripts/apply.sh --plan plan.json
    for a dry run. Re-run with
    --apply
    to execute. Add
    --drop-caches
    to flush the page cache afterward, or
    --reboot
    to take effect immediately.
  4. Re-run
    jetson-memory-audit/scripts/audit.sh
    to verify the actual delta.
  1. 运行
    scripts/plan.sh
    读取
    audit.json
    (来自
    jetson-memory-audit
    ),输出仅包含
    safety: safe
    配置项的方案(目标切换、显示管理器、音频、打印、调制解调器等)。
  2. 将方案展示给用户并确认。
  3. 运行
    scripts/apply.sh --plan plan.json
    进行试运行。添加
    --apply
    参数重新运行以执行变更。可添加
    --drop-caches
    参数在之后刷新页缓存,或添加
    --reboot
    参数使变更立即生效。
  4. 重新运行
    jetson-memory-audit/scripts/audit.sh
    以验证实际内存差值。

Expected workflow

预期工作流程

Use the scripts for estimates and application so recommendations are based on the current device state rather than the static upper-bound table alone.
  • For "what would headless save", "estimate", "plan", or production planning prompts, run
    scripts/plan.sh --audit <audit.json>
    and report
    estimated_total_savings_mb
    , the top
    recommendations[*].knob
    , and whether any display manager or
    graphical.target
    is active. Do not run
    apply.sh
    .
  • For prompts where the user explicitly says to apply headless mode now, run
    scripts/apply.sh --plan <plan.json>
    once as a dry run first. If the user has already approved mutation in the same prompt, re-run the same command with
    --apply
    and mention the reversible command(s).
  • If direct execution fails in an agent runtime, invoke scripts with
    bash {baseDir}/scripts/<script-name> ...
    . Do not try to
    chmod
    installed skill files.
使用脚本进行估算和应用,确保建议基于当前设备状态,而非仅依赖静态上限表格。
  • 对于“无头模式能节省多少内存”、“估算”、“规划”或生产规划类请求,运行
    scripts/plan.sh --audit <audit.json>
    并报告
    estimated_total_savings_mb
    、排名靠前的
    recommendations[*].knob
    ,以及是否有任何显示管理器或
    graphical.target
    处于活跃状态。请勿运行
    apply.sh
  • 对于用户明确要求立即应用无头模式的请求,先运行
    scripts/apply.sh --plan <plan.json>
    进行试运行。如果用户已在同一提示中批准变更,则添加
    --apply
    参数重新运行相同命令,并提及可逆命令。
  • 如果在Agent运行时中直接执行失败,请使用
    bash {baseDir}/scripts/<script-name> ...
    调用脚本。不要尝试修改已安装技能文件的
    chmod
    权限。

Plan / apply contract

规划/应用约定

  • plan.sh
    emits the same JSON shape as
    jetson-inference-mem-tune/scripts/recommend.py
    : an array of
    recommendations
    with
    {layer, knob, estimated_savings_mb, safety, command, reversible_command, rationale}
    .
  • apply.sh
    filters entries to
    safety == "safe"
    with a non-empty
    command
    , then re-checks the filtered safety marker in the shell loop before execution. Anything else, such as kernel command-line changes, device-tree changes, or accuracy tradeoffs, is out of scope for this skill.
  • Default mode is dry-run.
    --apply
    is required to mutate the system.
  • plan.sh
    输出的JSON格式与
    jetson-inference-mem-tune/scripts/recommend.py
    一致:一个包含
    recommendations
    的数组,每个元素包含
    {layer, knob, estimated_savings_mb, safety, command, reversible_command, rationale}
  • apply.sh
    会筛选出
    safety == "safe"
    command
    非空的条目,然后在shell循环中再次检查筛选后的安全标记,之后才执行。其他操作(如内核命令行更改、设备树更改或精度权衡)不属于本技能的范围。
  • 默认模式为试运行。必须添加
    --apply
    参数才能修改系统。

Knobs covered

涵盖的配置项

KnobActionEstimated savingsReversible?
disable-graphical-target
systemctl set-default multi-user.target
up to 865 MByes
stop-gdm3
/
gdm
/
lightdm
/
sddm
/
display-manager
systemctl disable --now <svc>
~200 MB / svcyes
stop-pulseaudio
disable audio daemon~8 MByes
stop-bluetooth
disable Bluetooth stack~6 MByes
stop-ModemManager
disable WWAN manager~4 MByes
stop-cups
/
stop-cups-browsed
disable print stack~5 / ~3 MByes
stop-snapd
disable Snap daemon~30 MByes
stop-whoopsie
/
kerneloops
disable crash reporters~4 / ~2 MByes
stop-avahi-daemon
disable mDNS~3 MByes
stop-unattended-upgrades
/
packagekit
disable background package work~6 / ~8 MByes
配置项操作估算节省内存是否可逆
disable-graphical-target
执行
systemctl set-default multi-user.target
最高865 MB
stop-gdm3
/
gdm
/
lightdm
/
sddm
/
display-manager
执行
systemctl disable --now <svc>
每个服务约200 MB
stop-pulseaudio
禁用音频守护进程约8 MB
stop-bluetooth
禁用蓝牙栈约6 MB
stop-ModemManager
禁用WWAN管理器约4 MB
stop-cups
/
stop-cups-browsed
禁用打印栈约5 / 约3 MB
stop-snapd
禁用Snap守护进程约30 MB
stop-whoopsie
/
kerneloops
禁用崩溃报告器约4 / 约2 MB
stop-avahi-daemon
禁用mDNS约3 MB
stop-unattended-upgrades
/
packagekit
禁用后台包管理工作约6 / 约8 MB

Do NOT disable these services

请勿禁用以下服务

  • nvargus-daemon
    — required for any libargus camera pipeline.
  • nvgetty.service
    — serial console; disabling can lock you out of recovery.
  • nvpmodel
    — power-mode service; required for clock/power tuning.
  • containerd
    /
    docker
    — leave on if you run containers (most inference workloads do).
  • nvfb
    /
    nvdisplay
    -related kernel services — tied to boot-time display configuration, so this skill does not change them.
  • nvargus-daemon
    — 任何libargus相机管线都需要该服务。
  • nvgetty.service
    — 串行控制台;禁用可能导致无法进入恢复模式。
  • nvpmodel
    — 电源模式服务;时钟/电源调优需要该服务。
  • containerd
    /
    docker
    — 如果运行容器(大多数推理工作负载都会运行),请保持启用。
  • nvfb
    /
    nvdisplay
    相关内核服务 — 与启动时的显示配置绑定,因此本技能不会更改这些服务。

Safety

安全性

  • Does not edit
    /boot/extlinux/extlinux.conf
    , the device tree, or boot-time memory reservations.
  • Does not disable services it does not have an explicit entry for (no blanket "disable everything not whitelisted").
  • Every applied change has a documented
    reversible_command
    . Re-running the plan with the reverts is sufficient to restore.
  • Dry-run by default.
    --apply
    is the only way to mutate.
  • Report only device facts and savings figures that came from live detection or audit output.
  • 不会编辑
    /boot/extlinux/extlinux.conf
    、设备树或启动时的内存预留。
  • 不会禁用没有明确条目的服务(不会采用“禁用所有未列入白名单的服务”的一刀切方式)。
  • 每个应用的更改都有文档记录的
    reversible_command
    。重新运行包含恢复操作的方案即可恢复原状。
  • 默认处于试运行模式。只有添加
    --apply
    参数才能修改系统。
  • 仅报告来自实时检测或审计输出的设备事实和内存节省数据。

Cross-platform behavior

跨平台行为

The same set of knobs applies to every Jetson family in the matrix above. The script reads
JETSON_GENERATION
/
JETSON_PRODUCT_LINE
/
JETSON_VARIANT
from
jetson-diagnostic/scripts/detect_jetson.sh
(and still exports legacy
JETSON_SKU
) so the agent can attribute the savings correctly in its summary, but it does not branch on product line.
上述配置项适用于所有Jetson系列。脚本从
jetson-diagnostic/scripts/detect_jetson.sh
读取
JETSON_GENERATION
/
JETSON_PRODUCT_LINE
/
JETSON_VARIANT
(仍会导出旧版
JETSON_SKU
),以便Agent在总结中正确归因内存节省量,但不会按产品线分支处理。",