icloud-photos-downloader / icloud_photos_downloader

A command-line tool to download photos from iCloud
MIT License
6.9k stars 554 forks source link

icloudpd 1.17.3: Failed to execv() /tmp/staticx-kJmNbp/icloud-1.17.3-linux-amd64.dynamic: Permission denied #788

Closed ThomasBalder closed 5 months ago

ThomasBalder commented 9 months ago

Overview

6 months a go I have installed iCloudpd on my Synology NAS using this guide: https://www.reddit.com/r/synology/comments/10hw71g/comment/j5f8bd8/. Since about two weeks my MFA token for iCloud expired so I needed to login again. That did not work (can't remember the error code), so I decided to upgrade pip and iCloudpd to the latest version. Since then, I get the error message: Failed to execv() /tmp/staticx-kJmNbp/icloud-1.17.3-linux-amd64.dynamic: Permission denied. Where the part 'kJmNbp' is random.

This happens with all the arguments. List, login to iCloud to store MFA token in keyring, etc.

I use the command /var/services/homes/tbalder/icloudpd-venv/bin/python /var/services/homes/installfolder/icloudpd-venv/bin/icloudpd -d "/volume1//foldername/foldername/" -u my@email --auto-delete --threads-num 3 --log-level info

Steps to Reproduce

  1. From my Synology nas (which is basically a Linux distro) I run (for example): # Login to iCloud and store password in keyring /var/services/homes/installfolder/icloudpd-venv/bin/icloud --username "my@email" or
  2. # Test connection by listing albums. This may prompt for 2-factor authentication the first time you run it. /var/services/homes/installfolder/icloudpd-venv/bin/icloudpd -u "my@email" -l

Expected Behavior

  1. Getting a prompt to enter password and approve MFA.
  2. Getting a list of albums in iCloud.

Actual Behavior

I receive an error message: Failed to execv() /tmp/staticx-kJmNbp/icloud-1.17.3-linux-amd64.dynamic: Permission denied. Where the part 'kJmNbp' is random.

Context

I have upgraded all the packages, and also reinstalled icloudPD using /var/services/homes/installfolder/icloudpd-venv/bin/pip3 install icloudpd, but that did not change the outcome. It also happens with a different iCloud account.

AndreyNikiforov commented 9 months ago

see #764

ThomasBalder commented 9 months ago

Thanks for the reply, but I see there is no current fix for it? I've tried the sudo mount /tmp -o remount,exec command, and now it gives me the option for MFA when logging in the first time (effectively running icloudp -l), but does not trigger the actual pop-up for MFA. Older versions like 17.1 and 17.0 in seperate venv give errors RE: mapping shared items. I've tried installing it in Docker on my NAS, but the container keeps crashing without clear reason.

AndreyNikiforov commented 9 months ago

Thanks for the reply, but I see there is no current fix for it?

IIUC Root cause is that Synology has limited permissions on tmp folder compared to other systems. icloudpd is distributed as binary executable, which unpacks at start using tmp folder.

As a workaround, there may be way to force source code installation - I haven't checked it though.

ThomasBalder commented 9 months ago

Okay, I’ll give that a go over the weekend and will report back. Thanks!

ThomasBalder commented 9 months ago

Just tried this, but I don't understand what I'm doing wrong. `/var/services/homes/tbalder/icloudpd-venv/bin/pip3 install --no-binary icloudpd ERROR: You must give at least one requirement to install (see "pip help install") adminuser@nas:~$ /var/services/homes/icloudpd/icloudpd-venv/bin/pip3 install icloudpd --no-binary

Usage: pip3 install [options] [package-index-options] ... pip3 install [options] -r [package-index-options] ... pip3 install [options] [-e] ... pip3 install [options] [-e] ... pip3 install [options] <archive url/path> ...

--no-binary option requires 1 argument adminuser@nas:~$ /var/services/homes/icloudpd/icloudpd-venv/bin/pip3 install icloudpd --no-binary :all: ERROR: Could not find a version that satisfies the requirement icloudpd (from versions: none) ERROR: No matching distribution found for icloudpd `

ThomasBalder commented 9 months ago

A little update for this issue: I've removed (does that count as uninstall?) the icloudpd-venv directories, rebooted DSM and installed again, so basically a fresh install right? Now when I run /var/services/homes/myuser/icloudpd-venv/bin/icloudpd -u "my@email.com" -l to test connection/list albums -- without authenticating before since reboot I get the same error. I enter 'sudo mount /tmp -o remount,exec' as suggested in #764 and run the icloupd command again, it changes. After entering my iCloud password, it asks me for an MFA code, but the MFA pop-up, but I don't get the prompt (or text msg) on my phone... After a while the request times out and the command fails (as expected).

Weirdly, I have another useraccount that I backup that originates from the same install dir (so same icloudpd command except for username), and that still works fine... So aside from the need to sudo mount ... command, perhaps something to do with the MFA token on Synology that's bugged?

ThomasBalder commented 8 months ago

After entering my iCloud password, it asks me for an MFA code, but the MFA pop-up, but I don't get the prompt (or text msg) on my phone...

An update regarding this issue: I've seem to fixed it using @Dylqn method, but slightly different. From SSH terminal on my NAS I ran /var/services/homes/username/icloudpd-venv/bin/icloud --username "my@username" --llist and weirdly enough now I did get a MFA prompt authentication... Perhaps it's a coincidence, maybe the MFA token got purged (don't know if that's a thing here), maybe it's something else. Hope this works for you too @biGdada (at least as a workaround).

So the TL;DR is two 'issues':

boasist commented 7 months ago

After entering my iCloud password, it asks me for an MFA code, but the MFA pop-up, but I don't get the prompt (or text msg) on my phone...

An update regarding this issue: I've seem to fixed it using @Dylqn method, but slightly different. From SSH terminal on my NAS I ran /var/services/homes/username/icloudpd-venv/bin/icloud --username "my@username" --llist and weirdly enough now I did get a MFA prompt authentication... Perhaps it's a coincidence, maybe the MFA token got purged (don't know if that's a thing here), maybe it's something else. Hope this works for you too @biGdada (at least as a workaround).

So the TL;DR is two 'issues':

  • MFA prompt doesn't appear on my phone, possibly fixed by running /var/services/homes/username/icloudpd-venv/bin/icloud --username "my@username" --llist from the SSH terminal on my Synology nas.
  • Failed to execv() /tmp/staticx-kJmNbp has a workaround by (from an SSH terminal in my case) running sudo mount /tmp -o remount,exec

Your TL;DR second bullet solved this same issue for me as well. Each time it went to run, a new temp folder was created, giving the permission denied error. I ran your line, and all worked just as it should. Thank you!

AndreyNikiforov commented 5 months ago

added a note to FAQ