Portainer config issues

NethServer Version: 7.7.1908
Module: nethserver-docker

I have followed the instructions at https://github.com/NethServer/nethserver-docker and I get the following 503 Error whe nI go to https://192.168.1.1:980/portainer/ :

Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity
problems. Please try again later.

Think I’m missing something stupidly small in the instructions.

I am a little unsure if the following would have any effect:

The default Docker bridged network is disabled, as long as the iptables mangling feature.

I got it working with these steps (Installation section):

you are not on the good GH branch, the rpm must built

1 Like

I uploaded a build to my repo for easier installation.

1 Like

The problem is that when I run the command db networks show aqua, it does not show anything. Its like the aqua zone is not created and neither is the firewall rules.

What are the required commands to achieve this?

It’s not in the networks db, it’s only configured in shorewall.

Check /etc/shorewall/zones and /etc/shorewall/policy.

I used to change the policy with a custom template in the nxfilter/pihole howto thread to need no firewall rules for easy testing and because the aqua zone seems not selectable in both server managers.

It looks like it worked some time ago:

EDIT:

I couldn’t manage it via the GUI.
As a workaround you may copy the 65aqua fragment and add wanted firewall rules with a custom template.

mkdir -p /etc/e-smith/templates-custom/etc/shorewall/rules

cp /etc/e-smith/templates/etc/shorewall/rules/65aqua /etc/e-smith/templates-custom/etc/shorewall/rules/

Edit /etc/e-smith/templates-custom/etc/shorewall/rules/65aqua and edit/add your firewall rules.

To apply the config:

signal-event firewall-adjust

I don’t actually know what firewall rules I should be adding for this to work right now or how to add them on the command line.

Is there a default set which you would recommend?

I was thinking of tackling or looking at this from a different perspective: what are the implications of having docker accessible in the Green Zone instead of the Aqua Zone?

It depends on the ports you need for your containers.
For testing I’d go with open policy like that:

/etc/e-smith/templates/etc/shorewall/policy/35aqua should look like that:

#
# 35aqua -- the Docker network policy
#
aqua net ACCEPT
$FW aqua ACCEPT
aqua $FW ACCEPT
loc aqua ACCEPT

Rules configuration is really simple:

For example /etc/e-smith/templates/etc/shorewall/rules/65aqua

#
# 65aqua Accept ping from aqua
#

Ping/ACCEPT    aqua            $FW


#
# 65aqua -- Rules for Docker containers
#

?COMMENT aqua
ACCEPT  aqua    $FW     tcp     3306

The first rule accepts ping from aqua to the firewall.
The second rule accepts mariadb from firewall to aqua

Here are some commonly used rules:

https://shorewall.org/two-interface.htm#DNS

Don’t forget to apply changes with

signal-event firewall-adjust

Next to bad security, I don’t know if that would be possible easily. Think of DHCP server vs docker setting IPs but never tested.

Thanks @mrmarkuz, definitely has some of those FW rules wrong or a few missing FW rules. I have corrected those as per your example and still getting the 503.

Think I am loosing my marbles and missing a couple of key points on this one…

It think it’s not a firewall problem as you get the 503 error. It’s not a rejected connection.

Check if docker is running:

systemctl status docker -l

Check if your containers are running, portainer is just a container:

docker ps -a

Is the aqua interface UP?

ip a s aqua0

You may reconfigure and restart with

signal-event nethserver-docker-update

and check /var/log/messages afterwards.

EDIT:

Did you enable nethserver-docker?

config setprop docker status enabled
signal-event nethserver-docker-update

Mar 24 21:24:43 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:43.229507950Z” level=info msg=“IPv6 enabled; Adding default IPv6 external servers: [nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844]”
Mar 24 21:24:43 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:43.273699678Z” level=error msg=“ca281aba5e2a3a49cfb76559bab48538b31c005ab7965f7f2dda1885b0c4ce1a cleanup: failed to delete container from containerd: no such container”
Mar 24 21:24:43 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:43.273764739Z” level=error msg=“Failed to start container ca281aba5e2a3a49cfb76559bab48538b31c005ab7965f7f2dda1885b0c4ce1a: network cc0cbf3f87550dd62a17593440f3911b0031634a87db104c3a8cb2b69cc3ee86 not found”
Mar 24 21:24:43 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:43.811933166Z” level=info msg=“No non-localhost DNS nameservers are left in resolv.conf. Using default external servers: [nameserver 8.8.8.8 nameserver 8.8.4.4]”
Mar 24 21:24:43 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:43.811974956Z” level=info msg=“IPv6 enabled; Adding default IPv6 external servers: [nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844]”
Mar 24 21:24:45 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:45.983636380Z” level=info msg=“Loading containers: done.”
Mar 24 21:24:46 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:46.394948171Z” level=info msg=“Docker daemon” commit=afacb8b graphdriver(s)=overlay2 version=19.03.8
Mar 24 21:24:46 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:46.395793670Z” level=info msg=“Daemon has completed initialization”
Mar 24 21:24:46 server.thenesbitts.net dockerd[28597]: time=“2020-03-24T21:24:46.581339725Z” level=info msg=“API listen on /var/run/docker.sock”
Mar 24 21:24:46 server.thenesbitts.net systemd[1]: Started Docker Application Container Engine.

docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c023fbed0877 pihole/pihole:latest “/s6-init” 5 hours ago Up About a minute (healthy) 53/udp, 53/tcp, 80/tcp, 443/tcp, 67/udp pihole
5a98f45d8dd8 packetworks/nxfilter-base:latest “/nxfilter/bin/start…” 5 hours ago Up About a minute nxfilter
ca281aba5e2a portainer/portainer “/portainer” 3 days ago Exited (2) 3 days ago portainer

ip a s aqua0

6: aqua0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:cc:b1:4b:4f brd ff:ff:ff:ff:ff:ff
inet 172.28.5.254/16 brd 172.28.255.255 scope global aqua0
valid_lft forever preferred_lft forever
inet6 fe80::42:ccff:feb1:4b4f/64 scope link
valid_lft forever preferred_lft forever

I am getting the following in /var/log/messages:

Mar 24 21:24:43 server dockerd: time=“2020-03-24T21:24:43.273699678Z” level=error msg=“ca281aba5e2a3a49cfb76559bab48538b31c005ab7965f7f2dda1885b0c4ce1a cleanup: failed to delete container from containerd: no such container”
Mar 24 21:24:43 server dockerd: time=“2020-03-24T21:24:43.273764739Z” level=error msg=“Failed to start container ca281aba5e2a3a49cfb76559bab48538b31c005ab7965f7f2dda1885b0c4ce1a: network cc0cbf3f87550dd62a17593440f3911b0031634a87db104c3a8cb2b69cc3ee86 not found”
Mar 24 21:24:43 server dockerd: time=“2020-03-24T21:24:43.811933166Z” level=info msg=“No non-localhost DNS nameservers are left in resolv.conf. Using default external servers: [nameserver 8.8.8.8 nameserver 8.8.4.4]”
Mar 24 21:24:43 server dockerd: time=“2020-03-24T21:24:43.811974956Z” level=info msg=“IPv6 enabled; Adding default IPv6 external servers: [nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844]”

And the docker logs is showing a lot of the following:

2020/03/21 20:14:40 Migrating database from version 0 to 22.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x88722a]

Still trying to figure out how to fix this now

The portainer container is not running, try the following:

docker start ca281aba5e2a

Ah! So if I run that command I get the following:

Error response from daemon: network cc0cbf3f87550dd62a17593440f3911b0031634a87db104c3a8cb2b69cc3ee86 not found
Error: failed to start containers: ca281aba5e2a

I’m not sure exactly how to fix that with breaking everything.

OK, let’s remove portainer container and recreate it.

Be sure to get the right container ID of portainer:

docker ps -a

Remove it!

docker rm -f <container ID>

Check if it’s deleted:

docker ps -a

Just to be sure we delete the image too, get the image ID:

docker images -a

Remove images:

docker rmi -f <image> ID

Recreate portainer container (it’s recreated if it doesn’t exist):

signal-event nethserver-docker-update

Check if portainer is started now:

docker ps -a

@mrmarkuz Thanks for that, that has fixed the one issue and its at least starting now and not complaining about missing/incorrect network.

Now the issue is a couple of seconds after it has successfully start, it is restarting the container and I can see the following in the logs?

    /home/vsts/work/1/s/api/cmd/portainer/main.go:521 +0x99
    2020/03/26 09:04:03 Migrating database from version 0 to 22.
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x88722a]

Not sure if this is the cause of the restarts?

Hi

It could also be s simple defective memory chip…
Check that out using the basis BIOS, that often has options for a memory check.
Or a linux Live CD like SystemrescueCD…

Had a stumper like that a while ago. it was one of the higher RAM chips, and only “barfed” when used… (Barf=core dump)… :slight_smile:

The chip reports to the BIOS the amount of RAM, real, available RAM is the less due to the defective chip, and…

My 2 cents
Andy

I think you’re hitting this one:

You need to delete the content of the local portainer directory and restart:

rm -Rf /var/lib/nethserver/portainer/*
signal-event nethserver-docker-update

@mrmarkuz it is working now. Thank you for all of your help!

1 Like