majd / ipatool

Command-line tool that allows searching and downloading app packages (known as ipa files) from the iOS App Store
MIT License
5.35k stars 468 forks source link

No such interface 'org.freedesktop.DBus.Properties' #173

Closed XerockXMG closed 1 year ago

XerockXMG commented 1 year ago

What happened?

Attempting to get this to run on a headless Linux system, but keep bumping into the following error:

9:53AM ERR error="failed to log in: failed to save item in keychain: failed to set item in keyring: No such interface 'org.freedesktop.DBus.Properties' on object at path /" success=false

I've tried a few different methods of attempting to mimic a Desktop instance, but still hitting it. Figured that --non-interactive would bypass this, but doesn't seem to.

Version

2.0.3

Relevant log output

9:53AM DBG error="failed to log in: failed to save item in keychain: failed to set item in keyring: No such interface 'org.freedesktop.DBus.Properties' on object at path /" stack=[{"func":"(*appstore).Login","line":"57","source":"appstore_login.go"},{"func":"loginCmd.func1","line":"42","source":"auth.go"},{"func":"(*Command).execute","line":"916","source":"command.go"},{"func":"(*Command).ExecuteC","line":"1044","source":"command.go"},{"func":"(*Command).Execute","line":"968","source":"command.go"},{"func":"Execute","line":"54","source":"root.go"},{"func":"main","line":"9","source":"main.go"},{"func":"main","line":"250","source":"proc.go"},{"func":"goexit","line":"1594","source":"asm_amd64.s"}]
9:53AM ERR error="failed to log in: failed to save item in keychain: failed to set item in keyring: No such interface 'org.freedesktop.DBus.Properties' on object at path /" success=false
XerockXMG commented 1 year ago

After some messing around with various things, I managed to get this to work on Rocky8 Headless.

I had to install gnome-keyring and dbus

I added the following to my ~/.bash_profile

# set dbus for remote SSH connections
if [ -n "$SSH_CLIENT" -a -n "$DISPLAY" ]; then
        machine_id=$(LANGUAGE=C hostnamectl|grep 'Machine ID:'| sed 's/^.*: //')
        x_display=$(echo $DISPLAY|sed 's/^.*:\([0-9]\+\)\(\.[0-9]\+\)*$/\1/')
        dbus_session_file="$HOME/.dbus/session-bus/${machine_id}-${x_display}"
        if [ -r "$dbus_session_file" ]; then
                export $(grep '^DBUS.*=' "$dbus_session_file")
                # check if PID still running, if not launch dbus
                ps $DBUS_SESSION_BUS_PID | tail -1 | grep dbus-daemon >& /dev/null
                [ "$?" != "0" ] && export $(dbus-run-session) >& /dev/null
        else
                export $(dbus-run-session) >& /dev/null
        fi
fi

I then had to run the following command

gnome-keyring-unlock --unlock --replace

When you run this command, you will be taken to the next line with what seems like nothing happening. You are in the stdin prompt for gnome-keyring. Type your unlock password here and hit Enter. Then press "Ctrl + D" to tell it you are done with input. You should get a message about it replacing the daemon.

If you get an error about a directory not being found like /root/.local/share/keyrings, make the directory manually.

The final piece of getting this to run headless was to modify /cmd/constants.go to change the keyring it tries to use from ipatool-auth.service to login as you can only unlock the default keyring while running headless.

After modifying that and building from source, I am now able to run ipatool headless without an issue thus far.