Run Pash in docker goes wrong

71 views
Skip to first unread message

zackl...@hotmail.com

unread,
Jul 20, 2016, 12:14:11 PM7/20/16
to Pash Project
I want to install Pash in docker and the docker image is official mono image(4.4.0).
I use xbuild to build in the source directory and it seems success although there are 47 Warnings

However, when I run the command
mono Source/PashConsole/bin/Debug/Pash.exe

Something goes wrong.  I don't know how to deal with. Any ideas?

Unhandled Exception:
System.Management.Automation.MethodInvocationException: No such provider. A provider with the name "FileSystem" doesn't exist.
  at System.Management.Automation.DriveManagementIntrinsics.GetAllForProvider (System.String providerName) <0x41326e30 + 0x0029b> in <filename unknown>:0
  at System.Management.Automation.ProviderInfo.get_Drives () <0x41326df0 + 0x0002b> in <filename unknown>:0
  at Pash.Implementation.SessionStateGlobal.SetCurrentDrive () <0x41326650 + 0x0006f> in <filename unknown>:0
  at Pash.Implementation.LocalRunspace.InitializeDefaultSnapins () <0x4130a4a0 + 0x0005b> in <filename unknown>:0
  at Pash.Implementation.LocalRunspace.Open () <0x4130a250 + 0x00113> in <filename unknown>:0
  at Pash.FullHost..ctor (Boolean interactive) <0x412cc770 + 0x000e1> in <filename unknown>:0
  at Pash.Program.Main (System.String[] args) <0x412cbdf0 + 0x00107> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Management.Automation.MethodInvocationException: No such provider. A provider with the name "FileSystem" doesn't exist.
  at System.Management.Automation.DriveManagementIntrinsics.GetAllForProvider (System.String providerName) <0x41326e30 + 0x0029b> in <filename unknown>:0
  at System.Management.Automation.ProviderInfo.get_Drives () <0x41326df0 + 0x0002b> in <filename unknown>:0
  at Pash.Implementation.SessionStateGlobal.SetCurrentDrive () <0x41326650 + 0x0006f> in <filename unknown>:0
  at Pash.Implementation.LocalRunspace.InitializeDefaultSnapins () <0x4130a4a0 + 0x0005b> in <filename unknown>:0
  at Pash.Implementation.LocalRunspace.Open () <0x4130a250 + 0x00113> in <filename unknown>:0
  at Pash.FullHost..ctor (Boolean interactive) <0x412cc770 + 0x000e1> in <filename unknown>:0
  at Pash.Program.Main (System.String[] args) <0x412cbdf0 + 0x00107> in <filename unknown>:0


Friedrich von Never

unread,
Jul 24, 2016, 12:58:58 AM7/24/16
to Pash Project
Hello! Could you please provide your Dockerfile so we reproduce the issue? I don't think anybody was observing this error before.

zackl...@hotmail.com

unread,
Jul 24, 2016, 5:16:50 AM7/24/16
to Pash Project
Here is my Dockerfile:

FROM mono:latest
RUN apt-get update && \
 apt-get install -y git
RUN mkdir /root/pash
WORKDIR /root/pash
RUN git clone https://github.com/Pash-Project/Pash.git . && \
 xbuild
CMD ["mono", "Source/PashConsole/bin/Debug/Pash.exe"]

You can just build and run, then you may reproduce the issue.


在 2016年7月24日星期日 UTC+8下午12:58:58,Friedrich von Never写道:

Friedrich von Never

unread,
Jul 24, 2016, 6:28:57 AM7/24/16
to Pash Project
Thanks for the info. I was able to reproduce the issue. It seems that Mono doesn't returns any logical drives on call System.IO.DriveInfo.GetDrives() if executing inside Docker.

Looks like a Mono bug 31021, the fix was merged a couple of months ago (March 15). I know nothing about a Mono or mono-docker release cycle, so I am not able to tell if the fixed version is released or not.

Could someone please research further? Can we fix the problem on Pash side or at least give some recommendations to Docker users?

// I will repost this to our issue tracker

