Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo on windows subsystem for linux
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
aliceinwire
Developer
Developer


Joined: 27 Mar 2013
Posts: 5
Location: Tokyo, Japan

PostPosted: Fri Jun 03, 2016 6:47 am    Post subject: Gentoo on windows subsystem for linux Reply with quote

Gentoo on windows subsystem for linux

any idea?

looks like they already did for fedora
https://www.variantweb.net/blog/running-fedora-on-windows-10-using-wsl/
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Fri Jun 03, 2016 12:37 pm    Post subject: Reply with quote

I looked a bit into it. Deleting all the Ubuntu stuff and replacing it with a stage3 (akin to what Fedora did) is one possibility.

The Ubuntu on Windows development unfortunately was done in secret. And despite promises of technical details, not much has been released publicly yet.
http://www.hanselman.com/blog/DevelopersCanRunBashShellAndUsermodeUbuntuLinuxBinariesOnWindows10.aspx
http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html
Dustin Kirkland wrote:
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. That required me to use Microsoft Visual Studio to clone a sample application, edit a few dozen XML files, create a bunch of icon .png's of various sizes, and so on.
I searched, but I could not find any documentation which describes how to perform these steps.
Back to top
View user's profile Send private message
iprice
n00b
n00b


Joined: 12 Jul 2016
Posts: 1

PostPosted: Tue Jul 12, 2016 7:10 pm    Post subject: Reply with quote

I actually had a go at this.

You can do the swapping of the root's pretty much, install WSL, run 'bash', install its ubuntu base, unarchive the stage 3 into a directory (i called /s3) and basically swap the file systems over.

You have some problems because of what I presume is the way windows implements file locking... I think you can specify what command to 'start' as a parameter to 'the windows 'bash' executable', so something like "bash /s3/bin/busybox etc etc" might be useful

Essentially mv everything from / into /old, rm -rf sensibly whatever's left (ignore sys proc mnt dev), you'll need to use busybox probably to do this because of the static linking. rm -rf any 'safe' folders that remain (usr, bin, sbin etc), it might complain about purging some parts of /usr or /bin but persistence paid off (!)

Once done you can mv or cp the stage3 from /s3 into the root. You'll need to move "init" from the old install back into the root. (dont know what happens if you dont, actually).

Set your /etc/locale.gen and locale-gen ... resolver doesn't seem to matter thus far (or is auto configured, i didn't even look). ICMP doesn't work.



You might need to use "lxrun /setdefaultuser root" (or may just find this useful).



None of the above is particularly of note, it's a bit fudgy but i've actually done this on real linux machines recently (swapping remote operating systems), it's a little more fudgey for reasons of windows locking i guess but it works still.

I suggest you "su -" after you run bash, i dont think the default init thing properly sets up bits of the environment, i get locale errors sometimes etc etc.




The reason I'm making this post, aside from having the time while my machine does some building, was to share the next "hurdle" I came across and it's resolution.

The problem is emerging anything fails pretty early on (after the unpacking of the source) with some error about "ebuild-ipc daemon process not detected". At first I was worried there was some limitation in the filesystem implementation that was being tripped, but I manually compiled bash (as a test package) so it seemed like in theory trying to build stuff oughta be possible.


The problem comes down to a file called "build-ipc.py". this is located on my system at /usr/lib64/portage/python3.5/build-ipc.py , though your lib directory may change, as may your python version directory (python 2.7 on my other machines mostly)...

In here you can find "def _daemon_is_alive(self)" which 'tries' to do something to do with locking, which fails miserably (i guess). If you delete this entire try/except/else and just replace it with "return True" (with the correct level of indentation, cant remember but python cares I believe), then ebuild commands run and complete.

I'm no gentoo expert, and worry a bit about the problem being to do with locking, since such things are sometimes used as guards, but if I look at this segment of code, not only is it only supposed to "check if something is running", which presumably it is since the builds succeed, and thus its just the check thats defective....
but also the whole check is centered around trying to FAIL to do something - it tries to get the lock, and if it fails, it assumes the daemon has the file open and says "all good here!". if the lock succeeds, it unlocks it again and says the daemon isn't running..... so i guess the locking code doesn't properly enforce something in microsoft's implementation here...

