chroot-distro 2.3.0__tar.gz → 2.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/.github/workflows/publish.yml +6 -6
  2. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/PKG-INFO +43 -39
  3. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/README.md +42 -38
  4. chroot_distro-2.3.2/check-config.sh +429 -0
  5. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/pyproject.toml +1 -1
  6. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/cli.py +3 -8
  7. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/help/pages.py +26 -2
  8. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/login/__init__.py +103 -32
  9. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/login/bindings.py +10 -1
  10. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/remove.py +52 -10
  11. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/completions/_chroot-distro +0 -4
  12. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/completions/chroot-distro.bash +3 -5
  13. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/completions/chroot-distro.fish +0 -6
  14. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/elevate.py +47 -9
  15. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/namespace.py +141 -21
  16. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/parser.py +0 -3
  17. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_cli.py +2 -18
  18. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_elevate.py +102 -5
  19. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_namespace.py +130 -1
  20. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_remove.py +76 -4
  21. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/uv.lock +1 -1
  22. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/.editorconfig +0 -0
  23. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/.github/codeql/codeql-config.yml +0 -0
  24. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/.github/dependabot.yml +0 -0
  25. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/.github/workflows/ci.yml +0 -0
  26. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/.github/workflows/codeql.yml +0 -0
  27. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/.gitignore +0 -0
  28. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/.python-version +0 -0
  29. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/LICENSE +0 -0
  30. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/check-before-commit.sh +0 -0
  31. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/__init__.py +0 -0
  32. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/arch.py +0 -0
  33. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/atomic.py +0 -0
  34. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/backup.py +0 -0
  35. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/build.py +0 -0
  36. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/clear_cache.py +0 -0
  37. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/copy.py +0 -0
  38. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/diff.py +0 -0
  39. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/help/__init__.py +0 -0
  40. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/help/render.py +0 -0
  41. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/info.py +0 -0
  42. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/install.py +0 -0
  43. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/install_local.py +0 -0
  44. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/kill.py +0 -0
  45. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/list_cmd.py +0 -0
  46. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/login/chroot_cmd.py +0 -0
  47. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/login/env.py +0 -0
  48. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/login/passwd.py +0 -0
  49. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/ps.py +0 -0
  50. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/push.py +0 -0
  51. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/rename.py +0 -0
  52. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/reset.py +0 -0
  53. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/restore.py +0 -0
  54. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/run.py +0 -0
  55. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/search.py +0 -0
  56. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/sync.py +0 -0
  57. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/commands/unmount.py +0 -0
  58. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/constants.py +0 -0
  59. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/exceptions.py +0 -0
  60. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/__init__.py +0 -0
  61. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/android.py +0 -0
  62. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_cache.py +0 -0
  63. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/__init__.py +0 -0
  64. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/constants.py +0 -0
  65. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/copy_step.py +0 -0
  66. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/dockerignore.py +0 -0
  67. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/engine.py +0 -0
  68. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/errors.py +0 -0
  69. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/handlers.py +0 -0
  70. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/parsing.py +0 -0
  71. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/run_step.py +0 -0
  72. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/stage.py +0 -0
  73. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/build_engine/users.py +0 -0
  74. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/display.py +0 -0
  75. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/docker/__init__.py +0 -0
  76. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/docker/cache.py +0 -0
  77. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/docker/layers.py +0 -0
  78. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/docker/media.py +0 -0
  79. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/docker/pull.py +0 -0
  80. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/docker/push.py +0 -0
  81. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/docker/refs.py +0 -0
  82. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/docker/transport.py +0 -0
  83. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/dockerfile.py +0 -0
  84. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/download.py +0 -0
  85. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/gpu.py +0 -0
  86. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/layer_diff.py +0 -0
  87. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/mount_manager.py +0 -0
  88. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/nvidia.py +0 -0
  89. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/oci_writer.py +0 -0
  90. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/rootfs.py +0 -0
  91. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/session.py +0 -0
  92. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/sound.py +0 -0
  93. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/tar_extract.py +0 -0
  94. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/wayland.py +0 -0
  95. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/helpers/x11.py +0 -0
  96. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/locking.py +0 -0
  97. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/message.py +0 -0
  98. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/names.py +0 -0
  99. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/paths.py +0 -0
  100. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/progress.py +0 -0
  101. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/py.typed +0 -0
  102. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/src/chroot_distro/rate_limit.py +0 -0
  103. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/conftest.py +0 -0
  104. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_android.py +0 -0
  105. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_arch.py +0 -0
  106. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_backup_restore.py +0 -0
  107. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_bind_options.py +0 -0
  108. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_constants.py +0 -0
  109. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_diff_baseline_cache.py +0 -0
  110. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_display.py +0 -0
  111. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_display_sockets.py +0 -0
  112. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_docker_refs.py +0 -0
  113. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_dockerfile.py +0 -0
  114. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_download_algorithms.py +0 -0
  115. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_download_blob_multi.py +0 -0
  116. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_download_multi.py +0 -0
  117. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_gpu.py +0 -0
  118. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_info.py +0 -0
  119. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_install.py +0 -0
  120. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_install_local.py +0 -0
  121. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_kill.py +0 -0
  122. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_layer_diff.py +0 -0
  123. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_list.py +0 -0
  124. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_locking.py +0 -0
  125. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_login_helpers.py +0 -0
  126. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_message.py +0 -0
  127. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_mount_manager_ns.py +0 -0
  128. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_names.py +0 -0
  129. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_parser.py +0 -0
  130. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_paths.py +0 -0
  131. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_progress.py +0 -0
  132. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_push_chunked.py +0 -0
  133. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_rootfs.py +0 -0
  134. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_sound.py +0 -0
  135. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_tar_extract.py +0 -0
  136. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_unmount.py +0 -0
  137. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_wayland.py +0 -0
  138. {chroot_distro-2.3.0 → chroot_distro-2.3.2}/tests/unit/test_x11.py +0 -0
@@ -16,7 +16,7 @@ jobs:
16
16
  runs-on: ubuntu-latest
17
17
 
18
18
  steps:
19
- - uses: actions/checkout@v4
19
+ - uses: actions/checkout@v7
20
20
  with:
21
21
  ref: ${{ github.event.workflow_run.head_sha }}
22
22
 
@@ -50,7 +50,7 @@ jobs:
50
50
  prerelease: ${{ steps.meta.outputs.prerelease }}
51
51
 
52
52
  steps:
53
- - uses: actions/checkout@v4
53
+ - uses: actions/checkout@v7
54
54
  with:
55
55
  ref: ${{ github.event.workflow_run.head_sha }}
56
56
 
@@ -120,7 +120,7 @@ jobs:
120
120
  runs-on: ubuntu-latest
121
121
 
122
122
  steps:
123
- - uses: actions/checkout@v4
123
+ - uses: actions/checkout@v7
124
124
  with:
125
125
  ref: ${{ needs.prepare.outputs.tag }}
126
126
 
@@ -138,7 +138,7 @@ jobs:
138
138
  run: python -m twine check dist/*
139
139
 
140
140
  - name: Upload build artifacts
141
- uses: actions/upload-artifact@v4
141
+ uses: actions/upload-artifact@v7
142
142
  with:
143
143
  name: python-package-distributions
144
144
  path: dist/
@@ -153,7 +153,7 @@ jobs:
153
153
 
154
154
  steps:
155
155
  - name: Download build artifacts
156
- uses: actions/download-artifact@v4
156
+ uses: actions/download-artifact@v8
157
157
  with:
158
158
  name: python-package-distributions
159
159
  path: dist/
@@ -170,7 +170,7 @@ jobs:
170
170
 
171
171
  steps:
172
172
  - name: Checkout repository
173
- uses: actions/checkout@v4
173
+ uses: actions/checkout@v7
174
174
  with:
175
175
  ref: ${{ needs.prepare.outputs.tag }}
176
176
  fetch-depth: 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chroot-distro
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: chroot-distro is a lightweight Linux container management utility built around chroot.
5
5
  Project-URL: Homepage, https://github.com/sabamdarif/chroot-distro
6
6
  Project-URL: Repository, https://github.com/sabamdarif/chroot-distro
@@ -157,15 +157,8 @@ pip install .
157
157
  ### First-run check
158
158
 
159
159
  On startup, commands that modify containers or mounts verify that the
160
- effective UID is `0`. If not, Chroot-Distro re-executes itself using, in
161
- order: `sudo`, `doas`, `pkexec`, or `su`.
162
-
163
- | Situation | Behaviour |
164
- |---|---|
165
- | Default | Auto-elevate when not root. |
166
- | `--no-elevate` or `CHROOT_DISTRO_NO_ELEVATE=1` | Skip elevation; exit with an error if not root. |
167
- | Termux, default | Prefer `su` (real root) over `sudo`. |
168
- | Termux, `--use-sudo` or `CHROOT_DISTRO_USE_SUDO=1` | Prefer `sudo` for elevation. |
160
+ effective UID is `0`. If not, Chroot-Distro auto-elevates when not root by
161
+ re-executing itself using, in order: `sudo`, `doas`, `pkexec`, or `su`.
169
162
 
170
163
  `list`, `ps`, `search`, `info`, and `help` do not require root on Termux and
171
164
  are never re-executed. On regular Linux, `list`, `ps`, and `info` still
@@ -233,8 +226,6 @@ laid out for the current terminal width.
233
226
  | Option | Description |
234
227
  |---|---|
235
228
  | `-h`, `--help` | Show top-level help. |
236
- | `--no-elevate` | Do not auto-elevate to root (`CHROOT_DISTRO_NO_ELEVATE=1`). |
237
- | `--use-sudo` | On Termux, prefer `sudo` over `su` (`CHROOT_DISTRO_USE_SUDO=1`). |
238
229
 
239
230
  Short aliases are accepted for many commands (`sh` → `login`, `rm` →
240
231
  `remove`, `ins` → `install`, etc.); each section below lists them.
@@ -477,13 +468,12 @@ chroot-distro login ubuntu --get-chroot-cmd
477
468
  | Option | Description |
478
469
  |---|---|
479
470
  | `-u`, `--user USER` | Log in as USER (default: `root`). Accepts `name`, numeric `uid`, `name:group`, or `uid:gid`. |
480
- | `--isolated` | Reduce host exposure and enable namespace isolation (mount, PID, UTS, IPC via `unshare`/`nsenter`). On Termux: also skip Android system, storage, and `$PREFIX` binds unless you opt in with `--shared-*` or `--bind`. (Fresh `/tmp` and `/run` are the default in every mode now, not just `--isolated`.) Mutually exclusive with `--minimal`. |
471
+ | `--isolated` | Reduce host exposure and enable namespace isolation (mount, PID, UTS, IPC, and cgroup when supported, via `unshare`/`nsenter`). On Termux: also skip Android system, storage, and `$PREFIX` binds unless you opt in with `--shared-*` or `--bind`. (Fresh `/tmp` and `/run` are the default in every mode now, not just `--isolated`.) Mutually exclusive with `--minimal`. To get the same namespace isolation **without** reducing the mount set, set `CD_USE_NS=1` instead (see [Environment variables](#environment-variables)). |
481
472
  | `--minimal` | Bare minimum chroot: core pseudo-filesystems only (`/dev`, `/proc`, `/sys`, plus `/run`, `/dev/pts`, `/dev/shm` when present). Stripped guest environment. Mutually exclusive with `--isolated`. |
482
473
  | `--shared-home` | Bind the invoking user's host home into the guest home (or `/root` for root). On Termux, binds `TERMUX_HOME`. |
483
474
  | `--shared-tmp` | Bind host tmp (`/tmp` on Linux, `$PREFIX/tmp` on Termux) to `/tmp` in the guest. Opt-in only: by default the container gets its own fresh `/tmp`, not the host's. |
484
475
  | `--shared-display` | Share the host display server (X11 and Wayland), audio (PulseAudio/PipeWire), and D-Bus session bus with the container. Binds only the specific session sockets, not the host's whole `/run`. Opt-in only. `--shared-x11` is accepted as a backward-compatible alias. |
485
476
  | `-b`, `--bind SRC[:DST]` | Bind-mount a custom host path (repeatable). `DST` must be an absolute guest path. |
486
- | `--hostname STRING` | Hostname inside the container (default: the container name). |
487
477
  | `-w`, `--work-dir PATH` | Initial working directory (default: user's home). |
488
478
  | `-e`, `--env VAR=VALUE` | Set a guest environment variable (repeatable). |
489
479
  | `--get-chroot-cmd` | Print the fully assembled `env` + `chroot` command line and exit. |
@@ -572,23 +562,38 @@ Termux.)
572
562
  - Guest `ldconfig` is run inside the chroot to refresh the shared library
573
563
  cache after the new libraries are bind-mounted.
574
564
 
575
- #### Namespace isolation (`--isolated`)
565
+ #### Namespace isolation (`--isolated` and `CD_USE_NS`)
576
566
 
577
567
  With `--isolated`, chroot-distro creates a per-container namespace holder
578
568
  (`unshare`) and runs bind mounts, special mounts, and `chroot` inside that
579
569
  environment (`nsenter`). Supported namespaces: **mount**, **PID**, **UTS**,
580
- and **IPC**. Isolation is **all-or-nothing**: chroot-distro probes the full
581
- requested namespace set first, and if any one of them is unsupported on the
582
- kernel it acquires none of them and falls back fully to a non-isolated
583
- login (with a warning naming the missing namespace), so a session is never
584
- left half-isolated. This is inspired by
570
+ **IPC**, and **cgroup**. The cgroup namespace is acquired best-effort (used
571
+ when the kernel supports it, skipped otherwise); the **mount/PID/UTS/IPC**
572
+ set is **all-or-nothing**: chroot-distro probes that set first, and if any
573
+ one of them is unsupported on the kernel it acquires none of them and falls
574
+ back fully to a non-isolated login (with a warning naming the missing
575
+ namespace), so a session is never left half-isolated. This is inspired by
585
576
  [Ubuntu-Chroot](Ubuntu-Chroot/tools/chroot.sh) and is **not** a full
586
577
  container runtime: there is no network namespace, no user namespace
587
578
  mapping, and no image layering.
588
579
 
589
- Do not mix `--isolated` and non-isolated logins on the same container
590
- without running `chroot-distro unmount <name>` first. Concurrent
591
- `--isolated` sessions share the same holder and mounts.
580
+ `--isolated` couples two things: namespace isolation **and** a reduced set
581
+ of host bind mounts (it skips the Android system/storage/`$PREFIX` binds on
582
+ Termux, and `/tmp`/display sharing on Linux, unless re-enabled with
583
+ `--shared-*` / `--bind`). If you want **only** the namespace isolation
584
+ while keeping every default mount, set the `CD_USE_NS=1` environment
585
+ variable instead: every `login`/`run` then runs in the same
586
+ mount/PID/UTS/IPC/cgroup namespaces but with the full default mount set
587
+ intact. `CD_USE_NS` accepts `1`/`true`/`yes`/`on`.
588
+
589
+ > `CD_USE_NS` is set by the invoking user but the tool re-executes itself
590
+ > as root; chroot-distro forwards the variable across `sudo`/`doas`/`pkexec`
591
+ > /`su` automatically, so it keeps working even when the `sudo` line prints
592
+ > `'-E' is ignored`.
593
+
594
+ Do not mix isolated (via `--isolated` or `CD_USE_NS`) and non-isolated
595
+ logins on the same container without running `chroot-distro unmount <name>`
596
+ first. Concurrent isolated sessions share the same holder and mounts.
592
597
 
593
598
  #### Host bindings (Termux, default mode)
594
599
 
@@ -632,8 +637,7 @@ entries win):
632
637
  when not `--isolated` and not `--minimal`.
633
638
  4. Your `--env VAR=VALUE` entries.
634
639
  5. `HOME`, `USER`, `TERM` (default `xterm-256color`), `COLORTERM`
635
- (when set on the host), and `HOSTNAME` (the `--hostname` value, else the
636
- container name).
640
+ (when set on the host), and `HOSTNAME` (the container name).
637
641
  6. When display sharing is active (via `--shared-display`):
638
642
  `DISPLAY`, `XAUTHORITY`, `XDG_RUNTIME_DIR`, `WAYLAND_DISPLAY`,
639
643
  `XDG_SESSION_TYPE`, `XDG_CURRENT_DESKTOP`, `DESKTOP_SESSION`,
@@ -645,10 +649,11 @@ entries win):
645
649
  WSL2 — `GALLIUM_DRIVER`, `MESA_D3D12_DEFAULT_DEVICE_TYPE`,
646
650
  `LIBGL_ALWAYS_SOFTWARE`. Your `--env` entries override these.
647
651
 
648
- `HOSTNAME` is always set to the container name (or `--hostname`). The
649
- `hostname`/`uname` commands report it only under `--isolated`, where the
650
- UTS namespace is given a real hostname; without `--isolated` they still
651
- report the host's name (no UTS namespace to change).
652
+ `HOSTNAME` is always set to the host system hostname name. The
653
+ `hostname`/`uname` commands report it only when namespace isolation is
654
+ active (via `--isolated` or `CD_USE_NS`), where the UTS namespace is given
655
+ a real hostname; otherwise they still report the host's name (no UTS
656
+ namespace to change).
652
657
 
653
658
  On Termux (unless isolated or minimal), `$PREFIX/bin` is appended to
654
659
  `PATH`. A snippet at `/etc/profile.d/termux-profile.sh` re-applies
@@ -1179,9 +1184,8 @@ paths on Linux are typically under `/root/.local/share/` and
1179
1184
  | `CD_DOWNLOAD_WORKERS` | Parallel registry layer downloads during `install` (default `4`, maximum `10`). Invalid values use the default; out-of-range values are clamped. |
1180
1185
  | `CD_DOWNLOAD_RATE_LIMIT` | Bandwidth limit for downloads (e.g., `5M` for 5 MiB/s, default `0` = unlimited). Supports suffixes `K`, `M`, `G` (case-insensitive). |
1181
1186
  | `CD_DOWNLOAD_MAX_RETRIES` | Maximum retry attempts per connection failure (default `3`, clamped between `0` and `20`). |
1187
+ | `CD_USE_NS` | When truthy (`1`/`true`/`yes`/`on`), every `login`/`run` uses full Linux namespace isolation (mount, PID, UTS, IPC, and cgroup when supported) **without** skipping any default bind mounts. Differs from `--isolated`, which also reduces the mount set. Forwarded across privilege elevation automatically. |
1182
1188
  | `CD_FORCE_NO_COLORS` | When set, disables ANSI colours in Chroot-Distro output. |
1183
- | `CHROOT_DISTRO_NO_ELEVATE` | When set to `1`, disables privilege auto-elevation (same as `--no-elevate`). |
1184
- | `CHROOT_DISTRO_USE_SUDO` | When set to `1`, prefer `sudo` over `su` on Termux (same as `--use-sudo`). |
1185
1189
  | `COLUMNS` | Fallback terminal width for `--help` rendering. |
1186
1190
  | `TERM`, `COLORTERM` | Inherited into the guest (always; even in `--minimal`). `TERM` defaults to `xterm-256color` when unset on the host. |
1187
1191
 
@@ -1209,7 +1213,7 @@ overridden from `manifest.json` image `Env`, but can be overridden with
1209
1213
 
1210
1214
  | Variable | Source / Fallback |
1211
1215
  |---|---|
1212
- | `HOSTNAME` | `--hostname` value; fallback the container name. Under `--isolated` the UTS namespace hostname is also set so `hostname`/`uname -n` report it. |
1216
+ | `HOSTNAME` | The container name. Under `--isolated` the UTS namespace hostname is also set so `hostname`/`uname -n` report it. |
1213
1217
 
1214
1218
  **GPU — NVIDIA native Linux (auto-detected, non-minimal):**
1215
1219
 
@@ -1237,10 +1241,9 @@ Completion scripts for Bash, Zsh, and Fish live in
1237
1241
  - `_chroot-distro`
1238
1242
  - `chroot-distro.fish`
1239
1243
 
1240
- They complete subcommands, global flags (`--no-elevate`, `--use-sudo`),
1241
- and per-command options (including `login`/`run` flags such as
1242
- `--shared-home`, `--shared-display`, `--get-chroot-cmd`, `--isolated`,
1243
- and `--minimal`).
1244
+ They complete subcommands, global flags, and per-command options (including
1245
+ `login`/`run` flags such as `--shared-home`, `--shared-display`,
1246
+ `--get-chroot-cmd`, `--isolated`, and `--minimal`).
1244
1247
 
1245
1248
  If your shell does not pick them up automatically, install them manually:
1246
1249
 
@@ -1274,9 +1277,10 @@ cp src/chroot_distro/completions/chroot-distro.fish \
1274
1277
  - **Kernel features**: FUSE modules, real `iptables`, custom cgroup
1275
1278
  hierarchies, and similar kernel-module features may not work inside the
1276
1279
  guest.
1277
- - **Namespaces**: `--isolated` provides mount/PID/UTS/IPC isolation via
1278
- `unshare`/`nsenter`, but there is no network namespace and no parity with
1279
- Docker or Podman.
1280
+ - **Namespaces**: `--isolated` (or `CD_USE_NS=1`) provides
1281
+ mount/PID/UTS/IPC isolation, plus the cgroup namespace when the kernel
1282
+ supports it, via `unshare`/`nsenter` — but there is no network namespace,
1283
+ no user-namespace mapping, and no parity with Docker or Podman.
1280
1284
  - **Bind mount hygiene**: crashed sessions or orphan processes can leave
1281
1285
  mounts busy; `unmount` and lazy unmount mitigate this but orphaned
1282
1286
  processes should be cleaned up.
@@ -128,15 +128,8 @@ pip install .
128
128
  ### First-run check
129
129
 
130
130
  On startup, commands that modify containers or mounts verify that the
131
- effective UID is `0`. If not, Chroot-Distro re-executes itself using, in
132
- order: `sudo`, `doas`, `pkexec`, or `su`.
133
-
134
- | Situation | Behaviour |
135
- |---|---|
136
- | Default | Auto-elevate when not root. |
137
- | `--no-elevate` or `CHROOT_DISTRO_NO_ELEVATE=1` | Skip elevation; exit with an error if not root. |
138
- | Termux, default | Prefer `su` (real root) over `sudo`. |
139
- | Termux, `--use-sudo` or `CHROOT_DISTRO_USE_SUDO=1` | Prefer `sudo` for elevation. |
131
+ effective UID is `0`. If not, Chroot-Distro auto-elevates when not root by
132
+ re-executing itself using, in order: `sudo`, `doas`, `pkexec`, or `su`.
140
133
 
141
134
  `list`, `ps`, `search`, `info`, and `help` do not require root on Termux and
142
135
  are never re-executed. On regular Linux, `list`, `ps`, and `info` still
@@ -204,8 +197,6 @@ laid out for the current terminal width.
204
197
  | Option | Description |
205
198
  |---|---|
206
199
  | `-h`, `--help` | Show top-level help. |
207
- | `--no-elevate` | Do not auto-elevate to root (`CHROOT_DISTRO_NO_ELEVATE=1`). |
208
- | `--use-sudo` | On Termux, prefer `sudo` over `su` (`CHROOT_DISTRO_USE_SUDO=1`). |
209
200
 
210
201
  Short aliases are accepted for many commands (`sh` → `login`, `rm` →
211
202
  `remove`, `ins` → `install`, etc.); each section below lists them.
@@ -448,13 +439,12 @@ chroot-distro login ubuntu --get-chroot-cmd
448
439
  | Option | Description |
449
440
  |---|---|
450
441
  | `-u`, `--user USER` | Log in as USER (default: `root`). Accepts `name`, numeric `uid`, `name:group`, or `uid:gid`. |
451
- | `--isolated` | Reduce host exposure and enable namespace isolation (mount, PID, UTS, IPC via `unshare`/`nsenter`). On Termux: also skip Android system, storage, and `$PREFIX` binds unless you opt in with `--shared-*` or `--bind`. (Fresh `/tmp` and `/run` are the default in every mode now, not just `--isolated`.) Mutually exclusive with `--minimal`. |
442
+ | `--isolated` | Reduce host exposure and enable namespace isolation (mount, PID, UTS, IPC, and cgroup when supported, via `unshare`/`nsenter`). On Termux: also skip Android system, storage, and `$PREFIX` binds unless you opt in with `--shared-*` or `--bind`. (Fresh `/tmp` and `/run` are the default in every mode now, not just `--isolated`.) Mutually exclusive with `--minimal`. To get the same namespace isolation **without** reducing the mount set, set `CD_USE_NS=1` instead (see [Environment variables](#environment-variables)). |
452
443
  | `--minimal` | Bare minimum chroot: core pseudo-filesystems only (`/dev`, `/proc`, `/sys`, plus `/run`, `/dev/pts`, `/dev/shm` when present). Stripped guest environment. Mutually exclusive with `--isolated`. |
453
444
  | `--shared-home` | Bind the invoking user's host home into the guest home (or `/root` for root). On Termux, binds `TERMUX_HOME`. |
454
445
  | `--shared-tmp` | Bind host tmp (`/tmp` on Linux, `$PREFIX/tmp` on Termux) to `/tmp` in the guest. Opt-in only: by default the container gets its own fresh `/tmp`, not the host's. |
455
446
  | `--shared-display` | Share the host display server (X11 and Wayland), audio (PulseAudio/PipeWire), and D-Bus session bus with the container. Binds only the specific session sockets, not the host's whole `/run`. Opt-in only. `--shared-x11` is accepted as a backward-compatible alias. |
456
447
  | `-b`, `--bind SRC[:DST]` | Bind-mount a custom host path (repeatable). `DST` must be an absolute guest path. |
457
- | `--hostname STRING` | Hostname inside the container (default: the container name). |
458
448
  | `-w`, `--work-dir PATH` | Initial working directory (default: user's home). |
459
449
  | `-e`, `--env VAR=VALUE` | Set a guest environment variable (repeatable). |
460
450
  | `--get-chroot-cmd` | Print the fully assembled `env` + `chroot` command line and exit. |
@@ -543,23 +533,38 @@ Termux.)
543
533
  - Guest `ldconfig` is run inside the chroot to refresh the shared library
544
534
  cache after the new libraries are bind-mounted.
545
535
 
546
- #### Namespace isolation (`--isolated`)
536
+ #### Namespace isolation (`--isolated` and `CD_USE_NS`)
547
537
 
548
538
  With `--isolated`, chroot-distro creates a per-container namespace holder
549
539
  (`unshare`) and runs bind mounts, special mounts, and `chroot` inside that
550
540
  environment (`nsenter`). Supported namespaces: **mount**, **PID**, **UTS**,
551
- and **IPC**. Isolation is **all-or-nothing**: chroot-distro probes the full
552
- requested namespace set first, and if any one of them is unsupported on the
553
- kernel it acquires none of them and falls back fully to a non-isolated
554
- login (with a warning naming the missing namespace), so a session is never
555
- left half-isolated. This is inspired by
541
+ **IPC**, and **cgroup**. The cgroup namespace is acquired best-effort (used
542
+ when the kernel supports it, skipped otherwise); the **mount/PID/UTS/IPC**
543
+ set is **all-or-nothing**: chroot-distro probes that set first, and if any
544
+ one of them is unsupported on the kernel it acquires none of them and falls
545
+ back fully to a non-isolated login (with a warning naming the missing
546
+ namespace), so a session is never left half-isolated. This is inspired by
556
547
  [Ubuntu-Chroot](Ubuntu-Chroot/tools/chroot.sh) and is **not** a full
557
548
  container runtime: there is no network namespace, no user namespace
558
549
  mapping, and no image layering.
559
550
 
560
- Do not mix `--isolated` and non-isolated logins on the same container
561
- without running `chroot-distro unmount <name>` first. Concurrent
562
- `--isolated` sessions share the same holder and mounts.
551
+ `--isolated` couples two things: namespace isolation **and** a reduced set
552
+ of host bind mounts (it skips the Android system/storage/`$PREFIX` binds on
553
+ Termux, and `/tmp`/display sharing on Linux, unless re-enabled with
554
+ `--shared-*` / `--bind`). If you want **only** the namespace isolation
555
+ while keeping every default mount, set the `CD_USE_NS=1` environment
556
+ variable instead: every `login`/`run` then runs in the same
557
+ mount/PID/UTS/IPC/cgroup namespaces but with the full default mount set
558
+ intact. `CD_USE_NS` accepts `1`/`true`/`yes`/`on`.
559
+
560
+ > `CD_USE_NS` is set by the invoking user but the tool re-executes itself
561
+ > as root; chroot-distro forwards the variable across `sudo`/`doas`/`pkexec`
562
+ > /`su` automatically, so it keeps working even when the `sudo` line prints
563
+ > `'-E' is ignored`.
564
+
565
+ Do not mix isolated (via `--isolated` or `CD_USE_NS`) and non-isolated
566
+ logins on the same container without running `chroot-distro unmount <name>`
567
+ first. Concurrent isolated sessions share the same holder and mounts.
563
568
 
564
569
  #### Host bindings (Termux, default mode)
565
570
 
@@ -603,8 +608,7 @@ entries win):
603
608
  when not `--isolated` and not `--minimal`.
604
609
  4. Your `--env VAR=VALUE` entries.
605
610
  5. `HOME`, `USER`, `TERM` (default `xterm-256color`), `COLORTERM`
606
- (when set on the host), and `HOSTNAME` (the `--hostname` value, else the
607
- container name).
611
+ (when set on the host), and `HOSTNAME` (the container name).
608
612
  6. When display sharing is active (via `--shared-display`):
609
613
  `DISPLAY`, `XAUTHORITY`, `XDG_RUNTIME_DIR`, `WAYLAND_DISPLAY`,
610
614
  `XDG_SESSION_TYPE`, `XDG_CURRENT_DESKTOP`, `DESKTOP_SESSION`,
@@ -616,10 +620,11 @@ entries win):
616
620
  WSL2 — `GALLIUM_DRIVER`, `MESA_D3D12_DEFAULT_DEVICE_TYPE`,
617
621
  `LIBGL_ALWAYS_SOFTWARE`. Your `--env` entries override these.
618
622
 
619
- `HOSTNAME` is always set to the container name (or `--hostname`). The
620
- `hostname`/`uname` commands report it only under `--isolated`, where the
621
- UTS namespace is given a real hostname; without `--isolated` they still
622
- report the host's name (no UTS namespace to change).
623
+ `HOSTNAME` is always set to the host system hostname name. The
624
+ `hostname`/`uname` commands report it only when namespace isolation is
625
+ active (via `--isolated` or `CD_USE_NS`), where the UTS namespace is given
626
+ a real hostname; otherwise they still report the host's name (no UTS
627
+ namespace to change).
623
628
 
624
629
  On Termux (unless isolated or minimal), `$PREFIX/bin` is appended to
625
630
  `PATH`. A snippet at `/etc/profile.d/termux-profile.sh` re-applies
@@ -1150,9 +1155,8 @@ paths on Linux are typically under `/root/.local/share/` and
1150
1155
  | `CD_DOWNLOAD_WORKERS` | Parallel registry layer downloads during `install` (default `4`, maximum `10`). Invalid values use the default; out-of-range values are clamped. |
1151
1156
  | `CD_DOWNLOAD_RATE_LIMIT` | Bandwidth limit for downloads (e.g., `5M` for 5 MiB/s, default `0` = unlimited). Supports suffixes `K`, `M`, `G` (case-insensitive). |
1152
1157
  | `CD_DOWNLOAD_MAX_RETRIES` | Maximum retry attempts per connection failure (default `3`, clamped between `0` and `20`). |
1158
+ | `CD_USE_NS` | When truthy (`1`/`true`/`yes`/`on`), every `login`/`run` uses full Linux namespace isolation (mount, PID, UTS, IPC, and cgroup when supported) **without** skipping any default bind mounts. Differs from `--isolated`, which also reduces the mount set. Forwarded across privilege elevation automatically. |
1153
1159
  | `CD_FORCE_NO_COLORS` | When set, disables ANSI colours in Chroot-Distro output. |
1154
- | `CHROOT_DISTRO_NO_ELEVATE` | When set to `1`, disables privilege auto-elevation (same as `--no-elevate`). |
1155
- | `CHROOT_DISTRO_USE_SUDO` | When set to `1`, prefer `sudo` over `su` on Termux (same as `--use-sudo`). |
1156
1160
  | `COLUMNS` | Fallback terminal width for `--help` rendering. |
1157
1161
  | `TERM`, `COLORTERM` | Inherited into the guest (always; even in `--minimal`). `TERM` defaults to `xterm-256color` when unset on the host. |
1158
1162
 
@@ -1180,7 +1184,7 @@ overridden from `manifest.json` image `Env`, but can be overridden with
1180
1184
 
1181
1185
  | Variable | Source / Fallback |
1182
1186
  |---|---|
1183
- | `HOSTNAME` | `--hostname` value; fallback the container name. Under `--isolated` the UTS namespace hostname is also set so `hostname`/`uname -n` report it. |
1187
+ | `HOSTNAME` | The container name. Under `--isolated` the UTS namespace hostname is also set so `hostname`/`uname -n` report it. |
1184
1188
 
1185
1189
  **GPU — NVIDIA native Linux (auto-detected, non-minimal):**
1186
1190
 
@@ -1208,10 +1212,9 @@ Completion scripts for Bash, Zsh, and Fish live in
1208
1212
  - `_chroot-distro`
1209
1213
  - `chroot-distro.fish`
1210
1214
 
1211
- They complete subcommands, global flags (`--no-elevate`, `--use-sudo`),
1212
- and per-command options (including `login`/`run` flags such as
1213
- `--shared-home`, `--shared-display`, `--get-chroot-cmd`, `--isolated`,
1214
- and `--minimal`).
1215
+ They complete subcommands, global flags, and per-command options (including
1216
+ `login`/`run` flags such as `--shared-home`, `--shared-display`,
1217
+ `--get-chroot-cmd`, `--isolated`, and `--minimal`).
1215
1218
 
1216
1219
  If your shell does not pick them up automatically, install them manually:
1217
1220
 
@@ -1245,9 +1248,10 @@ cp src/chroot_distro/completions/chroot-distro.fish \
1245
1248
  - **Kernel features**: FUSE modules, real `iptables`, custom cgroup
1246
1249
  hierarchies, and similar kernel-module features may not work inside the
1247
1250
  guest.
1248
- - **Namespaces**: `--isolated` provides mount/PID/UTS/IPC isolation via
1249
- `unshare`/`nsenter`, but there is no network namespace and no parity with
1250
- Docker or Podman.
1251
+ - **Namespaces**: `--isolated` (or `CD_USE_NS=1`) provides
1252
+ mount/PID/UTS/IPC isolation, plus the cgroup namespace when the kernel
1253
+ supports it, via `unshare`/`nsenter` — but there is no network namespace,
1254
+ no user-namespace mapping, and no parity with Docker or Podman.
1251
1255
  - **Bind mount hygiene**: crashed sessions or orphan processes can leave
1252
1256
  mounts busy; `unmount` and lazy unmount mitigate this but orphaned
1253
1257
  processes should be cleaned up.