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

Cannot connect to the balena daemon at unix:///var/run/balena.sock. Is the balena daemon running? #55

Open
RyanRamchandar opened this Issue Nov 2, 2017 · 6 comments

Comments

Projects
None yet
5 participants
@RyanRamchandar
Copy link

RyanRamchandar commented Nov 2, 2017

Description

After installing balena its daemon is not running. Calling balena ps or similar as root yields:

$ balena ps
Cannot connect to the balena daemon at unix:///var/run/balena.sock. Is the balena daemon running?

Steps to reproduce the issue:

  1. Install balena
  2. balena ps

Additional information you deem important (e.g. issue happens only occasionally):

Output of balena version:

$ balena version
Client:
 Version:      unknown-version
 API version:  1.31
 Go version:   go1.9
 Git commit:   unknown-commit
 Built:        unknown-buildtime
 OS/Arch:      linux/arm64
Cannot connect to the balena daemon at unix:///var/run/balena.sock. Is the balena daemon running?

Output of balena info:

$ balena info
Cannot connect to the balena daemon at unix:///var/run/balena.sock. Is the balena daemon running?

Additional environment details (AWS, VirtualBox, physical, etc.):
Allwinner A64 SoC

$ uname -a
Linux umbrela-bridge 4.13.0-rc7+ #44 SMP Wed Aug 30 23:00:03 UTC 2017 aarch64 aarch64 aarch64 GNU/Linux
@RyanRamchandar

This comment has been minimized.

Copy link

RyanRamchandar commented Nov 2, 2017

After some troubleshooting I ran balenad which seems to have started the daemon. How can I run this in the background and automatically on boot?

# balenad
WARN[0000] could not change group /var/run/balena.sock to balena: group balena not found 
INFO[0000] libcontainerd: new containerd process, pid: 1313 
WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=65536
WARN[0001] failed to rename /var/lib/balena/tmp for background deletion: rename /var/lib/balena/tmp /var/lib/balena/tmp-old: no such file or directory. Deleting synchronously 
INFO[0001] Graph migration to content-addressability took 0.00 seconds 
WARN[0001] Your kernel does not support swap memory limit 
WARN[0001] Your kernel does not support cgroup rt period 
WARN[0001] Your kernel does not support cgroup rt runtime 
INFO[0001] Loading containers: start.                   
INFO[0001] Default bridge (balena0) is assigned with an IP address 172.18.0.0/16. Daemon option --bip can be used to set a preferred IP address 
INFO[0001] Loading containers: done.                    
WARN[0001] Couldn't run auplink before unmount /var/lib/balena/tmp/docker-aufs-union523616249: exec: "auplink": executable file not found in $PATH 
WARN[0001] failed to retrieve balena-init version: exec: "balena-init": executable file not found in $PATH 
INFO[0001] Docker daemon                                 commit=c6df57f-unsupported graphdriver(s)=aufs version=17.06.0-dev
INFO[0001] Daemon has completed initialization          
INFO[0002] API listen on /var/run/balena.sock     
@zozo123

This comment has been minimized.

Copy link
Contributor

zozo123 commented Nov 10, 2017

Hello Ryan, it should be similar to the way you usually build dockerd to run on your system, see here. For example, sudo systemctl enable balena should work if you use systemd.

Regarding your original post, in case anyone find this post in the future, it's because one has to create a group named balena on his host.

@RyanRamchandar

This comment has been minimized.

Copy link

RyanRamchandar commented Nov 10, 2017

Thanks @zozo123 I wasn't aware of that. Perhaps this step can be added to the install.sh or in the README.

@AnnapoorniS

This comment has been minimized.

Copy link

AnnapoorniS commented Feb 2, 2018

Tried the below commands and ended up in errors
sudo systemctl enable balena
Failed to execute operation: No such file or directory

sudo systemctl status balena
● balena.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

sudo systemctl start balena
Failed to start balena.service: Unit balena.service not found.

Kindly suggest any ways that balena can run continuously as a background service on rebooting the machine.

@zozo123 can you help on this?

@cnrmck

This comment has been minimized.

Copy link

cnrmck commented Sep 24, 2018

I am also having this problem.

When I run sudo balena I get this:

