qbittorrent disconnected: tun0 interface is invalid

Questions about qBittorrent or Gluetun (VPN).
bloop
Posts: 9
Joined: Fri Mar 07, 2025 10:57 pm
United States of America

qbittorrent disconnected: tun0 interface is invalid

Post by bloop »

Hello! Installation instructions were great! I'm having one issue, though.

My qbittorrent is reporting its connection status as disconnected. If I enable the execution log in the ui, I can see the message:
The configured network interface is invalid. Interface: "tun0"

Running yams check-vpn is successful:
✅ Success: Your IPs are different. qBittorrent is masking your IP!

I am using protonvpn. I am using my OpenVPN credentials in ".env". I have port forwarding on, so I have "+pmp" at the end of my OpenVPN "VPN_USER" in the ".env" file.
My docker-compose.yaml is left untouched from the install process.
The gluetun service has "8080:8080/tcp" and "8081:8081/tcp" listed, uncommented, under ports.
PORT_FORWARD_ONLY and VPN_PORT_FORWARDING are both set to on, and uncommented.
The qbittorrent service has the ports section commented out, and has:
network_mode: "service:gluetun"

I have crontab setup with: "*/5 * * * * /opt/yams/scripts/update-port.sh".
I can also run this script manually with no errors.
Script body is from: https://gitlab.com/-/snippets/4788387

Please let me know if there's anything else I can check or any other information you need. Thank you so much for any help!

User avatar
rogs
Site Admin
Posts: 370
Joined: Mon Oct 23, 2023 12:53 pm
Location: Montevideo, Uruguay
Gender:
Contact:
Uruguay

Re: qbittorrent disconnected: tun0 interface is invalid

Post by rogs »

Hey @bloop!

Thank you for the amount of detail! Can you run the port forwarding script manually and see the output? Also, try adding a torrent manually in qBittorrent to see if it starts connecting.

Cheers!

Roger.

YAMS Creator

E: roger (at) rogs.me. Fuck you, email bots.
W: https://rogs.me
gpg: curl -sL https://rogs.me/rogs.txt | gpg --import
fingerprint: ADDF BCB7 8B86 8D93 FC4E 3224 C7EC E9C6 C36E C2E6


Also, I love cats :mrgreen:

Pirate jet, pirate jet
bloop
Posts: 9
Joined: Fri Mar 07, 2025 10:57 pm
United States of America

Re: qbittorrent disconnected: tun0 interface is invalid

Post by bloop »

Code: Select all

