Hacker News new | past | comments | ask | show | jobs | submit login
I've been working on X11 on jailbroken iOS (maxleiter.com)
403 points by MaxLeiter on Jan 17, 2020 | hide | past | favorite | 87 comments



You just reminded me of jwz’s portability efforts to keep XScreenSaver from being rewritten from scratch™ in the newest fad every time it comes around. He literally implemented X11 on top of Cocoa on top of UIKit on top of OpenGL on top of OpenGL ES just so that his hacks can still run. Though I wonder what will happen when Vulkan becomes the substrate API.


Good for him. Each to their own. That said, those hacks must be legendary for him to go to those lengths. Frankly I'm surprised xscreensaver is still around given all the various changes to window managers.

I've probably still got a few machines with a locally compiled version of xscreensaver lying around.


It's also remarkable that XScreensaver has one of the most stable DPMS implementations around.

Most screensavers and lockers lock-up the system while trying to switch the screen to low power mode on my PC but, XScreensaver works reliably. DisplayPort connection on nVidia cards is a pain point.


"(Display Power Management Signaling) enables power saving behaviour of monitors when the computer is not in use."

For those not familiar.


Every now and then I catch up with xscreensaver and I'm convinced jwz is a madman, intent on eventually implementing Emacs.


Again.


To be fair, he just forked it.


I think I just have one machine that still runs it, but I like xscreensaver and glad it's still around. It has a huge selection of screen savers, more than most other desktop environments, and they were all so cool!


OpenGL is probably going to be around forever, there's just too much stuff written around it that has 0 benefit from being completely rewritten in Vulkan. What is going to probably happen is that native OpenGL drivers will stop being developed as soon as implementations on top of Vulkan such as Zink become stable and competitive. After all, the fact that modern APIs such as DX12 and Vulkan are so low level has made reimplementing older, clunky APIs such as OpenGL and DX11 on top of them not only possible, but pretty much doable (see DXVK for instance).


OpenGL proper (not ES) wont go anywhere for at least the next 3-4 decades - there is way too much software written against it and keep getting written against it for it disappear. At worst, it will be reimplemented on top of something else (be it Vulkan or whatever), but this will be transparent to the applications using it.

Now if he wants to port XScreenSaver to a platform that doesn't have support for either OpenGL or OpenGL ES, my guess is that he'll write a wrapper.


OpenGL ES will need to be supported in some form for a long time to come because of WebGL, and perhaps existing Android and iOS games (depends how willing Google and Apple are to break backwards compatibility…). If not through native driver support, through ANGLE.


WebGL is a different beast from OpenGL ES, it doesn't require OpenGL ES's presence and can be implemented on top of any other 3D API that provides the necessary functionality (same with OpenGL and OpenGL ES of course).

FWIW i'd expect OpenGL on the desktop to exist for far longer than OpenGL ES on Android and iOS since the latter two do not put as much emphasis on backwards compatibility. Of course this wont stop others from implementing it, but that only helps when you have the source code and want to recompile an application - it wont help existing applications to keep working.


Glove on top of MoltenVK?


> If you're interested in using X11 now

I'm interested!

Take a look on AzPainter[0] — modern looking desktop app for painting, written in pure C with own toolkit built directly on top of X11.

Would be happy to see it ported to iOS.[1]

FTR, AzPainter already ported to Android, thanks to Termux app dev team.[2]

[0] https://github.com/symbian9/azpainter

[1] https://github.com/Symbian9/azpainter/issues/76

[2] https://github.com/Symbian9/azpainter/issues/6


Cool! I gave up on hacking on the iOS and macOS platforms because of how hostile Apple is towards it.

It's nice to see projects like this, I just hope that the rug doesn't get pulled out from under you after sinking time into it.


checkra1n (current jailbreak for devices with A10 or older chips) is based on a BootROM exploit, so thankfully I can keep my iPad on newer iOS versions and remain jailbroken.


> A10 or older chips

Actually it's A11 or older, which is even better.


