Mailing List Archive

Request: Help with Fresh
Hi all.
Is anyone able to help me troubleshoot getting Fresh set up and working on
Windows? I recently set up mediawiki with docker and want to be able to use
fresh. I use Windows 10.
Based on the instructions in the latest version of the README file[1], I
ran within git bash
```
bash -c 'curl -fsS
https://gerrit.wikimedia.org/g/fresh/+/21.04.1/bin/fresh-node10?format=TEXT
\
| base64 --decode > /usr/local/bin/fresh-node \
&& echo "d38c34d542dc685669485bbe04a9d1a926a224a4ba27a01d59ae563558d8e987
/usr/local/bin/fresh-node" | shasum -a 256 -c \
&& chmod +x /usr/local/bin/fresh-node \
&& echo -e "\n\xf0\x9f\x8c\xb1\x20Fresh\x20is\x20ready\x21\n"||(echo -e
"\xe2\x9d\x8c";false)'
```
and got the error
```
bash: line 1: /usr/local/bin/fresh-node: No such file or directory
curl: (23) Failure writing output to destination
?
```

Some investigation in the file system shows that `/usr/local` does not
exist. Where should I be trying to install it instead so that it works as a
normal command (eg `fresh-node -env -net`)?

Thanks,
--DannyS712

[1]
https://gerrit.wikimedia.org/r/plugins/gitiles/fresh/+/2eabb06e32a9971b1e9523f33bb4da0b3fce522b/README.md
Re: Request: Help with Fresh [ In reply to ]
I haven't tested these because I don't have a Windows machine handy. You
can try one of the following:

Option A: Replace '/usr/local/bin' in the invocation with '/usr/bin', which
does exist in git bash.

Option B:
1) Run:
echo 'export PATH="$PATH:/usr/local/bin"' >> ~/.bashrc
mkdir -p /usr/local/bin
chmod 775 /usr/local/bin

2) Close git bash and start it again
Run 'echo $PATH' without the quotes to confirm that /usr/local/bin is in it
Continue to run the installation command unmodified.

On Fri, Jul 2, 2021 at 8:34 AM DannyS712 Wiki <dannys712.wiki@gmail.com>
wrote:

> Hi all.
> Is anyone able to help me troubleshoot getting Fresh set up and working on
> Windows? I recently set up mediawiki with docker and want to be able to use
> fresh. I use Windows 10.
> Based on the instructions in the latest version of the README file[1], I
> ran within git bash
> ```
> bash -c 'curl -fsS
> https://gerrit.wikimedia.org/g/fresh/+/21.04.1/bin/fresh-node10?format=TEXT
> \
> | base64 --decode > /usr/local/bin/fresh-node \
> && echo "d38c34d542dc685669485bbe04a9d1a926a224a4ba27a01d59ae563558d8e987
> /usr/local/bin/fresh-node" | shasum -a 256 -c \
> && chmod +x /usr/local/bin/fresh-node \
> && echo -e "\n\xf0\x9f\x8c\xb1\x20Fresh\x20is\x20ready\x21\n"||(echo -e
> "\xe2\x9d\x8c";false)'
> ```
> and got the error
> ```
> bash: line 1: /usr/local/bin/fresh-node: No such file or directory
> curl: (23) Failure writing output to destination
> ?
> ```
>
> Some investigation in the file system shows that `/usr/local` does not
> exist. Where should I be trying to install it instead so that it works as a
> normal command (eg `fresh-node -env -net`)?
>
> Thanks,
> --DannyS712
>
> [1]
> https://gerrit.wikimedia.org/r/plugins/gitiles/fresh/+/2eabb06e32a9971b1e9523f33bb4da0b3fce522b/README.md
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Request: Help with Fresh [ In reply to ]
Thanks for the suggestions Ori - I tried Option A (using /usr/bin) and that
installed it. But, I then had trouble actually getting it to run:

In git bash, running `fresh-node` resulted in the error
> the input device is not a TTY. If you are using mintty, try prefixing
the command with 'winpty'

I tried to run the command in command prompt instead, since I understand
that it is TTY. I navigated to where the actual fresh-node file was
(C:\Program Files\Git\usr\bin>) and ran `bash fresh-node` with the result:
```
fresh-node: line 12: basename: command not found
fresh-node: line 13: basename: command not found
fresh-node: line 123: uname: command not found
/usr/bin/env: 'sh': No such file or directory
```

