Git Product home page Git Product logo

wsldl's Introduction

wsldl

Advanced WSL Distribution Launcher / Installer

wsldl logo

GitHub Workflow Status Github All Releases PRs Welcome License

💻Requirements

  • Windows 10 1709 Fall Creators Update or later(x64/arm64).
  • Windows Subsystem for Linux feature is enabled.

📦Install with Prebuilt Packages

You can see List on docs

Note: Exe filename is using to the instance name to register. If you rename it, you can register with a different name.

🔧Install with any rootfs tarball

Note: The filesystem needs to be in the root of the tarball, some rootfs tarballs may need to be repacked.

(wsldl.exe is x86_64, wsldl_arm64.exe is ARM64 build)

2. Rename it for distribution name to register.

(Ex: Rename to Arch.exe if you want to use "Arch" for the Instance name)

3. Put your install.tar(.gz) in same directory as exe (Installation directory)

4. Run exe to install. This process may take a few minutes.

🔧Install with any ext4 vhdx disk images (WSL2 only)

(wsldl.exe is x86_64, wsldl_arm64.exe is ARM64 build)

2. Rename it for distribution name to register.

(Ex: Rename to Arch.exe if you want to use "Arch" for the Instance name)

3. Put your install.ext4.vhdx(.gz) in same directory as exe (Installation directory)

4. Run exe to install. This process may take a few minutes.

🔗Use as a Launcher for already installed distribution

(wsldl.exe is x86_64, wsldl_arm64.exe is ARM64 build)

2. Rename it for registerd instance name.

Please check the registered instance name of the distribution with wslconfig /l command. (Ex: If the instance name is "Ubuntu-20.04", rename wsldl.exe to Ubuntu-20.04.exe)

4. Run exe to Launch instance or configuration.

For details, please see the help. ({InstanceName}.exe help)

Note: You can distribute your distribution including wsldl exe.

📝How-to-Use(for Installed Instance)

exe Usage

Usage :
    <no args>
      - Open a new shell with your default settings.

    run <command line>
      - Run the given command line in that instance. Inherit current directory.

    runp <command line (includes windows path)>
      - Run the given command line in that instance after converting its path.

    config [setting [value]]
      - `--default-user <user>`: Set the default user of this instance to <user>.
      - `--default-uid <uid>`: Set the default user uid of this instance to <uid>.
      - `--append-path <true|false>`: Switch of Append Windows PATH to $PATH
      - `--mount-drive <true|false>`: Switch of Mount drives
      - `--wsl-version <1|2>`: Set the WSL version of this instance to <1 or 2>
      - `--default-term <default|wt|flute>`: Set default type of terminal window.

    get [setting]
      - `--default-uid`: Get the default user uid in this instance.
      - `--append-path`: Get true/false status of Append Windows PATH to $PATH.
      - `--mount-drive`: Get true/false status of Mount drives.
      - `--wsl-version`: Get the version os the WSL (1/2) of this instance.
      - `--default-term`: Get Default Terminal type of this instance launcher.
      - `--lxguid`: Get WSL GUID key for this instance.

    backup [contents]
      - `--tar`: Output backup.tar to the current directory.
      - `--tgz`: Output backup.tar.gz to the current directory.
      - `--vhdx`: Output backup.ext4.vhdx to the current directory. (WSL2 only)
      - `--vhdxgz`: Output backup.ext4.vhdx.gz to the current directory. (WSL2 only)
      - `--reg`: Output settings registry file to the current directory.

    clean
      - Uninstall that instance.

    help
      - Print this usage message.

Just Run exe

>{InstanceName}.exe
[root@PC-NAME user]#

Run with command line

>{InstanceName}.exe run uname -r
4.4.0-43-Microsoft

Run with command line with path translation

>{InstanceName}.exe runp echo C:\Windows\System32\cmd.exe
/mnt/c/Windows/System32/cmd.exe

Change Default User(id command required)

>{InstanceName}.exe config --default-user user

