Skip to content

Restart does not apply a newly attached USB device to an app, yet the UI stops asking for a restart #134

Closed

Description

@nixfred

What happens

When a USB stick is attached to (or removed from) a running app, the Devices tab shows "Restart to apply" (web/src/usb.tsx line 50, driven by needsRestart in omarchyd/usb.mjs). The Restart button runs apps.restart, which is lifecycle(['restart'], 'restarting') in omarchyd/apps.mjs (around lines 1679-1699). For a restart it rewrites compose.usb.yml and then runs plain docker-compose restart:

if (!app.system && (args[0] === 'up' || args[0] === 'restart')) await writeUsbOverlay(app)
...
else await compose(app, ...args)
if (args[0] === 'up' || args[0] === 'restart') {
	markStarted(app.id)
	if (!app.system) {
		app.usbApplied = (app.usbDevices ?? []).map((d) => d.id)

docker-compose restart only restarts the existing containers; it does not re-read the compose files, so the new devices: entries (or the removal of old ones) never reach the container. Only up -d recreates a container when its configuration changed. Despite that, usbApplied is set to the full device list, so usbBindings() reports the device as live (liveIds), needsRestart turns false and the hint disappears. The app still does not have the device, and the UI now says it does.

How to reproduce

I ran createApps with a stand-in run that records the compose calls: installed an app, called bindUsb('demo-app', {id: '10c4:ea60', path: '/dev/ttyUSB0', ...}), then apps.restart.

Actual: the only compose command run is ... -f compose.omarchy.yml -f compose.usb.yml restart, and afterwards usbBindings()[0].liveIds is ['10c4:ea60'] (it was [] before). The overlay file does contain the device.

Expected: either the restart recreates the container (for example up -d --force-recreate, or stop followed by up -d), or usbApplied is not updated by a plain restart so the "Restart to apply" hint stays until the device really is applied. Stop then Start does apply it, which is not what the hint tells the user to do.

Suggested fix

For an app restart, run up -d --force-recreate (or stop then up -d) after writing the overlay, or only set usbApplied after an up.

Environment

Omarchy Server main (0786ba9, 0.9.50), Node 26.

Activity

  1. calledtoconstruct commented on Nov 21, 2026

    @calledtoconstruct
    Collaborator

    Working to resolve this.

    No open pull request references this issue, and no one has commented that they are working on it.

    This shares the app manager with #804, #688, #138, #679, #528, and #134. They share code and will land in one pull request.

    🤖 Generated with Grok 4.7

  2. calledtoconstruct commented on Nov 21, 2026

    @calledtoconstruct
    Collaborator

    Thank you @nixfred. Restart recreates the container, so a stick attached since the last start is the one that runs. The saved applied list matches that. This is on main in #844.

    🤖 Generated with Grok 4.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions