No such file or directory: './pairings/accessory-secret'
Closed this issue · 11 comments
Hello,
when i run the docker container on rpi 4 :
[....] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemo[.ok
Traceback (most recent call last):
��File "ap2-receiver.py", line 190, in
��LTPK = LTPK()
��File "ap2-receiver.py", line 164, in init
��announce_id, self.ltpk = Hap(PI).configure()
��File "/airplay2/ap2/pairing/hap.py", line 170, in init
����with open("./pairings/accessory-secret", "wb") as secret_file:
FileNotFoundError: [Errno 2] No such file or directory: './pairings/accessory-secret'
Interesting. It's attempting to write the file to that path. Permissions to be able to write to that folder pairings
and that file in the folder are necessary. Can you touch
the file and create an empty binary file? Does it work then?
Hi systemcrash,
I have the same error and after
touch ./pairings/accessory-secret
the file is generated but the error is always:
docker run -it --rm --device /dev/snd --net host invano/ap2-receiver
[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
Traceback (most recent call last):
File "ap2-receiver.py", line 190, in
LTPK = LTPK()
File "ap2-receiver.py", line 164, in init
announce_id, self.ltpk = Hap(PI).configure()
File "/airplay2/ap2/pairing/hap.py", line 170, in init
with open("./pairings/accessory-secret", "wb") as secret_file:
FileNotFoundError: [Errno 2] No such file or directory: './pairings/accessory-secret'
OK - then I think the docker image needs extending slightly to understand that the pairings dir should be mapped. Think you could pull together a docker-compose.yaml file with that in?
then I think the docker image needs extending slightly to understand that the pairings dir should be mapped.
I‘m not very familiar with docker. If you can guide me a little bit this should be no Problem…
I learned a ton about docker from google and stack overflow. 😎
Try something like this after ports
:
volumes:
- ./pairings:/pairings
For me, compose alone did not solve the issue.
I did a "fix" in code, though.
if not path.exists('./pairings/accessory-secret'):
accessory_secret = random(nacl.bindings.crypto_sign_SEEDBYTES)
try:
with open("./pairings/accessory-secret", "wb") as secret_file:
secret_file.write(accessory_secret)
except FileNotFoundError:
print("Could not open './pairings/accessory-secret'")
print("accessory_secret will not be persisted")
else:
with open("./pairings/accessory-secret", "rb") as secret_file:
accessory_secret = secret_file.read()
self.accessory_ltsk = nacl.signing.SigningKey(accessory_secret)
Thank you for your help. I will test as soon as possible. I'm on holiday and have little time to play with my raspberry pi 😅
Can one of you try with the docker-compose.yaml
file with e.g.:
version: '3.8'
services:
ap2:
restart: unless-stopped
network_mode: host
build: .
# ports:
# - "7000:7000"
# - "10000-10100:10000-10100/udp"
volumes:
- ./pairings:/airplay2/pairings/
devices:
- "/dev/snd"
environment: # All variables are optional.
- AP2HOSTNAME=Airplay2
- AP2IFACE=eth0
See 2aa2613
Thanks, as you speak about docker love. @systemcrash would you mind optimizing build?
Some steps are not cached, which makes rebuild very slow.
Use docker-compose or avoid the build step.