Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Using blobsaver with sudo on Linux hint in Wiki or Readme #545

Tuerpe started this conversation in General
Discussion options

Hey there,
sorry, it might seem really dumb but i think it would be nice to have a hint in the Wiki under "blobsaver on Linux" or in the readme that its mandatory to use blobsaver on linux with su privilegs. If i had this Info (not your fault just my total braindeadness) it would have saved me a bad day yesterday because i got stuck in recovery mode. On Linux (Im using Fedora) blobsaver cant detect my Iphone (13 Pro Max) in recovery mode without su privilegs.

Thx for reading and greetings:)

You must be logged in to vote

Replies: 15 comments

Comment options

Alternatively, I think it would be best to just have the program call polkit or an equivalent tool to request privilege escalation when needed.

You must be logged in to vote
0 replies
Comment options

Use this udev rule and you won't need su privileges

# Handle iOS devices in DFU and Recovery mode - for use with libirecovery
# Change group and permissions of iOS devices in DFU, legacy WTF, and Recovery mode
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="122[27]|128[0-3]", MODE="0666"
ACTION=="bind", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="122[27]|128[0-3]", MODE="0666"
You must be logged in to vote
0 replies
Comment options

Thx for sharing this method. But i think it would be helpful for some users, if theres a hint in the readme or wiki for either using sudo or your solution. As mentioned, it gave me a very bad day :D and the solution was so obvious.

You must be logged in to vote
0 replies
Comment options

That is because there is a udev rule that comes bundled with libirecovery. In addition to the rule above it sets the owner and group access on the device, but it wasn't working for me. Seems the same happened in your case. I tinkered a bit and made it work by only changing the mode and saving it as 39-libirecovery.rules to override the existing one.

You must be logged in to vote
0 replies
Comment options

hm okay. I thought I was the problem. :D Maybe this "bug" happened to me too.

You must be logged in to vote
0 replies
Comment options

I mean... yeah, this probably needs to be kept open imho. Like at the very least blobsaver should be able to figure out something is wrong and how to work around it.

You must be logged in to vote
0 replies
Comment options

is this gonna become my job now

You must be logged in to vote
0 replies
Comment options

I was not aware of this.

Is the udev rule not installed automatically when libirecovery is installed? @superrnovae

You must be logged in to vote
0 replies
Comment options

That depends on your distro, and blobsaver shouldn't assume the Udev rules are available and grant access to the specific user running the program. Handling this best would be checking if it has permission, and if it doesn't, then call polkit through e.g. Dbus.

You must be logged in to vote
0 replies
Comment options

I have no idea how polkit and udev works; but if someone could provide a more in depth explanation of what blobsaver should do (like what CLI programs or C functions to call) I could add a way for blobsaver to automatically detect it and try to fix it. Or if there's a way to elevate permissions while blobsaver is already running that would work too.

You must be logged in to vote
0 replies
Comment options

What is the error message given when it fails due to incorrect/missing permissions? I can at least try to add a more detailed error message to explain possible solutions.

You must be logged in to vote
0 replies
Comment options

On archlinux, I can't read apnonce normally without sudo.

What happens is:

This message stays for a while:
image

Then after quite a while (longer than the time taken for irecovery -q without sudo to fail) I get this:

image

The terminal output is:

> ./gradlew run
> Configure project :
Project : => 'airsquared.blobsaver' Java module
> Task :run
airsquared.blobsaver.app.LibimobiledeviceUtil$LibimobiledeviceException: irecovery error: code=-3
If your device is still in recovery mode, use the "Exit Recovery Mode" option from the help menu.
 at airsquared.blobsaver@3.3.0/airsquared.blobsaver.app.LibimobiledeviceUtil.throwIfNeeded(LibimobiledeviceUtil.java:344)
 at airsquared.blobsaver@3.3.0/airsquared.blobsaver.app.LibimobiledeviceUtil.waitForRecovery(LibimobiledeviceUtil.java:210)
 at airsquared.blobsaver@3.3.0/airsquared.blobsaver.app.LibimobiledeviceUtil$GetApnonceTask.call(LibimobiledeviceUtil.java:100)
 at airsquared.blobsaver@3.3.0/airsquared.blobsaver.app.LibimobiledeviceUtil$GetApnonceTask.call(LibimobiledeviceUtil.java:71)
 at javafx.graphics@19/javafx.concurrent.Task$TaskCallable.call(Task.java:1426)
 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
 at java.base/java.lang.Thread.run(Thread.java:833)

I can get the apnonce value fine if I run blobsaver with sudo.

You must be logged in to vote
0 replies
Comment options

@Redecorating how did you install libirecovery?

You must be logged in to vote
0 replies
Comment options

I have it from the AUR:

> pacman -Q libirecovery-git 
libirecovery-git 2:1.0.0.r47.gab5b4d8-1
> pacman -Ql libirecovery-git
libirecovery-git /usr/
libirecovery-git /usr/bin/
libirecovery-git /usr/bin/irecovery
libirecovery-git /usr/include/
libirecovery-git /usr/include/libirecovery.h
libirecovery-git /usr/lib/
libirecovery-git /usr/lib/libirecovery-1.0.so
libirecovery-git /usr/lib/libirecovery-1.0.so.3
libirecovery-git /usr/lib/libirecovery-1.0.so.3.0.0
libirecovery-git /usr/lib/pkgconfig/
libirecovery-git /usr/lib/pkgconfig/libirecovery-1.0.pc
libirecovery-git /usr/lib/udev/
libirecovery-git /usr/lib/udev/rules.d/
libirecovery-git /usr/lib/udev/rules.d/39-libirecovery.rules
> cat /usr/lib/udev/rules.d/39-libirecovery.rules
# Handle iOS devices in DFU and Recovery mode - for use with libirecovery
# Change group and permissions of iOS devices in DFU, legacy WTF, and Recovery mode
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="122[27]|128[0-3]", OWNER="root", GROUP="storage", MODE="0660"
# Handle checkra1n DFU mode
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="1338", OWNER="root", GROUP="storage", MODE="0660"

It includes a udev rule, although I'm not too sure of how to check if this rule is changing the permissions of the usb device or not.

You must be logged in to vote
0 replies
Comment options

I'll move this to a discussion, since it doesn't seem like something that can be easily fixed.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Converted from issue

This discussion was converted from issue #459 on January 22, 2023 23:42.

AltStyle によって変換されたページ (->オリジナル) /