Skip to content

Instantly share code, notes, and snippets.

@kmatt
Last active September 1, 2025 13:35
Show Gist options
  • Save kmatt/aad3970a05f72fbbd5f1b9ef7ee1e330 to your computer and use it in GitHub Desktop.
Save kmatt/aad3970a05f72fbbd5f1b9ef7ee1e330 to your computer and use it in GitHub Desktop.

Revisions

  1. kmatt revised this gist Feb 16, 2024. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions void-wsl.txt
    Original file line number Diff line number Diff line change
    @@ -31,11 +31,12 @@ $ xbps-reconfigure -fa

    $ useradd -m -G wheel -s /bin/bash $USERNAME
    $ passwd $USERNAME
    $ su - $USERNAME

    # Default user
    $ echo -e "[user]\ndefault=$USERNAME" > /etc/wsl.conf

    # IMPORTANT - Use visudo to grant wheel group sudo (/etc/sudoers)
    # Grant sudo
    $ sed -i 's/# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers

    > wsl --terminate $DISTRONAME
    > wsl -d $DISTRONAME
    > wsl -d $DISTRONAME
  2. kmatt revised this gist Feb 16, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion void-wsl.txt
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@

    # use rootfs tarball from https://voidlinux.org/download
    # ex: https://repo-default.voidlinux.org/live/current/void-x86_64-ROOTFS-20230628.tar.xz
    # uncompress but do not extract tar file
    # uncompress but do not extract tar file (don't tar -x)

    > wsl.exe --import $DISTRONAME $STORAGEPATH void-$VERSION.tar

  3. kmatt revised this gist Feb 16, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion void-wsl.txt
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@

    # use rootfs tarball from https://voidlinux.org/download
    # ex: https://repo-default.voidlinux.org/live/current/void-x86_64-ROOTFS-20230628.tar.xz
    # uncompress but do not extract tar file (gunzip only)
    # uncompress but do not extract tar file

    > wsl.exe --import $DISTRONAME $STORAGEPATH void-$VERSION.tar

  4. kmatt revised this gist Feb 16, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion void-wsl.txt
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@

    # use rootfs tarball from https://voidlinux.org/download
    # ex: https://repo-default.voidlinux.org/live/current/void-x86_64-ROOTFS-20230628.tar.xz
    # uncompress but do not unzip tar file
    # uncompress but do not extract tar file (gunzip only)

    > wsl.exe --import $DISTRONAME $STORAGEPATH void-$VERSION.tar

  5. kmatt renamed this gist Nov 4, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. kmatt revised this gist Oct 18, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    # Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
    # prompt ">" indicates Powershell commands
    # prompt "$" are Linux shell commands

    # https://docs.microsoft.com/en-us/windows/wsl/install-win10

  7. kmatt revised this gist Sep 13, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@
    > wsl --set-default-version 2

    # use rootfs tarball from https://voidlinux.org/download
    # ex.: https://alpha.de.repo.voidlinux.org/live/current/void-x86_64-ROOTFS-20210930.tar.xz
    # ex: https://repo-default.voidlinux.org/live/current/void-x86_64-ROOTFS-20230628.tar.xz
    # uncompress but do not unzip tar file

    > wsl.exe --import $DISTRONAME $STORAGEPATH void-$VERSION.tar
  8. kmatt revised this gist Jun 19, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ $ useradd -m -G wheel -s /bin/bash $USERNAME
    $ passwd $USERNAME
    $ su - $USERNAME

    $ echo "[user]\ndefault=$USERNAME" > /etc/wsl.conf
    $ echo -e "[user]\ndefault=$USERNAME" > /etc/wsl.conf

    # IMPORTANT - Use visudo to grant wheel group sudo (/etc/sudoers)

  9. kmatt revised this gist Nov 15, 2022. 1 changed file with 4 additions and 6 deletions.
    10 changes: 4 additions & 6 deletions void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -32,11 +32,9 @@ $ useradd -m -G wheel -s /bin/bash $USERNAME
    $ passwd $USERNAME
    $ su - $USERNAME

    # get Linux UID
    $ id -u
    1000
    $ echo "[user]\ndefault=$USERNAME" > /etc/wsl.conf

    # IMPORTANT - use visudo to grant wheel group sudo
    # IMPORTANT - Use visudo to grant wheel group sudo (/etc/sudoers)

    # set default linux user
    > Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\DistributionName | Where-Object -Property DistributionName -eq $DISTRONAME | Set-ItemProperty -Name DefaultUid -Value $UID
    > wsl --terminate $DISTRONAME
    > wsl -d $DISTRONAME
  10. kmatt revised this gist Nov 3, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@ $ su - $USERNAME
    $ id -u
    1000

    # use visudo to grant wheel group sudo
    # IMPORTANT - use visudo to grant wheel group sudo

    # set default linux user
    > Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\DistributionName | Where-Object -Property DistributionName -eq $DISTRONAME | Set-ItemProperty -Name DefaultUid -Value $UID
  11. kmatt revised this gist Nov 3, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -39,4 +39,4 @@ $ id -u
    # use visudo to grant wheel group sudo

    # set default linux user
    > Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\ DistributionName | Where-Object -Property DistributionName -eq $DISTRONAME | Set-ItemProperty -Name DefaultUid -Value $UID
    > Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\DistributionName | Where-Object -Property DistributionName -eq $DISTRONAME | Set-ItemProperty -Name DefaultUid -Value $UID
  12. kmatt revised this gist Apr 11, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ $ xbps-install base-system
    $ xbps-remove base-voidstrap
    $ xbps-reconfigure -fa

    $ useradd -m -G wheen -s /bin/bash $USERNAME
    $ useradd -m -G wheel -s /bin/bash $USERNAME
    $ passwd $USERNAME
    $ su - $USERNAME

  13. kmatt revised this gist Jan 8, 2022. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,6 @@ $ xbps-install base-system
    $ xbps-remove base-voidstrap
    $ xbps-reconfigure -fa


    $ useradd -m -G wheen -s /bin/bash $USERNAME
    $ passwd $USERNAME
    $ su - $USERNAME
  14. kmatt created this gist Jan 8, 2022.
    43 changes: 43 additions & 0 deletions void-wsl.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    # Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
    # prompt ">" indicates Powershell commands

    # https://docs.microsoft.com/en-us/windows/wsl/install-win10

    > dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    > dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

    # install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

    > wsl --set-default-version 2

    # use rootfs tarball from https://voidlinux.org/download
    # ex.: https://alpha.de.repo.voidlinux.org/live/current/void-x86_64-ROOTFS-20210930.tar.xz
    # uncompress but do not unzip tar file

    > wsl.exe --import $DISTRONAME $STORAGEPATH void-$VERSION.tar

    > wsl -d $DISTRONAME

    # optional - update xbps mirrors
    $ cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
    # if in US https://voidlinux.org/news/2021/10/mirror-retirement.html

    $ xbps-install -Su xbps
    $ xbps-install -u
    $ xbps-install base-system
    $ xbps-remove base-voidstrap
    $ xbps-reconfigure -fa


    $ useradd -m -G wheen -s /bin/bash $USERNAME
    $ passwd $USERNAME
    $ su - $USERNAME

    # get Linux UID
    $ id -u
    1000

    # use visudo to grant wheel group sudo

    # set default linux user
    > Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\ DistributionName | Where-Object -Property DistributionName -eq $DISTRONAME | Set-ItemProperty -Name DefaultUid -Value $UID