anyone know if this is likely to be an issue somewhere? I'm pretty sure bodging this check is fine, but are there any well known problems with locking not functioning properly and always returning the "OK" state? I know this is a bit of an old gripe for unix anyway as various NFS setups have 'struggled' with this and caused issues for things like MTAs (i think, its been a long time since i did nfs-root work, and i imagine the support/code has progressed in the decade gone by).




Mostly just sharing progress, I'm currently updating world, and i'll probably do an 'emerge -e @world' at some point for lulz, and to see what breaks.
Back to top
View user's profile Send private message
eddy89
Apprentice
Apprentice


Joined: 01 Feb 2006
Posts: 180
Location: /world/Italy/Torino

PostPosted: Mon Nov 14, 2016 6:00 pm    Post subject: Reply with quote

Hi,
Quote:
The problem comes down to a file called "build-ipc.py". this is located on my system at /usr/lib64/portage/python3.5/build-ipc.py , though your lib directory may change, as may your python version directory (python 2.7 on my other machines mostly)...

Thanks to floppym from gentoo irc channel, I found a way to sort this out in a "clean" way:

As described here https://archives.gentoo.org/gentoo-portage-dev/message/b0c27bce9f0ccffee2e2923145741a7b
You can temporary replace _default_lock_fn = fcntl.lockf to _default_lock_fn = fcntl.flock in /usr/lib/python2.7/site-packages/portage/locks.py

Then, as this bug is solved in keyword-masked portage version 2.3.2, you can unmask it and go like a charm!

P.s: Instead of moving the whole rootfs from inside the bash environment, just replace the rootfs directory with the gentoo one in windows (cmd or explorer)
Back to top
View user's profile Send private message
brokenHeart
n00b
n00b


Joined: 15 May 2013
Posts: 35
Location: versailles

PostPosted: Sat Nov 19, 2016 11:07 am    Post subject: Reply with quote

Hi,

I actually doing some experiments with WSL and Gentoo.
The "_default_lock_fn = fcntl.lockf to fcntl.flock" trick have not solved the problem for me.
When using stage3 and basically follows install handbook this allows you to pass "emerge --config sys-libs/timezone-data" but the first "real" emerge fails with another IPC relative error ...
Code:
File "/usr/lib/portage/python2.7/ebuild-ipc.py", line 282, in <module>
    sys.exit(ebuild_ipc_main(sys.argv[1:]))
  File "/usr/lib/portage/python2.7/ebuild-ipc.py", line 279, in ebuild_ipc_main
    return ebuild_ipc.communicate(args)
  File "/usr/lib/portage/python2.7/ebuild-ipc.py", line 136, in communicate
    lock_obj = portage.locks.lockfile(self.ipc_lock_file, unlinkfile=True)
  File "/usr/lib64/python2.7/site-packages/portage/locks.py", line 113, in lockfile
    raise PermissionDenied(func_call)
