Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite Browser fails to open a DB inside a wsl2 installation #2142

Closed
1 task
Because789 opened this issue Feb 20, 2020 · 35 comments
Closed
1 task

SQLite Browser fails to open a DB inside a wsl2 installation #2142

Because789 opened this issue Feb 20, 2020 · 35 comments
Labels
enhancement Feature requests. wsl Windows Subsystem for Linux

Comments

@Because789
Copy link

Because789 commented Feb 20, 2020

Details for the issue

What did you do?

I tried to open a SQLite database inside of a Windows Subsystem for Linux 2 installation (Ubuntu) and nothing happened. I copied the database to my desktop and the db opened fine.

That means, it did NOT work with this path:
\wsl$\Ubuntu\home\iamgroot\dev\dev.db
But it did work with this path:
C:\Users\iamgroot\Desktop\dev.db

I guess that behaviour is to be expected, since I try to open a file from a linux file system in a Windows software, and this issue therefore should be labeled feature request. But looking at the seemless integration of vscode and wsl2, it feels more like a bug...

Useful extra information

The info below often helps, please fill it out if you're able to. :)

What operating system are you using?

  • [x ] Windows: ( version: 2004 (Build 19564.1005) with WSL 2 activated (Ubuntu))

What is your DB4S version?

  • [ x] 3.11.2 (64bit for Windows)

Did you also

@mgrojo
Copy link
Member

mgrojo commented Mar 2, 2020

"Virtual" filesystems usually give problems when opening an SQLite file inside them. See for example #2084. Isn't there any error message when you try to open the DB file?

@tomlagier
Copy link

I'm having this same issue with WSL1, no error message given. Are there logs somewhere I can take a look at?

@mgrojo
Copy link
Member

mgrojo commented Mar 26, 2020

Open it from a "Command Prompt" window; maybe it prints some error. When using a nightly build, there is also an error log in the "SQL Log" dock. You have to select it from the combo box.

Besides, have you checked whether you can write to the db file and the containing directory? Try opening it in read-only mode, and maybe the problem is skipped.

@karim karim added the wsl Windows Subsystem for Linux label Apr 24, 2020
@karim
Copy link
Member

karim commented Apr 24, 2020

@Because789 Please check #2209 for more information.

I guess that behaviour is to be expected, since I try to open a file from a linux file system in a Windows software, and this issue therefore should be labeled feature request.

Unfortunately, there is nothing we can do here. WSL is not meant to run GUI apps. If you really want that, you can install an X Server on Windows.

But looking at the seemless integration of vscode and wsl2, it feels more like a bug...

VS Code is doing that using an extension (https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl). If you checked the first image in this link https://code.visualstudio.com/docs/remote/wsl you will see how it works.

Basically, you run VS Code on Windows and you just send/receive commands to WSL (Linux environment) in the background, for tools that are running on WSL.

I'm not sure how we can change Database Browser for SQLite to support WSL. If you want to open the app on Windows while the database is on Linux then I wouldn't recommended it with SQLite (the library).

SQLite does not work well on networked/virtualized/emulated file systems due to file locking issues that are unique to each file system. When more than one file system is involved, SQLite fails to operate correctly.

A different approach is to sync/copy the database file itself so you can have access to it on Windows and WSL, while opening it using the GUI on Windows only.

@justinclift
Copy link
Member

@karim At some future point, we could potentially do something similar to the DbAndroid plugin for SQLite Studio: https://github.com/pawelsalawa/sqlitestudio/wiki/DbAndroid

eg have a plugin that runs on the "remote" system (inside WSL in this case), and pipeline requests between DB4S and that plugin to "do stuff" in WSL.

Can't see it being something we'd do in the near future though, unless someone decides it'd be an interesting project to pick up sooner rather than later.

@karim
Copy link
Member

karim commented Apr 26, 2020

That's a good idea, and not hard to do. I will label this as enhancement for now.

@karim karim added the enhancement Feature requests. label Apr 26, 2020
@mattwojo
Copy link

mattwojo commented Jul 6, 2020

Following. :)

@jramiresbrito
Copy link

Following too :)

@ActiveChooN
Copy link

Following too

@GeoMaciolek
Copy link

Question - if the problem (or part of the problem?) is filesystem locking not being supported (on the \\wsl$\... share) - but, opening "readonly" - shouldn't we be able to skip file locking when opening readonly?

@blacksheepaul
Copy link

It seems still no solution

@Bilalharoon
Copy link

also following

@jesuscmdev
Copy link

Siguiendo,
Al intentar abrir un archivo database.sqlite de mi subsistema linux sqlite browser se queda en blanco
Gracias!

