boredazfcuk / docker-icloudpd

An Alpine Linux container for the iCloud Photos Downloader command line utility
1.81k stars 168 forks source link

No keyring file is created #161

Closed FrankHdf closed 2 years ago

FrankHdf commented 2 years ago

Hello, I try to use your image with LibreElec. Here the home directory is set to /storage. I create the docker container using this parameters (below others):

   --env user=root \
   --env user_id=0 \
   --env group=root \
   --env group_id=0 \
   --volume /storage/iCloudconfig:/config \
   --volume /storage/iCloud:/home/root/iCloud \

I have created the directories /storage/iCloudconfig and /storage/iCloud If I run this: docker exec -it iCloudPD touch /config/python_keyring/keyring_pass.test a file /storage/iCloudconfig/python_keyring/keyring_pass.test is created as expected. So I hope I configured the volumes correctly. But when I run docker exec -it iCloudPD sync-icloud.sh --Initialise and go through the initialize process everything looks fine, the cookie file for my apple ID is created in /storage/iCloudconfig, but no keyring file is created. Do I something wrong? The initialize process gives this error message:

22-05-19 14:16:07 INFO     Creating directory: /home/root/.local/share/
2022-05-19 14:16:07 INFO     Creating symbolic link: /home/root/.local/share/python_keyring/ to: /config/python_keyring/ directory
2022-05-19 14:16:07 INFO     Group, root:0, already created
2022-05-19 14:16:07 INFO     User, root:0, already created
2022-05-19 14:16:07 INFO     Set owner, root, on iCloud directory, if required
2022-05-19 14:16:07 INFO     Set group, root, on iCloud directory, if required
2022-05-19 14:16:07 INFO     Correct owner on icloudpd temp directory, if required
2022-05-19 14:16:07 INFO     Correct group on icloudpd temp directory, if required
2022-05-19 14:16:07 INFO     Correct owner on config directory, if required
2022-05-19 14:16:07 INFO     Correct group on config directory, if required
2022-05-19 14:16:07 INFO     Correct owner on keyring directory, if required
2022-05-19 14:16:07 INFO     Correct group on keyring directory, if required
2022-05-19 14:16:07 INFO     Set 750 permissions on iCloud directories, if required
2022-05-19 14:16:07 INFO     Set 640 permissions on iCloud files, if required
2022-05-19 14:16:07 INFO     Configure password
**2022-05-19 14:16:07 ERROR    Keyring file /config/python_keyring/keyring_pass.cfg does not exist**
2022-05-19 14:16:07 INFO      - Please add the your password to the system keyring using the --Initialise script command line option
2022-05-19 14:16:07 INFO      - Syntax: docker exec -it <container name> sync-icloud.sh --Initialise
2022-05-19 14:16:07 INFO      - Example: docker exec -it icloudpd sync-icloud.sh --Initialise
2022-05-19 14:16:07 INFO     Waiting for keyring file to be created...

Thanks a lot for your help! Best regards

FrankHdf commented 2 years ago

I found that a password file is created during the initialize process, docker exec -it iCloudPD cat /root/.local/share/python_keyring/keyring_pass.cfg shows the the content of this file, below others it contains my apple id. But I cannot find this file outside the container.

matteoveglia commented 2 years ago

Hi @FrankHdf - How did you end up fixing this?

I tried symlinking the cfg that you handily found the location of above, to the actual location the tool was looking for: docker exec -it icloudpd ln -s /root/.local/share/python_keyring/keyring_pass.cfg /config/python_keyring/keyring_pass.cfg

That seemed to work, after an initialise run it asked for my 2FA and success! But... now for some reason and I'm not sure if it's related but i'm getting the "No new files detected. Nothing to download" info and nothing in my data directory where my .mounted exists.

@boredazfcuk here's my log, nothing at all untoward. Though, maybe unrelated, but when I cat the config in /root/.local/ there's data in there but when I cat the symlink there's no data but that might be a limitation of cat working with symlinks.

