Error when trying to run Memgraph under Ubuntu on WSL: "System has not been booted with systemd as init system (PID 1). Can't operate." - memgraphdb

My setup is Windows 11 with WSL2 and Ubuntu 22.04.1 LTS (GNU/Linux 5.15.79.1-microsoft-standard-WSL2 x86_64). I'm following the instructions for installing Memgraph on Ubuntu
but I keep getting the error:
mike#wks1:~$ wget https://download.memgraph.com/memgraph/v2.5.1/ubuntu-22.04/memgraph_2.5.1-1_amd64.deb
--2023-01-27 09:26:51-- https://download.memgraph.com/memgraph/v2.5.1/ubuntu-22.04/memgraph_2.5.1-1_amd64.deb
Resolving download.memgraph.com (download.memgraph.com)... 172.67.130.22, 104.21.7.96, 2606:4700:3034::6815:760, ...
Connecting to download.memgraph.com (download.memgraph.com)|172.67.130.22|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17578738 (17M) [application/x-www-form-urlencoded]
Saving to: ‘memgraph_2.5.1-1_amd64.deb’
memgraph_2.5.1-1_amd64.deb 100%[=================================================>] 16.76M 18.3MB/s in 0.9s
2023-01-27 09:26:52 (18.3 MB/s) - ‘memgraph_2.5.1-1_amd64.deb’ saved [17578738/17578738]
mike#wks1:~$ sudo dpkg -i memgraph_2.5.1-1_amd64.deb
[sudo] password for mike:
Selecting previously unselected package memgraph.
(Reading database ... 24112 files and directories currently installed.)
Preparing to unpack memgraph_2.5.1-1_amd64.deb ...
Unpacking memgraph (2.5.1-1) ...
Setting up memgraph (2.5.1-1) ...
Don't forget to switch to the 'memgraph' user to use Memgraph
......+.....+.+........+......+...+...+.......+......+......+.........+.........+...+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*......+...+...+...+............+...+.......+...+...........+...+.+.........+...+...+...........+...+.......+...............+...+.....+......+.+...+......+..+...............+.............+..+....+...+.....+.+.....+.......+..............+.+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+.+........+......+.+........+............+.............+.............................+......+..........+......+......+........+......+...............+..........+...........+.........+...+.......+.....+...+................+.....+..........+......+....................+.+............+................................+...+.+..............+.+.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
..............+..+......+....+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...+....+.....+.......+............+...+........+.......+........+.........+...+...+.+.....+.............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+..+..........+...+......+...........+....+...............+.....+...+.......+.....+...+..........+...+............+........+.......+.....+.+.........+..+...+.+.....+..........+..+.........+............................+..+.+.....+........................+.+................................+...+...+.+........+.......+.........+.....+.+...+...........+............+.......+..+.+..+................+.........+......+...........+.+..+.............+..+.+..+........................+....+..+.......+........+....+........+.......+......+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----
Created symlink /etc/systemd/system/multi-user.target.wants/memgraph.service → /lib/systemd/system/memgraph.service.
mike#wks1:~$ sudo journalctl --unit memgraph
No journal files were found.
-- No entries --
mike#wks1:~$ sudo systemctl start memgraph
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
I've tried all of the tips that I got by Googling, but non of them didn't work. When I dual boot into Ubuntu, I have no problems. What am I going wrong?

The procedure for installing Memgrap using WSL and Ubuntu is different than installing Memgraph directly onto Ubuntu. There is a notice in your output that says Don't forget to switch to the 'memgraph' user to use Memgraph.
The command for running Memgraph under WSL is:
sudo runuser -l memgraph -c '/usr/lib/memgraph/memgraph'
Take a look at the documentation on how to install MemgraphDB on Windows with WSL.

Related

How to connect to the agent: IPC connect call

I'm using Ubuntu (VERSION="20.04 LTS (Focal Fossa) on Windows 10. Itried to install Docker.
I'm following the Docs from docs.docker.com:
I run the two commands:
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
When I run the second command it return an error:
Warning: apt-key output should not be parsed (stdout is not a terminal)
gpg: can't connect to the agent: IPC connect call failed
I looked in internet I found that some links trying to resolve the issue but in vein.
gpg: can't connect to the agent: IPC connect call failed
https://michaelheap.com/gpg-cant-connect-to-the-agent-ipc-connect-call-failed/
Someone have a suggestion please ?
Thanks
The temporary workaround mentioned on the issue thread at https://github.com/microsoft/WSL/issues/5125#issuecomment-625985191 worked for me. Run the commands
wget https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1871129/+files/libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb
sudo dpkg --install libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb
sudo apt-mark hold libc6 #to avoid further update
Edit: /var/lib/dpkg/info/libc6:amd64.postinst and remove the sleep 1 like so:
Change this:
To this:

memgraph service not started after installation on WSL

After installation of debian package of memgraph on windows subsystem for Linux. memgraph is not started automatically.
Install debian package for memgraph. Some errors will be shown for chattr like
chattr: Inappropriate ioctl for device while reading flags on /usr/share/memgraph/examples/Europe/snapshots.
After that memgraph is not started. Running systemctl start memgraph
gives the
error Failed to connect to bus: No such file or directory.
which is expected as systemd is not supported by WSL.
So, how can memgraph be started in a WSL shell.
By default, there is no systemd on WSL, which means that Memgraph doesn't run automatically.
Try to run Memgraph manually by executing the following shell command:
/usr/lib/memgraph/memgraph
The concrete path depends on which Linux do you use.
locate memgraph
Might help you to figure out the right path.

