This is a rough outline on how to setup altserver-linux
on the 🍓🍰. Wifi refreshing is enabled through the use of netmuxd
, which acts as a proxy from AltServer
to the iDevice (replaces/enhances usbmuxd
).
- https://www.reddit.com/r/jailbreak/comments/wa4z2z/tutorial_altstore_wifi_refresh_on_raspberry_pi/ (the OG)
- https://www.reddit.com/r/AltStore/comments/zvcdzv/finally_a_working_raspberry_pi_4_altserver_for/ (copied the OG and enhanced some aspects)
Create a dedicated folder for the setup, e.g. ~/Developer/alt-server
to hold binaries and other things.
sudo apt install -y \
libavahi-compat-libdnssd-dev \
usbmuxd \
ninja-build \
ldc \
libplist-dev \
libimobiledevice-dev \
libgtk-3-0 \
dub \
openssl
Install libimobiledevice-glue
from source by following the instructions on https://github.com/libimobiledevice/libimobiledevice-glue#debian--ubuntu-linux.
As well, install libimobiledevice
from source, by following the instructions on https://github.com/libimobiledevice/libimobiledevice#debian--ubuntu-linux. This installs executables such as idevicepair
and ideviceinfo
. We can use those later to verify if our wireless connection to the idevice is working properly.
Install rustup from https://rustup.rs/ and setup up the toolchain:
rustup toolchain install stable
rustup default stable
Then enable some systemd services. Before you do that however, you need to edit the usbmuxd
service file, which is located at /lib/systemd/system/usbmuxd.service
. Add the following to it:
# Taken from https://bugs.archlinux.org/task/31056
[Install]
WantedBy=multi-user.target
so that it can enabled with systemctl
. Then run:
sudo systemctl enable --now avahi-daemon.service
sudo systemctl enable --now usbmuxd
Now you can download the AltServer-aarch64
binary from https://github.com/NyaMisty/AltServer-Linux/releases and place it in the folder you created earlier.
As well, download the netmuxd
binary aarch64-linux-netmuxd
from https://github.com/jkcoxson/netmuxd/releases and also place it in the your folder.
Don't forget to make them executable with chmod +x ...
.
Install Docker by following the instructions on https://pimylifeup.com/raspberry-pi-docker/. If the docker install script fails at some point because it's trying to startup a service that won't start, just do a sudo reboot
and run the script again. Ignore the warning that running the script again might cause problems, this is just to warn that it could cause problems if docker has been installed in another way.
With docker installed, you can now run the following command to start the anisette
container:
docker run -d -v lib_cache:/opt/lib/ --restart=always -p 6969:6969 --name anisette dadoum/anisette-server:latest
This will keep the container running even if you reboot the pi. No cron job necessary for that.
Everything should now be set up. First, connect your iDevice to your Mac/PC with USB, enable "Wifi Sync" in the Finder or in iTunes and hit Sync/Apply
. This is important so the iDevice will also be recognized over the network by the pi. After syncing disconnect the iDevice from USB make sure it is broadcasting itself on the network by running avahi-browse -a
on the pi. Or run dns-sd -B _apple-mobdev2._tcp local
on the mac. On linux you need to do sudo apt-get install avahi-utils
first. If the device does not show up, there is no chance it will be recognized by netmuxd
.
Once your iDevice is broadcasting itself, connect it to the pi via USB and tap trust
on the iDevice to trust the pi. Verify that the pairing was successful by running idevicepair validate
. Now, disconnect your iDevice from the pi. Run sudo ./aarch64-linux-netmuxd
to start the netmuxd
proxy. Ensure that no errors or warnings are issued by netmuxd
, it won't quit the program but it will also most likely not work. It should say:
Starting netmuxd
Starting mDNS discovery for _apple-mobdev2._tcp.local with mdns
Listening on /var/run/usbmuxd
Adding device 00008110-0123A456B789D012 # or similar, this should appear after a few seconds
If the device is not added it is not properly paired with the pi or it is not broadcasting itself to the network via bonjour. Troubleshoot this problem and continue only when the device is shown here.
When the device shows up (without heartbeat errors), you can now run sudo ALTSERVER_ANISETTE_SERVER=http://127.0.0.1:6969 ./AltServer-aarch64
to start the AltServer
app. If the ALTSERVER_ANISETTE_SERVER
env variable is set in your current environment, you could also do a sudo -E
to make all env variables available in the root user process. This is not happening automatically! Verify that the env variable is set for the process by running:
ps aux | grep AltServer # copy pid
sudo cat /proc/<pid>/environ | tr '\0' '\n'
If the ALTSERVER_ANISETTE_SERVER
env variable is not present in the output here, make sure you ran AltServer
with the ALTSERVER_ANISETTE_SERVER
env variable specified correctly! If this is not set AltServer
will not complain, but App refreshing will most likely not work, because AltServer is not using your own anisette server!
Quit the AltServer
for now and install AltStore
on the iDevice. Check the latest version number for AltStore here: https://cdn.altstore.io/file/altstore/apps.json
curl -L https://cdn.altstore.io/file/altstore/apps/altstore/1_6_1.ipa > AltStore.ipa # replace 1_6_1 with the most recent version
sudo ALTSERVER_ANISETTE_SERVER=http://127.0.0.1:6969 ./AltServer-aarch64 -u 00008110-0123A456B789D012 -a <apple-id-email> -p <apple-id-password> AltStore.ipa
AltStore
should now be successfully installed on your iDevice. You can now just start AltServer
without any arguments (but with the env variable!) and use it for app refreshingn and installing apps through AltStore
directly. Try Delta
in the AltStore
App for example.
If anything fails, always make sure it works through USB (disable netmuxd
first) to make sure it's not a wireless connection issue. Always make sure sudo systemctl status usbmuxd
and sudo systemctl status avahi-daemon.service
are running at all times, especially after a system reboot.
Use crontab to start netmuxd
and AltServer
on boot. Run sudo crontab -e
and add the following lines:
@reboot sleep 20 && /.../alt-server/aarch64-linux-netmuxd > /.../alt-server/log/netmuxd.log 2>&1
@reboot sleep 20 && ALTSERVER_ANISETTE_SERVER=http://127.0.0.1:6969 /.../alt-server/AltServer-aarch64 > /.../alt-server/log/altserver.log 2>&1
replace ...
with the whole path to the executables. Also create your log
folder so the processes can write their logs in the background with mkdir /.../alt-server/log
. The 2>&1
part is important to redirect stderr to stdout so it is written to the log file as well.
After a sudo reboot
make sure AltServer
and netmuxd
processes run (with ps aux | grep ...
) and write to their log files. Also make sure the anisette
container is running with docker ps
. Inspect it's logs with docker logs anisette
to make sure it is running properly. Finally make sure the AltServer
process has the ALTSERVER_ANISETTE_SERVER
env variable set.
You can also start netmuxd
like this:
sudo ./aarch64-linux-netmuxd --disable-unix --host 127.0.0.1
You then need to set the USBMUXD_SOCKET_ADDRESS=127.0.0.1:27015
for AltServer
so it can connect to netmuxd
. The second tutorial from reddit mentions that for this to work usbmuxd
has to be disabled (sudo systemctl stop usbmuxd
. For me however it worked without these extra steps, so i'll leave this step out.
If you want to build netmuxd from source, it uses an mdns
fork which you would need to clone first from https://github.com/jkcoxson/mdns
and place on the same level as your clone
from https://github.com/jkcoxson/netmuxd/
. Then just edit the zeroconf = { version = "0.10.5", path = "../zeroconf-rs/zeroconf", optional = true }
to zeroconf = { version = "*" }
in the Cargo.toml
of netmuxd
. Make sure you have sudo apt-get -y install libclang-dev cmake
installed and then follow the build instructions from the netmuxd
README
.
- Linux Shell Script for setting up
AltServer
, should also work wirelessly: https://github.com/powenn/AltServer-Linux-ShellScript/blob/main/run.sh I did not try this but it might be worth it. - How to untrust devices on iPhone (revoke trust for all connected computers): https://discussions.apple.com/thread/253563134
- install altstore through altserver on linux, but install all other apps through altstore, if you install stuf with altserver directly it will not show up in altstore
- iDevice needs to have wifi sync enabled in finder on macos (or itunes on windows)
- you can see environment variables of any process by running
sudo cat /proc/<pid>/environ | tr '\0' '\n'
(replace<pid>
with the process id of the process you want to see the environment variables of) - You can reset the anisette docker container by
docker stop anisette
,docker rm anisette
anddocker volume rm lib_cache
- When asked for the 2 Factor Auth Code in
AltStore
it sometimes happens for me that it first reports "invalid code". Then, when refreshing the desired App again it works the second time without issues.
thank you for the suggestion and the patience, I've not so much experience in linux :/
By the way, now I've resolved the heartbeat error (i had to do the extra step ''sudo systemctl stop usbmuxd'' too) but still the main problem is there, when I open the Altstore app on my iphone I could not log with my apple Id and im in an infinite loading (look below):
fast recap: resolved heartbeat, downloaded & installed altstore from altserver linux through wifi, started altserver, then opened Altstore from iphone, try to login, infinite loading.....
Could be a chance that there is a conflict from the old Altstore (previously i had an Altstore from a windows altserver that I've deleted before I installed this one) and this one?
For more info, when I start Altserver, in the output I've this:
No argument supplied, if you want for help, please use -h or --help
Not supplying ipa, running in server mode!
Running python3 command to advertise AltServer: from ctypes import *; dll = CDLL('libdns_sd.so'); sdRef = c_int(); flags = 0; interfaceIndex = 0; name = None; regtype = br'_altserver._tcp'; domain = None; host = None; port = 33243; txtLen = 17; txtRecord = b'\x10\x73\x65\x72\x76\x65\x72\x49\x44\x3D\x31\x32\x33\x34\x35\x36\x37'; ret = dll.DNSServiceRegister(byref(sdRef), flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, None, None); print('DNSServiceRegister result: %d' % ret); from threading import Event; Event().wait();
*** WARNING *** The program 'python3.10' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/blog/projects/avahi-compat.html
DNSServiceRegister result: -65548
Those Warnings are something that should I care about or could I ignore them?