[GH-ISSUE #674] [Bug]: Docker image missing iproute2 — alias/secondary IPs not shown in Virtual Printer Bind Address dropdown #446

Closed
opened 2026-05-06 12:29:36 +02:00 by BreizhHardware · 4 comments

Originally created by @PurseChicken on GitHub (Mar 12, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/674

Originally assigned to: @maziggy on GitHub.

Bug Description

When running Bambuddy in Docker with network_mode: host on a system that has alias (secondary) IP addresses configured on a network interface, the Virtual Printer "Bind Address" dropdown only shows the primary IP address. Alias IPs are not listed, making it impossible to bind virtual printers to dedicated alias IPs.
The root cause is that the Docker image does not include iproute2, so the ip command is not available. In backend/app/services/network_utils.py, the get_all_interface_ips() function checks for the ip command via shutil.which("ip") and falls back to _fallback_get_all_ips() → get_network_interfaces() when it's not found. The fallback uses fcntl.ioctl with SIOCGIFADDR (0x8915), which is a kernel-level limitation that only returns the primary IP per interface — secondary/alias addresses are invisible to this ioctl.
Meanwhile, psutil (which is already a dependency in the image) correctly sees all IPs via psutil.net_if_addrs(). This was confirmed inside the running container.

Expected Behavior

The Bind Address dropdown should list all IP addresses available on the host, including alias/secondary IPs. In my case, the interface bond1 has three IPs (one primary, two aliases), and all three should appear as bind options for virtual printers.

Steps to Reproduce

Configure alias IP addresses on a network interface (e.g., via TrueNAS Network → Interface → Aliases)
Deploy Bambuddy as a Docker custom app with network_mode: host
Go to Settings → Virtual Printer → Add/Edit a virtual printer
Open the "Bind Address" dropdown
Only the primary IP is listed; alias IPs are missing

Printer Model

P1S

Bambuddy Version

0.2.3b1

Printer Firmware Version

01.09.01.00

Installation Method

Docker

Operating System

Linux (Other)

Relevant Logs / Support Package

# Confirmed ip command is missing
$ docker exec -it <container> python3 -c "import shutil; print(shutil.which('ip'))"
None

# Confirmed psutil sees all IPs (primary + aliases)
$ docker exec -it <container> python3 -c "
import psutil
for iface, addrs in psutil.net_if_addrs().items():
    for a in addrs:
        if a.family == 2:
            print(f'{iface}: {a.address}')
"
bond1: 10.x.x.106    # primary
bond1: 10.x.x.45     # alias
bond1: 10.x.x.50     # alias

# Confirmed fib_trie inside container shows all three IPs (host networking works)
$ docker exec -it <container> cat /proc/net/fib_trie | grep -A1 "10.x.x"
# All three IPs present as LOCAL

# Workaround: installing iproute2 and restarting resolves the issue
$ docker exec --user root -it <container> apt-get update && apt-get install -y iproute2
$ docker restart <container>
# All three IPs now appear in the dropdown

Screenshots

No response

Additional Context

Suggested Fix (either or both):

  1. Add iproute2 to the Docker image so the ip -j addr show code path in get_all_interface_ips() works as intended.
  2. Improve _fallback_get_all_ips() to use psutil.net_if_addrs() instead of the ioctl-based get_network_interfaces(). psutil is already a dependency and correctly returns all IPs including aliases:
def _fallback_get_all_ips() -> list[dict]:
    """Fallback: use psutil to get all IPs including aliases."""
    import psutil
    entries = []
    for iface, addrs in psutil.net_if_addrs().items():
        if _is_excluded(iface):
            continue
        ipv4_count = 0
        for a in addrs:
            if a.family != socket.AF_INET:
                continue
            try:
                network = ipaddress.IPv4Network(f"{a.address}/{a.netmask}", strict=False)
            except ValueError:
                continue
            entries.append({
                "name": iface,
                "ip": a.address,
                "netmask": a.netmask,
                "subnet": str(network),
                "is_alias": ipv4_count > 0,
                "label": iface,
            })
            ipv4_count += 1
    entries.sort(key=lambda e: (e["name"], e["is_alias"], e["ip"]))
    return entries

Checklist

  • I have searched existing issues to ensure this bug hasn't already been reported
  • I am using the latest version of Bambuddy
  • My printer is set to LAN Only mode
  • My printer has Developer Mode enabled
Originally created by @PurseChicken on GitHub (Mar 12, 2026). Original GitHub issue: https://github.com/maziggy/bambuddy/issues/674 Originally assigned to: @maziggy on GitHub. ### Bug Description When running Bambuddy in Docker with network_mode: host on a system that has alias (secondary) IP addresses configured on a network interface, the Virtual Printer "Bind Address" dropdown only shows the primary IP address. Alias IPs are not listed, making it impossible to bind virtual printers to dedicated alias IPs. The root cause is that the Docker image does not include iproute2, so the ip command is not available. In backend/app/services/network_utils.py, the get_all_interface_ips() function checks for the ip command via shutil.which("ip") and falls back to _fallback_get_all_ips() → get_network_interfaces() when it's not found. The fallback uses fcntl.ioctl with SIOCGIFADDR (0x8915), which is a kernel-level limitation that only returns the primary IP per interface — secondary/alias addresses are invisible to this ioctl. Meanwhile, psutil (which is already a dependency in the image) correctly sees all IPs via psutil.net_if_addrs(). This was confirmed inside the running container. ### Expected Behavior The Bind Address dropdown should list all IP addresses available on the host, including alias/secondary IPs. In my case, the interface bond1 has three IPs (one primary, two aliases), and all three should appear as bind options for virtual printers. ### Steps to Reproduce Configure alias IP addresses on a network interface (e.g., via TrueNAS Network → Interface → Aliases) Deploy Bambuddy as a Docker custom app with network_mode: host Go to Settings → Virtual Printer → Add/Edit a virtual printer Open the "Bind Address" dropdown Only the primary IP is listed; alias IPs are missing ### Printer Model P1S ### Bambuddy Version 0.2.3b1 ### Printer Firmware Version 01.09.01.00 ### Installation Method Docker ### Operating System Linux (Other) ### Relevant Logs / Support Package ```shell # Confirmed ip command is missing $ docker exec -it <container> python3 -c "import shutil; print(shutil.which('ip'))" None # Confirmed psutil sees all IPs (primary + aliases) $ docker exec -it <container> python3 -c " import psutil for iface, addrs in psutil.net_if_addrs().items(): for a in addrs: if a.family == 2: print(f'{iface}: {a.address}') " bond1: 10.x.x.106 # primary bond1: 10.x.x.45 # alias bond1: 10.x.x.50 # alias # Confirmed fib_trie inside container shows all three IPs (host networking works) $ docker exec -it <container> cat /proc/net/fib_trie | grep -A1 "10.x.x" # All three IPs present as LOCAL # Workaround: installing iproute2 and restarting resolves the issue $ docker exec --user root -it <container> apt-get update && apt-get install -y iproute2 $ docker restart <container> # All three IPs now appear in the dropdown ``` ### Screenshots _No response_ ### Additional Context Suggested Fix (either or both): 1. Add iproute2 to the Docker image so the ip -j addr show code path in get_all_interface_ips() works as intended. 2. Improve _fallback_get_all_ips() to use psutil.net_if_addrs() instead of the ioctl-based get_network_interfaces(). psutil is already a dependency and correctly returns all IPs including aliases: ``` def _fallback_get_all_ips() -> list[dict]: """Fallback: use psutil to get all IPs including aliases.""" import psutil entries = [] for iface, addrs in psutil.net_if_addrs().items(): if _is_excluded(iface): continue ipv4_count = 0 for a in addrs: if a.family != socket.AF_INET: continue try: network = ipaddress.IPv4Network(f"{a.address}/{a.netmask}", strict=False) except ValueError: continue entries.append({ "name": iface, "ip": a.address, "netmask": a.netmask, "subnet": str(network), "is_alias": ipv4_count > 0, "label": iface, }) ipv4_count += 1 entries.sort(key=lambda e: (e["name"], e["is_alias"], e["ip"])) return entries ``` ### Checklist - [x] I have searched existing issues to ensure this bug hasn't already been reported - [x] I am using the latest version of Bambuddy - [x] My printer is set to LAN Only mode - [x] My printer has Developer Mode enabled
BreizhHardware 2026-05-06 12:29:36 +02:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@maziggy commented on GitHub (Mar 12, 2026):

Fixed in branch dev.

Fix interface aliases not shown in virtual printer interface select

The Docker image (python:3.13-slim) didn't include iproute2, so the
ip command wasn't available. The code fell back to ioctl-based
enumeration which can only return one IP per interface — aliases like
eth0:1 were completely invisible. Added iproute2 to the Dockerfile.

<!-- gh-comment-id:4045549123 --> @maziggy commented on GitHub (Mar 12, 2026): Fixed in branch dev. Fix interface aliases not shown in virtual printer interface select The Docker image (python:3.13-slim) didn't include iproute2, so the `ip` command wasn't available. The code fell back to ioctl-based enumeration which can only return one IP per interface — aliases like eth0:1 were completely invisible. Added iproute2 to the Dockerfile.
Author
Owner

@maziggy commented on GitHub (Mar 12, 2026):

Please let me know if it works for you now.

<!-- gh-comment-id:4048106328 --> @maziggy commented on GitHub (Mar 12, 2026): Please let me know if it works for you now.
Author
Owner

@PurseChicken commented on GitHub (Mar 13, 2026):

Just deployed 0.2.2b4-daily.20260313 and its working without issue now. Aliases properly show as options in the list.

Thank you!

<!-- gh-comment-id:4057354556 --> @PurseChicken commented on GitHub (Mar 13, 2026): Just deployed 0.2.2b4-daily.20260313 and its working without issue now. Aliases properly show as options in the list. Thank you!
Author
Owner

@TravisWilder commented on GitHub (Mar 14, 2026):

I can also confirm that I can select the alias

<!-- gh-comment-id:4060428043 --> @TravisWilder commented on GitHub (Mar 14, 2026): I can also confirm that I can select the alias
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy#446
No description provided.