Can't change incoming port on Raspberry Pi qBittorrent-nox

Linux specific questions, problems.
Post Reply
Zongdang
Newbie
Newbie
Posts: 9
Joined: Fri Jan 05, 2018 9:31 pm

Can't change incoming port on Raspberry Pi qBittorrent-nox

Post by Zongdang »

As I get older I find my search skills waning so I apologize if the answer to my problem lies within the forum or some other obvious location.  I truthfully tried my best to search here and on the net.  Also, I wasn't really sure which sub forum to post in as this may not be a problem relating to Linux at all but since both machines where I execute qBittorrent run a version of Linux I figured I would start here.

I run qBittorrent-nox on a Raspberry Pi Zero where it has been running successfully for quite some time.  I've noticed however that it always uses the same port (18791) no matter what I do.  All other changes I make through the WebUi save just fine but the port always reverts to that same number.  I have the option checked to "Use different port on each startup" but even with a reboot and restart of qBittorrent-nox it still uses that same port number.  I use qBittorrent (not nox) on my Ubuntu desktop and do not have this problem there.  It starts with a new port every time (per the check box option) and if I change it manually and save it then it will retain what I entered until the next restart when it will start with a new (random) port number.

In both cases I am running through an Openvpn software firewall and NordVPN.  The firewall settings force my traffic through the VPN using their required port number but the qBittorrent incoming connection port must be at the VPN's machine otherwise my software firewall would not allow any torrents to process and I'm not experiencing that problem at all.  I'm probably overlooking something obvious so please forgive an old fool for trying to use this newfangled  ;) technology.
MPW
Member
Member
Posts: 20
Joined: Wed Mar 23, 2011 12:52 pm

Re: Can't change incoming port on Raspberry Pi qBittorrent-nox

Post by MPW »

Hello,

sounds like the qbittorrent process has no write access to the configuration file. As which user does qbit run and are the access right to /home/$USER/.config/qbittorrent/qbittorrent.conf correct?

Regards,
MPW
Zongdang
Newbie
Newbie
Posts: 9
Joined: Fri Jan 05, 2018 9:31 pm

Re: Can't change incoming port on Raspberry Pi qBittorrent-nox

Post by Zongdang »

Thanks for the reply MPW.  That sounds like something to look at though I don't understand why other settings I change within the UI seem to take just fine.  Anyway, I looked at qbittorrent.conf and it contains the entry Connection\PortRangeMin=18791 which makes sense as to why it displays that port number on the Connections tab of the Options window.  If write access is not available to that process then I'm surprised an error doesn't display to that effect when I make the change in the WebUI and then save it.  Maybe that kind of error is not trapped (or looked for)?

I looked at the permissions for that file and only the main userid has write authority so you are probably right and the web access is some other userid that does not have write authority.  I am running qBittorrent-nox from the main userid using the screen command.  I then disconnect (ctrl-ad) and leave it running that way.  I kept the web access userid as the default (admin) and can log in to the webui just fine.

As qBittorrent-nox is running under the main userid I would think that permissions there would not be an issue.  The webui, however, is most likely another matter and I am not very versed in Linux itself, let alone permissions to easily determine how that all works together.  When I sudo cat /etc/passwd one of the lines displayed is www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin and I'm wondering if that is the userid to which I need to giver write authority.  It's late here, I'm tired and my brain is shutting down so I'm going to go to bed and take a look at it with fresh eyes tomorrow.  Thanks again for your input.
Zongdang
Newbie
Newbie
Posts: 9
Joined: Fri Jan 05, 2018 9:31 pm

Re: Can't change incoming port on Raspberry Pi qBittorrent-nox

Post by Zongdang »

Do you ever have one of those days where nothing is consistent?  I'm having that kind of day today and there's a lot of weird sh!t happening regarding this issue.  I checked the conf file while nox was not running and compared it to the same file when nox is running and... wait for it... the contents are not the same!  And I did not change anything.  When nox is not running there is not a line with Connection\PortRangeMin at all.  When it does run it has that entry with the value 18791.  After I started nox again, the website I use to check my IP and port showed a different port number in use!  What?  I checked the conf file again and the port number in the file still shows 18791 but the website (which normally does show port 18791 for that instance of qBittorrent-nox) shows port 42399.  Does that mean nox all of a sudden decided to pay attention to the "Use different port on each startup" checkbox?

One difference on my end is I use NordVPN and their server I was using stopped responding (or at least qBittorrent-nox stopped uploading/downloading - showing no peer connections).  So I switched servers and restarted nox.  I have switched servers several times in the past but port 18791 never changed to anything else.

At this point I don't believe there is a permissions issue because one other weird thing happened which makes a permissions problem unlikely.  While I had nox running and I was logged into the WebUI I again tried changing the port number and then went and looked at the conf file.  The port number was changed to what I had entered!  When I looked at it through the UI it once again showed 18791.  It appears to me there are some defaults set in qBittorrent-nox that change when you first start nox and again when you end it.  I need a drink!
MPW
Member
Member
Posts: 20
Joined: Wed Mar 23, 2011 12:52 pm

Re: Can't change incoming port on Raspberry Pi qBittorrent-nox

Post by MPW »

Hello,

www-data is not your default user account, it should be ”pi“. You get your user information with the command ”id“.

You can verfiy the port with

netstat -tulpen |grep qbit

Regards,
Matthias
Zongdang
Newbie
Newbie
Posts: 9
Joined: Fri Jan 05, 2018 9:31 pm

Re: Can't change incoming port on Raspberry Pi qBittorrent-nox

Post by Zongdang »

Yes, I'm aware that "pi" is my default user account and that is the userid I use when I ssh to that particular pi (I have 5 currently in service that are running all the time each with their own purpose as well as 1 zero W, 1 Banana, and one LePotato waiting in the wings to do my bidding at who knows what).  What I was wondering is if www-data is the userid used behind the scenes when logged in with the WebUI.  That is actually a moot point now that I have seen that the conf file is modified when I enter a change through the WebUI.  it's just that that the WebUI does not seem to retain the change on it's display and the conf file reverts to a default state after logging out of the WebUI.

Anyway, here is the result of the netstat command you suggested:
tcp        0      0 10.8.8.159:42399        0.0.0.0:*              LISTEN      1000      79620      1690/qbittorrent-no
tcp6      0      0 :::8080                :::*                    LISTEN      1000      79816      1690/qbittorrent-no
udp        0      0 10.8.8.159:51269        0.0.0.0:*                          1000      79636      1690/qbittorrent-no
udp        0      0 10.8.8.159:6771        0.0.0.0:*                          1000      79635      1690/qbittorrent-no
udp        0      0 127.0.0.1:6771          0.0.0.0:*                          1000      79631      1690/qbittorrent-no
udp        0      0 0.0.0.0:6771            0.0.0.0:*                          1000      79630      1690/qbittorrent-no
udp        0      0 0.0.0.0:35193          0.0.0.0:*                          1000      79693      1690/qbittorrent-no
udp        0      0 10.8.8.159:42399        0.0.0.0:*                          1000      79621      1690/qbittorrent-no
udp        0      0 127.0.0.1:37643        0.0.0.0:*                          1000      79632      1690/qbittorrent-no



As I said in my previous post, the site I use (ipleak.net using the activate button on that page followed by the magnet link) for checking how the outside world sees my qBittorent box sees the port 42399 which the netstat command seems to agree with.  The question remains why the change happened (I did not enter that particular port number), why the port number changes I input into the WebUI do not get retained (again, it appears the conf file is actually changed through WebUI entry but only until shutting down qBittorrent when the file reverts to what can only be described as a seemingly default group of settings.  The file modify data/time changes with the changes to the file to match when my entries were made through the UI and when qBittorrent is shut down.  Go figure!
Post Reply