@johandos
Copy link

Continúa el problema, he intentado realizar la conexión con phpstorm y no permite hacerlo

@DerAlSem
Copy link

It's still there (and following)

@vbrozik
Copy link

vbrozik commented Dec 30, 2021

Could you please fix the SQLite Browser to show an error message when opening a database on a \\wsl$\ file system fails?

DB Browser for SQLite Version 3.12.2 still fails silently.

@GusSand
Copy link

GusSand commented Oct 6, 2022

October 2022, Still fails silently on WSL2 Ubuntu. Windows 10

@noviceGuru
Copy link

November 2022, same problem

@justinclift
Copy link
Member

Do other GUI applications works inside WSL? Aside from Visual Studio Code that is, which has it's own extension based workaround to support it (as mentioned above).

@xewl
Copy link

xewl commented Nov 26, 2022

What I do as a workaround; I've set up & installed VcXsrv and run sqlitebrowser (and some other AppImages) from within WSL2.

@justinclift
Copy link
Member

Ahhhh, interesting. That's the "set up an X server" approach @karim mentioned. Does it work decently well?

@rickh57
Copy link

rickh57 commented Nov 26, 2022

WSLg works for this. That avoids the need to configure VcXsrv, and WSLg is now available for Windows 10 and Windows 11. (I've tried this from one of my Win11 systems -- I haven't confirmed that it works on my Win10 systems, but I've launched other Linux GUI apps there and expect it to work).

@justinclift
Copy link
Member

Awesome! That WSLg thing looks useful for people. 😄

@GusSand @noviceGuru @DerAlSem @Bilalharoon @guluguru @ActiveChooN @mattwojo @tomlagier This seems like it might be the right solution, at least for now. 😄

@rickh57
Copy link

rickh57 commented Nov 27, 2022

I'm using the version of sqlitebrowser that I install using apt.

@noviceGuru
Copy link

@justinclift Actually this was my problem:
I used to think using SQLite browser in Windows, if I browsed to the correct directory to pick up my DB file (which is in my WSL), the browser would work, but I was wrong. The only way is to run it from WSL itself, and having Xserver , run the app graphically.
So you'll have to install Xserver on your Windows, get it running and test it, then use apt to install SQLite browser and then run it.
This link worked for me to get my Xserver running (which was a headache):
https://aalonso.dev/blog/how-to-use-gui-apps-in-wsl2-forwarding-x-server-cdj

@rickh57
Copy link

rickh57 commented Nov 27, 2022

With the latest WSLg, you don't have to install an Xserver yourself; it's built into WSL itself.

@xewl
Copy link

xewl commented Nov 28, 2022

and expect it to work).

Wasn't aware of WSLg myself either, cheers for the heads up!
Edit: actually had to undo some of my manual Display setup for Xsrv, but it "just works™" now!

@rickh57
Copy link

rickh57 commented Nov 28, 2022

I installed and ran sqlitebrowser in WSLg on my Win10 systems and it worked fine there, too.

@justinclift
Copy link
Member

Awesome! 😄

@jessielw
Copy link

WSLg works great. Thanks for the tips!

@Because789
Copy link
Author

Since we have a good solution with WSLg, I'm gonna close this issue.

@vbrozik
Copy link

vbrozik commented Feb 9, 2023

@Because789 using WSLg is a workaround. It is probably not suitable for everyone and the original bug is still there. I do not understand why this is considered to be a reason for closing the issue?

In my opinion the most serious part of the problem is not that it is not possible to open the file but that SQLite Browser does not show any error message explaining the problem and it leaves all the users to investigate what is going on.

@chrisjlocke
Copy link
Member

but that SQLite Browser does not show any error message

Don't shoot the messenger.
If DB4S cannot see a file to open, it cannot open it. It cannot cast spells and summon the file to appear if the OS doesn't show it.
WSL is a 'feature' and it doesn't guarantee 100% that everything is going to work 100% with everything else.

@kelle
Copy link

kelle commented Nov 27, 2023

I found this thread useful and just want to add some more details.

  • The error we got was a "Database is locked" message. So, at least there's an error message now!

  • In order to install SQLite Browser in WSL, follow the install instructions for Ubuntu on the Downloads page. Currently, these are the commands to run from a WSL Terminal:

sudo add-apt-repository -y ppa:linuxgndu/sqlitebrowser
sudo apt-get update
sudo apt-get install sqlitebrowser
  • It then shows up as an app in the Start menu.

@parastooam
Copy link

That is great, thank you @kelle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. wsl Windows Subsystem for Linux
Projects
None yet
Development

No branches or pull requests