How to forward Docker for Mac to X11?

Using Docker for Mac 1.12 (stable) and OS X 10.11.5 (15F34), I'm attempting to make one of my containers forward to X11.
First, I install XQuartz from my bash shell:
$ brew cask install xquartz
==> Downloading https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.9.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask xquartz
==> Running installer for xquartz; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
==> installer: Package name is XQuartz 2.7.9
==> installer: Installing at base path /
==> installer: The install was successful.
🍺 xquartz staged at '/usr/local/Caskroom/xquartz/2.7.9' (73M)
Then I continue with setting up XQuartz...
open -a XQuartz
In the XQuartz Preferences -> Security tab, I enable "Allow connections from network clients".
Then I am supposed to run xhost + $MY_IP_ADDRESS in my bash shell, but all I get is this error:
xhost: unable to open display ""
In the end, all guides I'm reading says I should run my container like this:
docker run -e DISPLAY=$MY_IP_ADDRESS:0 -v /tmp/.X11-unix:/tmp/.X11-unix DOCKER_IMAGE
...but that doesn't work. In my particular container, I get this error:
... cannot connect to X server 10.0.0.131:0
What am I doing wrong?
Turns out there's a bug in XQuartz 2.7.9.
When using XQuartz 2.7.10_beta2, it works.
I have xQuartz 2.7.11 installed on Mac OS.
I was getting the following error
<program>: cannot connect to X server <ip>:0
when trying to run docker container. I tried downgrading XQuartz but it still didn't fix my issue.
A crucial piece to to the setup is to add your ip access control list for xhost.
xhost + $(ipconfig getifaddr en0)
After adding the ip to xhost, everything works. There is no need to downgrade Xquartz version.
Solution
After installing XQuartz you will need to restart your computer as horcle_buzz suggested; starting a new terminal session is not enough.
After a reboot you can grant access for whatever you need using the xhost command. Just be careful and understand the consequences of too permissive a rule. This other discussion has more info: Running Chromium inside Docker - Gtk: cannot open display: :0
Additional findings
Some extra things I discovered along the way:
XQuartz must be running first:
$ open -a XQuartz
You can expose 127.0.0.1 instead of looking up your local IP (caveat emptor: I'm not an expert on the implications of this setting):
$ xhost + 127.0.0.1
127.0.0.1 being added to access control list
You can use the special host.docker.internal identifier with docker run:
$ docker run -e DISPLAY=host.docker.internal:0 jess/firefox
# 🧙‍♀️ magic 🧙‍♂️
At least for me, ctrl + c does not shutdown the container; I need to close the X11 window manually.
If you quit XQuartz, you must re-auth with xhost after starting it again (the permission doesn't "stick").
Doing it this way I didn't need to mount /tmp/.X11-unix when calling docker run.
I tested this with XQuartz 2.7.11 and Docker Desktop 2.1.0.2 on macOS Mojave (10.14.6).

docker-machine:Error with pre-create check: "exit status 126"

When I'm type the code sudo docker-machine create --driver virtualbox default to create a new virtual machine. It can not worked. Here is the info:
xxxMacBook-Pro:~ xxx$ docker --version
Docker version 1.12.0, build 8eab29e
xxxMacBook-Pro:~ xxx$ docker-machine --version
docker-machine version 0.8.0, build b85aac1
xxxMacBook-Pro:~ xxx$ sudo docker-machine create --driver virtualbox default
Running pre-create checks...
Error with pre-create check: "exit status 126"
Please help me to figure this out.
Exit status 126 on a Mac indicates that you don't have Virtualbox installed, which comes separate from Docker.
Run the following command to install it:
brew cask install virtualbox;
Now you can gracefully run your command again.
NB: You don't have to use sudo, unless there are some special privileges you want to accord whatever you are creating.
Update: As of 2021 you can use
brew install --cask virtualbox
The same error occurred on my OSX, because I'v only installed docker.app.
Probably, you should install docker toolbox instead of docker.app.
Docker.app doesn't include virtualbox driver, but docker toolbox includes virtual box driver.
https://www.docker.com/products/docker-toolbox
I had the same problem with Docker for Mac. You need to install VirtualBox additionally from https://www.virtualbox.org/wiki/Downloads

Installing docker with devstack

I am trying to install devstack and docker (http://devstack.org/guides/single-machine.html) onto a VM containing Ubuntu 13.10 Server. devstack contains a docker installer script in tools/docker/install_docker.sh which it is recommended to run first before running the stack.sh installer script for devstack. I have patched the docker install script according to the bug report https://bugs.launchpad.net/devstack/+bug/1237581 however docker still reports a problem:
socat[NNNN] E connect(3, AF=1 "/var/run/docker.sock", 22): Connection refused
Does anyone know a fix for this problem?
Thanks,
David
If you get error messages regarding /var/run/docker.sock then either the docker daemon/service is not started or your user (devstack user) has no permissions.
Start docker:
service docker restart
Add your user (devstack user) to the docker group. Try to enumerate containers:
docker ps
If that still does not fix the problem then you might want to change the permission of /var/run/docker.sock directly:
sudo chown vagrant:vagrant /var/run/docker.sock
Check your kernel ( uname -a ) and make sure it is 3.8 or latest. Also, make sure you are on a 64bit Ubuntu ( X86_64 distribution ). The point is that the Docker daemon might not be starting (fails) because it is not supported on a 32 bit distribution.

Resources