New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plans for alternative distributions: e.g. Fedora, ArchLinux, etc? #8

Closed
jokeyrhyme opened this Issue Apr 7, 2016 · 43 comments

Comments

Projects
None yet
@jokeyrhyme

jokeyrhyme commented Apr 7, 2016

My Windows machines always have a dual-booting Linux partition: playing games in Windows, and getting work done in Linux. As such, I'm extremely excited about WSL and Ubuntu on WSL.

I'm curious about whether or not there is room for more choice in distributions? Is there an open specification that describes what was necessary for Ubuntu to do? Can alternative distribution images that conform to this specification be used instead? Is it possible to build such an image myself, or is there a signing requirement?

I'd love to see ArchLinux and Fedora alternatives, once the dust settles of course.

@primeinc

This comment has been minimized.

primeinc commented Apr 7, 2016

This was the first question I had when watching the demo video +1

@jokeyrhyme

This comment has been minimized.

jokeyrhyme commented Apr 7, 2016

An effort to release an open specification could be related to #1 ?

@Krutonium

This comment has been minimized.

Krutonium commented Apr 7, 2016

I would be all over an Arch version of this.

@jernejs

This comment has been minimized.

jernejs commented Apr 7, 2016

I replaced the userland with a Gentoo stage 3, which didn't seem to break anything (however, emerge doesn't work due to failing sanity checks on /dev).

@eugenelet

This comment has been minimized.

eugenelet commented Apr 7, 2016

I think that Manjaro is a great arch distribution

@dethoma dethoma added the feature label Apr 11, 2016

@dethoma dethoma closed this Apr 11, 2016

@raeesbhatti

This comment has been minimized.

raeesbhatti commented Apr 13, 2016

I would say that they should make Windows Subsystem for Linux open-source, so that, developers can add their own flavors. Because WSL team will never have enough resources to meet the expectations of such broad community.

UserVoice issue for making Windows Subsystem for Linux open-source

@tkelman

This comment has been minimized.

tkelman commented Apr 15, 2016

WSL doesn't need to be open source for this to be possible. WSL is kernel mode code anyway (I think, correct me if I'm wrong) so I don't think the community would have the ability to compile and run custom patched copies of WSL easily. But for this item, all we'd need is documentation on what modifications Canonical made between the standard Ubuntu distribution (iso or whatever) and the userland-only version that Bash on Windows downloads. And either documentation or source for the C:\Windows\System32\bash.exe launcher/installer, which is a win32 executable so presumably anyone would be able to build an equivalent or modified version to pull down an alternate distro's userland.

@benhillis

This comment has been minimized.

Member

benhillis commented Apr 15, 2016

@tkelman You are correct. We would not need to make the project open source to open up to other distributions. Currently we're focused on delivering a solid bash shell but there are many other exciting potential applications of our technology, including allowing people to select their distro of choice.

As far as the image we got from Canonical it has absolutely zero modifications. Dustin Kirkland from Canonical has a great blog post with some more info if you are interested.

@tkelman

This comment has been minimized.

tkelman commented Apr 15, 2016

I read that blog post when it went up, I'm curious on the technical specifics of which image it's using though. Is it literally the exact http://releases.ubuntu.com/releases/trusty/ubuntu-14.04.4-server-amd64.iso image, or is it a userspace-only version derived from it with the Linux kernel removed?

@benhillis

This comment has been minimized.

Member

benhillis commented Apr 15, 2016

You are correct, it's just the userspace pieces. It's kind of hidden in his post but he points you to the exact .tar.gz:

So as part of the engineering work, I needed to wrap the stock Ubuntu root filesystem into a Windows application package (.appx) file for suitable upload to the Windows Store.