Do you know if checkra1n could eventually allow Linux based operating systems like Android or Debian to run on Apple mobile hardware?


Who's going to write the drivers?


Perhaps the same folks who previously had Android running on the iPhone 3G a decade ago:

https://linuxoniphone.blogspot.com/2010/05/android-on-iphone...


The 3G had a commodity Samsung CPU core and 'off the shelf' third party subsidiary components, the drivers for which were available. Modern Apple custom in-house chips not so much.


Yeah, I sunk a few hours into trying to get Docker running on a jailbroken iPhone. It’d be awesome if all the arm work done for Raspi (et al) since the last hey day of Jailbreaking, could be easily ported to arm64 (Darwin)


Raspberry PI runs the Linux kernel, hence Docker is a relatively easy lift.

iPhone runs Darwin, which has none of the low level primitives in the kernel (cgroups, namespaces, etc) that Linux does, so good luck with that!


It is possible, and I believe a few of the developers of checkra1n/some of the community has expressed interest in running Linux. Whether or not it happens who knows.


I was disappointed to see that the authors have decided to keep it closed source for now. Has anyone done a security audit of it?


Being ignorant of all things jailbreaking, is there a reason why X11 the display can't run on iOS? Surely an ios app can run a persistent background server, eg web? Or is it the swapping out/pausing that is the problem? Or is the answer to these simply a sharp edged and loud NO? We-say-so etc.

I fully get why Vnc/X11 as a screen sharing facility wouldn't work - no access. I also get why running a full devel environment would be pain for a "normal" developer to implement - again, no access.

This is all ironic because Apple market their iPad Pro as a professional device AND the cpu/ram is obviously plenty good enough (they themselves said so). The thing is more powerful than a Pi. And it meekly manages to compile quite a lot. My little Pi collection is now at 5 members and growing.

So, Apple, why can't I compile apps for ios on ipados? Hmmm? Wheels for the mind, think different etc


For some definition of “server”, yes. https://www.raywenderlich.com/5817-background-modes-tutorial...:

”Your app is only allowed to keep running in the background in very specific cases. For example, these include playing audio, getting location updates or fetching the latest content from a server.

If your task does not fall into these categories, backgrounding may not be for you. You may even find yourself with an App Store rejection if you try to cheat the system by using background modes outside the realm of their purposes, so consider yourself warned!”

If you read that, your ‘server’ either will only run for a finite time determined by the OS (in practice 3 minutes), or only run at highly granular times determined by the OS (”the system uses usage patterns to determine when to best fire off a background fetch. For example, if your user opens the app at 9 AM each morning, it’s likely that a background fetch will occur sometime before that time.”)

I think a X11 server that tracks updates for those three minutes of inactive time, and has a window manager that requests window updates where needed when the app becomes active could work, though.

(Disclaimer: these restrictions get relaxed over time on iOS. I may have missed some recent improvements)


Fortunately background apps are still not allowed or every app and his brother would find a reason to require it.

This kind of functionality would require an external server but then you may as well use VNC.


From what I can tell most "things that need persistent connections", including vnc or ssh, are not so persistent on ios.


But that still isn’t a reason to need a a jailbroken iOS device. There is no technical limitation on playing background music to keep the session open. It would require a Mac and XCode. You don’t have to pay for a developer account to install on your own device.


No, you don’t, but AFAIK, you’ll have to reinstall your app every week. https://codewithchris.com/deploy-your-app-on-an-iphone:

”Note: Without enrolling in the Apple Developer Program, your app will only last for 7 days on your device. After that, you’ll have to re-deploy it to your device via Xcode. If you’re enrolled in the Apple Developer Program, you won’t have this inconvenience.”

That’s “less than ideal”.


So even in that case, it seems like he could offer the option of keeping the session running in the background using audio. If you have a jailbroken device, you can turn off the audio.

Since it is open source - that means if you own a Mac, you can install it yourself. If you don’t want the hassle of revalidating the software every seven days, and want to play with other open source software, pay the developer fee.

I have no plans on becoming an iOS developer professionally, but heck if I owned a Mac I would get a developers license just to play around with developing for iOS and to use third party open source software.

I would love to experiment with Xamarin and other cross platform mobile tech.


> Surely an ios app can run a persistent background server, eg web? Or is it the swapping out/pausing that is the problem?

I don’t know technical details, but trying to use ssh tunnels on iOS, the tunnel won’t forward until I swap iSH into the foreground, so I have to constantly swap between the browser and the terminal.

Not very practical.


That is not a limitation on jailbroken devices. E.G. I use ssh to run a SOCKS proxy; I just run it in the terminal and it runs forever.


I would guess it depends on how this was implemented really. If you’re using private apis then it is a no go. But if you were to somehow only use public apis to fill the x11 apis then it would maybe be okay.


There are 2 parts indeed. Jailbroken - provides ability of root / non-sandbox interaction. Without it, each process is sandboxed:

* you don't have access to other files (you can have some ability to have shared folders but it's very scoped)

* you can't do much IPC if I remember correctly.

So you're capabilities are more limited. Even if those were not critical, X11 as an environment would be useless as you'd need to have it on each app you build because the AppStore requires pre-compiled or interpreted code. You're not allowed to have an app that download other apps...


You can download JavaScript code. Though that would require rewriting an ecosystem or at least porting everything to wasm.


This makes me happy. I have so much X11 code written over the past few decades, and I always fall back to X programming when I need to do something fast and in C. I've written a few simple iOS apps, but was frustrated with GStreamer support. Of course I have no idea what Cydia is... off to wikipedia.


For anyone else, Cydia is a dpkg based package manager for jailbroken iOS


Very cool, I wish jailbreak wasn't needed! Hopefully this shows Apple that people want to use their iPad as coding machines too...


Apple will eventually give you some kind of Xcode.

BTW, few years ago this guy made some Xcode remote before joining Apple Xcode team :) - https://twitter.com/LouisDhauwe/status/1008071487721439233/v...

But that's only part of the problem. Still until Apple would give us the ability (similar to Android) running unsigned / not from App Store / no timebombs certs (similar to Android unknown sources), iOS is the most propriety platform and that's a shame.


I agree that Apple will eventually provide some sort of Xcode support. For now, Pythonista is a proof of concept that you can effectively write small Python programs on an iPad.

I plug my small iPad Pro into my USB-C interface large monitor and a few applications take advantage of dual screens to show different content.

For now, I find that I can code while traveling using a remote Linux server, Working Copy, Prompt ssh shell app, and Textastic for local editing. Not very convenient, but it works.

What is convenient on my iPad while traveling is writing. I use leanpub with markdown files stored in a github repo for each book, edit and do git stuff with Working Copy, and generate review PDFs on leanpub’s web app. This works fine. On rare occurrences I use Microsoft Word on my iPad, works great, but I prefer markdown and leanpub.


There are a couple ways but they’re both kind of a bitch and the OS deletes the app and its data after some period of time (depending on which method you use.)


I have recently been coding on iPad using a combination of Working Copy [1] and Termius [2].

[1]: https://workingcopyapp.com/

[2]: https://www.termius.com/

Working Copy is an amazing graphical Git client and integrates fully with iOS Files.

But for now SSH/Mosh via Termius feels closer to a traditional dev environment. It gives me full access to the command line, tmux, vim, etc., and mapping caps lockesc sidesteps the lack of an iPad escape key and would be my default on a computer anyway.

I would love to have the best of both worlds: a traditional dev environment local to my iPad and integrated with native iOS APIs.


Tossing this in for people interested, Kodex (https://apps.apple.com/us/app/kodex/id1038574481) is a great text editor that can integrate with Working Copy locally.


Kodex looks good. The App Store mentioned in-app purchases, but I couldn’t find any info.

I have been using Textastic for a long while with Working Copy. What are the advantages of Kodex over Textastic that you have seen?


There's only one IAP listed, and it's a $4.99US "Tip".


I find it ironic that the best tablet to run full-fledged Linux is Microsoft Surface.


Not so ironic any more if we consider Microsoft’s work on WSL in a last couple of years.


What are you missing right now? I have been very happy with Buffer and the new files system, panes for multitasking, + VNC.


give me root or give me death


I give you... an Android tablet.


* I sell you... a bad experience.


This is an absolutely batshit crazy idea. I love it.


Add it to my list of "nice things we can't have inside the walled garden"


I am confused, so is a X11 stack/server runs in an iOS device natively (not remotely) but you need a VNC client since a X11 client is not implemented yet?


You can do the same today, without a jailbreak using https://ish.app/ which is an x86 emulator capable of running on the latest iOS / iPadOS versions. I do actually use it for work. Plus it works with standard x86 alpine Linux packages.


I'm sure many people find ish.app useful. It failed for me mostly because the emulation layer slows things down too much. I wanted to run emacs on my iPad Pro (2017) and it is indeed straightforward to get it (and many other things) running under ish. Maybe some people would be happy with it; for me the sluggishness of emacs in ish made me look for other solutions. At the moment, I'm using iVim, which works great and is a native ios app so very snappy.


There’s a short tutorial on their wiki for anyone interested: https://github.com/tbodt/ish/wiki/Running-a-VNC-Server


I guess technically you can, but emulating x86 on arm sounds horrible. (Friendly reminder that nothing like JIT is allowed on iOS for third-party code.)


It’s reasonable if you’re doing some light editing.


I’d absolutely love to see X11 added to ish. That’s probably the only thing that could keep me from switching to one of the open source phones.


Yep. Someone more familiar with Swift/iOS internals can probably write a proper client as an app, but I can't do that at the moment


Oh is that it? I thought x11vnc was needed so you could do input/output (keyboard/mouse and such).


An iPad is certainly a thin client...

More seriously though, while I am (or have been) persuaded that the restricted environment of iOS generally does make sense for the majority of people, I’d love to see official “blank” iDevices or an open developer mode available for them. Perhaps something similar to being able to install Linux on PlayStation’s. They make very nice portable computing platforms for prototyping and development.


Shame that newer devices can’t have this


Finally xeyes!


Reminds me of Qmole.[0]

[0] https://github.com/chriskmanx/qmole


Interesting porting effort here for X11 on iOS. I'm not sure why I would use this but wouldn't it be beneficial for more iPhone jailbreak users to have Android dual-booting on their iDevice device?

If that were to happen, I would never need to buy a second phone like I would just use my single Macbook to triple-boot Windows, Mac and Ubuntu.


Well, for starters, you'd need to reverse engineer drivers for custom Apple hardware, some of which is hardened against that.

...And about 37 other extremely difficult things later, Apple would sue you.


Under what grounds?


Under the grounds of making them sad and you having way less money than they have.


You can do whatever you want with your own gear. Apple doesn't go after you until you start spreading it around.


Dual booting would be far better, but isn't possible right now. It's theoretically possible thanks to checkm8 (https://twitter.com/axi0mX/status/1177542201670168576), but will require an enormous amount of work. This was something I knew I could accomplish


What's with all the hype? This has been done over 10 years ago: http://ingvar.blog.redpill-linpro.com/2009/11/17/running-nat...


Will the approach in the article you linked work today?


Wouldn't porting Wayland be easier and more future proof than porting X11?


Wayland is linux only, and will require significantly more work. Some work has been done on macOS, so maybe one day...


What about RDP would that be a possibility?


need rooted ?


Yep, you'd have to be jailbroken / rooted to use Cydia.


Sorry, I must have been out of the loop. When was the jailbreak for iOS 13 published? (I'm also a complete stranger to jailbreaking—never done it before.)


Sometime in December, but Checkra1n is still in beta and only works up to the iPhone X since the bug was patched on the newer 2019 iPhones.

https://canijailbreak.com/



There is an exploit that can be used, but it only works on old devices (iPhone X and older).


A bootrom exploit has been found that works on all pre-2019 iOS devices.


Bravo




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: