sandlock icon indicating copy to clipboard operation
sandlock copied to clipboard

sandlock learn - howto

Open Dreadeath opened this issue 2 months ago • 4 comments

Hello, how should one use "learn" feature? I mean I can't run any GUI app, and simple terminal programs like htop or mc are broken with it, since it seems I can't pass any 'run' arguments to it. Can you provide some examples (I'm too dumb I think for this) to see what should it like to be at all?

Dreadeath avatar Sep 05 '26 19:09 Dreadeath

A few things:

Passing arguments works. Everything after -- goes to the program:

sandlock learn -o profile.toml -- htop -d 50

If args aren't landing for you, please paste the exact command you ran.

htop/mc aren't broken, they just never exit. sandlock learn only writes the profile when the observed process terminates. Interactive TUIs run until you quit them, so learn looks stuck and emits nothing.

Fix: quit the app normally or use --timeout to auto-stop with a partial profile:

sandlock learn --timeout 6 -o htop.toml -- htop
sandlock run --profile-file htop.toml -- htop 

GUI apps: not currently supported by learn.

ghazariann avatar Sep 06 '26 21:09 ghazariann

I meant sandlock run arguments, so I can tune environment and reduce restrictions, like (broad example) sandlock run -r / -- mc. For now sandlock learn -- mc makes mc unusable after start. Maybe it should though, because learn was not planned for that sort of apps, it's not clear for me now.

GUI apps: not currently supported by learn.

Got it

Dreadeath avatar Sep 06 '26 23:09 Dreadeath

Thanks for the report. I think it exposes a deeper problem: we didn't handle devices files correctly in COW and learn, so I created PR #210 .

congwang-mk avatar Sep 08 '26 02:09 congwang-mk

Regarding the doc, please check out https://sandlock.io/docs/profiles.html

congwang-mk avatar Sep 08 '26 03:09 congwang-mk