Introduction¶
The default dsh-sandbox-local runner in DSH (DeepSeek Harness) builds a Landlock-based sandbox in a WSL2 environment. Its access list is hard-coded: it defaults to /dev/null and additionally grants write access to /tmp and the workspace root directory. Beyond that, there is no configuration option to add extra paths.
This restriction blocks GPU usage in a WSL2 environment: /dev/dxg cannot be opened for read/write, causing CUDA initialization to fail; also, libcuda needs to write thread names to /proc, and denied write operations can cause cuInit to return CUDA_ERROR_OPERATING_SYSTEM.
The dsh-wsl-gpufix plugin modifies the sandbox configuration to explicitly grant access to /dev/dxg and /proc in the Landlock runner, restoring GPU functionality while preserving sandbox isolation.
Plugin Overview¶
This is a Cordis host plugin for resolving the issue where the DSH Landlock sandbox cannot access the GPU in WSL2.
- Maintainer: Jumqyc
- License: MIT
- Purpose: DSH model inference helper plugin
Core Features¶
- Grant WSL2 GPU device access: Adds
/dev/dxgthrough thereadWriteconfiguration option. - Enable CUDA in the Landlock sandbox: Also adds
/procto satisfy the system calls required by CUDA initialization. - Standard structure compatibility: Supports the standard DSH bundle plugin structure.
- Multiple installation methods: Supports GitHub remote installation, local clone installation, and global Home-layer installation (Method C).
Installation and Activation¶
Before installing, ensure your environment meets the following conditions:
1. WSL2: nvidia-smi already works in a regular non-sandboxed terminal.
2. DSH Landlock runner: You are using the Landlock mode of dsh-sandbox-local, not Bubblewrap.
3. Kernel support: The system kernel has Landlock enabled (detectable with landlock-run --probe).
Method A: Install from GitHub (Recommended)¶
Use the official command to register the plugin package directly.
dsh plugin --profile <profile> add github:Jumqyc/dsh-wsl-gpufix
Method B: Local Clone Installation¶
If you need to modify the plugin code or install it offline, you can first clone the repository and then register it using a local path.
git clone https://github.com/Jumqyc/dsh-wsl-gpufix.git
dsh plugin --profile <profile> add link:/absolute/path/to/dsh-wsl-gpufix
Method C: Global Home-layer Installation (Method C)¶
This method does not require changing any profile configuration; it installs directly in the global Home layer and is suitable for scenarios where all profiles need to share GPU permissions.
bash install.sh
After installation, restart the profile or wait for the plugin hot reload to take effect.
Typical Usage¶
In a Landlock sandbox configured with the above plugin, run the following command to verify whether CUDA is available.
python -c "import os, torch; os.close(os.open('/dev/dxg', os.O_RDWR)); print(torch.cuda.is_available(), torch.cuda.get_device_name(0))"
Example expected output:
True NVIDIA GeForce RTX 4060 Laptop GPU
Use Cases and Notes¶
- Use cases: Local model inference inside a DSH Landlock sandbox, or development environments that require WSL2 GPU acceleration.
- Permission adjustment: The plugin achieves this by relaxing sandbox permissions. It adds the
--rw /dev/dxgand--rw /procflags to Landlock at startup. - Security limitations: The plugin cannot disable the sandbox, modify approval policies, or execute code in the configuration. It can only append
--rwflags, and these apply only to the configuredmodes(default:workspace-write). - Compatibility: It applies only to the DSH Landlock runner. If you are using the Bubblewrap runner or a non-Landlock runner, the plugin will not take effect.
Conclusion¶
The dsh-wsl-gpufix plugin provides the necessary GPU access path for running DSH in WSL2. Through fine-grained permission control, it resolves CUDA initialization compatibility issues while maintaining sandbox security.
- GitHub repository: https://github.com/Jumqyc/dsh-wsl-gpufix
- Plugin directory: https://www.skillhub.cn/plugins/Jumqyc/dsh-wsl-gpufix