portage.exception.PermissionDenied: open('/var/tmp/portage/app-eselect/eselect-vi-1.1.7-r1/.ipc_lock'


I have totally turned off IPC by setting _enable_ipc_daemon to False in /usr/lib64/python2.7/site-packages/_emerge/AbstractEbuildProcess.py ( https://github.com/Microsoft/BashOnWindows/issues/992 ) This have solved my problem but I don't understand all consequences. May be there is a more tricky, clean and efficient solution ?

When you first log with bash.exe in a new rootfs a init executable file is created and fired to start linux scripts. Some usefull directories (/dev and few others)are also created and populated. I suppose this tree and processes started by init are mainly Debian distributions compliant. Workarounds will certainly be necessaries to have a more operational and performant Gentoo system ported to WSL.

While installing I have found many others bugs relative to network stack, FS or MS kernel API, for which you can find, most of the time, a workaround or a little patch available somewhere, I have compiled some in french forum.
For the moment, the only real problem I found is with
Code:
timer_create: Function not implemented
not implemented in MS kernel API.
GHC and (if you install it in binary mode) all compilations based on Haskell seems impossibles but with Gentoo what is really impossible ?

https://github.com/Microsoft/BashOnWindows/issues/307


PS : my install proc
- as root or sudo untar stage3 tarbal ( tar xvjpf stage3-*.tar.bz2 --xattrs ) in an ubuntu bash in a /root/gentoo directory
(seen from Windows root directory is outside rootfs but from ubuntu bash is /root)
- exit bash
- rename rootfs in rootfs_ubuntu in windows explorer (MS key+R => %localappdata%\lxss + enter)
- in cmd (admin mode)
Code:
cd %localappdata%\lxss
C:\Users\Toto\AppData\Local\lxss> move root\gentoo .\rootfs

then run
Code:
lxrun /setdefaultuser
to set a user for this new rootfs.
Use root as default user
and start bash.exe
ensure user and setuid bits are what and where they must be (by example /bin/su -rws--x--x root root ) ...
Back to top
View user's profile Send private message
eddy89
Apprentice
Apprentice


Joined: 01 Feb 2006
Posts: 180
Location: /world/Italy/Torino

PostPosted: Wed Mar 14, 2018 11:33 am    Post subject: Reply with quote

Hi,
Sorry for upping this post, but I think that a lot of problems in new WSL (Windows 1709) has been solved and Gentoo could run smoothly. Moreover, they added the ability to install different distros via the app store, we could try to prepare and propose a Microsoft Store version of Gentoo! :D
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2283
Location: Adendorf, Germany

PostPosted: Wed Mar 14, 2018 12:31 pm    Post subject: Reply with quote

eddy89 wrote:
Hi,
Sorry for upping this post, but I think that a lot of problems in new WSL (Windows 1709) has been solved and Gentoo could run smoothly. Moreover, they added the ability to install different distros via the app store, we could try to prepare and propose a Microsoft Store version of Gentoo! :D
Installation of stage3 is easy now. See:
gentoo subsystem on windows 10, ask here if you need help
. ;-)
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Wed Mar 14, 2018 1:06 pm    Post subject: Reply with quote

eddy89 wrote:
Hi,
Sorry for upping this post, but I think that a lot of problems in new WSL (Windows 1709) has been solved and Gentoo could run smoothly. Moreover, they added the ability to install different distros via the app store, we could try to prepare and propose a Microsoft Store version of Gentoo! :D

You cannot associate Gentoo name on something that doesn't respect Gentoo social contract.
Even Gentoo will not depends on Microsoft Store itself, that "Gentoo" version (the WSL one) would ; and you can just see it there why it is bad: if you are not using windows 10 64bits, that page is refusing to gave you the debian WSL: https://www.microsoft.com/en-gb/store/p/debian-gnu-linux/9msvkqc78pk6 with a This app does not work on your device.. While debian doesn't depends on MS store, the Debian WSL one totally depends on it.

So, could you have gentoo in WSL? I think it's doable yes, but not "gentoo" ; fork it, name it the way you like, but don't provide a version with Gentoo name or logo in it as it is against Gentoo philosophy.

The problem with store, is that they put restrictions (at first to help user not using something that would not work on his system), but should still provide a way to get it (what user will do with it, is part of the freedom many open source project expect to be carry on, i could just want debian WSL to install it on another device that would be able to run it, or just to look at it or whatever reason i would need it), but the result remains the same: monetary restrictions (need to pay), login restrictions (need to subscribe and as such accept all policies that the subscription would put on yourself: privacy usage...), drm and all kind of shit like that are against the philosophy of free software.

Because right now, even "free" (of charge), you cannot get that Debian WSL app which should made Debian users totally mad (you can see https://www.debian.org/social_contract #1 is broken by Debian WSL by We will never make the system require the use of a non-free component. ; because however you take it, that Debian WSL do depends on MS Store, and MS Store is a non-free component.

This is really bad to associate your name and logo and philosophy to another project that doesn't respect it: WSL versions break this, while WSL versions do profit from the name and work of people associate with debian (or gentoo or whatever distro carrying that philosophy).
Debian and its users doesn't shine because a WSL version exists, the one that shine is Windows 10 that is proud to offer Debian to its users. But it only shine base on Debian's name, because it provide Debian to Windows 10 users, but it doesn't provide the mentality and philosophy Debian is trying to carry on with its project and as such goes against the Debian project itself.

I'm not a debian user so they do what they want, but as a Gentoo user i hope our trustees would kick MS ass if they start using Gentoo name and logo to create a WSL gentoo version that would abuse Gentoo name and fame to make Windows 10 shine more while fucking the mentality and philosophy Gentoo is made on.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, Finland

PostPosted: Wed Mar 14, 2018 2:59 pm    Post subject: Reply with quote

krinn wrote:
~snippetisnap~
++
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
eddy89
Apprentice
Apprentice


Joined: 01 Feb 2006
Posts: 180
Location: /world/Italy/Torino

PostPosted: Wed Mar 14, 2018 10:19 pm    Post subject: Reply with quote

Sorry krinn, I get your point(s) but I'm not saying that Gentoo could be *only* obtained via Microsoft store. If you want to get Gentoo for free, you still can, also if it's on the store. If you want the ability (and the comfort) to get it from the store, you should be able to, if it's doable. All the restrictions you mentioned of the store are applied to the comfort part, but no one is forcing you to use the store.
About the Debian social contract, I think you're confusing the *requirement* of a non-free component with the ability to have it over one of these. Correct me if I'm wrong.
I'm a Gentoo user too, but I'm also a Windows user, and although I'm not a philosopher, I'm a user of whatever I think it's useful. And I think that Gentoo on WSL could be useful. End of story.
You really think that's about making Windows shine? I'm sorry, but again, here's nothing about shining IMHO.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Mar 14, 2018 11:33 pm    Post subject: Reply with quote

eddy89 wrote:
Sorry krinn, I get your point(s) but I'm not saying that Gentoo could be *only* obtained via Microsoft store. If you want to get Gentoo for free, you still can, also if it's on the store. If you want the ability (and the comfort) to get it from the store, you should be able to, if it's doable. All the restrictions you mentioned of the store are applied to the comfort part, but no one is forcing you to use the store.

krinn, sorry but this here is right. If Gentoo had a zero-tolerance policy for non-free infrastructure, it'd already be violating it with the existence of https://github.com/gentoo/gentoo.
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2678

PostPosted: Wed Mar 14, 2018 11:55 pm    Post subject: Reply with quote

Whatever the philosophy angle, krinn is very much correct that branding a non-Gentoo product with the Gentoo name and logo would be in violation of Gentoo copywrite.

guidelines wrote:
You may not use the Gentoo name in any software project that can be used to augment or extend the capabilities of official Gentoo project software (hosted on the gentoo.org domain).

The use of the Gentoo name or logo for repositories, overlays or projects that solely focus on the official Gentoo project software and documentation is seen as service identification and is governed under that section.
EDIT: No need to point out that installing on windows is not an official capability of Gentoo and is an augmentation or extension of the supported kernel therefore the Gentoo branding is specifically been disallowed.
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2283
Location: Adendorf, Germany

PostPosted: Thu Mar 15, 2018 8:51 am    Post subject: Reply with quote

Sorry if this sounds stupid, but what the hell would anybody want to install a WSL instance of Gentoo via the Microsoft App Store in the first place? That instance would be out-of-date the day after it got released anyway.

If you really must have Gentoo within a WSL instance, just install a stage3 tarball using legacy WSL like in the thread linked above shows.

...hell, such an App Store instance would be out-of-date even before it would hit the store...
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, Finland

PostPosted: Thu Mar 15, 2018 10:09 am    Post subject: Reply with quote

So if installed via M$ App Store you cannot emerge -u @world?
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2283
Location: Adendorf, Germany

PostPosted: Thu Mar 15, 2018 11:44 am    Post subject: Reply with quote

Zucca wrote:
So if installed via M$ App Store you cannot emerge -u @world?
You would be able to, of course. The fun starts when the provided tree is growing old...
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, Finland

PostPosted: Thu Mar 15, 2018 12:19 pm    Post subject: Reply with quote

Yamakuzure wrote:
Zucca wrote:
So if installed via M$ App Store you cannot emerge -u @world?
You would be able to, of course. The fun starts when the provided tree is growing old...
Ah. Of course. Keeping it updated on M$ store would be PITA I guess.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Mar 15, 2018 2:47 pm    Post subject: Reply with quote

eddy89 wrote:
but I'm not saying that Gentoo could be *only* obtained via Microsoft store. If you want to get Gentoo for free, you still can, also if it's on the store.

There's a suitability you miss there, you cannot get Gentoo from the store, you can get ONLY gentoo WSL from it.
So unlike what you think, you can ONLY get gentoo WSL from the store, even you can get gentoo from elsewhere.
And i don't want or need to download gentoo to see what it is, i was trying to download gentoo WSL to see what it is ; which is impossible because i'm on gentoo (well not gentoo but debian) and the store disallow me to do so.



Ant P. wrote:
krinn, sorry but this here is right. If Gentoo had a zero-tolerance policy for non-free infrastructure, it'd already be violating it with the existence of https://github.com/gentoo/gentoo.

And it is, having the tree host on github.com is an aberration ; where git hosting could had been handle by a computer from the gentoo infrastructure.

You may think, bah, not a big issue there, but there's one: github is an American company that is rule under USA laws
At least i know you have age restriction (i dunno if it come from US laws or just github.com policy), as only a 13+ old could create an account on github, and as such kick out any 13- below genius from commit access. Some more restrictions may exists.

While everyone may say i'm picky, just having the tree host on github make gentoo depends on github rules, which add restrictions unrelated to gentoo itself, and these restrictions DO remove freedom (last time i check the "Become a dev" section of gentoo didn't impose you must be 13+)

So why i don't gives that much a fuck about github.com usage while i care a few more about gentoo WSL?
Because i think restrictions of github.com can be easy bypass.
But for the Gentoo WSL, there's nothing you can do against that, as i'm not discussing the quality of the gentoo product run under WSL but the endorsement of Microsoft politics imply by allowing Gentoo name to be associate with it.

I'm not against Gentoo under WSL, i'm against Gentoo name where they could fork and use their own name to not associate Gentoo with them.
If you prefer, Wine is named Wine, not "Microsoft Windows under Linux", ok?
I'm also not against github.com as-is, but i could say while i wouldn't do anything to goes against it, i would be a few more happier if git hosting was done by Gentoo infra instead.

eddy89 wrote:
I'm a Gentoo user too, but I'm also a Windows user, and although I'm not a philosopher, I'm a user of whatever I think it's useful. And I think that Gentoo on WSL could be useful. End of story.
You really think that's about making Windows shine? I'm sorry, but again, here's nothing about shining IMHO.

And yes, it would make MS shine, in the sense that instead of having to dual boot Windows and Gentoo, because of WSL you only have Windows install, while still using Gentoo. But your OS is not Gentoo, it's Windows. As such the OS hosting other OS became the critical one, if you use Gentoo to host Windows, debian or whatever OS in VM, in your eyes, you can loose any of them, but removing Gentoo mean loosing all. That OS is then the one that shine, as it's the critical one and must remain install.
WSL is a good way to make sure Windows is kept install and people must still buy it, even they like to play with debian or gentoo or whatever other OS.
There's no benefits for Gentoo thru WSL, you might have more comfort as a Windows user, but what comfort you get as Gentoo user from it?

WSL is the Microsoft weapon for the fight of cloud computing, in no way WSL was made for any comfort of Windows user, just like it would be stupid to think any store (well, all i know) were made for comfort of users, they were made to make profit, even they offer free stuff to download.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum