rolisoft / wsl-distribution-switcher Goto Github PK
View Code? Open in Web Editor NEWScripts to replace the distribution behind Windows Subsystem for Linux with any other Linux distribution published on Docker Hub.
License: MIT License
Scripts to replace the distribution behind Windows Subsystem for Linux with any other Linux distribution published on Docker Hub.
License: MIT License
OS Build: 14393.693
python: 3.4.5 cygwin
How can I allow it to write there?
Hiya Roli, I found a kind of security flaw in the design of the distro switcher.
Suppose you have a no-goodnik on your bash install through ssh. Right now, if you've used the WSL-switcher, they can just go do
cd /mnt/c/Users/Username/AppData/Local/lxss
then if there is any other rootfs than the default one, say rootfs_ubuntu_xenial
, they can just enter that with cd
and read off of /etc/shadow
.
Two possible solutions: One, regenerate/delete the /etc/passwd
and /etc/shadow
files in switch.py
, or store the rootfs_distro_tag
folders inside of %localappdata%\lxss\rootfs\sbin
, since Microsoft protects viewing that from bash, and bash prevents non-root users from viewing it (because of the nature of sbin).
Hiya, @RoliSoft I noticed you pushed an update today to support Arch, and I saw that you added @goreliu 's hack to get chroot working.
He also wrote a little hack to get fakeroot (needed for makepkg) working, where he replaces the fakeroot executable with a shellscript that quits. Would you add that too?
Also, I like how you stored the binary of the fake libchroot as text, that was a cute trick.
Also, side note, Arch also uses the wheel
group for sudoer by default.
Because package installation isn't working properly on Fedora, I tried installing openSuse (using the Creator's Update). Now when opening bash I get the code "Error: 0x80070040". Based on google results, it appears the issue is usually the result of manually removing the /etc/resolv.conf symlink on WSL, so the problem could be that file isn't present on the openSUSE Docker package.
Latest version, when using install.py, it fails to move the homedir to the new temp directory because "homedirw" gets translated as
%localappdir%\lxss\home/usernameblah
instead of %localappdir%\lxss\home\usernameblahblah
Not sure exactly why the stripping thing that you do doesn't work right, but it doesn't work properly right now.
Steps to reproduce:
C:/> python install.py fedora:25
C:/> lxrun /setdefaultuser root
C:/> bash
$ dnf install -y sudo
During the install a Segmentation fault (Code dumped)
occurs and the RPM db is corrupted.
The image fedora:24
works as expected:
C:/> python install.py fedora:24
C:/> lxrun /setdefaultuser root
C:/> bash
$ dnf install -y sudo
Installs and finishes.
Using Windows 10 b1703 and the latest code from this repo:
<redacted>\WSL-Distribution-Switcher>python get-source.py debian:jessie
[*] Fetching official-images info for debian:jessie...
[*] Fetching Dockerfile from repo debuerreotype/docker-debian-artifacts/47859e2e12eadf1ff7f449d0d8b541a68289a40f/jessie...
[!] Failed to fetch Dockerfile from https://raw.githubusercontent.com/debuerreotype/docker-debian-artifacts/47859e2e12eadf1ff7f449d0d8b541a68289a40f/jessie/Dockerfile: HTTP Error 404: Not Found
too young too simple,sometime navie
Can't even start the thing. Output below. I don't know what other info I can provide.
c:\Users\Chris\Downloads>python get-source.py opensuse:tumbleweed
Traceback (most recent call last):
File "get-source.py", line 10, in <module>
ensure_ca_load()
File "c:\Users\Chris\Downloads\utils.py", line 85, in ensure_ca_load
if ssl.create_default_context().cert_store_stats()['x509_ca'] == 0:
AttributeError: 'module' object has no attribute 'create_default_context'
c:\Users\Chris\Downloads>python --version
Python 3.3.5
Hi there Rolisoft,
I tried doing the steps, get-prebuilt, then install, and if I didn't delete the pycache file, the build process for pacaur would fail because it would say it couldn't find awk.
Also, there's a small error when it tries to extract the apache license.txt file at the very beginning of the install, but it doesn't seem to matter.
Apparently the default user doesn't get added to the sudo group, so if you don't set a root password so you can su and add the user to the sudo group, you're stuck with a clean system with no way to install packages.
The following distributions are currently installed:
- debian:latest*
- debian:latest
- fedora:latest
- ubuntu:trusty
To switch back to the default distribution, specify ubuntu:trusty as the argument.
I have to versions of debian:lates installed. How do I remove one of them ?
I have WSL downloaded on my C drive under ~\Downloads\Anything Techy\Useful Software\WSL-Distribution-Switcher, and when I go to install a rootfs:
cp: cannot stat '/mnt/c/Users/Jorge/Downloads/Anything': No such file or directory
cp: cannot stat 'techy/Useful': No such file or directory
cp: cannot stat 'Software/WSL-Distribution-Switcher/rootfs_pritunl_archlinux_latest.tar.gz': No such file or directory
Probably a simple error to fix
get-prebuilt alpine:edge
it has no bash, how exactly do we start ?
I used the script to install fedora and enabled the hook script but still can not get access to the root account neither can install sudo
note: I already put ROOTPASSWD in system environment variables - System Variables
also how can I delete installed image as I tried to re install fedora after removing the sample from the hook file and now the switch script show I have two copies of fedora:latest
Running the hook causes wmic to be invoked, which fails if C:\Windows\system32\wbem is not on the PATH. It would be nice if wmic was searched for earlier and an error message with the appropriate suggestion on how to fix the issue was done before actually installing the distribution so that it could be fixed and the install run again
Hey, trying to set up Centos 6.6, no real errors in console while installing but bash keeps crashing with error 139.
C:\dev\WSL-Distribution-Switcher>get-source centos:6.6
[*] Fetching official-images info for centos:6.6...
[*] Fetching Dockerfile from repo CentOS/sig-cloud-instance-images/8911843d9a6cc71aadd81e491f94618aded94f30/docker...
[*] Downloading archive https://raw.githubusercontent.com/CentOS/sig-cloud-instance-images/8911843d9a6cc71aadd81e491f94618aded94f30/docker/centos-6.6-20150304_1234-docker.tar.xz...
[*] Rootfs archive for centos:6.6 saved to rootfs_centos_6.6.tar.xz.
C:\dev\WSL-Distribution-Switcher>install centos:6.6
[*] Probing the Linux subsystem...
[*] Default user is tost at /home/tost.
[*] Reading /etc/{passwd,shadow,group,gshadow} entries for root and tost...
[*] Beginning extraction...
[*] Backing up current rootfs to rootfs_ubuntu_trusty...
[*] Switching to new rootfs...
[*] Writing entries of root and tost to /etc/{passwd,shadow,group,gshadow}...
C:\dev\WSL-Distribution-Switcher>bash
C:\dev\WSL-Distribution-Switcher>echo %errorlevel%
139
From windows docs:
ERROR_SUBST_TO_SUBST
139 (0x8B)
The system tried to substitute a drive to a directory on a substituted drive.
Any idea what's causing this?
Awesome project btw :))
edit
Tested on another PC, same issue, Centos 7 works fine. Weird...
After manually fetching Gentoo's stage3-amd64-nomultilib-20170525.tar.bz2
and using install.exe from v0.1.0 to install it under Windows 10 (1703), I discovered that the tarball was not extracted properly:-
$ cd /usr/share/terminfo/
$ echo *
1 2 3 4 5 6 7 8 9 a b c d e f g h i j k L M n o P q r s t u v w X z
This is missing eight additional directories. Had it been extracted properly, the list would have appeared as follows:-
$ echo *
1 2 3 4 5 6 7 8 9 a A b c d e E f g h i j k l L m M n N o p P q Q r s t u v w x X z
The damage is not limited to files owned by ncurses. However, this particular example is interesting because it manifests as weird terminal behaviour. This is because Windows sets TERM=xterm-256color
, but the corresponding terminfo file cannot be located. Normally it would be beneath the lower-case x
directory but, instead, it is beneath the upper-case X
directory.
I recall previously using an older version of WSL-Distribution-Switcher with a standalone Python, without issue.
Hello,
@jdmansour pointed out in Atlas on Windows that he was also getting sudo: unable to create sockets: Socket type not supported
. This was the only reference to sudo: unable to create sockets: Socket type not supported
that I was able to find.
Since sudo works under Ubuntu but fails under CentOS, I thought it must be a CentOS issue rather than a WSL issue.
If you're running as root, you can use sudo -V
to dump a detailed sudo configuration, along with ./configure
compile time flags. After a lot of trial and error, I was able to get sudo working under CentOS via WSL Distribution Switcher.
First, download the sudo sourcecode from sudo.ws.
Then you'll need to install a boatload of dependancies to get this to build.
yum install file make zlib zlib-devel \
gcc vim svn wget make \
sssd sssd-libwbclient-devel \
pam-devel libselinux-devel
Then you'll want to configure with:
./configure -v --with-all-insults --with-pam \
--with-nsswitch=no --without-ldap --without-sendmail \
--with-logfac=authpriv --with-logging=syslog \
--with-editor=/bin/vi --with-env-editor \
--with-timeout=15 --with-password-timeout=0 \
--with-passprompt="[sudo] password for %p:" \
--without-lecture --with-tty-tickets \
--disable-root-mailer --enable-admin-flag \
--with-sssd --with-sssd-lib=/usr/lib64 \
--with-selinux --enable-zlib \
--without-fqdn
Last, you'll want to edit /etc/sudoers. On the very last line, you'll want to put:
me ALL=(ALL) NOPASSWD: ALL
Of course me should be your actual username. You'll also want to make sure to include a blank line after this line, as it also seems to be required by sudo. This should fix: sudo: no tty present and no askpass program specified
errors.
I'm sure that it's not the best solution, but it's a viable way to get sudo working on CentOS under WSL. I wish I could think of a way to include this into the post_install script but it's such a long winded process, building a custom RPM would seem to be the most viable option, but then is WSL-Distribution-Switcher going to want to host packages that handle compatability for certain programs?
I am hitting this after a fresh re-install of WSL and have Ubuntu:trusty installed:
python get-source.py ubuntu:xenial
[] Fetching official-images info for ubuntu:xenial...
[] Fetching Dockerfile from repo tianon/docker-brew-ubuntu-core/1a5cb40f41ac4829d8c301ccd2cf3b7a13687a8b/xenial...
[] Downloading archive https://raw.githubusercontent.com/tianon/docker-brew-ubuntu-core/1a5cb40f41ac4829d8c301ccd2cf3b7a13687a8b/xenial/ubuntu-xenial-core-cloudimg-amd64-root.tar.gz...
[] Rootfs archive for ubuntu:xenial saved to rootfs_ubuntu_xenial.tar.gz.
python get-prebuilt.py ubuntu:xenial
[] Requesting authorization token...
[] Fetching manifest info for ubuntu:xenial...
[] Downloading layer sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4...
[] Downloading layer sha256:6d9ef359eaaa311860550b478790123c4b22a2eaede8f8f46691b0b4433c08cf...
[] Downloading layer sha256:9654c40e9079e3d5b271ec71f6d83f8ce80cfa6f09d9737fc6bfd4d2456fed3f...
[] Downloading layer sha256:e8db7bf7c39fab6fec91b1b61e3914f21e60233c9823dd57c60bc360191aaf0d...
[] Downloading layer sha256:f8b845f45a87dc7c095b15f3d9661e640ebc86f42cd8e8ab36674846472027f7...
[] Downloading layer sha256:d54efb8db41d4ac23d29469940ec92da94c9a6c2d9e26ec060bebad1d1b0e48d...
[*] Rootfs archive for ubuntu:xenial saved to rootfs_ubuntu_xenial.tar.gz.
python install.py ubuntu:xenial
[] Probing the Linux subsystem...
[] Default user is ikky at /home/ikky.
[] Reading /etc/{passwd,shadow,group,gshadow} entries for root and ikky...
[] Beginning extraction...
[!] Failed to extract archive: [WinError 126] The specified module could not be found
P.S: WSL was NOT running when I was executing these commands.
I would love to have an LFS system in my WSL. What would be the best way to get there? I can build it all under WSL, I think (been a while since I tried). Should I try to put it in a SquashFS archive and then unsquash it as you mention in your blog for ArchLinux?
python install.py rootfs_centos_latest.tar.xz
[*] Probing the Linux subsystem...
[!] Failed to get home directory of default user in WSL: [WinError 2] 。
Hi guys.
I am trying to install debian:latest from cygwin console, but keep getting the error:
$ python3 install.py debian:latest
[*] Probing the Linux subsystem...
Traceback (most recent call last):
File "install.py", line 34, in
basedir, lxpath = probe_wsl()
File "/cygdrive/c/Users/amadeus/Desktop/tmp/WSL-Distribution-Switcher/utils.py", line 125, in probe_wsl
basedir = os.path.join(os.getenv('LocalAppData'), 'lxss')
File "/usr/lib/python3.4/posixpath.py", line 82, in join
path += b
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
Steps to reproduce:
python3 get-prebuilt.py debian:latest
python3 install.py debian:latest
My python version is:
$ python3 --version
Python 3.4.3
Same thing happens for python2(2.7.10), but with a slightly different error:
$ python install.py debian:latest
[*] Probing the Linux subsystem...
Traceback (most recent call last):
File "install.py", line 34, in
basedir, lxpath = probe_wsl()
File "/cygdrive/c/Users/amadeus/Desktop/tmp/WSL-Distribution-Switcher/utils.py", line 125, in probe_wsl
basedir = os.path.join(os.getenv('LocalAppData'), 'lxss')
File "/usr/lib/python2.7/posixpath.py", line 70, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
WSL is enabled, lxrun /? shows the help text.
Thanks in advance!
Title says it all :3
Debian jessie was installed by get-source.py.
After apt-get install ... , wget, curl and git are not working properly.
See below, git clone was not successful, nothing fetched from server.
root@DESKTOP-1LAII7P:/sbin# wget
Aborted (core dumped)
root@DESKTOP-1LAII7P:/sbin# curl
Aborted (core dumped)
root@DESKTOP-1LAII7P:/sbin# git clone https://github.com/RoliSoft/WSL-Distribution-Switcher.git
Cloning into 'WSL-Distribution-Switcher'...
root@DESKTOP-1LAII7P:/sbin#
ive yet to try others but:
python install.py alpine:latest
or python install.py voidrootfs.tar.xz
does successfully build the rootfs but when i execute 'bash' it gives me:
Error: 0x80070002
whats up?
Heya, @RoliSoft
I have a log of a brand new install off a new arch.SFS and you mislocated the libmockchroot in the preinstall script, probably forgot to change its location later on.
Also, lots of problems with sigchecks failing even after fixing that on my end. It says it can't look up the keys remotely.
Edit: Oops, I pulled it like 4 hours ago =.=.
Edit2: Nope, I was right, you are overwriting it after all. Find where you write "libfakechroot" and you'll see you're overwriting it.
Anyway, after fixing it, I think you need to add two lines to the postinstall script for arch:
pacman-key --init
pacman-key --populate archlinux
Edit: Maybe I'll just do a pull request
Anyway, afterwards, I'm still getting this acl error afterwards
Edit 3: I'm going to fix this properly then submit a proper pull request. The last one was messed up.
Hiya,
I played around with the scripts a bit, and I noticed that the sample script does a couple of bad things.
First, instead of adding the primary user directly to the sudoers with no password, the user should be added to the group sudo with the shell command
usermod -aG sudo $defaultusername
Second, it should install sudo
if the package manager is supported.
Third, for some reason with the ubuntu:devel docker image, you need to decompress with gzip the UTF8 charmap:
gzip -d /usr/share/i18n/charmaps/UTF-8.gz
before generating the locale, or else it won't work. I don't know if this happens with the ubuntu:latest docker image, but I checked a couple of times with ubuntu:devel.
Is this a know issue? I am not finding anyone who documented such issue:
[] Installing tools...
error: rpmdb: BDB0113 Thread/process 7/140163040478976 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 - (-30973)
error: cannot open Packages database in /var/lib/rpm
Error: Error: rpmdb open failed
[!] Failed to run hook in WSL: Command '['cmd', '/C', 'C:\windows\System32\bash.exe', '-c', 'REGULARUSER="ikky" WINVER="14393" /root/hook_postinstall_all.sh']' returned non-zero exit status 1.
[] Switching default user back to ikky...
Hiya @RoliSoft ; New build (14936) adds support for chroot, so you can probably fix your arch installer hack (if you want to check for WinBuild number).
Cheers!
I'm trying to install CentOS 6. Fetching the filesystem works, but I get an error message during installation (see below). It is the same error message that you got here under "Installing the new rootfs".
If I try to start WSL with bash.exe
afterwards, nothing happens. No error message, it just returns me to the prompt.
The issue seems to be that the old CentOS version's adduser
doesn't take the --quiet
parameter, and that trips up lxrun.exe
. However /etc/passwd
and /etc/shadow
seem to be edited correctly. Any ideas how to get this running?
> python get-source.py centos:6
> python install.py centos:6
[*] Probing the Linux subsystem...
[*] Default user is jason at /home/jason.
[*] Switching default user to root...
[*] Reading /etc/{passwd,shadow,group,gshadow} entries for root and jason...
[*] Copying rootfs_centos_6.tar.xz to /root/rootfs-temp...
[*] Beginning extraction...
[*] Waiting for the Linux subsystem to exit...
[*] Backing up current rootfs to rootfs_ubuntu_trusty...
[*] Switching to new rootfs...
[*] Writing entries of root and jason to /etc/{passwd,shadow,group,gshadow}...
[*] Switching default user back to jason...
/usr/sbin/adduser: unrecognized option '--quiet'
Usage: adduser [options] LOGIN
adduser -D
adduser -D [options]
Options:
-b, --base-dir BASE_DIR base directory for the home directory of the
new account
-c, --comment COMMENT GECOS field of the new account
-d, --home-dir HOME_DIR home directory of the new account
-D, --defaults print or change default useradd configuration
-e, --expiredate EXPIRE_DATE expiration date of the new account
-f, --inactive INACTIVE password inactivity period of the new account
-g, --gid GROUP name or ID of the primary group of the new
account
-G, --groups GROUPS list of supplementary groups of the new
account
-h, --help display this help message and exit
-k, --skel SKEL_DIR use this alternative skeleton directory
-K, --key KEY=VALUE override /etc/login.defs defaults
-l, --no-log-init do not add the user to the lastlog and
faillog databases
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow to create users with duplicate
(non-unique) UID
-p, --password PASSWORD encrypted password of the new account
-r, --system create a system account
-R, --root CHROOT_DIR directory to chroot into
-s, --shell SHELL login shell of the new account
-u, --uid UID user ID of the new account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
[!] Failed to switch default user in WSL: Command '['cmd', '/C', 'C:\\Windows\\System32\\lxrun.exe', '/setdefaultuser', 'jason']' returned non-zero exit status 4294967295
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "install.py", line 119, in switch_user_back
subprocess.check_output(['cmd', '/C', lxpath + '\\lxrun.exe', '/setdefaultuser', user])
File "C:\Users\jdman\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 626, in check_output
**kwargs).stdout
File "C:\Users\jdman\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 708, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['cmd', '/C', 'C:\\Windows\\System32\\lxrun.exe', '/setdefaultuser', 'jason']' returned non-zero exit status 4294967295
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "install.py", line 123, in switch_user_back
exit(-1)
File "C:\Users\jdman\AppData\Local\Programs\Python\Python35\lib\_sitebuiltins.py", line 26, in __call__
raise SystemExit(code)
SystemExit: -1
I don't know what the issue is, but installing fedora 25 and then doing a dnf update results in the rpm database being broken and trying to repair it failed.
I doubt that the issue has anything to do with wsl-distribution-switcher, but wanted to note if in case anyone else ran in to this or anyone has a workaround
Not sure why but I seem to be getting errors for any of the tagged official distros, but not 3rd party. Anyone have any ideas why this might be?
C:\Users\USER\Code\WSL-Distribution-Switcher>python get-prebuilt.py alpine:latest
[*] Requesting authorization token...
[*] Fetching manifest info for alpine:latest...
[!] Failed to fetch manifest info for alpine: HTTP Error 404: NOT FOUND
C:\Users\USER\Code\WSL-Distribution-Switcher>python get-prebuilt.py ubuntu:trusty
[*] Requesting authorization token...
[*] Fetching manifest info for ubuntu:trusty...
[!] Failed to fetch manifest info for ubuntu: HTTP Error 404: NOT FOUND
C:\Users\USER\Code\WSL-Distribution-Switcher>python get-prebuilt.py pritunl/archlinux
[*] Requesting authorization token...
[*] Fetching manifest info for pritunl/archlinux:latest...
[*] Downloading layer sha256:fa15d8aec9382c4924fd3ec2f716d6d7733acdcb5ce2dff508e0a783dbe2d469...
Not an issue persay, but I really love your colour scheme in the WSL preview screenshot. Any chance you could post your config?
When I try to start something like SSH, I get the following error:
Failed to get D-Bus connection: Operation not permitted
On the CentOS docker page, they mention that you need to use this pre-build and then lunch it using:
docker run --privileged --name httpd -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 -d httpd
I can download the pre-build just fine, but how would you implement the docker run command from above?
Using WSL on Windows build 10.0.14393 centos:6 installs without and warnings/errors. However, when trying to run bash.exe it silently exists with a non-zero exit code.
C:\WSL-Distribution-Switcher-master>python.exe install.py centos:6
[*] Probing the Linux subsystem...
[*] Default user is root at /root.
[*] Reading /etc/{passwd,shadow,group,gshadow} entries for root...
[*] Beginning extraction...
[*] Backing up current rootfs to rootfs_ubuntu_trusty...
[*] Switching to new rootfs...
[*] Writing entries of root to /etc/{passwd,shadow,group,gshadow}...
C:\WSL-Distribution-Switcher-master>bash.exe
C:\>echo %ERRORLEVEL%
139
C:\>
i just installed debian, but sudo didn't get installed. i set the regular username/password, but how do i su into root to install sudo? thanks
Are there any plans to add support for Manjaro? It's at no.3 on DistroWatch, so it might make sense to support it if possible.
Hello!
Ask a question!
there is no problem when running the python program,
download and install doker rootfs! but bash.exe is not working.
run bash.exe directly after the exit.he will not enter the bash command line mode.
when i switch back to the default subsystem bash.exe is running
Windows version 10.0.14393
how should I fix it?
-----command log-----
C:\WSL-Distribution-Switcher>install.py centos:6.6
[*] Probing the Linux subsystem...
[*] Default user is root at /root.
[*] Reading /etc/{passwd,shadow,group,gshadow} entries for root...
[*] Beginning extraction...
[*] Backing up current rootfs to rootfs_centos_6.9...
[*] Switching to new rootfs...
[*] Writing entries of root to /etc/{passwd,shadow,group,gshadow}...
C:\WSL-Distribution-Switcher>bash
C:\WSL-Distribution-Switcher>switch.py
usage: ./switch.py image[:tag]
The following distributions are currently installed:
- centos:6.6*
- centos:6.9
- ubuntu:trusty
To switch back to the default distribution, specify ubuntu:trusty as the argument.
C:\WSL-Distribution-Switcher>switch.py ubuntu:trusty
[*] Probing the Linux subsystem...
[*] Moving current rootfs to rootfs_centos_6.6...
[*] Moving desired rootfs_ubuntu_trusty to rootfs...
C:\WSL-Distribution-Switcher>bash
root@NANDER:/mnt/c/WSL-Distribution-Switcher#
When running switch.py I get:
You do not seem to have the default distribution installed anymore.
To reinstall it, run lxrun /uninstall and lxrun /install from the command prompt.
This happens because switch.py checks for Ubuntu trusty, but lxrun /install
installs xenial nowadays.
I successfully switched to Debian Stretch, but sudo does not come installed by default and I cannot obtain root access to install it.
Thanks to Dist Switch I've changed my WSL from Ubuntu to CentOS.
I got my sudo
problems worked out, but there are a handful of packages that I can't install due to the following error: error: unpacking of archive failed on file /some/file/name: cpio: cap_set_file failed - Operation not supported
Searching for this error, I found several references to Docker users having the same problem, but their solution seems to involve the Docker client/server and doesn't seem to apply back to WSL's VolFs
filesystem.
Obviously the ideal solution would be for WSL to support every possible operation, but the fact that this mostly works on Ubuntu but fails to CentOS makes me wonder about other options. Unfortunately, I'm not terribly familiar with cpio
and not really sure where to go next.
CentOS packages I've seen impacted are httpd
and iputils
For example, try sudo yum install -y httpd
···
Loaded plugins: ovl, verify
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-40.el7.centos.4 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================== Package Arch Version Repository Size ========================================================================================================================================================Installing:
httpd x86_64 2.4.6-40.el7.centos.4 updates 2.7 M
Transaction Summary
========================================================================================================================================================Install 1 Package
Total download size: 2.7 M
Installed size: 9.4 M
Downloading packages:
httpd-2.4.6-40.el7.centos.4.x86_64.rpm | 2.7 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : httpd-2.4.6-40.el7.centos.4.x86_64 1/1 Error unpacking rpm package httpd-2.4.6-40.el7.centos.4.x86_64
error: unpacking of archive failed on file /usr/sbin/suexec: cpio: cap_set_file
Verifying : httpd-2.4.6-40.el7.centos.4.x86_64 1/1
Failed:
httpd.x86_64 0:2.4.6-40.el7.centos.4
Complete!
···
When iputils
fails, it's on:
Error unpacking rpm package iputils-20121221-7.el7.x86_64
error: unpacking of archive failed on file /usr/bin/ping: cpio: cap_set_file
PS C:\Users\knigh> C:\Windows\py.exe C:\Users\knigh\Git\WSL-Distribution-Switcher\install.py fedora
[] Probing the Linux subsystem...
[!] The Linux subsystem is currently running. Please kill all instances before continuing.
PS C:\Users\knigh> C:\Windows\py.exe C:\Users\knigh\Git\WSL-Distribution-Switcher\install.py fedora
[] Probing the Linux subsystem...
[] Default user is thinkdigital at /home/thinkdigital.
[] Reading /etc/{passwd,shadow,group,gshadow} entries for root and thinkdigital...
[] Beginning extraction...
[!] Failed to extract archive: [WinError 126] The specified module could not be found
PS C:\Users\knigh> C:\Windows\py.exe C:\Users\knigh\Git\WSL-Distribution-Switcher\install.py fedora
[] Probing the Linux subsystem...
[] Default user is thinkdigital at /home/thinkdigital.
[] Reading /etc/{passwd,shadow,group,gshadow} entries for root and thinkdigital...
[] Beginning extraction...
[!] Failed to extract archive: [WinError 126] The specified module could not be found
PS C:\Users\knigh> C:\Windows\py.exe C:\Users\knigh\Git\WSL-Distribution-Switcher\get-prebuilt.py fedora
[] Requesting authorization token...
[] Fetching manifest info for fedora:latest...
[] Downloading layer sha256:691bc14ee27487db536172a1fcdbbf956f460d1e1e1b201828e3a2bab81c5ec8...
[] Downloading layer sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4...
[] Rootfs archive for fedora:latest saved to rootfs_fedora_latest.tar.gz.
PS C:\Users\knigh> C:\Windows\py.exe C:\Users\knigh\Git\WSL-Distribution-Switcher\install.py .\rootfs_fedora_latest.tar.
gz
[] Probing the Linux subsystem...
[] Default user is thinkdigital at /home/thinkdigital.
[] Reading /etc/{passwd,shadow,group,gshadow} entries for root and thinkdigital...
[] Beginning extraction...
[!] Failed to extract archive: [WinError 126] The specified module could not be found
Windows Info
....:::: knigh@DESKTOP-0LAUJSG
....:::::::::::: OS: Microsoft Windows 10 Home Insider Preview 64-bit
....:::: :::::::::::::::: Kernel: 10.0.16199
....:::::::::::: :::::::::::::::: Uptime: 0d 5h 35m 44s
:::::::::::::::: :::::::::::::::: Motherboard: HP 81A1
:::::::::::::::: :::::::::::::::: Shell: PowerShell 5.1.16199.1000
:::::::::::::::: :::::::::::::::: Resolution: 1280 x 720
:::::::::::::::: :::::::::::::::: Window Manager: DWM
................ ................ Font: Segoe UI
:::::::::::::::: :::::::::::::::: CPU: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
:::::::::::::::: :::::::::::::::: GPU: Intel(R) HD Graphics 520
:::::::::::::::: :::::::::::::::: RAM: 7121 MB / 16295 MB (44%)
'''':::::::::::: :::::::::::::::: Disk: 198GB / 233GB (85%)
'''':::: ::::::::::::::::
''''::::::::::::
''''::::
I want to share my java distribution (currently in /opt) between distributions. Is there a recommended way to share it? The way I see it, only home directory stays outside rootfs.
Only asking, not requesting a feature.
Thank you, Great work btw!
Upgrade to Latest Kernel version to 4.x in CentOS 7.
for some reason when I try to download the docker image for kali it downloads through about 6 layers, but the last layer tells me http error 401: unauthorized.
Could I perhaps use a different tool to download the image to see if the problem persists? I'm a bit of a docker newb.
EDIT: I've tried doing it with docker pull and docker save but this saves layers in a tar.gz instead of the actual rootfs.
EDIT2: Do I simply combine the layers into a single .tar.gz? How would I go about doing this? I have the docker image but it contains layers...
Hi, on my system lxrun and bash are not in c:\windows\sysnative but in c:\windows\system32
I fixed the scripts by removing the c:\windows\sysnative and allow the scripts to run the the lxrun and bash from PATH, but that may conflict with users using cygwin/msys2.
An option to select the path for lxrun/bash should be provided or to verify the executables before.
Thanks!
Excuse me, did anyone install Alpine Linux?
python install.py alpine:latest
... OK ...
But, Bash cant't run.
Experiencing this on 10.0.16241 Build 16241 Home, Insider Fast Ring
Everything was working fine until the latest build came down for me. I previously was using Fedora 25. The first time I experienced this I did an lxinstall /uninstall /y /full - and uninstalled WSL in Windows features, then reinstalled.
C:\Users\tronik>lxrun /install
Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution.
Distributions can be installed by visiting the Windows Store:
https://aka.ms/wslstore
-- Beta feature --
This will install Ubuntu on Windows, distributed by Canonical and licensed under its terms available here:
https://aka.ms/uowterms
Type "y" to continue: y
Downloading from the Windows Store... 100%
Extracting filesystem, this will take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: tronik
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!
Documentation is available at: https://aka.ms/wsldocs
I then run bash, passwd for tronik, sudo passwd root, to change passwords.
And then... get-prebuilt.py for fedora:latest and
C:\opt\WSL-Distribution-Switcher>install.py fedora:latest
[*] Probing the Linux subsystem...
[*] Default user is tronik at /home/tronik.
[*] Reading /etc/{passwd,shadow,group,gshadow} entries for root and tronik...
[*] Removing leftover rootfs-temp...
[*] Beginning extraction...
[*] Backing up current rootfs to rootfs_ubuntu_xenial...
[*] Switching to new rootfs...
[*] Writing entries of root and tronik to /etc/{passwd,shadow,group,gshadow}...
C:\opt\WSL-Distribution-Switcher>switch.py
usage: ./switch.py image[:tag]
The following distributions are currently installed:
- fedora:latest*
- ubuntu:xenial
You do not seem to have the default distribution installed anymore.
To reinstall it, run lxrun /uninstall and lxrun /install from the command prompt.
C:\opt\WSL-Distribution-Switcher>bash
Error: 0x80070040
Press any key to continue...
In addition, restarting or stopping/starting lxssmanager has no effect.
As well as trying to switch back to ubuntu:xenial with switch.py yields message about Linux subsystem is currently running. Please kill all instances before continuing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.