>{InstanceName}.exe
[user@PC-NAME dir]$

Set "Windows Terminal" as default terminal

>{InstanceName}.exe config --default-term wt

How to uninstall instance

>{InstanceName}.exe clean

How-to-backup

export to backup.tar.gz (WSL1 or 2)

>{InstanceName}.exe backup --tgz

export to backup.ext4.vhdx.gz (WSL2 only)

>{InstanceName}.exe backup --vhdxgz

How-to-import

.tar(.gz) (WSL1 or 2)

>{InstanceName}.exe install backup.tar.gz

.ext4.vhdx(.gz) (WSL2 only)

>{InstanceName}.exe install backup.ext4.vhdx.gz

🛠How-to-Build

Please see DEVELOPERS.md

📄License

MIT

Copyright (c) 2017-2021 yuk7

wsldl's People

Contributors

abelsromero avatar am11 avatar andremueller-cosateq avatar biswa96 avatar crramirez avatar dennischancs avatar dependabot[bot] avatar djelibeybi avatar hdk5 avatar k900 avatar ledoge avatar llxlr avatar mishamosher avatar mmizutani avatar nvander1 avatar raulfpl avatar rek42 avatar schokokex avatar sileshn avatar testwill avatar vinfall avatar vpraharsha03 avatar wight554 avatar yosukes-dev avatar yuk7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wsldl's Issues

Custom init script?

I am trying to build a custom distro where the base image does not contain "useradd".
How do I provide a custom init script that install packages like shadow-utils, sudo, passwd, util-linux-user, etc.?

Can't convert paths includes space.

An error occurs if a path containing spaces is entered in the argument in runp.

>{InstanceName}.exe runp vim "C:\Dir Dir\file.txt"
ERROR: Path translation failed.

Make the instance thumb drive portable

Probably an enhancement, but i'm not sure how difficult it would be. It's possible this belongs over in your yuk7/wsldl project. 🤷‍♂ (intended to register this issue on the CentWSL project. Oops.)

i'd like to install this instance on a thumb drive so i can take it with the rest of my dev environment. i'm aware that when the thumb drive is plugged into another system, the new machine will need to register the WSL instance.

Right now when i attempt to install from the thumb drive, i see:

PS W:\env\wsl\CentWSL> .\CentOS.exe
Installing...
ERROR:Installation Failed!
HRESULT:0x80070057
Press any key to continue...

If i install on an internal drive and attempt to migrate it to the thumb, i start down a rabbit hole of registry changes and other things that ultimately don't work:

The parameter is incorrect.

No idea what originates it. Maybe a debug argument for the EXE could also be added? 😁

If you decide to try this, let me know how i can contribute.

After unregistering a wsldl distro, I can no longer install any - HRESULT:0x80070001

I followed the following process, and as a result of it am no longer able to install any wsldl distro.

  1. Installed ArchLinux using the zip package.
  2. A few days later, I uninstalled by wsl --unregister Arch (I guess this is what caused the problem? I now know, I should have run Arch.exe clean instead)

After following these steps, I tried running Arch.exe without changing anything (rootfs untouched, etc), but I get the error ERROR:Installation Failed! HRESULT:0x80070001
I also tried re-downloading and unzipping, but get the same error.
I also tried installing Artix, but get the same error.

If I install ubuntu from the microsoft store it works properly.

Arch.exe closes when you use run argument

Describe the issue
I'm not sure if it is a bug but also I would like to ask about it.

When you use Arch.exe run "echo 'hello'" the Arch Linux instance is closed. I would like to prevent this closing because I'd like to do something like

Arch.exe run "termite & && disown (pgrep termite) && exit"

That way I'd be starting directly my favorite terminal into my xming instace but keeping the Arch Linux instance running in background.

To Reproduce
Using the run argument for Arch.exe produces an unexpected closure (in my opinion)

Expected behavior
I'd like to run a particular command but not closing Arch.exe after that execution.

Screenshots
image

