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

Running on Raspberry PI #200

Closed
steinrr opened this issue Sep 2, 2022 · 5 comments
Closed

Running on Raspberry PI #200

steinrr opened this issue Sep 2, 2022 · 5 comments

Comments

@steinrr
Copy link

steinrr commented Sep 2, 2022

I am trying to run icloudpd on my Raspberry PI 3 (ARM v7).

Creating network:

   docker network create \
   --driver=bridge \
   --subnet=192.168.115.0/24 \
   --gateway=192.168.115.254 \
   --opt com.docker.network.bridge.name=icloudpd_br0 \
   icloudpd_bridge

Then creating container:

   docker create \
   --name iCloudPD_boredazfcuk \
   --hostname icloudpd_boredazfcuk \
   --network icloudpd_bridge \
   --restart=always \
   --env user=pi \
   --env user_id=1000 \
   --env group=pi \
   --env group_id=1000 \
   --env apple_id=maskeduser@gmail.com \
   --env authentication_type=2FA \
   --env TZ=Europe/London \
   --volume icloudpd_myvolume_config:/config \
   --volume /home/pi/icloudPictures:/home/boredazfcuk/iCloud \
   boredazfcuk/icloudpd

Then I start the container

pi@raspberrypi:~ $ docker start iCloudPD_boredazfcuk
iCloudPD_boredazfcuk

And then when I try to initialize - I get a lot of errors. First some pip errors and then some network errors:

pi@raspberrypi:~ $ docker exec -it a9b6658b2336 sync-icloud.sh --Initialise

1970-01-01 01:00:00 INFO     ***** boredazfcuk/icloudpd container for icloud_photo_downloader started *****
1970-01-01 01:00:00 INFO     ***** For support, please go here: https://github.com/boredazfcuk/docker-icloudpd *****
1970-01-01 01:00:00 INFO     ***** /usr/local/bin/sync-icloud.sh date: 2022/08/28_16:45 *****
1970-01-01 01:00:00 INFO     ***** /usr/local/bin/sync-icloud.sh hash: 24b24c52e5dd8e44cba70839a1b832cd *****
1970-01-01 01:00:00 INFO     Alpine Linux 3.16.1
1970-01-01 01:00:00 INFO     Python version: 3.10.5
Traceback (most recent call last):
  File "/usr/bin/pip3", line 5, in <module>
    from pip._internal.cli.main import main
  File "/usr/lib/python3.10/site-packages/pip/_internal/__init__.py", line 4, in <module>
    from pip._internal.utils import _log
  File "/usr/lib/python3.10/site-packages/pip/_internal/utils/_log.py", line 8, in <module>
    import logging
  File "/usr/lib/python3.10/logging/__init__.py", line 57, in <module>
    _startTime = time.time()
PermissionError: [Errno 1] Operation not permitted
1970-01-01 01:00:00 INFO     icloudpd version:
Traceback (most recent call last):
  File "/usr/bin/pip3", line 5, in <module>
    from pip._internal.cli.main import main
  File "/usr/lib/python3.10/site-packages/pip/_internal/__init__.py", line 4, in <module>
    from pip._internal.utils import _log
  File "/usr/lib/python3.10/site-packages/pip/_internal/utils/_log.py", line 8, in <module>
    import logging
  File "/usr/lib/python3.10/logging/__init__.py", line 57, in <module>
    _startTime = time.time()
PermissionError: [Errno 1] Operation not permitted
1970-01-01 01:00:00 INFO     pyicloud-ipd version:
1970-01-01 01:00:00 INFO     Running user id: 0
1970-01-01 01:00:00 INFO     Running group id: 0
1970-01-01 01:00:00 INFO     Local user: pi:1000
1970-01-01 01:00:00 INFO     Local group: pi:1000
1970-01-01 01:00:00 INFO     Force GID: False
1970-01-01 01:00:00 INFO     LAN IP Address: 192.168.115.1
1970-01-01 01:00:00 INFO     Default gateway: 192.168.115.254
1970-01-01 01:00:00 INFO     DNS server: 127.0.0.11
nslookup: clock_gettime(MONOTONIC) failed
1970-01-01 01:00:00 WARNING  Cannot find icloud.com IP address - retrying
nslookup: clock_gettime(MONOTONIC) failed
nslookup: clock_gettime(MONOTONIC) failed

