Skip to content

Using WSL

Hiroki Yamada edited this page Feb 2, 2026 · 6 revisions

Using WSL

ROS 2 is generally recommended to be used on a native Ubuntu environment, but WSL can also be used for quick and simple verification tests.
Please refer to this as a reference only.
The following steps show how to install Ubuntu on WSL. After that, please install ROS 2 and SIGVerse.

Install Ubuntu on WSL

Run PowerShell as Administrator, then execute the following command to install WSL and Ubuntu 22.04.

wsl --install -d Ubuntu-22.04

After starting Ubuntu, run the following commands inside Ubuntu (WSL).

sudo apt update
sudo apt install -y dbus-x11
sudo dbus-uuidgen --ensure=/etc/machine-id
echo 'XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}; export XDG_RUNTIME_DIR; if [ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ] || [ ! -S "$XDG_RUNTIME_DIR/bus" ]; then unset DBUS_SESSION_BUS_ADDRESS; eval "$(dbus-launch --sh-syntax --exit-with-session)"; fi' >> ~/.bashrc
source ~/.bashrc

Start Ubuntu

Use the command below to start Ubuntu 22.04.

wsl -d Ubuntu-22.04

Stop WSL

Use the command below to stop all running WSL distributions and the WSL virtual machine.

wsl --shutdown

Uninstall Ubuntu

Warning: This command is only for uninstalling Ubuntu.
It will permanently delete the Ubuntu WSL distribution and all data inside it. Do not run it during normal use.

wsl -l -v
wsl --shutdown
wsl --unregister Ubuntu-22.04
wsl -l -v

If you also want to remove the Ubuntu 22.04 package, uninstall Ubuntu 22.04 from the Windows Apps settings.

Using CUDA

To use CUDA on Ubuntu in WSL, install an appropriate NVIDIA driver on Windows and an appropriate CUDA Toolkit on Ubuntu.
In principle, follow the steps in the page below; however, the procedure appears to have issues (as of February 2026).
https://documentation.ubuntu.com/wsl/stable/howto/gpu-cuda/

Run the following commands to add CUDA to your PATH:

echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

On the Ubuntu side, run nvidia-smi and nvcc -V, and confirm that they display the NVIDIA GPU/driver information and the CUDA Toolkit information.

Clone this wiki locally