Enviroment:

  • Windows build number: 10.0.18363.778
  • Security Software: Windows Defender
  • WSL version 1/2: I don't know because wsl -l -v just shows the same than wsl --help so I guess the WSL1
  • ArchWSL version 20.4.3.0
  • ArchWSL Installer type zip/appx/other clean/update I'd say via appx but I don't remember right now
  • Launcher version wsldl, version 20040300

Additional context
Maybe this is an intenctional/wanted behaviour, but I would like at least to know how to prevent that closure.

[Feature Request] Add option to run a startup-command

Today the 'run' parameter runs a command and exits WSL immediately.
It would be nice to have a similar option which runs a startup-command. This could be used for example to 'cd' directly into the current directory of the Windows CMD console.

wdl

how to Register to WSL

add support to change dir when lanuch exe

Hi,

Can we support to add arg to the comman that change the dir inside of wsl, that is when excute the command line with the dir argument, we can chane to the coresponding directory specified.

for example, excute Centos.exc -p /tmp , and then we are in root@hostname:/tmp

run subcommand requires bash

A very small alpine linux install should also work without bash to fork a run command argument.
Ideas:

  • make also default shell a configuration item: e.g. /bin/ash instead of /bin/bash
  • rework forking in run command to use the default shell
  • check if upstream API error

Reproduction:

  • Install alpine WSL
  • apk add bash
  • alpine.exe run ps (works)
  • apk del bash
  • alpine.exe run ps (fails)
  • alpine.exe run /bin/sh -c '/bin/ps' (fails)

Running distro failed with "Installation directory not found" error if executable and distro names are mismatched case-sensitive

I have a Debian WSL distro on my old computer and move it to my new PC with the following process:

:: On the source computer
wsl.exe --export debain Debian-Export.tar
:: On the destination computer
wsl.exe --import debian D:\some\path Debian-Export.tar

Everything is OK but the official Debian launcher app is not installed on destination. So I want to use this launcher app instead.

Launcher's run and config commands are run successfully. But launching the distro with renamed launcher.exe failed with the following error:

C:>debian.exe
Installation directory not found: .
Make sure it exists or reinstall.

WSL2 support?

i.e. can we convert successfully to WSL 2 ?( via: wsl --set-version Distro 2)

Cannot configure default user with Alpine.exe

I downloaded the Alpine.zip file, extracted it, and ran Alpine to register with WSL. I ran Alpine again to start it up and created a new user called jim.

When I exit, and then run
Alpine config --default-user jim
I get

ERROR:Invalid Argument.
Failed to detect user.

