RaspberryMatic icon indicating copy to clipboard operation
RaspberryMatic copied to clipboard

`99-ccu-shim-network` script doesn't work

Open Mutantpenguin opened this issue 7 months ago • 5 comments

Describe the issue you are experiencing

I am running RaspberryMatic in Docker and used the automatic setup via script from https://raspberrymatic.de/install-docker.sh.

The network script 99-ccu-shim-network doesn't work for me, but I am unsure why. I know this, because pinging the docker container from the host (or another container) does not work. I need this functionality to integreate RaspberryMatic with HomeAssistant.

If I run the commands from 99-ccu-shim-network manually everything works fine. I don't mean the whole script, but just the following lines (adjusted for my IPs):

ip link add ccu-shim link ${CCU_NETWORK_INTERFACE} type macvlan mode bridge
ip addr add ${CCU_CONTAINER_IP_AUX} dev ccu-shim
ip link set ccu-shim up
ip route add ${CCU_CONTAINER_IP} dev ccu-shim protocol static

I am more than willing to debug this on my own, but would need a little help to get started as I never did something like that.

Describe the behavior you expected

A working network shim interface

Steps to reproduce the issue

  1. Reboot
  2. Wait for all docker containers to be up and running
  3. Try to ping the container from the host.

What is the version this bug report is based on?

3.73.9.20231130

Which base platform are you running?

rpi3 (RaspberryPi3)

Which HomeMatic/homematicIP radio module are you using?

HmIP-RFUSB

Anything in the logs that might be useful for us?

Sorry, I don't have access to them at this moment and will upload the logs later.

Additional information

No response

Mutantpenguin avatar Dec 11 '23 12:12 Mutantpenguin

I feel dumb.

Do I understand it correctly that I can test these script just by bringing the interface down and up again by doing the following?

ifconfig eth0 down
ifconfig eth0 up

Mutantpenguin avatar Dec 11 '23 12:12 Mutantpenguin

This sounds like the ifupdown package might not be installed on your host machine (where you run docker). So please check if this package is installed. Thus, something like:

sudo apt-get install ifupdown 

if you are using debian/ubuntu host.

jens-maus avatar Dec 11 '23 12:12 jens-maus

Thanks for the tip, but that didn't help since ifupdown is already installed.

Neither did my experiments with putting some echo statements into the script and using ifconfig eth0 down/up to test it. This didn't output anything at all and didn't bring up the ccu-shim.

I should have written, that I am using Raspbian Bullseye, because I think that might explain my situation after doing some research on this topic:

  • Raspbian seems to use dhcpcd and not ifupdown which means it ignores all the scripts in /etc/network/if-up.d/. At least that's my rough understanding of the situation.

Calling the script like it's done in install-docker.sh works totally fine btw:

IFACE="eth0" /etc/network/if-up.d/99-ccu-shim-network

Mutantpenguin avatar Dec 11 '23 20:12 Mutantpenguin

I do have the same behavior since I upgraded to bookworm on my raspberry pi 4 with docker.

Everything works fine: raspberrymatic and iobroker. Just the shim network is not initialised when rebooting. Manual commands executed in shell work fine - just the script is not executed anymore. (ifupdown is installed)

I now just included the 4 lines within /etc/rc.local - This is at least working while rebooting

@jens-maus @Mutantpenguin : Is there any "better" solution?

tp1de avatar Jan 05 '24 16:01 tp1de

The only other solution I know of would be to write your own systemd file for this. But I wouldn't call this "better". You can read about this here https://github.com/jens-maus/RaspberryMatic/issues/1373#issuecomment-922508274

I don't really know much about networking, so I don't know what would be the correct solution.But it seems like the so called dhcpcd-run-hooks are the preferred solution on raspbian: https://manpages.ubuntu.com/manpages/bionic/man8/dhcpcd-run-hooks.8.html

Attention, the mentioned paths there are not correct. For me (on bullseye) it's /etc/dhcp/dhclient-enter-hooks.d.

In an ideal world, the run-docker.sh wouldn't even create the file 99-ccu-shim-network on raspbian bullseye.

@jens-maus If you are able to give me any hints if the mentioned dhcpcd-run-hooks are the correct way of solving this I will try my hands on a pull request.

Mutantpenguin avatar Jan 06 '24 22:01 Mutantpenguin

There hasn't been any activity on this issue recently. To keep our backlog manageable we have to clean old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest RaspberryMatic version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 06 '24 05:04 github-actions[bot]