It says it cannot find icloud.com ip, but I can at least ping it from my Raspberry:

pi@raspberrypi:~ $ ping icloud.com
PING icloud.com (17.253.144.10) 56(84) bytes of data.
64 bytes from world-any.aaplimg.com (17.253.144.10): icmp_seq=1 ttl=57 time=18.9 ms
64 bytes from world-any.aaplimg.com (17.253.144.10): icmp_seq=2 ttl=57 time=19.0 ms

Seems that the network issue can be related to the time issue? I see that the time of container is in 1970?
Found this:
alpinelinux/docker-alpine#135

I logged into the container and tried running this command manually:

/ # pip3 list | grep pyicloud-ipd
Traceback (most recent call last):
  File "/usr/bin/pip3", line 5, in <module>
    from pip._internal.cli.main import main
  File "/usr/lib/python3.10/site-packages/pip/_internal/__init__.py", line 4, in <module>
    from pip._internal.utils import _log
  File "/usr/lib/python3.10/site-packages/pip/_internal/utils/_log.py", line 8, in <module>
    import logging
  File "/usr/lib/python3.10/logging/__init__.py", line 57, in <module>
    _startTime = time.time()
PermissionError: [Errno 1] Operation not permitted

Which is the command that generates errors. If I remove "the grep part" it works fine - i.e. "pip3 list" works fine by itself.

I also did:

/ # date
Thu Jan  1 01:00:00 CET 1970

and

/ # ping google.com
ping: bad address 'google.com'

and

/ # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: clock_gettime(MONOTONIC) failed

@boredazfcuk
Copy link
Owner

Lots of weird things happening here then… it’s saying there’s a permissions issue when running a pip command (the second one, first one seems to complete OK).

It also has an incorrect time… which will break TLS communications with iCloud.com every if there was nothing else wrong.

Can you see if you are running the container in a restricted mode? Possibly set it to run privileged?

@steinrr
Copy link
Author

steinrr commented Sep 2, 2022

Tried with --privileged and that worked fine. But I guess it should not really run like that? There is no direct need for it technically?

And a totally unrelated question:
I see that there is an option for not downloading live photos. Does this mean that live photos will not be downloaded at all - or will it still download the photo as a still photo and just not the video part? Or will it ignore the photo totally?

@boredazfcuk
Copy link
Owner

Yeah, I think you're going to have to. I've had a couple other people mention issues running on Raspberry Pis. I think the Raspbain (or whatever the OS is called nowadays) it must default to a restricted group, so that the container can't actually write to itself.

From what I remember, the app in the container doesn't recognise "live photos". All it does is log on to icloud.com and download everything it finds. Live photos are stored as an IMGxxxx.HEIC image and an accompanying IMGxxxx.HEIC.MOV so it downloads both.

You'll notice this with a lot of files. What is stored in icloud.com does not match what is stored on your phone. Basically, Apple just takes photos in a default resolution and then applies an "after effect" to the photo. These files can be seen if you plug your phone into your computer and browse the device in the file explorer (they're AAE files). These effect files add the filter to the phone, like "portait" or "sepia" or "greyscale" etc.

Currently there's no way of downloading these and applying them to the photo in question. If you open them up in a text editor, you can see they're actually encrypted, so it may present a problem to people trying to develop that functionality for the app inside the container.

@steinrr
Copy link
Author

steinrr commented Sep 2, 2022

OK - thanks for the information and help with this issue. Maybe a note in dockerhub could prevent other PI-users to struggle with this?

@boredazfcuk
Copy link
Owner

I'll need a bit more investigation before I add something. I don't really know anything about the issue, beyond seeing something similar once or twice before...

Is this happening on all OSs on arm devices, or specific ones? Is it happening with the default config, or is it a user implemented change which is responsible? i do have an RPi2 knocking around somewhere. I may fire it up and see if I can replicate the behaviour.

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

No branches or pull requests

2 participants