Posts by Doemela

    UPDATE 2026-09-20: Fixed — patch submitted upstream

    Confirmed the leak on stock LE13 nightly 20260920-b68ee23 (ConnMan 2.0, iwd backend, Generic x86_64): fd count 22 → 49+ over VPN cycles, never recovers. Root cause in plugins/wifi.c interface_removed() — early-return skips g_supplicant_interface_cancel().

    Patch (v7) submitted to [email protected]. With patch applied: fd returns to baseline (22) after every cycle. Verified data + fix instructions: Upstream ConnMan FD Leak Automated Mitigation Guide

    Thank you for the responses, I'm afraid it turned out to be a problem with inexperience with Kodi. I've now got it working as expected.

    But when adjusting settings in Kodi, it seems that different pages behave differently when it comes to when the changes are saved. Also sometimes there seems to be a considerable lag between when you press a button (I've been using Kore) and the interface presents you with the options, so that an inexperienced user might think that it was dead button and moved on to explore what other ways there are to achieve the changes he wants.

    Np, some buttons take a long time, like updating the servers, because it has to access several servers in each country for its database. If you select several countries, it can mean downloading tens of servers. This will be fixed in a future version(s), so you will get a progress window.

    Salute!

    Hi, a new user here. I just installed latest and greatest of LibreELEC and among the first add-ons service.wireguard.manager from the Doemela repo. As I already have Mullvad vpn on another device I used the same account in LibreELEC and got it up and running without much trouble.

    But there are two things that baffle me, it doesn't connect at boot, that is I have to always establish the vpn connection manually after a reboot. Secondly it doesn't seem to have registered that I only want a specific country to show up when selecting the vpn connection. My selected country is there in the config, but I am always given a list that starts with Albania when connecting the vpn.

    Regarding: "My selected country is there in the config, but I am always given a list that starts with Albania when connecting the vpn." Did you save the settings after selecting the countr(y|ies) as the addon told you?

    I need to see the log. To post logs to this forum, copy and paste the following into SSH:

    1. Shell session
      grep -i "service.wireguard.manager" /storage/.kodi/temp/kodi.log | pastebinit
    2. And post that URL here.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>LoggingRestart Kodi
    2. Replicate the problem
    3. Generate a log URL (do not post/upload logs to the forum)
    4. Use "Settings > LibreELEC > System > Paste system logs" or run "pastekodi" over SSH, then post the URL link

    Also read the Settings Explained on our wiki.

    Salute.

    To help other community members check if their systems are suffering from this ConnMan file descriptor leak, I have written a diagnostic script. Connect via SSH and create the script:

    Shell session
    mkdir -p /storage/.config/scripts
    nano /storage/.config/scripts/connman-leak-test.sh

    Paste the following code inside the file:

    Save and exit (Ctrl+O, Enter, Ctrl+X), then give it execution permissions and run it:

    Shell session
    chmod +x /storage/.config/scripts/connman-leak-test.sh
    /storage/.config/scripts/connman-leak-test.sh

    If you let it run full course or interrupt it, it will provide a direct paste link showing if your system is experiencing un-canceled socket tracking build-ups.

    To the original question: I'd prefer to see the patch merged and package bumped than place 'known bug' info in the wiki.

    I completely understand your point regarding LE13+ and preferring a package bump once the patch is merged upstream.

    However, my main concern is for users on LE11 and LE12. Since those legacy versions are in maintenance mode and likely won't receive a core ConnMan package update, they will continue to hit this 1024 fd crash. To give you a real-world example of why this is urgent for legacy LE11/LE12: in a standard dual-setup where Ethernet is active and Wi-Fi is left floating on 'idle' or 'ready', ConnMan triggers this background scan-loop constantly. The file descriptors stack up in record time without even touching VPNs/WireGuard. It affects anyone running hybrid wired/wireless setups from day one.

    How would you prefer we handle this for legacy releases? Would it be acceptable to post a brief workaround/troubleshooting note in the forum for them (e.g., using a systemd/cron timer to periodically flush ConnMan before it hits the 1024 fd limit)?

    On a side note, I just submitted [PATCH v6] upstream to the ConnMan mailing list. I believe I have now cleaned up all the formatting issues and the stray line-deletes to meet the strict Linux ecosystem style guidelines—or at least I hope so, but you would know better than me!

    Thank you for your suggestion
    I tried the addon but am not shure how to use it and how to switch. If i click on the addon in the overview, i see my 2 created profiles in a selection menu. When i select one, the actual settings get saved to this profile. But i want to switch this profile.

    You can switch between profiles using key map see https://kodi.wiki/view/Add-on:Audio_Profiles https://forum.kodi.tv/showthread.php?tid=353852

    The only solution I can think of to bypass DHCP is a small background script to bypass it. Create a file named autostart.sh for your sister and send it to her. Here is the exact code needed. Copy this block of text:

    Instructions for your Sister. To install this script, you will need a computer connected to the same home network as the LibreELEC device.

    • Open File Explorer on your computer.
    • In the address bar at the very top, type your LibreELEC network path and press Enter:
      \\YOUR_LIBREELEC_IP_ADDRESS\ (Example: \\192.168.1.15\)
    • Open the Configfiles folder.
    • If you cannot see it, enable "Hidden items" in the View settings of Windows.
    • Copy autostart.sh to that Config folder.
    • Restart LibreELEC.

    this "we must block manual dns overwrites because we can" mentality.

    You got it totally wrong it is not LE that sets DHCP on or off all ISPs or self bought modems/routers have DHCP as default ON it is up to the user to set that in modem/router off/on. LE has nothing to do with that if you do not want to use it set it off in modem/router and modify /etc/resolv.conf

    I checked the true upstream master branch on Google Git and saw exactly where my branch had diverged. I also noticed that my webmail client mangled the formatting with automatic line wraps on the first attempt. I have rewritten the patch from scratch using the correct upstream context lines and split the long lines to prevent any word-wrap issues. I just submitted the clean [PATCH v2] directly to [email protected]. Appreciate the sharp eye ty for the help.

    Doemela when interacting with mailing lists:

    a) If you submit a patch as an additional comment within a bug report (as you have) it will be handled in patch tooling as a comment, and not as a patch. Instead submit the patch to the mailing-list as an actual patch; assume general kernel standards and etiquette for the patch submission. Keep the description brief/simple and use imperative (not conversational) tone. Note that AI generated patches are obvious and a human touch is generally appreciated by maintainers.

    b) Once you submit a bug report and start a mail thread on the list always reply to the original message (even if this means replying to yourself) to keep everything in the same thread. If you send further information as 'new' messages these will not be linked in any of the list/review tooling that maintainers use.

    c) Never top-post replies; always add information and content inline to the original post or append below the original. Again, this is to keep the information flow sequential in patch/review tooling.

    Thanks for the reminder! It's been a while since I last used the mailing lists. I just resent the fix as a clean, standalone plain-text patch email.

    DEVELOPMENT UPDATE: Structural Upstream Fix & Formal C-Code Patch (Beyond Mitigation)

    Following up on the v1.5.3 addon service mitigations (the LimitNOFILE=512 circuit breaker), we have successfully moved beyond temporary containment. By auditing ConnMan’s active repository source layers, we have isolated the exact code path responsible for the Wi-Fi specific resource aggregation.

    The Root Cause: Structural Bypass inside plugins/wifi.c
    When an out-of-band virtual interface (like our WireGuard tunnel) drops, ConnMan's wireless event pathway triggers interface_removed(). If the parent device linkage has already been decoupled during the routing shift, the function hits an early conditional exit check:

    Code
    if (wifi == NULL || wifi->device == NULL) {
       DBG("wifi interface already removed");
       return; /* 🛑 THE STRUCTURAL HOLE: Early return bypasses object lifecycle teardown! */
    }


    Because of this premature return, the mandatory GLib unreferencing routines (g_supplicant_interface_cancel and g_supplicant_interface_set_data) are completely bypassed. This leaves the low-level netlink and event tracking sockets running infinitely inside the OS handle table, causing the 72+ FD leaks we captured earlier.

    Upstream Git Patch Submitted
    I have submitted a formal patch to the core mailing list ([email protected]) to separate the hardware link check from the memory lifecycle teardown, ensuring cleanup runs unconditionally:

    Compiling Safely Across Your Custom LibreELEC Tree Targets
    For anyone building custom distribution images, you can drop this patch file straight into packages/network/connman/patches/connman-999-fix-wifi-fd-leak.patch and rebuild your exact appliance tree environment cleanly:

    For PC / Intel / AMD (Generic x86_64 Target):

    Code
    PROJECT=Generic ARCH=x86_64 ./scripts/clean connman
    PROJECT=Generic ARCH=x86_64 ./scripts/build connman

    For Raspberry Pi 4 (32-bit ARM Target):

    Code
    PROJECT=RPi ARCH=arm ./scripts/clean connman
    PROJECT=RPi ARCH=arm ./scripts/build connman

    For Raspberry Pi 5 (64-bit AArch64 Target):

    Code
    PROJECT=RPi ARCH=aarch64 ./scripts/clean connman
    PROJECT=RPi ARCH=aarch64 ./scripts/build connman

    The addon's built-in sandbox remains active to protect normal users, but this patch resolves the core issue at the operating system level.

    Salute!

    UPDATE: Case-Sensitivity Fix & Hardened Service Sandbox (v1.5.3+ Breakthrough)

    Following up on my previous live wireless debugging sessions, my team and I have successfully verified the exact interaction pattern and locked down a 100% zero-leak state under active runtime conditions.

    During our final integration testing for the management addon, we isolated two critical regressions in the initial workaround parameters that other users/developers should be aware of:

    1. ConnMan Configuration Case-Sensitivity
    ConnMan's underlying GLib key-file parser is strictly case-sensitive. My previous configuration block utilized lowercase keys (e.g., onlinecheckmode). Because of this typographical mismatch, ConnMan completely ignored those lines and quietly fell back to its default background testing intervals, keeping the background tracking loops fully alive.

    The configuration layout must use strict camelCase fields to be parsed correctly:

    Code
    [General]
    preferredtechnologies = ethernet,wifi,cellular
    OnlineCheckMode = none
    OnlineCheckIPv4URL = 
    OnlineCheckIPv6URL = 
    OnlineCheckInterval = 0
    OnlineCheckURL =


    Once corrected to uppercase camelCase, the journal log immediately confirms the tracking engine has successfully flattened out:

    Code
    connmand[1859187]: Online check disabled; interface eth0 [ ethernet ] remains in ready state.

    2. Dropping LimitNOFILE from 4096 down to 512 (The Safe Sandbox Boundary)
    Setting LimitNOFILE=4096 in the systemd override actually creates a dangerous race condition against the host environment. Because the Linux kernel's global default allocation maximum for an unprivileged process space defaults to 1024, setting systemd's ceiling to 4096 means a cascading Wi-Fi netlink handle leak will breach the kernel ceiling long before it hits the systemd limit. This results in the exact hard network lockup and dropped SSH terminal access we are trying to prevent.

    By dropping the process sandbox boundary down to 512, systemd acts as a highly effective, native circuit breaker. If a user runs exclusively on Wi-Fi and cycles their VPN repeatedly, systemd will cleanly catch, terminate, and gracefully restart the daemon *before* it can exhaust the global OS resource table—keeping host routing tables 100% stable.

    The corrected /storage/.config/system.d/connman.service.d/override.conf:

    Code
    [Service]
    ExecStart=
    ExecStart=/usr/sbin/connmand -nr --config=/storage/.config/connman_main.conf --nodnsproxy
    ExecStartPost=/bin/sh -c "sleep 2; if ! grep -q 'Method=manual' /storage/.cache/connman/*/settings 2>/dev/null; then echo -e 'nameserver 1.1.1.1\nnameserver 9.9.9.9' >> /etc/resolv.conf; fi"
    LimitNOFILE=512
    LogRateLimitIntervalSec=0

    Live Verification Results:
    After forcing a systemctl daemon-reload and cycling our target WireGuard interface (vpn_91_90_123_2) 10 times consecutively over a live monitoring window, the process limit ceiling safely clamped and the file handle loops fully stabilized at an ultra-low, flat baseline:

    Code
    Every 1.0s: echo -n 'VPN Daemon (connman-vpnd): '; ls -l /proc/$(pidof connman-vpnd)/fd 2>/dev/null | wc -l; echo -n 'Main Daemon (connmand): '; ls -l /proc/$(pidof connmand)/fd 2>/dev/null | wc -l
    VPN Daemon (connman-vpnd): 10
    Main Daemon (connmand):    19

    The structural leak is neutralized, execution tracking boundaries are safely held on LibreELEC, and process allocation profiles remain completely flatlined. These automatic configuration rewrites are fully integrated into our add-on upcoming release.

    Upstream ConnMan FD Leak & Automated Mitigation Guide
    Multi-Provider WireGuard VPN Manager for LibreELEC (NordVPN, PIA, Mullvad, Proton, Custom) - BrodjagaRatnik/service.wireguard.manager
    github.com

    Salute!

    chaosen3 Before I look into building support for this standalone dedicated auth path, I want to make sure I design the logic correctly for your specific setup. I actually already wrote some alpha code for it! However, to save myself the headache and grief of a massive backend rewrite, I want to double-check how you plan to use it.

    Jumping into the full add-on service means my background loops—like the connection watchdog, update crons, and ConnMan deadlocks—will constantly try to rotate tokens and ping public server lists. For a dedicated IP, I will have to build a lot of special overrides to tell the service: 'Stop, do not touch this connection, it is static!'

    To be completely transparent: this add-on was born out of my own personal needs. While I love open-source and sharing my work for free, my time is limited. I have my own job, bills to pay, and a life outside of coding. I am happy to help up to a certain point, but I cannot do massive, time-consuming backend overhauls for free.

    Could you tell me a bit more about your exact goal?

    1. Full Integration: Do you want the add-on to fully manage the dedicated connection on the background (handling ConnMan routing, automatic firewall rules, and keeping the tunnel alive)?
    2. Standalone WireGuard Config Generator Manager: Alternatively, I could pull the core connection, disconnection, killswitch, and system watchdog service logic from this manager and tie it together into a brand new, standalone add-on tailored specifically for custom/dedicated WireGuard tokens. This keeps this main project clean, saves me a massive rewrite headache, and gives you a fully functional, lightweight service for your dedicated connection.
    3. Config Generator Only: Or do you just want a quick utility built into the UI to generate the WireGuard configuration files using your token, so you can run them via your own custom scripts or system paths?

    Let me know your thoughts and what your setup looks like so we can see what is realistic!

    Saluti.