If I replace Alpine.exe with Launcher.exe (see issue #9 for reason), Launcher hangs (never terminates nor produces any output).

If I start Alpine or Launcher again, I am able to su jim, so the user does exist.

Silent Install option

I am trying to add an Alpine distro that uses your exe to my deployment and the final installation step where it asks to for user input to continue is a manual steps I would like a flag to install silently. Is this possible?

Rootfs for debian?

When using debian stretch rootfs, I always get this error:

Installing...
ERROR:Installation Failed!
HRESULT:0x80004005
Press any key to continue...

backup problem

Describe the issue
Arch.exe backup return error:

Running backup Script.
If a password is requested, please enter the root password.

tar: Cowardly refusing to create an empty archive
Try 'tar --help' or 'tar --usage' for more information.
bash: line 1: --exclude: command not found
bash: line 2: --exclude: command not found

To Reproduce
execute Arch.exe backup

Expected behavior
backup runs without any error

Enviroment:

  • Windows build number: 10.0.18363.535
  • Security Software: avast
  • WSL version 1/2: WSL1
  • ArchWSL version: 19.11.16.0
  • ArchWSL Installer type: zip update
  • Launcher version: 19111602

`run` command spawns a new process and never kills it

Every time run/-c command is executed, it spawns wslhost.exe, which will never be killed:

  • Before executing Arch.exe run "echo 'test'"
    image
  • After executing Arch.exe run "echo 'test'"
    image

While other distros (not using wsldl) don't have this problem:

  • Before executing ubuntu2004.exe run "echo 'test'"
    image
  • After executing ubuntu2004.exe run "echo 'test'"
    image

It's quite annoying because when there are a lot of wslhost.exes, launching a new terminal of wsl will fail and complain The Windows Subsystem for Linux instance has terminated.

[CentOS] HRESULT:0x80004001

Hello,

First of all, thanks for your tool.
I've tested to create a CentOS7 instance.
When i launch "centos.exe", i get this error:

Installing...
ERROR:Installation Failed!
HRESULT:0x80004001

For the rootfs, i've got it from the official dockerhub centos repository.
They give a ".tar.xz" file that i've conveted to ".tar.gz"
Can you give some help please?

Customizable TargetName and user

Is it possible to create arguments to change Target name, defalut user and to create launch installed instance shortcut in Start menu?

HEY YUK7

Hi! I have some questions to you. How can contact you?

TODO:

  • re-write codes with in better c/c++
  • use WslLaunch function for get uid in set-default-user
  • Separate project
  • fix worst Engrish

Fedora 28 segfault

Hello!
When I run Fedora and try use command "yum update" then I get error "Segmentation fault (core dumped)"

0x80004005 error

I got

D:\Users\McModder\Downloads>arch-inst.exe
Installing...

ERROR:Installation Failed! 0x80004005
D:\Users\McModder\Downloads>

I have both arch-inst.exe and rootfs.tar.gz in same folder
image

Tried to launch with user and admin rights

Win10 Pro 1709, build 16299.19
image

Connect to existing rootfs

After Windows reinstallation WSL records obviously lost. And you can't just run Arch.exe with your existing rootfs folder and continue to work.
I've found a workaround: rename old rootfs, install new distro from rootfs.tar (just to register it), then delete and return old rootfs.
But this is inconvinient, why not just to connect to existing rootfs folder if it already exists?

How to manage distros?

Currently, after distro installation if I rename the file Launcher.exe -> Ubuntu.exe it won't run because there's no distro associated with the name Ubuntu. I'd like to change the name Launcher to Ubuntu. The current workaround is:

  1. Save the rootfs folder.
  2. Launcher.exe clean
  3. Ubuntu.exe (needs rootfs.tar.gz)
  4. Replace the rootfs folder with the saved one.

Also, is there any way to manage all distros installed using wsldl? For example, if someone has renamed their folder, then how to fix it?

Alpine.exe does not have clean or help commands

The Alpine.exe file in .../releases/downloads/17112101/Alpine.zip does not recognize either clean or help as commands.

A workaround is to download the latest Launcher.exe and rename it as Alpine.exe.

Not an issue: Some improvements needed

Recently, I am following your repo and also added some idea in my repo. But I have some suggestions, may be that help this project.

  1. In newer version of Windows SDK, Microsoft has added Wslapi.h header file. So that you have not to make definition of that WSL functions. 2. Also you may skip to launch WSL.exe in your program by calling the WslLaunchInteractive function. 3. It will be easy if there is a separate header file and .c files for each of the functions.

Also many more....

How to reset default terminal

So, after I created a user manually in CentOS WSL, then I change the default user with command:
CentOS.exe config --default-user hakim
It turned out error: HRESULT:0x80004005 when I double click CentOS.exe.

Then, i tried to delete the user and readded it again.
wsl -d CentOS -u root
I tried again CentOS.exe config --default-user hakim and it works successfully.
centos1
centos2

Before, unfortunately, I set it with command: CentOS.exe config --default-term wt.
centos3
Does the launcher fail? I double clicked it, now, It only shows CentOS folder.
But I can successfully access CentOS WSL as the new user when I access it via dropdownlist.
centos4

How can I reset the default terminal? Help and thanks.

Register to WSL?

I can run the .exe in cmd and get the distro, but how can I register this so I have it as a tile like the Ubuntu I installed from ms store. is is with lxrun? did this get depreciated? thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.