2022-05-28 10:18:43 INFO boredazfcuk/icloudpd container for icloud_photo_downloader started 2022-05-28 10:18:43 INFO For support, please go here: https://github.com/boredazfcuk/docker-icloudpd 2022-05-28 10:18:43 INFO /usr/local/bin/sync-icloud.sh date: 2022/05/20_13:21 2022-05-28 10:18:43 INFO /usr/local/bin/sync-icloud.sh hash: REDACTED 2022-05-28 10:18:43 INFO Alpine Linux 3.13.5 2022-05-28 10:18:43 INFO Python version: 3.8.10 WARNING: You are using pip version 22.0.4; however, version 22.1.1 is available. You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command. 2022-05-28 10:18:44 INFO icloudpd version: 1.7.2 WARNING: You are using pip version 22.0.4; however, version 22.1.1 is available. You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command. 2022-05-28 10:18:46 INFO pyicloud-ipd version: 0.10.1 2022-05-28 10:18:46 INFO Running user id: 0 2022-05-28 10:18:46 INFO Running group id: 0 2022-05-28 10:18:46 INFO Local user: root:0 2022-05-28 10:18:46 INFO Local group: root:0 2022-05-28 10:18:46 INFO Force GID: False 2022-05-28 10:18:46 INFO LAN IP Address: 172.27.0.2 2022-05-28 10:18:46 INFO Default gateway: 172.27.0.1 2022-05-28 10:18:46 INFO DNS server: 127.0.0.11 2022-05-28 10:18:46 INFO IP address for icloud.com: 17.253.144.10 2022-05-28 10:18:46 INFO Route check to icloud.com successful 2022-05-28 10:18:46 INFO Apple ID: REDACTED@me.com 2022-05-28 10:18:46 INFO Authentication Type: 2FA 2022-05-28 10:18:46 INFO Cookie path: /config/REDACTED 2022-05-28 10:18:46 INFO Cookie expiry notification period: 3 2022-05-28 10:18:46 INFO Download destination directory: /home/root/iCloud 2022-05-28 10:18:46 INFO Folder structure: {:%Y/%m/%d} 2022-05-28 10:18:46 INFO Directory permissions: 750 2022-05-28 10:18:46 INFO File permissions: 640 2022-05-28 10:18:46 INFO Synchronisation interval: 86400 2022-05-28 10:18:46 INFO Synchronisation delay (minutes): 0 2022-05-28 10:18:46 INFO Set EXIF date/time: False 2022-05-28 10:18:46 INFO Auto delete: False 2022-05-28 10:18:46 INFO Photo size: original 2022-05-28 10:18:46 INFO Single pass mode: False 2022-05-28 10:18:46 INFO Skip download check: False 2022-05-28 10:18:46 INFO Skip live photos: False 2022-05-28 10:18:46 INFO Number of most recently added photos to download: Download All Photos 2022-05-28 10:18:46 INFO Downloading photos from album: Download All Photos 2022-05-28 10:18:46 INFO Stop downloading when prexisiting files count is: Download All Photos 2022-05-28 10:18:46 INFO Live photo size: original 2022-05-28 10:18:46 INFO Skip videos: False 2022-05-28 10:18:46 INFO Convert HEIC to JPEG: False 2022-05-28 10:18:46 INFO JPEG conversion quality: 90 2022-05-28 10:18:46 INFO Cleaned notification title: iCloudPD 2022-05-28 10:18:46 INFO Discord notifications enabled 2022-05-28 10:18:46 INFO Discord Discord ID: REDACTED 2022-05-28 10:18:46 INFO Discord Discord token: REDACTED 2022-05-28 10:18:46 INFO Discord notification URL: https://discord.com/api/webhooks/REDACTED/REDACTED 2022-05-28 10:18:46 INFO Sending Discord startup notification 2022-05-28 10:18:46 INFO Discord startup notification sent successfully 2022-05-28 10:18:46 INFO Download notifications: Enabled 2022-05-28 10:18:46 INFO Delete notifications: Enabled 2022-05-28 10:18:46 INFO Downloading from: icloud.com 2022-05-28 10:18:47 INFO Group, root:0, already created 2022-05-28 10:18:47 INFO User, root:0, already created 2022-05-28 10:18:47 INFO Set owner, root, on iCloud directory, if required 2022-05-28 10:18:47 INFO Set group, root, on iCloud directory, if required 2022-05-28 10:18:47 INFO Correct owner on icloudpd temp directory, if required 2022-05-28 10:18:47 INFO Correct group on icloudpd temp directory, if required 2022-05-28 10:18:47 INFO Correct owner on config directory, if required 2022-05-28 10:18:47 INFO Correct group on config directory, if required 2022-05-28 10:18:47 INFO Correct owner on keyring directory, if required 2022-05-28 10:18:47 INFO Correct group on keyring directory, if required 2022-05-28 10:18:47 INFO Set 750 permissions on iCloud directories, if required 2022-05-28 10:18:47 INFO Set 640 permissions on iCloud files, if required 2022-05-28 10:18:47 INFO Configure password 2022-05-28 10:18:47 INFO Using password stored in keyring file: /config/python_keyring/keyring_pass.cfg 2022-05-28 10:18:47 INFO Check download directory mounted correctly 2022-05-28 10:18:47 INFO Failsafe file /home/root/iCloud/.mounted exists, continuing 2022-05-28 10:18:47 INFO Set owner, root, on iCloud directory, if required 2022-05-28 10:18:47 INFO Set group, root, on iCloud directory, if required 2022-05-28 10:18:47 INFO Correct owner on icloudpd temp directory, if required 2022-05-28 10:18:47 INFO Correct group on icloudpd temp directory, if required 2022-05-28 10:18:47 INFO Correct owner on config directory, if required 2022-05-28 10:18:47 INFO Correct group on config directory, if required 2022-05-28 10:18:47 INFO Correct owner on keyring directory, if required 2022-05-28 10:18:47 INFO Correct group on keyring directory, if required 2022-05-28 10:18:47 INFO Set 750 permissions on iCloud directories, if required 2022-05-28 10:18:47 INFO Set 640 permissions on iCloud files, if required 2022-05-28 10:18:47 INFO Sync user root 2022-05-28 10:18:47 INFO Synchronisation starting at 10:18:47 2022-05-28 10:18:47 INFO Check 2FA Cookie 2022-05-28 10:18:47 INFO Cookie exists, check expiry date 2022-05-28 10:18:47 INFO Valid two factor authentication cookie found. Days until expiration: 90 2022-05-28 10:18:47 INFO Check download directory mounted correctly 2022-05-28 10:18:47 INFO Failsafe file /home/root/iCloud/.mounted exists, continuing 2022-05-28 10:18:47 INFO Check for new files using password stored in keyring file 2022-05-28 10:18:47 INFO Generating list of files in iCloud. This may take a long time if you have a large photo collection. Please be patient. Nothing is being downloaded at this time 2022-05-28 10:18:53 INFO Check successful 2022-05-28 10:18:53 INFO No new files detected. Nothing to download 2022-05-28 10:18:53 INFO Web cookie expires: 2022-07-27 @ 17:09:41 2022-05-28 10:18:53 INFO Two factor authentication cookie expires: 2022-08-26 @ 17:09:50 2022-05-28 10:18:53 INFO Days remaining until expiration: 90 2022-05-28 10:18:53 INFO iCloud login counter = 1 2022-05-28 10:18:53 INFO Synchronisation ended at 10:18:53 2022-05-28 10:18:53 INFO Total time taken: 00:00:06 2022-05-28 10:18:53 INFO Next synchronisation at 10:18:47

FrankHdf commented 2 years ago

Hi matteoveglia,

after running sync-icloud.sh I run this: docker exec -it iCloudPD cp -f /root/.local/share/python_keyring/keyring_pass.cfg /config/python_keyring So the keyring file is on the right place. The problem is, that the keyring file is correctly created in the homefolder of the user root but the symlink seems to use /home/root/.... This works for all users except root. It would be great if this could be fixed by boredazfcuk. Hope this workaround helps for now.

matteoveglia commented 2 years ago

Thanks! That works the same for me as the symlink but I switched to the cp method you gave as that seemed to do the trick.

I still can't get it to work though, whether I set the user as root or something else, I get all photos have been downloaded but nothing was downloaded at all.

Guessing that a Closed ticket won't be responded to so i'll make a new one, thanks again!

boredazfcuk commented 2 years ago

I've pushed a new version to Dockerhub which should address this issue. It will check the home directory location of the user and use that as the home folder location, instead of /home being hardcoded. Please test and let me know.