(his link points to the xenial version and we're using trusty, but you get the idea)

@tkelman

This comment has been minimized.

tkelman commented Apr 15, 2016

D'oh, thanks for that! Does make sense that this would have some commonality with "cloud images" you might use in a container. So it's the "wrap [...] into a Windows application package" equivalent step that we'd need to reverse engineer or get source or documentation of some kind to be able to recreate on a different distro. Should look into whether any other distros have equivalent userspace-only images already prepared.

@sjenning

This comment has been minimized.

sjenning commented Apr 19, 2016

I've done it for Fedora:
https://www.youtube.com/watch?v=lRg0BXhxncM

How to:
https://www.variantweb.net/blog/running-fedora-on-windows-10-using-wsl/

The install is not user friendly as lxrun.exe is hardcoded for the Ubuntu userspace tarball and seems to be the only utility in all of Windows that can actually create proper symlinks on NTFS.

Need the source for lxrun.exe please!

# strings lxrun.exe | grep base
base\subsys\lxss\lxrun\main.cpp
base\subsys\lxss\lxrun\download.cpp
base\subsys\lxss\lxrun\install.cpp
base\subsys\lxss\lxrun\uninstall.cpp
base\subsys\lxss\lxrun\update.cpp
base\subsys\lxss\lxcmdlineshared\console.cpp
base\subsys\lxss\lxcmdlineshared\svccomm.cpp
base\subsys\lxss\lxcmdlineshared\helpers.cpp
base\subsys\lxss\tar2lx\lib\tar2lx.cpp   <-- I assume this is the symlink magic
@hanetzer

This comment has been minimized.

hanetzer commented May 30, 2016

I've actually done arch linux within this, but I've ran into a major problem that would likely have to be fixed in pacman/libalpm itself, in that it makes numerous calls to chroot() from unistd.h which apparently isnt currently supported within lxss

@jokeyrhyme

This comment has been minimized.

jokeyrhyme commented May 30, 2016

The chroot issue is here: #47

@hanetzer

This comment has been minimized.

hanetzer commented May 30, 2016

Oh, so it is! btw, I'm talking about the c call for chroot() and not the command itself. As I said, I actually have a 'running' archlinux going, but I can't use pacman :P

@hanetzer

This comment has been minimized.

hanetzer commented Jun 15, 2016

For whatever reason I can't replicate it again, and even then until we can do chroot() it's next to useless :/

@goreliu

This comment has been minimized.

goreliu commented Aug 16, 2016

@SRGOM

Install Arch Linux to WSL:

  1. Download latest iso file from https://www.archlinux.org/download/
  2. Extract arch\x86_64\airootfs.sfs from archlinux-2016.08.01-dual.iso to /path/to/airootfs.sfs
  3. Enter bash.exe, install squashfs-tools with apt-get, run unsquashfs /path/to/airootfs.sfs in /root
  4. Close bash.exe, enter c:\Users%username%\AppData\Local\lxss with explorer.exe, backup rootfs, move root\squashfs-root to rootfs
  5. Enter bash.exe again, it's Arch Linux now

Solve(skip) chroot problem:

echo 'int chroot(const char *path){return 0;}' > chroot.c
gcc chroot.c -shared -fPIC -o /path/to/libchroot.so

LD_PRELOAD=/path/to/libchroot.so pacman

A screenshot:

archlinux_in_wsl

@goreliu

This comment has been minimized.

goreliu commented Aug 16, 2016

@SRGOM

  • fakeroot doesn't work, but makepkg depends it
$ fakeroot
fakeroot, while creating message channels: Function not implemented
This may be due to a lack of SYSV IPC support.
fakeroot: error while starting the `faked' daemon.
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

I wrote a fakefakeroot, replace it, just works, but then owners of files in .pkg.xz are not root.

#!/bin/bash

if [ "$1" = "-v" ]; then
    echo 1.0
    exit
fi

export FAKEROOTKEY=1

exec "$@"

unset FAKEROOTKEY
  • Versions of packages in Arch Linux are much higher then which in Ubuntu 14.04, some tools failed to run, such as script command and socat UNIX-LISTEN:aa - command.
  • We can't start any serivce with systemctl start foo, and no service command exists. The only method seems to be manually run /usr/bin/sshd , /usr/bin/crond, ...
@RoliSoft

This comment has been minimized.

RoliSoft commented Aug 18, 2016

For what it's worth, I wrote a few scripts to easily grab the Docker official images, install them as the rootfs for WSL, and switch between the installed distributions seamlessly.

The project is in its infancy, and available from here: https://github.com/RoliSoft/WSL-Distribution-Switcher

I'll look into adding more sources and post-install hooks to fix known issues for each image, where the issue is known and fixable.

@aseering

This comment has been minimized.

Contributor

aseering commented Aug 19, 2016

@SRGOM -- sorry for the delay -- do you think the existing "Tools and Instructions" category would work? If not, or if it gets too crowded, I'd be happy to make a new section.

@fpqc

This comment has been minimized.

fpqc commented Aug 26, 2016

@goreliu I had a problem where the unsquashfs'd thing didn't have GCC.

@goreliu

This comment has been minimized.

goreliu commented Aug 26, 2016

@fpqc Compile codes in Ubuntu and move output binaries to Arch also works.

@fpqc

This comment has been minimized.

fpqc commented Aug 26, 2016

@goreliu yeah I figured.

@fpqc

This comment has been minimized.

fpqc commented Aug 27, 2016

@goreliu Sorry, one other thing: Where do I put the fakefakeroot script? Do I overwrite the downloaded fakeroot?

Also, can I add the libchroot to /etc/ld.so.preload ?

@goreliu

This comment has been minimized.

goreliu commented Aug 27, 2016

@fpqc Uninstall fakeroot, and put fakefakeroot in /usr/bin/fakeroot, or any other directories in PATH.

Adding libchroot to /etc/ld.so.preload may cause some security problems (for example, sshd will not chroot to /var/empty, and no error messages will be printed).

@RoliSoft

This comment has been minimized.

RoliSoft commented Aug 31, 2016

@goreliu You can use fakeroot-tcp from AUR instead of fakeroot. It works better than a wrapper, since the owners of the files in the .pkg.xz are actually set to root.

That being said, your wrapper is needed to initially compile fakeroot-tcp.

@goreliu

This comment has been minimized.

goreliu commented Sep 1, 2016

@RoliSoft Thanks, fakeroot-tcp works.

@RoliSoft

This comment has been minimized.

RoliSoft commented Sep 1, 2016

@fpqc I wrote a small lib which you can put in /etc/ld.so.preload, and will only affect pacman, so it's safe:

#define _GNU_SOURCE
#include <unistd.h>
#include <libgen.h>
#include <dlfcn.h>
#include <linux/limits.h>
#include <string.h>

int chroot(const char *path)
{
    // return 0 for pacman

    char dest[PATH_MAX];
    if (readlink("/proc/self/exe", dest, PATH_MAX) != -1) {
        char* file = basename(dest);
        if (strcmp(file, "pacman") == 0) {
            return 0;
        }
    }

    // passthrough for others,
    // currently results in -1 and errno=38

    int (*_chroot)(const char*);
    _chroot = dlsym(RTLD_NEXT, "chroot");
    return (*_chroot)(path);
}

Compile it with:

$ gcc libmockchroot.c -shared -fPIC -ldl -o /lib64/libmockchroot.so
$ echo "/lib64/libmockchroot.so" >> /etc/ld.so.preload
@fpqc

This comment has been minimized.

fpqc commented Sep 1, 2016

@RoliSoft I hope you are putting this in your project, I pull it every time you update it!

@RoliSoft

This comment has been minimized.

RoliSoft commented Sep 1, 2016

Further search revealed the fakechroot package, which hooks the file I/O functions and actually rewrites the paths.

After installation with pacman, you can add /usr/lib/libfakeroot/fakechroot/libfakechroot.so to /etc/ld.so.preload, which will cause all chroot-using applications to not only not fail, but behave as expected if chroot was available.

This does, however, load the library into all applications. I haven't tested the performance implications just yet, but based on the source, not many operations are done, if chroot is not called by the process.

@turbo

This comment has been minimized.

turbo commented Sep 1, 2016

If you are brave, you can try the (undocumented, unstable) dev branch of alwsl.

alwsl is really two parts:

  • the alwsl.bat management utility (manage WSL, users, snapshots etc.) on the windows side and
  • a custom archlinux distribution containing many custom builds of pacman, root-related libs, makepgk, yaourt etc. in order to operate smoothly within WSL.

The batchfile version is not the final product, more like a proof-of-concept. The final version of alwsl will be released at some point next week. The final version contains a plugin system for user-defined addons to alwsl systems (like Audio from WSL, a better X setup etc.).

As I said, ATM the dev branch is undocumented. Download a copy of the alwsl.bat and run it without arguments to see usage information.

@fpqc

This comment has been minimized.

fpqc commented Sep 1, 2016

@minxomat Have you tried @RoliSoft 's scripts? I looked at the alwsl.bat thing, and it doesn't even look like it is fixing chroot and fakeroot (fakechroot and fakeroot-tcp). @RoliSoft has got all the little Arch compatibility hacks ready to go, just remove the ".sample" from the hook script.

@turbo

This comment has been minimized.

turbo commented Sep 1, 2016

@fpqc If you looked at the script and my above post, I clearly stated that this is a custom distribution. it contains all fixes necessarily for WSL. The distro is downloaded during the install task. It not only fixes fakeroot, but every other error or warning (that I know of atm) you might get in WSL otherwise.

@turbo

This comment has been minimized.

turbo commented Sep 1, 2016

Think of it as a replacement for lxrun. Instead of installing and managing a ubuntu server WSL, it does the same with archlinux. Sure you can make a vanilla arch compatible, but this is meant for folks who look for something as simple to run as lxrun itself.

@fpqc

This comment has been minimized.

fpqc commented Sep 1, 2016

@minxomat Interesting, I'll try it out. It won't delete my /home and /root, will it?

Also, in the readme you really ought to explain what changed packages you're using.

@turbo

This comment has been minimized.

turbo commented Sep 1, 2016

@fpqc Well, I don't recommend to use it just now. But you can try. Backup everything in any case.

Full documentation is ofc included in the final version. Also, not all mods are applied in the dev branch, so there might be some warnings until testing is finished. If you find something, open an issue. It's better to have duplicate issues to be reminded of important things 😄

@DarthSpock

This comment has been minimized.

DarthSpock commented Oct 23, 2017

Are there plans for Red Hat Linux, Kali, and SELinux to be added to the Windows Store?

@marcthe12

This comment has been minimized.

marcthe12 commented Oct 31, 2017

Can we sdk to create our own from chroot or tarball

@DarthSpock

This comment has been minimized.

DarthSpock commented Jan 17, 2018

Just to give everyone an update to Kali, see this Twitter post from Kali https://twitter.com/kalilinux/status/951140177510006793/photo/1

@DarthSpock

This comment has been minimized.

DarthSpock commented Mar 7, 2018

Both Kali Linux and Debian are now available on the Windows Store

@Biswa96

This comment has been minimized.

Biswa96 commented Mar 7, 2018

My questions @tara-raj 1. Who does provide the install.tar.gz file? Does Microsoft make that own or the developer of that distro? 2. Who publish the appx in Windows Store? 3. And last, who build the added distro_name.exe in Appx package?

@bitcrazed

This comment has been minimized.

Collaborator

bitcrazed commented Mar 27, 2018

@Biswa96 - @tara-raj is currently working with several Linux distro vendors to help them bundle & publish their distros to the store - we feel it's best for the distro owners to control and manage the release of their distros on their schedule.

We believe that it's best for all concerned, if a distro is published from the store under the auspices of the owning organization. This way, when you see "Ubuntu" published by "Canonical Inc.", you can feel confident that it's the real-deal, whereas if you saw "Ubuntu" published by "Joe Bloggzzz the MegaGeek", you might pause and question whether the app is legitimate.

Distro owners are responsible for everything that goes into their APPX- the distro tar.gz itself, along with the launcher, and any icons/images etc.

Distro owners fork the sample distro launcher, modify a few settings, and build their launcher app. The launcher app is (deliberately) very simple, and basically handles registering a distro and launching of a distro instance when the user clicks a start menu tile, or calls the launcher's app execution alias (e.g. "ubuntu.exe").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment