edgedb / edgedb-cli

The EdgeDB CLI
https://www.edgedb.com/docs/cli/index
Apache License 2.0
167 stars 23 forks source link

`edgedb project init` fails in WSL. Can't start an instance #781

Closed emme1444 closed 2 years ago

emme1444 commented 2 years ago

Steps to Reproduce:

  1. Run edgedb project init in the WSL shell in a directory on the WSL filesystem.
  2. Output is:
    No `edgedb.toml` found in `/home/user/dev/project_name` or above
    Do you want to initialize a new project? [Y/n]
    > Y
    Specify the name of EdgeDB instance to use with this project [default: project_name]: 
    > project_name
    Checking EdgeDB versions...
    Specify the version of EdgeDB to use with this project [default: 2.0-rc.3]: 
    > 2.0-rc.3
    ┌─────────────────────┬──────────────────────────────────────────────────┐
    │ Project directory   │ /home/user/dev/project_name                      │
    │ Project config      │ /home/user/dev/project_name/edgedb.toml          │
    │ Schema dir (empty)  │ /home/user/dev/project_name/dbschema             │
    │ Installation method │ portable package                                 │
    │ Version             │ 2.0-rc.3+8c42ac9                                 │
    │ Instance name       │ project_name                                     │
    └─────────────────────┴──────────────────────────────────────────────────┘
    Version 2.0-rc.3+8c42ac9 is already installed
    Initializing EdgeDB instance...
    [systemctl] Failed to connect to bus: No such file or directory
    [2022-07-22T13:25:39Z WARN  edgedb::portable::linux] failed to reload systemd daemon: systemctl failed: exit status: 1 (command-line: "systemctl" "--user" "daemon-reload")
    [systemctl] Created symlink /home/user/.config/systemd/user/default.target.wants/edgedb-server@project_name.socket → /home/user/.config/systemd/user/edgedb-server@project_name.socket.
    [systemctl] Failed to connect to bus: No such file or directory
    [2022-07-22T13:25:39Z WARN  edgedb::portable::project] Error running EdgeDB as a service: service start failed: exit status: 1 (command-line: "systemctl" "--user" "start" "edgedb-server@project_name.socket")
    EdgeDB will not start on next login. Trying to start database in the background...
    Specifying instance name as positional argument is deprecated. Use `-I project_name` instead.
    [systemctl] Failed to connect to bus: No such file or directory
    edgedb error: service start failed: exit status: 1 (command-line: "systemctl" "--user" "start" "edgedb-server@project_name.socket")

I stumbled on to #647, however the output presented there seems to suggest it's possible to start the instance with edgedb instance start, just not "auto-startable", if I understood correctly. My instance, however, does not want to start at all, as suggested by the lack of suggestion.

Am I missing something? Are there any workarounds? Or did I stumble onto something unseen?

elprans commented 2 years ago

This should have been fixed in #778. There will be a release with a fix today.

emme1444 commented 2 years ago

Thanks for the response! I'll try it out tomorrow.

emme1444 commented 2 years ago

Hi @elprans!

Ok, so I've tried out cli version 2.0.0-dev.811+1a17756. I don't know if this is what you meant when you said there'd be a fix for later today, but anyway. I mean the warning message added in #778 exists so yeah.

This version does have the warning but it doesn't really help me, since the message only mentions auto-startup. However, like I explained in the issue description above, EdgeDB does not want to start the instance at all. As you can see with the updated logs below. All calls to systemctl return exit status: 1.

No `edgedb.toml` found in `/home/user/dev/edgedb/init_test3` or above
Do you want to initialize a new project? [Y/n]
> Y
Specify the name of EdgeDB instance to use with this project [default: init_test3]:
> init_test3
Checking EdgeDB versions...
Specify the version of EdgeDB to use with this project [default: 2.0-rc.3]:
> 2.0-rc.3
┌─────────────────────┬───────────────────────────────────────────────┐
│ Project directory   │ /home/user/dev/edgedb/init_test3              │
│ Project config      │ /home/user/dev/edgedb/init_test3/edgedb.toml  │
│ Schema dir (empty)  │ /home/user/dev/edgedb/init_test3/dbschema     │
│ Installation method │ portable package                              │
│ Version             │ 2.0-rc.3+8c42ac9                              │
│ Instance name       │ init_test3                                    │
└─────────────────────┴───────────────────────────────────────────────┘
Version 2.0-rc.3+8c42ac9 is already installed
Initializing EdgeDB instance...
[systemctl] Failed to connect to bus: No such file or directory
[2022-07-23T13:55:35Z WARN  edgedb::portable::linux] failed to reload systemd daemon: systemctl failed: exit status: 1 (command-line: "systemctl" "--user" "daemon-reload")
[systemctl] Created symlink /home/user/.config/systemd/user/default.target.wants/edgedb-server@init_test3.socket → /home/user/.config/systemd/user/edgedb-server@init_test3.socket.
[systemctl] Failed to connect to bus: No such file or directory
[2022-07-23T13:55:35Z WARN  edgedb::portable::project] Error running EdgeDB as a service: service start failed: exit status: 1 (command-line: "systemctl" "--user" "start" "edgedb-server@init_test3.socket")
EdgeDB will not start on next login. Trying to start database in the background...
Specifying instance name as positional argument is deprecated. Use `-I init_test3` instead.
[systemctl] Failed to connect to bus: No such file or directory
edgedb error: service start failed: exit status: 1 (command-line: "systemctl" "--user" "start" "edgedb-server@init_test3.socket")

Running edgedb instance list

[systemctl] Failed to connect to bus: No such file or directory
┌───────┬────────────┬───────┬──────────────────┬──────────┐
│ Kind  │ Name       │ Port  │ Version          │ Status   │
├───────┼────────────┼───────┼──────────────────┼──────────┤
│ local │ init_test3 │ 10703 │ 2.0-rc.3+8c42ac9 │ inactive │
└───────┴────────────┴───────┴──────────────────┴──────────┘

shows the instance as inactive.

Running edgedb instance start init_test3 outputs the following.

Specifying instance name as positional argument is deprecated. Use `-I init_test3` instead.
[systemctl] Failed to connect to bus: No such file or directory
edgedb error: service start failed: exit status: 1 (command-line: "systemctl" "--user" "start" "edgedb-server@init_test3.socket")

I genuinely don't understand. What am I missing?

tailhook commented 2 years ago

Can you show the output of env command?

I can't reproduce that on Windows 11 on wsl2. Do you have some specific shell configuration file? Do you use default shell or a custom one? Or maybe you're running edgedb command from a script or other command?

emme1444 commented 2 years ago

I am using zsh (oh-my-zsh). However I can reproduce the issue using bash too.

Here is the `env` for `zsh` ``` SHELL=/usr/bin/zsh LSCOLORS=Gxfxcxdxbxegedabagacad LESS=-R NVM_INC=/home/user/.nvm/versions/node/v18.6.0/include/node WSL_DISTRO_NAME=Ubuntu-22.04 WT_SESSION=7a8673b0-60fa-4372-9e14-bd15b40272cf NAME=DESKTOP-OV3D6ED PWD=/home/user/dev/edgedb/init_test4 LOGNAME=user HOME=/home/user LANG=en_US.UTF-8 WSL_INTEROP=/run/WSL/8_interop LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: WAYLAND_DISPLAY=wayland-0 NVM_DIR=/home/user/.nvm LESSCLOSE=/usr/bin/lesspipe %s %s TERM=xterm-256color ZSH=/home/user/.oh-my-zsh LESSOPEN=| /usr/bin/lesspipe %s USER=user DISPLAY=:0 SHLVL=2 NVM_CD_FLAGS=-q BASH_ENV=/etc/bash.bashrc PAGER=less XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir WSLENV=WT_SESSION:BASH_ENV/u:WT_PROFILE_ID PATH=/home/user/.nvm/versions/node/v18.6.0/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/windows/system32:/mnt/c/windows:/mnt/c/windows/System32/Wbem:/mnt/c/windows/System32/WindowsPowerShell/v1.0/:/mnt/c/windows/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/nodejs/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Microsoft SQL Server/120/Tools/Binn/:/mnt/c/Program Files/Common Files/Autodesk Shared/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/user/AppData/Roaming/edgedb/bin:/mnt/c/Users/user/.cargo/bin:/mnt/c/Users/user/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/user/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/user/AppData/Roaming/npm:/mnt/c/Program Files (x86)/GitHub CLI/:/mnt/c/Users/user/flutter/bin:/mnt/c/Users/user/protoc/bin:/mnt/c/Users/user/AppData/Local/Pub/Cache/bin:/mnt/c/Users/user/controlmymonitor:/mnt/c/Users/user/.dotnet/tools:/mnt/c/Users/user/AppData/Roaming/edgedb/bin:/mnt/c/Program Files (x86)/Nmap:/mnt/c/Users/user/AppData/Roaming/edgedb/bin NVM_BIN=/home/user/.nvm/versions/node/v18.6.0/bin HOSTTYPE=x86_64 PULSE_SERVER=/mnt/wslg/PulseServer WT_PROFILE_ID={17bf3de4-5353-5709-bcf9-835bd952a95e} OLDPWD=/home/user/dev/edgedb _=/usr/bin/env ```
Here is the `env` for `bash` ``` SHELL=/usr/bin/bash NVM_INC=/home/user/.nvm/versions/node/v18.6.0/include/node WSL_DISTRO_NAME=Ubuntu-22.04 WT_SESSION=ed313adb-b45e-4724-a376-8805ca68119c NAME=DESKTOP-OV3D6ED PWD=/home/user/dev/edgedb/init_test5 LOGNAME=user MOTD_SHOWN=update-motd HOME=/home/user LANG=en_US.UTF-8 WSL_INTEROP=/run/WSL/797_interop LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: WAYLAND_DISPLAY=wayland-0 NVM_DIR=/home/user/.nvm LESSCLOSE=/usr/bin/lesspipe %s %s TERM=xterm-256color LESSOPEN=| /usr/bin/lesspipe %s USER=user DISPLAY=:0 SHLVL=1 NVM_CD_FLAGS= BASH_ENV=/etc/bash.bashrc XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir WSLENV=WT_SESSION:BASH_ENV/u:WT_PROFILE_ID XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop PATH=/home/user/.local/bin:/home/user/.local/bin:/home/user/.nvm/versions/node/v18.6.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/windows/system32:/mnt/c/windows:/mnt/c/windows/System32/Wbem:/mnt/c/windows/System32/WindowsPowerShell/v1.0/:/mnt/c/windows/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/nodejs/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Microsoft SQL Server/120/Tools/Binn/:/mnt/c/Program Files/Common Files/Autodesk Shared/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/user/AppData/Roaming/edgedb/bin:/mnt/c/Users/user/.cargo/bin:/mnt/c/Users/user/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/user/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/user/AppData/Roaming/npm:/mnt/c/Program Files (x86)/GitHub CLI/:/mnt/c/Users/user/flutter/bin:/mnt/c/Users/user/protoc/bin:/mnt/c/Users/user/AppData/Local/Pub/Cache/bin:/mnt/c/Users/user/controlmymonitor:/mnt/c/Users/user/.dotnet/tools:/mnt/c/Users/user/AppData/Roaming/edgedb/bin:/mnt/c/Program Files (x86)/Nmap:/snap/bin NVM_BIN=/home/user/.nvm/versions/node/v18.6.0/bin HOSTTYPE=x86_64 PULSE_SERVER=/mnt/wslg/PulseServer WT_PROFILE_ID={17bf3de4-5353-5709-bcf9-835bd952a95e} _=/usr/bin/env OLDPWD=/home/user/dev/edgedb ```

The following is the same for both zsh and bash.

$ which edgedb
/home/user/.local/bin/edgedb
$ file $(which edgedb)
/home/user/.local/bin/edgedb: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, BuildID[sha1]=ce3509ecb4488ffd8036e15d13e8c58e32d96e08, stripped

EdgeDB CLI version 2.0.0-dev.811+1a17756

tailhook commented 2 years ago

Ah, right, it's the new GUI support in windows that set XDG_RUNTIME_DIR. I was finally able to reproduce that. Should be easy to fix.