so I then tried harder to get it to work in git bash. A bit of testing and
internet research later about the TTY issue, and I found that the cause of
the TTY failure was that the fresh-node script has a line
`docker_args+=("--interactive" "--tty")`. I replaced this with
`docker_args+=("--interactive")` and then tried to run fresh-node again.

This time, it looked like it was starting to work, saying that it couldn't
find the 'docker-registry.wikimedia.org/releng/node10-test-browser:0.6.3-s2'
image locally and so downloaded it. However, after it downloaded, there was
an error:
```
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:380: starting container process caused: exec:
"C:/Program Files/Git/usr/bin/sh": stat C:/Program Files/Git/usr/bin/sh: no
such file or directory: unknown.
```

and repeated attempts to run `fresh-node` produce the same error (without
trying to download the image again).

Looking through file explorer, "C:/Program Files/Git/usr/bin/sh" does
appear to exist (it's a 1918 KB application).

So, what I'm wondering is:
* what is the correct way to *run* fresh-node on windows once it is
downloaded to /usr/bin?
* is this Docker error because I removed the --tty parameter? Or is it
something else?

Thanks,
--DannyS712

P.S.: sorry if I messed up the thread by emailing wikitech-l directly
instead of replying to the prior message, I get the mailing list in digest
mode, though I've just switched it to regular for now. This was meant to be
part of the thread at
https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/PZBTLTN5MJMWQ2ULVCYIFYDM4RKDQZUO/
Re: Request: Help with Fresh [ In reply to ]
I believe that the supported/recommended way to run fresh-node in Windows
is to use WSL (Windows Subsystem for Linux)
<https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux> [microsoft
documentation <https://docs.microsoft.com/en-us/windows/wsl/install-win10>]
based on a comment by Krinkle at T279131#7016315
<https://phabricator.wikimedia.org/T279131#7016315>.

Regards,
Sohom Datta.


On Mon, Jul 5, 2021 at 8:41 PM DannyS712 Wiki <dannys712.wiki@gmail.com>
wrote:

> Thanks for the suggestions Ori - I tried Option A (using /usr/bin) and
> that installed it. But, I then had trouble actually getting it to run:
>
> In git bash, running `fresh-node` resulted in the error
> > the input device is not a TTY. If you are using mintty, try prefixing
> the command with 'winpty'
>
> I tried to run the command in command prompt instead, since I understand
> that it is TTY. I navigated to where the actual fresh-node file was
> (C:\Program Files\Git\usr\bin>) and ran `bash fresh-node` with the result:
> ```
> fresh-node: line 12: basename: command not found
> fresh-node: line 13: basename: command not found
> fresh-node: line 123: uname: command not found
> /usr/bin/env: 'sh': No such file or directory
> ```
>
> so I then tried harder to get it to work in git bash. A bit of testing and
> internet research later about the TTY issue, and I found that the cause of
> the TTY failure was that the fresh-node script has a line
> `docker_args+=("--interactive" "--tty")`. I replaced this with
> `docker_args+=("--interactive")` and then tried to run fresh-node again.
>
> This time, it looked like it was starting to work, saying that it couldn't
> find the '
> docker-registry.wikimedia.org/releng/node10-test-browser:0.6.3-s2' image
> locally and so downloaded it. However, after it downloaded, there was an
> error:
> ```
> docker: Error response from daemon: OCI runtime create failed:
> container_linux.go:380: starting container process caused: exec:
> "C:/Program Files/Git/usr/bin/sh": stat C:/Program Files/Git/usr/bin/sh: no
> such file or directory: unknown.
> ```
>
> and repeated attempts to run `fresh-node` produce the same error (without
> trying to download the image again).
>
> Looking through file explorer, "C:/Program Files/Git/usr/bin/sh" does
> appear to exist (it's a 1918 KB application).
>
> So, what I'm wondering is:
> * what is the correct way to *run* fresh-node on windows once it is
> downloaded to /usr/bin?
> * is this Docker error because I removed the --tty parameter? Or is it
> something else?
>
> Thanks,
> --DannyS712
>
> P.S.: sorry if I messed up the thread by emailing wikitech-l directly
> instead of replying to the prior message, I get the mailing list in digest
> mode, though I've just switched it to regular for now. This was meant to be
> part of the thread at
> https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/PZBTLTN5MJMWQ2ULVCYIFYDM4RKDQZUO/
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Request: Help with Fresh [ In reply to ]
Unfortunately, using WSL didn't work either. I got
```
bash: curl: command not found
base64: unrecognized option: decode
BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary.

Usage: base64 [-d] [FILE]

Base64 encode or decode FILE to standard output
-d Decode data
?
```
when I tried to download it there.

A bunch of research later, and I found
https://github.com/Microsoft/vscode-docker/issues/462 which isn't directly
related but suggested that I try `//bin/sh` as the command instead of
`/bin/sh` and indeed, switching to that worked, so I got fresh working.

A summary for future reference - using fresh on windows with git bash:
* in the original download command, replace `/usr/local/bin` with `/usr/bin`
* after you download it, modify the file to remove the `--tty` argument to
the docker command, and to change the entry point from `/bin/sh` to
`//bin/sh`

Thanks for the help.
--DannyS712

On Mon, Jul 5, 2021 at 9:33 AM Sohom Datta <dattasohom1@gmail.com> wrote:

> I believe that the supported/recommended way to run fresh-node in Windows
> is to use WSL (Windows Subsystem for Linux)
> <https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux> [microsoft
> documentation <https://docs.microsoft.com/en-us/windows/wsl/install-win10>]
> based on a comment by Krinkle at T279131#7016315
> <https://phabricator.wikimedia.org/T279131#7016315>.
>
> Regards,
> Sohom Datta.
>
>
> On Mon, Jul 5, 2021 at 8:41 PM DannyS712 Wiki <dannys712.wiki@gmail.com>
> wrote:
>
>> Thanks for the suggestions Ori - I tried Option A (using /usr/bin) and
>> that installed it. But, I then had trouble actually getting it to run:
>>
>> In git bash, running `fresh-node` resulted in the error
>> > the input device is not a TTY. If you are using mintty, try prefixing
>> the command with 'winpty'
>>
>> I tried to run the command in command prompt instead, since I understand
>> that it is TTY. I navigated to where the actual fresh-node file was
>> (C:\Program Files\Git\usr\bin>) and ran `bash fresh-node` with the result:
>> ```
>> fresh-node: line 12: basename: command not found
>> fresh-node: line 13: basename: command not found
>> fresh-node: line 123: uname: command not found
>> /usr/bin/env: 'sh': No such file or directory
>> ```
>>
>> so I then tried harder to get it to work in git bash. A bit of testing
>> and internet research later about the TTY issue, and I found that the cause
>> of the TTY failure was that the fresh-node script has a line
>> `docker_args+=("--interactive" "--tty")`. I replaced this with
>> `docker_args+=("--interactive")` and then tried to run fresh-node again.
>>
>> This time, it looked like it was starting to work, saying that it
>> couldn't find the '
>> docker-registry.wikimedia.org/releng/node10-test-browser:0.6.3-s2' image
>> locally and so downloaded it. However, after it downloaded, there was an
>> error:
>> ```
>> docker: Error response from daemon: OCI runtime create failed:
>> container_linux.go:380: starting container process caused: exec:
>> "C:/Program Files/Git/usr/bin/sh": stat C:/Program Files/Git/usr/bin/sh: no
>> such file or directory: unknown.
>> ```
>>
>> and repeated attempts to run `fresh-node` produce the same error (without
>> trying to download the image again).
>>
>> Looking through file explorer, "C:/Program Files/Git/usr/bin/sh" does
>> appear to exist (it's a 1918 KB application).
>>
>> So, what I'm wondering is:
>> * what is the correct way to *run* fresh-node on windows once it is
>> downloaded to /usr/bin?
>> * is this Docker error because I removed the --tty parameter? Or is it
>> something else?
>>
>> Thanks,
>> --DannyS712
>>
>> P.S.: sorry if I messed up the thread by emailing wikitech-l directly
>> instead of replying to the prior message, I get the mailing list in digest
>> mode, though I've just switched it to regular for now. This was meant to be
>> part of the thread at
>> https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/PZBTLTN5MJMWQ2ULVCYIFYDM4RKDQZUO/
>> _______________________________________________
>> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
>> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
>>
>> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/