INFO[0000] libcontainerd: new containerd process, pid: 23608 
WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=1048576
INFO[0001] [graphdriver] using prior storage driver: overlay2 
INFO[0001] Graph migration to content-addressability took 0.00 seconds 
WARN[0001] Your kernel does not support cgroup memory limit 
WARN[0001] Your kernel does not support cgroup cfs period 
WARN[0001] Your kernel does not support cgroup cfs quotas 
WARN[0001] Your kernel does not support cgroup rt period 
WARN[0001] Your kernel does not support cgroup rt runtime 
WARN[0001] mountpoint for pids not found                
INFO[0001] Loading containers: start.                   
INFO[0001] Default bridge (balena0) is assigned with an IP address 172.18.0.0/16. Daemon option --bip can be used to set a preferred IP address 
INFO[0001] Loading containers: done.                    
WARN[0001] failed to retrieve balena-init version: exec: "balena-init": executable file not found in $PATH 
INFO[0001] Docker daemon                                 commit=c6df57f-unsupported graphdriver(s)=overlay2 version=17.06.0-dev
INFO[0001] Daemon has completed initialization          
INFO[0001] API listen on /var/run/balena.sock           

But:
sudo systemctl enable balena
Failed to enable unit: File balena.service: No such file or directory

sudo systemctl status balena
Unit balena.service could not be found.

@zozo123 Would love your thoughts on this. Do I need to create my own systemctl unit file for the balena daemon, or is there a built in way to do it?

@cnrmck

This comment has been minimized.

Copy link

cnrmck commented Sep 24, 2018

@AnnapoorniS and whomever else may come across this: the reason your systemctl doesn't work when sudo balena does is because you do not have a systemctl unit file for the balena daemon (balenad).

It's not too hard to fix this.

First go grab unit files from the balena repo (choose the right version for you, or the most recent version if unsure). If you are not on a Red Hat system then use the balena.system file and the balena.socket file. The balena.system.rpm file is for Red Hat (afaik). Copy those files (with the same names) into your systemd directory (either /lib/systemd/system or /etc/systemd/system). You can confirm it's the correct directory by running systemctl cat dbus.service | diff -s - /lib/systemd/system/dbus.service
If you get back something along the lines of:
1d0
< # /lib/systemd/system/dbus.service

Then /lib/systemd/system is the right directory. If not, try the same thing with /etc/systemd/system/dbus.service instead. Getting the message "diff: /etc/systemd/system/dbus.service: No such file or directory" means that it is not the /etc/... directory that you want (therefore you want the /lib/ directory).

Once you've found the right directory and you've copied the .socket and .system files into it (like with curl https://github.com/some/location/balena-engine.socket -o /correct/path/to/balena-engine.socket, read through the comments of each of those files to see if you need to change anything.

For example, if when you run systemctl --version you get a number bigger than 226 (like systemd 232) you need uncomment the #TasksMax=infinity line in balena.service.

The last thing to check is that the ExecStart=/usr/bin/balenad -H fd:// line is correct. Run which balenad and if the path you get back is different, update the path in balena.service so that it is correct, otherwise you will get a 203/EXEC failure.

That's the gist. Once you've done all that you should be able to run sudo systemctl daemon-reload followed by sudo systemctl enable balena-engine and sudo systemctl start balena-engine.

If you have trouble, follow the errors.

robertgzr added a commit that referenced this issue Jan 8, 2019

contrib/install.sh: Add notice that balena-engine-daemon needs to be …
…started

Connects-to: #55
Signed-off-by: Robert Günzler <robertg@balena.io>

robertgzr added a commit that referenced this issue Jan 8, 2019

contrib/install.sh: Add details to the success message
First warn the user that balena-engine-daemon needs to be started.
Including instructions on how to make the system ready for that:
- service files
- balena-engine group
- how to allow non-root users to run containers

Connects-to: #55
Connects-to: #51
Signed-off-by: Robert Günzler <robertg@balena.io>

@robertgzr robertgzr added the wip label Jan 8, 2019

robertgzr added a commit that referenced this issue Jan 16, 2019

contrib/install.sh: Add details to the success message
First warn the user that balena-engine-daemon needs to be started.
Including instructions on how to make the system ready for that:
- service files
- balena-engine group
- how to allow non-root users to run containers

Connects-to: #55
Connects-to: #51
Signed-off-by: Robert Günzler <robertg@balena.io>

robertgzr added a commit that referenced this issue Jan 16, 2019

contrib/install.sh: Add details to the success message
First warn the user that balena-engine-daemon needs to be started.
Including instructions on how to make the system ready for that:
- service files
- balena-engine group
- how to allow non-root users to run containers

Connects-to: #55
Connects-to: #51
Signed-off-by: Robert Günzler <robertg@balena.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment