Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

Support "Bash on Windows" #154

Closed
turbobuilt opened this issue Jul 19, 2017 · 62 comments
Closed

Support "Bash on Windows" #154

turbobuilt opened this issue Jul 19, 2017 · 62 comments

Comments

@turbobuilt
Copy link

Migrated from: meteor/meteor#7583

Meteor 1.4 and meteor 1.5 don't work on Windows Subsystem for Linux. 1.3 worked though. If this worked, MDG could drop support for regular windows binaries. That would be great because meteor on windows is painfully slow anyways.

@hwillson
Copy link
Contributor

Some people have reported having great luck using Meteor with the Windows Subsystem for Linux (see meteor/meteor#5091 (comment)). What issues are you seeing?

@turbobuilt
Copy link
Author

I haven't tried it in a while, so maybe it works now. However, at least one person reported problems:
meteor/meteor#7583 (comment)

@mizzao
Copy link

mizzao commented Jul 19, 2017

I believe all versions of Meteor work great when completely self-contained inside WSL. However, this isn't ideal: WSL doesn't have a graphical environment, so you have to install your own X server on Windows (rather janky at the moment) or edit everything with vim or emacs in a console.

The design of WSL is to allow both Linux and Windows applications to access files in the same filesystem, the Windows filesystem. (It doesn't work the other way). So you make your meteor app under C:\Users\myself\..., which shows up under /mnt/c/Users/myself/... in WSL. You can then edit the files with a Windows editor (e.g. VS Code or WebStorm), and Meteor picks up the file changes and does everything it normally would in Linux.

This worked great up to Meteor 1.3.5.1, but no longer with Meteor 1.4. In this case you basically get this error:

Unexpected mongo exit code 100. Restarting.   
Unexpected mongo exit code 100. Restarting.   
Unexpected mongo exit code 100. Restarting.   
Can't start Mongo server.                     
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.

To reproduce this in WSL (again, works fine with 1.3.5.1, not with 1.4+):

cd /mnt/c/Users/myself/
meteor create myapp
cd myapp
meteor

It's very likely the upgrade to Mongo 3.2 (in Meteor 1.4) that broke things; meteor/meteor#7583 is pretty clear that it's not working for anyone. You can also see lots more details in this thread: https://forums.meteor.com/t/linuxs-meteor-install-now-works-natively-on-windows/21954/21

A while ago, this post suggested the awkward workaround of setting up MongoDB using the Windows version of Meteor: meteor reset, meteor run, then switching back to WSL (for increased performance, access to other Linux utilities, etc.) This somehow sets up Mongo in a Windows-friendly way, after which the Linux meteor works properly. However, I just tested this with Meteor 1.5 and it doesn't work anymore, throwing the following errors:

Your development database is using mmapv1, the old, pre-MongoDB 3.0 database engine. You should consider upgrading to Wired
Tiger, the new engine. The easiest way to do so in development is to run meteor reset. If you'd like to migrate your database,
please consult https://docs.mongodb.org/v3.0/release-notes/3.0-upgrade/
                                              
Unexpected mongo exit code null. Restarting.  
                                              
Your development database is using mmapv1, the old, pre-MongoDB 3.0 database engine. You should consider upgrading to Wired
Tiger, the new engine. The easiest way to do so in development is to run meteor reset. If you'd like to migrate your database,
please consult https://docs.mongodb.org/v3.0/release-notes/3.0-upgrade/
                                              
Unexpected mongo exit code 100. Restarting.   
                                              
Your development database is using mmapv1, the old, pre-MongoDB 3.0 database engine. You should consider upgrading to Wired
Tiger, the new engine. The easiest way to do so in development is to run meteor reset. If you'd like to migrate your database,
please consult https://docs.mongodb.org/v3.0/release-notes/3.0-upgrade/
                                              
Unexpected mongo exit code 100. Restarting.   
Can't start Mongo server.                     
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.

My intuition for a fix here is to get Meteor to run the Windows-version of Mongo when it detects a WSL environment. But maybe it has something to do with file locking, in which case it would be far more complicated.

@RDeluxe
Copy link

RDeluxe commented Aug 9, 2017

Same problem here. That would be so nice to use meteor correctly on windows.

@w33zy
Copy link

w33zy commented Aug 31, 2017

Same problem also. The meteor command is giving me an error in Windows. Now I am getting an error in WSL.

@fuzzybabybunny
Copy link

fuzzybabybunny commented Sep 14, 2017

So here is a small summary of what I've found using Windows Subsystem for Linux:

  • There are ZERO plans by Microsoft to allow Windows programs to edit files in the Linux directory (located in a hidden folder called 'lxss.'

https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/

People have tried, the Windows programs don't add the right headers to the files, and the files become invisible to Linux. This is the best case scenerio. Worst case would probably be file corruption and the Linux environment doesn't function.

  • If I install my Meteor app inside lxss (~ or whatever in bash) instead of mount/c I no longer get any mongo errors and everything seems to be fine.... but this also means that none of my meteor files are editable in my Windows environment, which completely ruins everything.

  • MDG probably has support for Windows Subsystem WAY down on their priority list.

Due to all these factors, how have people's experiences been using something like VcXsrv Windows X Server along with Atom or Sublime? Crashing? Slowdowns? Lag? Resource intensive? It's a janky-ass workaround, but it seems to be the only option for editing Windows Subsystem Linux files in Windows.

@mizzao
Copy link

mizzao commented Sep 15, 2017

I have a pretty weird setup right now, but it works:

  • Run Meteor on Windows
  • Use VS Code on Windows as an editor
  • Do any other Meteor/bash operations in /mnt/c/... under a Linux shell. Pretty much everything works here except meteor run because of Mongo.

I recently found that Meteor runs much faster on Windows if you disable Windows Defender real-time scanning, which uses 100% CPU as Antimalware Service Executable and slows everything down whenever Meteor downloads packages from the Internet. That was my original reason for trying to run Meteor in WSL - because it was so slow.

@abernix
Copy link
Contributor

abernix commented Sep 15, 2017

Has anyone here been trying Windows Sub-system for Linux (WSL) (a.k.a. Bash on Windows) with the bleeding edge Windows Insider Releases (nightly builds, etc.)?

More specifically, does anyone know if some of the file system problems are alleviated with DrvFs? The blog post about it can be found here. I realize this was posted in April 2017, but I'm not sure if it's even been released into the official Windows 10 builds yet.

WSL is obviously a work in progress by Microsoft, but it's something which we're really excited about since it greatly simplifies our ability to move Meteor forward quicker by allowing a unified code-base. It's incredible how far the Microsoft team has come (with what they were up against, compatibility-wise), but we still have a lot of exceptions in place just for Windows and WSL has certainly made some of that easier.

A lot of the most breakthrough improvements to the WSL experience have appeared in the Insider builds, and 4 months before the Creatives Update was released I had amazing improvements in my experience on WSL (something I don't use often, as I'm on macOS, but the difference was incredible).

We would greatly appreciate help from Windows users who are able to help us improve it. My assistance in getting started with contributing is always on the table, but the Development.md document has a lot of the "getting started" details.

@joadr
Copy link

joadr commented Sep 21, 2017

Hi, DrvFs doesn´t make mongo work.
I´ve been testing as I think WSL is going to make thinks way better for windows users.
As I see, the article talks about 16176 build and I have 16291. I followed the instructions and mounted the drive DrvFs. I confirmed it was mounted by looking /proc/mounts which outputs

C: /mnt/c drvfs rw,relatime 0 0

Mongo keeps failing with the same error.

@abernix
Copy link
Contributor

abernix commented Sep 21, 2017

@joadr What if you run:

export LC_ALL=C

...and then try starting Meteor (and Mongo) as usual?

@joadr
Copy link

joadr commented Sep 21, 2017

/mnt/c/Users/joadr-w/projects/meteor $ export LC_ALL=C
/mnt/c/Users/joadr-w/projects/meteor $ meteor
[[[[[ /mnt/c/Users/joadr-w/projects/meteor ]]]]]

=> Started proxy.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start Mongo server.
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.

@mizzao
Copy link

mizzao commented Sep 21, 2017

@joadr I think the previous post is the result of running meteor from Windows cmd and then later running meteor from WSL using the db that was created from Windows. If you meteor reset on that project (or a copy of it), do you still see the exit code 100? Or something else?

@joadr
Copy link

joadr commented Sep 21, 2017

@mizzao You are totally right, I will delete that post to not bring confusion.
By the way, it outputs the exit codes 100
Anyway is good to know that it also doesn´t work with mmapv1

@joadr
Copy link

joadr commented Sep 21, 2017

Anyway as meteor for windows is super slow, even disabling Windows Defender's Realtime Security, I work with an external mongo server, and then meteor runs well on WSL.

@mizzao
Copy link

mizzao commented Oct 9, 2017

Strange error in WSL at the moment: if trying to run more than one Meteor instance at once (on a different port), the following error occurs when starting the second instance:

Retrying after error { [Error: SQLITE_IOERR: disk I/O error] errno: 10, code: 'SQLITE_IOERR' }
Retrying after error { [Error: SQLITE_IOERR: disk I/O error] errno: 10, code: 'SQLITE_IOERR' }
/home/mao/.meteor/packages/meteor-tool/.1.5.2.108jvny++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:218
      throw error;
      ^

Error: SQLITE_IOERR: disk I/O error
    at Error (native)
 => awaited here:
    at Promise.await (/home/mao/.meteor/packages/meteor-tool/.1.5.2.108jvny++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:60:12)
    at [object Object]._.extend._execute (/tools/packaging/catalog/catalog-remote.js:355:8)
    at /tools/packaging/catalog/catalog-remote.js:144:10
    at [object Object]._.extend._retry (/tools/packaging/catalog/catalog-remote.js:156:16)
    at new Db (/tools/packaging/catalog/catalog-remote.js:143:8)
    at [object Object]._.extend.initialize (/tools/packaging/catalog/catalog-remote.js:694:15)
    at /tools/cli/main.js:844:20

This is in the Meteor 1.5.2 tool, but the project is using some other Meteor release.

@merlinstardust
Copy link

I have had this issue with VMs and I just tried my fix on Bash on Windows. If you mount the local folder, it works. You should also mount node_modules to be safe

// mount .meteor/local
sudo mount --bind ~/.mounts/app-name/.meteor/local `pwd`/.meteor/local

// mount node_modules
sudo mount --bind ~/.mounts/app-name/node_modules `pwd`/node_modules 

Make sure you are in your app's directory so pwd works correctly

@janKir
Copy link

janKir commented Nov 25, 2017

I could also make it running the way @merlinpatt described using the simple-todo app. However, when I try to access Mongo in another console via meteor mongo I get an error: Retrying after error { Error: SQLITE_IOERR: disk I/O error ...
Still, it is compiling without problems and the browser is working, too, even after this error.

EDIT: This is apparently not a Mongo error, since other Meteor commands throw the same error.

@sdasun
Copy link

sdasun commented Nov 26, 2017

@janKir did you find a solution?

@janKir
Copy link

janKir commented Nov 26, 2017

No, I did not try anything on the meteor mongo etc. error.
As I said, meteor run works if I bind the .meteor/local directory to a linux-only folder. I don't even need to do this with the node_modules. This way, I'm currently working on a small test project.

@brucejo75
Copy link

brucejo75 commented Nov 28, 2017

@sdasun, @janKir, @mizzao,

I found a workaround to the

Error: SQLITE_IOERR: disk I/O error

details @ meteor/meteor#9426.

This appears to be because of: microsoft/WSL#1927
Also related: microsoft/WSL#2395

Workaround?

Hack your local version of catalog-remote.js found here for v1.6:

~/.meteor/packages/meteor-tool/.1.6.0.1whvdik.oongk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/tools/packaging/catalog/catalog-remote.js

Change: https://github.com/meteor/meteor/blob/devel/tools/packaging/catalog/catalog-remote.js#L144
to

self._execute('PRAGMA journal_mode=TRUNCATE');

And it worked!

FYI: here is the file on my local WSL installation of Meteor 1.6 to modify:

Recommendation

Option 1 new environment variable

Add an environment variable, METEOR_SQLITE_JOURNAL_MODE. If METEOR_SQLITE_JOURNAL_MODE is set then open SQLite with journal_mode=$METEOR_SQLITE_JOURNAL_MODE.

A flag like this may be useful for users that are seeing this issue.

Option 2 change journal mode

or could simply make the change to TRUNCATE.

Let me know if you want me to submit a PR for this.

@brucejo75
Copy link

brucejo75 commented Nov 28, 2017

@abernix,

I believe that the fall creators update has the DrvFS on it.

My entire project is on my E: drive aka /mnt/e.

For Meteor I am still getting the errors. I also tried:

mongod --dbpath .meteor/local/db

Looks like mongo is surprised by the file WiredTiger.wt, then it cannot do a directory-sync.

Output

bruce@DEVPC:/mnt/e/u/temp/testu$ mongod --dbpath .meteor/local/db
2017-11-28T14:47:44.870-0800 I CONTROL  [initandlisten] MongoDB starting : pid=5439 port=27017 dbpath=.meteor/local/db 64-bit host=DEVPC
2017-11-28T14:47:44.871-0800 I CONTROL  [initandlisten] db version v3.4.10
2017-11-28T14:47:44.872-0800 I CONTROL  [initandlisten] git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
2017-11-28T14:47:44.875-0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-11-28T14:47:44.876-0800 I CONTROL  [initandlisten] allocator: tcmalloc
2017-11-28T14:47:44.877-0800 I CONTROL  [initandlisten] modules: none
2017-11-28T14:47:44.878-0800 I CONTROL  [initandlisten] build environment:
2017-11-28T14:47:44.878-0800 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-11-28T14:47:44.879-0800 I CONTROL  [initandlisten]     distarch: x86_64
2017-11-28T14:47:44.879-0800 I CONTROL  [initandlisten]     target_arch: x86_64
2017-11-28T14:47:44.881-0800 I CONTROL  [initandlisten] options: { storage: { dbPath: ".meteor/local/db" } }
2017-11-28T14:47:44.906-0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=7531M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-11-28T14:47:44.922-0800 E STORAGE  [initandlisten] WiredTiger error (17) [1511909264:922581][5439:0x7fc4be330d00], connection: .meteor/local/db/WiredTiger.wt: handle-open: open: File exists
2017-11-28T14:47:44.924-0800 I STORAGE  [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.24
2017-11-28T14:47:45.433-0800 E STORAGE  [initandlisten] WiredTiger error (5) [1511909265:433968][5439:0x7fc4be330d00], connection: .meteor/local/db/: directory-sync: fdatasync: Input/output error
2017-11-28T14:47:45.437-0800 I -        [initandlisten] Assertion: 28595:5: Input/output error src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 276
2017-11-28T14:47:45.441-0800 I STORAGE  [initandlisten] exception in initAndListen: 28595 5: Input/output error, terminating
2017-11-28T14:47:45.443-0800 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2017-11-28T14:47:45.444-0800 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-11-28T14:47:45.448-0800 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2017-11-28T14:47:45.448-0800 I CONTROL  [initandlisten] now exiting
2017-11-28T14:47:45.451-0800 I CONTROL  [initandlisten] shutting down with code:100

@abernix
Copy link
Contributor

abernix commented Nov 29, 2017

Copy/pasting from meteor/meteor#9426 for further discussion:


@brucejo75 said in meteor/meteor#9426 (comment):

I think enabling a workaround via an environment variable is a pretty good solution?

@abernix replied in meteor/meteor#9426 (comment):

We prefer automatic detection over additional configuration (which requires discovery and implementation by users who are experiencing the problem). If that's not possible, or this needs to be explored without breaking for another segment of users, then an environment variable might be a temporary option, but I'd like to avoid considering that as a solution.

If you're confident in your solution (and can reason around any downsides to that change) I'd suggest we detect it automatically (Windows && WSL && ??) and make the change for everyone.


If others can confirm this tweak to Mongo's journaling helps the situation, let's discuss making it more permanent!

@janKir
Copy link

janKir commented Nov 29, 2017

Changing the journal_mode to truncate made the meteor mongo command work for me.

@brucejo75
Copy link

Hi @abernix, like your idea about automatically detecting WSL (I had looked at any identifying environment variables and could not find any).

Regarding downside, I know nothing about SQLite. From the threads on the WSL bugs I had gathered that WAL is the best performing of the SQLite journaling modes. The claim in the threads was that using non-WAL was a performance issue. Here is the journaling mode pragma description.

I do not know how many times the SQLite DB is accessed per build, but I am going to guess it is in the 10's, maybe 100's. I am assuming that is a relatively small hit to the build performance and given it does not work at all on WSL today worth the change for WSL if we can keep it to that environment.

@abernix
Copy link
Contributor

abernix commented Nov 29, 2017

I do not know how many times the SQLite DB is accessed per build, but I am going to guess it is in the 10's, maybe 100's.

Some benchmarking would be great if you have some time. I'd venture to say that it could be quite high. The SQLlite database is used to cache the package catalog and could be making a lot of requests. I'm not asking you to measure the requests, but perhaps if you could (outside of WSL) compare the two modes of operation.

@brucejo75
Copy link

brucejo75 commented Dec 1, 2017

Hi @abernix,

I activated DEBUG_SQL here by setting METEOR_DEBUG_SQL.

And I was able to get timings from my project.

All runs were performed on windows.

First test:

meteor run my app in both journal_mode=WAL & journal_mode=TRUNCATE, ran 2 tests.
Timing results can be found here.

Second test:

meteor reset, meteor run both apps concurrently.
Timing results can be found here.

ALERT: I got a SQLite error on straight windows while in WAL mode when I ran the 2nd test. This may be a problem for more than just WSL.

Discussion

I think the performance differences between the 2 schemes are negligible for this use case 10's of transactions per clean rebuild.

Note the comment in the catalog-remote.js code:

// WAL mode copes much better with (multi-process) concurrency

Maybe in earlier versions collision problems were detected when not using WAL mode?

This is the checkin that turned on WAL.

I could not find an associated issue. Maybe this? Maybe it was just voodoo 😺

@mizzao
Copy link

mizzao commented Dec 5, 2017

An update to my earlier posts: Meteor 1.6.0 running on the Fall Creators Update (build 1709) still experiences the Mongo unable to start problem. (Not surprising given no updates to WSL were in this update.)

However, though the earlier Creators Update (build 1703) improved inotify support for a number of Linux apps, it actually did not help for Mongo. So a fix is still somewhere in the future...

@faziloub
Copy link

any new about this issue ?

@brucejo75
Copy link

Running Meteor using bash on windows (aka WSL) works well and has been my primary development environment since the beginning of the year.

Mongo issues

I just filed meteor/meteor#9914 to make sure it is looked at directly. (the issue is a little buried in this thread, partly my fault! sorry @mizzao)

There are issues running Mongo 😞, but they can be worked around!

  • Create your project off of the ~ directory. Running from there starts Mongo.
    I do not recommend this option because none of your windows tools will be able to write files in that sub-directory.
  • Instead of running Mongo within WSL set up a DB running in Windows and connect to it by setting MONGO_URL properly. Or even try running mongod from a db setup under the ~ directory.

Multiple simultaneous meteor servers

With the release of v1.7 there is an new environment variable: METEOR_SQLITE_JOURNAL_MODE.

After you install v1.7 (and only after):
To be able to run multiple versions of meteor within WSL set METEOR_SQLITE_JOURNAL_MODE=TRUNCATE.

@smeijer
Copy link

smeijer commented May 29, 2018

For the mongo part, I would recommend using Mongo trough Docker, and connect to that instance instead. Makes it also possible to explore the database when Meteor ain't running.

But mostly, I'm surprised by:

Running Meteor using bash on windows (aka WSL) works well and has been my primary development environment since the beginning of the year.

I've tried it in January when I bought my new notebook. But the filesystem on WSL is terribly slow. Really on the level that it's unbearable.

@brucejo75
Copy link

brucejo75 commented May 29, 2018

re:

For the mongo part, I would recommend using Mongo trough Docker, and connect to that instance instead. Makes it also possible to explore the database when Meteor ain't running.

I set up my windows Mongo as a windows service. So it is always running when my dev box is up & I can always inspect it. No need for Docker.

re:

I've tried it in January when I bought my new notebook. But the filesystem on WSL is terribly slow. Really on the level that it's unbearable.

I often times see comments like these. But I have no issues with speed. None!

I made sure that defender was not monitoring my development directories and I made sure my editor was not monitoring meteor build directories. Both of these slow down the apparent filesystem speed by a large amount. I also turn off monitoring of node by defender.

I added an update to the forum topic on this which shows my exclusion settings for Defender and for VSCode while developing using WSL.

@faziloub
Copy link

When i installed mongodb its works fine in linux wsl windows 10 april update

@ProphetDaniel
Copy link

@fifou17 , where did you install mongodb, windows? I installed inside Linux bash shell following this and it didn't fix for me...

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org

@faziloub
Copy link

faziloub commented Jul 14, 2018

@ProphetDaniel i installed in linux bash ubuntu 18.04 using sudo apt-get install mongodb
and i did MONGO_URL and started service mongodb its works if the project meteor is in the linux bash and you cant edit the project source from windows yu will get permission denied but if is in windows its doesnt work even if you install mongodb in windows it wont work

@brucejo75
Copy link

@fifou17, @ProphetDaniel, see meteor/meteor#9914

@ipinyulun
Copy link

After you install v1.7 (and only after):
To be able to run multiple versions of meteor within WSL set METEOR_SQLITE_JOURNAL_MODE=TRUNCATE.

is any body there using meteor 1.8.0.2?
im using WSL as well and i had set up env var METEOR_SQLITE_JOURNAL_MODE=TRUNCATE
and even hardcode it inside catalog-remote.js
however its still not working.
i could not perform more that 1 build at the same time.

anybody have the solution maybe?

@faziloub
Copy link

faziloub commented Apr 3, 2019

@ipinyulun the project must be in windows out of wsl and if you cloned the project from github you need to clone from wsl

@yanqingkai
Copy link

yanqingkai commented Jun 13, 2019

Running Meteor using bash on windows (aka WSL) works well and has been my primary development environment since the beginning of the year.

Mongo issues

I just filed meteor/meteor#9914 to make sure it is looked at directly. (the issue is a little buried in this thread, partly my fault! sorry @mizzao)

There are issues running Mongo 😞, but they can be worked around!

  • Create your project off of the ~ directory. Running from there starts Mongo.
    I do not recommend this option because none of your windows tools will be able to write files in that sub-directory.
  • Instead of running Mongo within WSL set up a DB running in Windows and connect to it by setting MONGO_URL properly. Or even try running mongod from a db setup under the ~ directory.

Multiple simultaneous meteor servers

With the release of v1.7 there is an new environment variable: METEOR_SQLITE_JOURNAL_MODE.

After you install v1.7 (and only after):
To be able to run multiple versions of meteor within WSL set METEOR_SQLITE_JOURNAL_MODE=TRUNCATE.

i use meteor 1.8.1 do all that thing but not work.
still Retrying after error { Error: SQLITE_IOERR: disk I/O error ...
i clone a project in wsl. Then install ok.
but start failed. without any multi process

@yanqingkai
Copy link

@ipinyulun
i think i am the same with you.
did you work out?

@brucejo75
Copy link

@yanqingkai,

Can you build a single server on WSL? If not, you may need to reset your Meteor SQLite DB. This DB is used to track package installs for meteor.

I am still using Meteor on WSL very successfully. I am hoping that WSL2 will resolve some of the files system issues of WSL and this issue may go away entirely!

@yanqingkai
Copy link

yanqingkai commented Jun 14, 2019

@brucejo75
I start a ubuntu1804.
sudo apt install g++ build-essential git curl python-minimal
curl https://install.meteor.com/ | sh
Clone a project.
Then install Ok.
But start failed.
set env even fix catalog-remote.js code.
But still start failed with SQLITE_IOERR.
Then I meteor reset. install and start
SQLITE_IOERR disappear. But https://github.com/meteorhacks/meteorx/issues/8 come.
fix as https://github.com/meteorhacks/meteorx/issues/8#issuecomment-476190781.
Then something orthers come.
I will all reset and do this again.
Could you please give me a simple path from start a wsl ubuntu1804 to start a meteor 1.8.1 app like Rocket.chat.
it will be very ❤️ of you

@brucejo75
Copy link

It sounds like the SQLITE_IOERR has stopped for you? If so, then you are having trouble with another issue.

Before building a project on WSL you might just try a meteor create for a simple build of a test project.

For issues with meteorhacks/meteorx you should seek help on that issue thread.

@yanqingkai
Copy link

@brucejo75
thanks very much.
SQLITE_IOERR still exist when first start.
Then meteor reset. And install sqlite locked.
After delete the db file. install ok.
Then start failed is another trouble.
No matter at all. WSL2 comes now.
Im going to play with wsl2.

@LuizMoratelli
Copy link

This worked for me:

  1. Delete .meteor/local
  2. Create a folder in home dir like mkdir ~/projects/project
  3. Create a symlink cd .meteor && ln -s ~/projects/project local
  4. Run meteor cd .. && meteor

https://www.youtube.com/watch?v=EjmOkiiMAWw

@PGlivicky
Copy link

Is this still an issue? Now, for me, everything works fine without the workaround suggested in the comment before the const JOURNAL_MODE declaration (line 23) in https://github.com/meteor/meteor/blob/master/tools/packaging/catalog/catalog-remote.js .

Namely in a freshly created default app directory meteor mongo runs without errors.

I'm using the latest Meteor 1.11.1 and Ubuntu 20.04 in WSL2 on Win10 (10.0.19041).

@brucejo75
Copy link

brucejo75 commented Dec 2, 2020

Hi @PGlivicky,

Is your default app directory off the linux root tree? e.g. ~pglivicky...

If so, meteor & mongo will work just fine in that scenario. Issues come when:

  • mongo does not work if your project is in a drive that is not on the root (e.g. /mnt/d)
  • SQLite I/O errors occur if you run multiple server instances simultaneously.

Just installed WSL2 but have not gotten to the point of testing meteor yet. It would be good to know if you are working in those scenarios?

@PGlivicky
Copy link

Hello @brucejo75. Thank you for explaining.

I'm using meteor in WSL2 for almost 2 months now with my project folder in my linux home directory ( ~/... ) and without issues. But the mongo itself worked absolutely fine even when my project was on the windows drive ( /mnt/c/... ). I had problems with editing the files there in vscode though, so I didn't test more than running a few mongo queries from shell.

@brucejo75
Copy link

@PGlivicky, thanks for the update! Also, glad to hear that mongo is working.

VScode Idea: Try editing your files with Remote-WSL:

  1. View -> Command Palette...
  2. Search for WSL
  3. select Remote-WSL

Then editing files will not add the carriage return aka ^M

@filipenevola
Copy link
Collaborator

Hi @brucejo75 what about creating a PR to incorporate your adjustments into Meteor core?

@brucejo75
Copy link

Hi @filipenevola,

I already did!

See TRUNCATE journal mode for packaging DB on Windows like file systems. But it turned out that this caused an issue for meteor upgrade. So this fix was made. And a new environment variable METEOR_SQLITE_JOURNAL_MODE was added.

Beyond that I think some documentation may help. At least the environment variable should be documented and then it may be helpful to outline the issues with running mongo on WSL.

I can add that to my todos.

@PGlivicky
Copy link

@brucejo75

VScode Idea: Try editing your files with Remote-WSL

thank you for the tip. I'll try that.

@StorytellerCZ
Copy link
Collaborator

@brucejo75 Please do!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests