Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory: './pairings/accessory-secret' #43

Closed
joni15 opened this issue Jul 20, 2021 · 11 comments
Closed

No such file or directory: './pairings/accessory-secret' #43

joni15 opened this issue Jul 20, 2021 · 11 comments

Comments

@joni15
Copy link

joni15 commented Jul 20, 2021

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'

@systemcrash
Copy link
Member

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?

@thebeater
Copy link

thebeater commented Jul 22, 2021

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'

@systemcrash
Copy link
Member

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?

@thebeater
Copy link

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…

@systemcrash
Copy link
Member

I learned a ton about docker from google and stack overflow. 😎
Try something like this after ports:

   volumes:
     - ./pairings:/pairings

@Shaquu
Copy link

Shaquu commented Jul 24, 2021

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)

@joni15
Copy link
Author

joni15 commented Jul 25, 2021

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 😅

@systemcrash
Copy link
Member

systemcrash commented Jul 25, 2021

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

systemcrash added a commit that referenced this issue Jul 28, 2021
Basic docker-compose.yaml file which also maps the pairings folder.

Tested on:

docker-compose version 1.26.2
Docker version 20.10.7, build f0df350

Should help with #43 and #45

Also added the --volume flag to map the pairings folder from the docker
command.
@systemcrash
Copy link
Member

See 2aa2613

systemcrash added a commit that referenced this issue Jul 28, 2021
Basic docker-compose.yaml file which also maps the pairings folder.

Tested on:

docker-compose version 1.26.2
Docker version 20.10.7, build f0df350

Should help with #43 and #45

Also added the --volume flag to map the pairings folder from the docker
command.
@Shaquu
Copy link

Shaquu commented Jul 28, 2021

Thanks, as you speak about docker love. @systemcrash would you mind optimizing build?
Some steps are not cached, which makes rebuild very slow.

@systemcrash
Copy link
Member

Use docker-compose or avoid the build step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants