Native PlayStation 4 Component Discussion

I am as well. When I try to use setcap it doesn’t work as /usr/bin/python3.5 doesn’t exist on my setup.

I have HA setup in a Virtual Environment on Raspbian. I’ve tried /srv/homeassistant/bin/python3.5 but I get the following error:

Failed to set capabilities on file `/srv/homeassistant/bin/python3.5' (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file

Does anyone have a clue as to what the path is to Python on for a Virtual Environment?

Same here running HA on a mac which has no setcap command!

Help needed please

hi mate, you can figure out what python you need to run the setcap command on by doing:

cd /usr/bin
ls -al | grep python3

you’ll see what file it is pointing to:

lrwxrwxrwx 1 root root 9 Jan 20 2017 python3 -> python3.5

and then you run:

sudo setcap ‘cap_net_bind_service=+ep’ /usr/bin/python3.5

Then restart you homeassistant service and you should be good to go.

Unfortunately this fails to work for me using /usr/bin/python3.7

didn’t work.

the setcap command worked with no issues, but rebooting HA still has the same issue of being unable to bind with port 987.

running ls -al | grep python3 results in the following, and includes that line you posted about half way through.

lrwxrwxrwx  1 root root          37 Sep 28 03:25 arm-linux-gnueabihf-python3.5-config -> arm-linux-gnueabihf-python3.5m-config
-rwxr-xr-x  1 root root        3252 Sep 28 03:25 arm-linux-gnueabihf-python3.5m-config
lrwxrwxrwx  1 root root          36 Jan 20  2017 arm-linux-gnueabihf-python3-config -> arm-linux-gnueabihf-python3.5-config
lrwxrwxrwx  1 root root          37 Jan 20  2017 arm-linux-gnueabihf-python3m-config -> arm-linux-gnueabihf-python3.5m-config
lrwxrwxrwx  1 root root          29 Jan 26  2017 dh_python3 -> ../share/dh-python/dh_python3
lrwxrwxrwx  1 root root          23 Sep 28 03:25 pdb3.5 -> ../lib/python3.5/pdb.py
lrwxrwxrwx  1 root root          31 Jan 20  2017 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root root           9 Jan 20  2017 python3 -> python3.5
-rwxr-xr-x  2 root root     3976256 Sep 28 03:25 python3.5
lrwxrwxrwx  1 root root          36 Sep 28 03:25 python3.5-config -> arm-linux-gnueabihf-python3.5-config
-rwxr-xr-x  2 root root     3976256 Sep 28 03:25 python3.5m
lrwxrwxrwx  1 root root          37 Sep 28 03:25 python3.5m-config -> arm-linux-gnueabihf-python3.5m-config
lrwxrwxrwx  1 root root          16 Jan 20  2017 python3-config -> python3.5-config
lrwxrwxrwx  1 root root          10 Jan 20  2017 python3m -> python3.5m
lrwxrwxrwx  1 root root          17 Jan 20  2017 python3m-config -> python3.5m-config

@onemico, @Ktnrg45,

Hi, good afternoon,

I also have homeassistant setup in a virtual environment.

I did use your suggested command:

ls -al | grep python3

to find where it is pointing to, then i issued the command:

sudo setcap ‘cap_net_bind_service=+ep’ /srv/homeassistant/bin/python3.6

Which gave me the error:

Failed to set capabilities on file `/srv/homeassistant/bin/python3.6’ (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file

Question remains: how can i (and others) give access to the ports needed in a virtual environment? :grinning:

Thanks in advance,

br,
Raymond

Your setcap command should be:

sudo setcap 'cap_net_bind_service=+ep' /usr/bin/python3.6

Also in a virtual environment?

when is do:

ls -al | grep python3
Inside /usr/bin i get:
lrwxrwxrwx 1 root root 9 mrt 23 2014 python3 → python3.4

Unless you installed python3.6 to your virtual environment, and I can’t image how or why that’d happen, your python install should be in /usr/bin/python3.6

When i do that i get:

Failed to set capabilities on file `/usr/bin/python3.6’ (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file

Then use python3.4 as you seem to have that installed instead of 3.6 :wink:

Did that, and the command seemed to work, but i still get a:

Aborted
Could not bind to port 987.

Thanks for your help.

Br,
Raymond

That gets you to the same situation the rest of us are in which means you’re not alone and the problem is not isolated to something one of us is doing wrong. Hang tight, I’m sure we’ll get a response from the dev soon.

I’m still stuck in Mac as no setcap command works. Trying authbind but haven’t figured out yet…

Thank you very much.
One question keeps running around in my head :slight_smile:
I am on a Virt Env, should the command not use the path to your Virt Env?
Just thinking out loud, i am a newbie to this matter.

No, we’re trying to tell our system that Python (system-wide) can bind the ports it needs. Python is the thing that’s running the virtual environment. The virtual environment is just a neat way to keep things isolated.

SUCCESS!!! This worked for me. I’m now up to the next step. I’m going to head to bed now, but I’ll continue over the weekend.

sudo setcap 'cap_net_bind_service=+ep' /srv/homeassistant/bin/python3

Sorry guys, I am on VENV too and that is what worked for me.

You might also want to do a netstat and check if anything else is using port 987 also?

Sadly not for me, i still get:

Failed to set capabilities on file `/srv/homeassistant/bin/python3’ (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file

Nothing is bound to 987 for me:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 10.0.0.201:8300         0.0.0.0:*               LISTEN      5482/python3
tcp        0      0 0.0.0.0:32400           0.0.0.0:*               LISTEN      556/Plex Media Serv
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      623/nginx: master p
tcp        0      0 127.0.0.1:40561         0.0.0.0:*               LISTEN      662/Plex Plug-in [c
tcp        0      0 127.0.0.1:32401         0.0.0.0:*               LISTEN      556/Plex Media Serv
tcp        0      0 0.0.0.0:32402           0.0.0.0:*               LISTEN      623/nginx: master p
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      552/sshd
tcp        0      0 127.0.0.1:32600         0.0.0.0:*               LISTEN      752/Plex Tuner Serv
tcp        0      0 127.0.0.1:8088          0.0.0.0:*               LISTEN      543/influxd
tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN      5482/python3
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      623/nginx: master p
tcp6       0      0 :::8086                 :::*                    LISTEN      543/influxd
tcp6       0      0 :::22                   :::*                    LISTEN      552/sshd
tcp6       0      0 :::3000                 :::*                    LISTEN      6333/grafana-server

Same result here.

root@Up2:/usr/bin# ls -al | grep python
lrwxrwxrwx  1 root root          26 Sep 27 21:40 dh_pypy -> ../share/dh-python/dh_pypy
-rwxr-xr-x  1 root root        1056 Jan 18 10:56 dh_python2
lrwxrwxrwx  1 root root          29 Sep 27 21:40 dh_python3 -> ../share/dh-python/dh_python3
lrwxrwxrwx  1 root root          69 Jan  1 14:19 lirc-setup -> ../lib/x86_64-linux-gnu/python3.7/site-    packages/lirc-setup/lirc-setup
lrwxrwxrwx  1 root root          23 Feb 18 11:05 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx  1 root root          23 Feb  2 14:31 pdb3.7 -> ../lib/python3.7/pdb.py
lrwxrwxrwx  1 root root          31 Jan 18 07:54 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root root          26 Sep 27 21:40 pybuild -> ../share/dh-python/pybuild
lrwxrwxrwx  1 root root           7 Jan 18 10:56 python -> python2
lrwxrwxrwx  1 root root           9 Jan 18 10:56 python2 -> python2.7
-rwxr-xr-x  1 root root     3689320 Feb 18 11:05 python2.7
lrwxrwxrwx  1 root root           9 Jan 18 07:54 python3 -> python3.7
-rwxr-xr-x  2 root root     4873728 Feb  2 14:31 python3.7
lrwxrwxrwx  1 root root          33 Feb  2 14:31 python3.7-config -> x86_64-linux-gnu-python3.7-config
-rwxr-xr-x  2 root root     4873728 Feb  2 14:31 python3.7m
lrwxrwxrwx  1 root root          34 Feb  2 14:31 python3.7m-config -> x86_64-linux-gnu-python3.7m-config
lrwxrwxrwx  1 root root          16 Jan 18 07:54 python3-config -> python3.7-config
lrwxrwxrwx  1 root root          10 Jan 18 07:54 python3m -> python3.7m
lrwxrwxrwx  1 root root          17 Jan 18 07:54 python3m-config -> python3.7m-config
lrwxrwxrwx  1 root root          29 Jan 18 10:56 pyversions -> ../share/python/pyversions.py
lrwxrwxrwx  1 root root          34 Feb  2 14:31 x86_64-linux-gnu-python3.7-config -> x86_64-linux-gnu-python3.7m-config
-rwxr-xr-x  1 root root        3291 Feb  2 14:31 x86_64-linux-gnu-python3.7m-config
lrwxrwxrwx  1 root root          33 Jan 18 07:54 x86_64-linux-gnu-python3-config -> x86_64-linux-gnu-    python3.7-config
lrwxrwxrwx  1 root root          34 Jan 18 07:54 x86_64-linux-gnu-python3m-config -> x86_64-linux-gnu-python3.7m-config