Friedrich von Never

unread,
Jul 24, 2016, 6:36:48 AM7/24/16
to Pash Project

zackl...@hotmail.com

unread,
Jul 24, 2016, 8:30:11 AM7/24/16
to Pash Project
Thanks, but is there any alternative choice now? I have to run PowerShell script and C# in Linux in Docker.

eg. Use wine and .net, but only powershell 1.0 can be used in wine.

      Or can I build and use pash on wine with .net.

Any good ideas.

在 2016年7月24日星期日 UTC+8下午6:36:48,Friedrich von Never写道:

Stefan Burnicki

unread,
Jul 25, 2016, 3:10:44 AM7/25/16
to Pash Project
I can not reproduce this issue. The Dockerfile works for me when building and running it with
```
docker build -t pash .
docker run -it --rm pash
```
I'm running docker 1.11.2 on Ubuntu 16.04 with kernel 4.6.0-040600rc6-generic.
What system are you using?

The error message "No such provider. A provider with the name "FileSystem" doesn't exist." looks like it doesn't find the *provider* which is part of the `System.Management.Automation.dll`.
What you might want to try is to run the container with bash, cd into the build directory and run it from there:
```
docker run -it --rm pash bash
cd ~/pash/Source/PashConsole/bin/Debug
mono Pash.exe
```
(or change the WORKDIR in the Dockerfile accordingly).

Also, please note that it's very likely that you need to adjust your Powershell script to run with Pash, as Pash is still missing lots of features.

zackl...@hotmail.com

unread,
Jul 25, 2016, 5:20:15 AM7/25/16
to Pash Project
I tried but it doesn't work.
I run it on Azure Container Service with Docker swarm/1.1.0 and API version 1.2.2. The OS is Ubuntu 14.04 with Kernel Version: 3.19.0-59-generic.

I also tried to run on my local system without swarm, it goes wrong as well.

Did you get 47 warnings when pash was compiled? 

Stefan Burnicki

unread,
Jul 25, 2016, 4:40:30 PM7/25/16
to Pash Project
Alright, I was able to reproduce and investigate the issue with another machine running docker 1.10.3.
The problem is that "/" doesn't appear in `/proc/mount` in old docker versions, so mono cannot return information about "/" in FileSystemProvider.cs:352.

The only possible workaround is currently an up to date docker version. I can also write a fix for this issue. However, I will need a day or two until I have time for this.

Btw, 47 warnings is (unfortunately) normal when compiling Pash.

zackl...@hotmail.com

unread,
Jul 25, 2016, 11:54:24 PM7/25/16
to Pash Project


I'm so confused that I install the latest Docker on my local machine but it shows the same issue as the old version. Now, the version is  1.12.0-rc4 with API version 1.24.

I'm using Windows 10, so the docker is based on Hyper-v, and it shows the OS is Alpine Linux v3.4. So, I'm not sure whether the OS is the key.

Friedrich von Never

unread,
Jul 26, 2016, 12:51:16 AM7/26/16
to Pash Project
I have also been testing Hyper-V Docker on Windows 10. Maybe that's the case, yeah.

Stefan Burnicki

unread,
Jul 26, 2016, 1:39:15 AM7/26/16
to Pash Project
This is weird, as I'm also experiencing the issue on Ubuntu with an older kernel and docker version.
Anyway, I just wrote a fix which is currently available on a branch of my github fork. Please try it with this Dockerfile
```
FROM mono:latest
RUN apt-get update && \
apt-get install -y git
RUN mkdir /root/pash
WORKDIR /root/pash
RUN git clone https://github.com/sburnicki/Pash.git . && \
   git checkout newdrive_fix && \
   xbuild
CMD ["mono", "Source/PashConsole/bin/Debug/Pash.exe"]
```
For me it solves the issue. If it also works for you, I will issue a pull request to the upstream master branch.

zackl...@hotmail.com

unread,
Jul 26, 2016, 2:05:58 AM7/26/16
to Pash Project
Oh, it works. Thank you!
Reply all
Reply to author
Forward
0 new messages