2025-03-07 23:11:31 | VPN container gluetun in healthy state!
2025-03-07 23:11:31 | qBittorrent Cookie invalid, getting new SessionID
2025-03-07 23:11:31 | Public IP: ###.###.###.###
2025-03-07 23:11:31 | Configured Port: #####
2025-03-07 23:11:31 | Active Port: #####
2025-03-07 23:11:31 | Port OK (Act: ##### Cfg: #####)

Censored everything because iunno what matters haha, but the ip looked good, and all ports were the same value.
I did notice that it gives the "qBittorrent Cookie invalid, getting new SessionID" message every time.

I tried manually adding a debian iso torrent through the web ui, and it is also stalled.

User avatar
rogs
Site Admin
Posts: 370
Joined: Mon Oct 23, 2023 12:53 pm
Location: Montevideo, Uruguay
Gender:
Contact:
Uruguay

Re: qbittorrent disconnected: tun0 interface is invalid

Post by rogs »

Ok, everything looks right except for 'qBittorrent Cookie invalid, getting new SessionID'. Is the port being set correctly? You might have a problem with the configuration.

Maybe you can try deleting the qBittorrent config and regenerating it? I don't know what else to try to be honest.

YAMS Creator

E: roger (at) rogs.me. Fuck you, email bots.
W: https://rogs.me
gpg: curl -sL https://rogs.me/rogs.txt | gpg --import
fingerprint: ADDF BCB7 8B86 8D93 FC4E 3224 C7EC E9C6 C36E C2E6


Also, I love cats :mrgreen:

Pirate jet, pirate jet
bloop
Posts: 9
Joined: Fri Mar 07, 2025 10:57 pm
United States of America

Re: qbittorrent disconnected: tun0 interface is invalid

Post by bloop »

I tried doing the ol':

Code: Select all

mv /opt/yams/config/qbittorrent/qBittorrent/qBittorrent.conf /opt/yams/config/qbittorrent/qBittorrent/qBittorrent.conf.old

and running through the setup again (https://yams.media/config/qbittorrent/) as well as verifying the port forwarding stuff again (https://yams.media/advanced/port-forwarding/), but I'm still stuck in the same state.

Yeah I'm not sure what else to try either, haha.

bloop
Posts: 9
Joined: Fri Mar 07, 2025 10:57 pm
United States of America

Re: qbittorrent disconnected: tun0 interface is invalid

Post by bloop »

Well, I don't think port forwarding was working. I tried entering the qbittorrent ip from "yams check-vpn" and the port from running "/opt/yams/scripts/update-port.sh" into https://www.yougetsignal.com/tools/open-ports/ and the port was not open, even after adding the port forward to my router.

So I tried disabling port forwarding by running "yams stop", editing "/opt/yams/.env" to remove "+pmp" from my vpn username, and editing the docker-compose.yaml to comment out the "PORT_FORWARD_ONLY=on" and "VPN_PORT_FORWARDING=on" lines. I also deleted the qbittorrent config again to make sure the port was set back to the default 6881.

qbittorrent was still disconnected. I even tried removing all torrents, setting the network interface to eth0, and adding a distro iso torrent, and the connection status is firewalled. So it seems I've got myself quite the mess here, haha.

Additional mess notes:

  • I am running this on an raspberry pi 4, but the OS is "Debian GNU/Linux 12 (bookworm)".
  • I am only able to connect to the services via my external IP after port forwarding in my router, but not through the server's internal 192.168.. ip for some reason (but I can ssh to it via the internal ip).
bloop
Posts: 9
Joined: Fri Mar 07, 2025 10:57 pm
United States of America

Re: qbittorrent disconnected: tun0 interface is invalid

Post by bloop »

Ok, here's what I just tried.

Completely fresh install of Raspberry Pi OS (64-bit) on a Raspberry Pi 4.

sudo apt update
sudo apt upgrade

git is installed by default, docker is not.

sudo mkdir -p /opt/yams
sudo chown -R $USER:$USER /opt/yams

git clone --depth=1 https://gitlab.com/rogs/yams.git /tmp/yams
cd /tmp/yams
bash install.sh

Storage location is set to an external SSD connected through a SATA -> USB A adapter.
Something like "/media/name/New\ Volume".

The install.sh seemed to loop, so once I saw the success message and Service URLs I had to exit out because it started prompting me with the beginning questions again.

I was getting permission errors with the docker installation from the script, so I had to "sudo usermod -aG docker $USER".

All service were started, and "yams check-vpn" passed.

Looking at qBittorrent execution logs in the ui, I see again:
Trying to listen on the following list of IP addresses: "tun0:6881"
The configured network interface is invalid. Interface: "tun0".

On the bottom bar, connection status is Disconnected.

I tried adding a torrent for a Debian ISO, status is still disconnected.
ALSO, I see that I have 1 torrent in the status section on the left, but nothing shows up on the right, no matter what I click on the left, but I do see that the stalled category has 1, so I know it's not working.

I've tried "yams stop" and "yams start" as well.

I'm not sure what could be going wrong here. I'm not changing anything weird, I'm just going through the normal installation process and config process on a completely fresh OS install. Such a bummer haha

User avatar
rogs
Site Admin
Posts: 370
Joined: Mon Oct 23, 2023 12:53 pm
Location: Montevideo, Uruguay
Gender:
Contact:
Uruguay

Re: qbittorrent disconnected: tun0 interface is invalid

Post by rogs »

Hey! I think you may have misunderstood a few parts. There's no need to open any ports on your router.

Quick question: are you using a free or paid ProtonVPN account?

Also, you didn’t mention you were using a Raspberry Pi. I don’t think that’s the issue, but it’s possible Raspbian has problems with the /dev/tun device. You might want to check that.

It’s also pretty hard to debug without any logs. Could you share the Gluetun logs in a pastebin?

Cheers!

Roger

YAMS Creator

E: roger (at) rogs.me. Fuck you, email bots.
W: https://rogs.me
gpg: curl -sL https://rogs.me/rogs.txt | gpg --import
fingerprint: ADDF BCB7 8B86 8D93 FC4E 3224 C7EC E9C6 C36E C2E6


Also, I love cats :mrgreen:

Pirate jet, pirate jet
bloop
Posts: 9
Joined: Fri Mar 07, 2025 10:57 pm
United States of America

Re: qbittorrent disconnected: tun0 interface is invalid

Post by bloop »

Haha yeah, I misunderstood a couple of things. I'm not port forwarding anything on my router anymore.

This is a paid Proton VPN account, but I've got port forwarding turned off for now just to try and get it working at all.

I'll see if I can find anything about Raspberry Pi's OS having trouble with the /dev/tun device.

Here's gluetun's latest run's logs: https://pastebin.com/FKFrFAQC

Thank you for your help!

User avatar
rogs
Site Admin
Posts: 370
Joined: Mon Oct 23, 2023 12:53 pm
Location: Montevideo, Uruguay
Gender:
Contact:
Uruguay

Re: qbittorrent disconnected: tun0 interface is invalid

Post by rogs »

Ok, right in the end I see the VPN working without issues:

Code: Select all

2025-05-08T20:54:42Z INFO [ip getter] Public IP address is 185.246.211.195 (France, Île-de-France, Paris - source: ipinfo)

So it must be something else then. If it was the /dev/tun device, the VPN wouldn't connect. What do you see in qBittorrent? Can you send a screenshot of the network interface screen? I'm talking about this one: https://yams.media/pics/qbittorrent-5.webp

Cheers!

Roger.

YAMS Creator

E: roger (at) rogs.me. Fuck you, email bots.
W: https://rogs.me
gpg: curl -sL https://rogs.me/rogs.txt | gpg --import
fingerprint: ADDF BCB7 8B86 8D93 FC4E 3224 C7EC E9C6 C36E C2E6


Also, I love cats :mrgreen:

Pirate jet, pirate jet
Post Reply