Welcome to the iPadForums how-to guide on using Safe Mode to help you maintain a stable jailbreak...
What is Safe Mode?Mobile Substrate Update - 18/04
With the release of version 0.9.3997 on 18/04, Mobile Substrate now includes a special failsafe in addition to SafeMode. If you are experiencing a problem with a tweak or app, simply turn the device off. When you power it back up, hold down the "Volume Up" switch on your device until the lock screen appears. This will cause Mobile Substrate to disable itself and everything which relies on it allowing you to start Cydia and remove the offending tweak. Very Convenient! Once the problem tweak is removed, simply reboot your device!
Safe Mode is a facility provided by Mobile Substrate, a core component of the jailbreak where tweaks need to hook into the operating system. Mobile Substrate provides integration services to the tweaks and also protects you from badly behaving tweaks via Safe Mode.
When safe mode is active on your iPad, all tweaks which use Mobile Substrate are temporarily disabled to give you an opportunity to resolve the problem. Many inexperienced jailbreakers incorrectly blame Mobile Substrate for their device being in Safe Mode. As the text which appears when you are in safe mode explains, Mobile Substrate did not cause the problem, it protected you from it...
You should never remove Mobile Substrate from your device unless you absolutely positively know what your are doing and why! Also, don't believe any of the ramblings you will find across the internet about Mobile Substrate causing severe battery drain or that you are best to downgrade to an older version. Typically, these are misinformed discussions by inexperienced users. You should always be running the latest version of Mobile Substrate unless you hear definitively that there is a problem with it. Even then, you can expect Saurik to pull the build from Cydia and replace it with a working one very quickly and the staff at iPadForums will let you know officially that there is a problem!
Automatic activation of Safe Mode.
From time to time you may find that your device resprings and safe mode is activated automatically. You will recognise this has happened because "Safe Mode" will be visible in the status bar and a pop-up dialogue will appear explaining what has happened. You will also notice that because all JB tweaks have been temporarily disabled your springboard will look more like a stock device than a jailbroken one. Your icon layout is likely to be reset, icons may no longer be in the folders you expected, and the dock might be different (depending on how your device is customised).
What do I do?
First, don't panic! Safe mode is there to protect you and is not to be feared!
Sometimes, like any piece of software, a JB tweak can crash and trigger Mobile Substrate to offer Safe Mode protection. It is not necessarily a sign that there is something fundamentally wrong with your jailbreak. It's just that a tweak crashed. So the first thing to try is respringing by pressing the "Restart" button on the pop-up Safe Mode dialogue, If you already dismissed the dialogue, that's OK. You can call it up again at any time by tapping the status bar at the top of the screen where it says "Exit Safe Mode".
If your device resprings and everything looks normal again, then the crash which caused Safe Mode to be triggered was probably not too serious and "just one of those things". Apps do crash from time to time, particularly jailbreak tweaks which hook into the operating system. Just write it off to experience and continue to enjoy your JB!
However, if you immediately end up back in Safe Mode again, or you can perform some type of action which will consistently trigger Safe Mode, then you know you have a badly behaving tweak on your hands. 9 times out of 10 the culprit will be the last tweak you installed or updated. For this reason it is VERY IMPORTANT that you pay attention to the updates you apply via Cydia. If you don't know what it was you updated then you may have to go through everything on a trial and error basis until you find out what was wrong. First rule of Cydia - pay attention!
Removing badly behaving tweaks.
The main purpose of Safe Mode is to allow you to get into Cydia and remove a tweak or app which is causing problems. If you suddenly find yourself in a Safe Mode situation which you cannot get out of then chances are the last tweak or app which you installed or updated in Cydia is causing the problem. Open Cydia, switch to the installed tab, and remove the application(s) or tweak(s) which you recently installed or updated. Common culprits on the iPad are older tweaks or apps which were designed specifically for the iPhone. These sometimes don't play well with the iPad at all.
Once you have removed the appropriate tweaks and apps, respring the device. If you are back to your normally jailbroken state, then chances are you correctly identified the problem tweak. You may want to keep an eye on it, search our forum for information on it, or get in touch with the developer to ask about iPad compatibility.
If you still end up in Safe Mode after removing the tweak you thought might be the problem, then you will need to carry on testing out other tweaks and apps until you find the culprit. This is typically trial and error, but you should always go on the basis of what was most recently installed. JB apps tend not to develop problems over time, they tend to have them from the outset so look at what has most recently changed.
Help! I can't even get into Safe Mode!
Sometimes a JB tweak can be so badly behaved that Mobile Substrate cannot or does not put the device into Safe Mode automatically. In these situations, a wise jailbreaker will ensure they have kept a back door open for triggering Safe Mode themselves. There are several alternative methods to ensure you can launch Safe Mode manually, but all of them need a little prior preparation, so the best advice is to do them NOW when you are not in need of Safe Mode rather than wait until your device is in a mess, when you may struggle to get Safe Mode activated... You have been warned!
Safe Mode Launcher.
A Cydia app which does exactly what it says on the tin! Installing this app will put an icon on your springboard which will enable Safe Mode for you. Very handy. Just be aware that sometimes, depending on the severity of the problems you are facing, you may not be able to even get to your springboard to launch this app if it is installed, so don't rely on it as your only protection... There are several other similar apps in Cydia which provide icons for you to click to get into safe mode. All of these should be considered in the same category as this. Very useful, but not always accessible, depending on the error you are encountering.
Using SBSettings (normally from the lock screen) to get into Safe Mode is the most popular and easy way to get started with a basic level of protection. Make sure you allow SBSettings to be activated from the Lock Screen, bring it up with it's usual action (swipe across the status bar by default), choose the "Power" button on the right hand side, and choose "Safe Mode" from the pop-up menu. Your device will respring into Safe Mode.
Another popular method for the more savvy jailbreaker is to assign a specific Activator gesture to trigger Safe Mode when at the Lock Screen. This leaves you free to choose the gesture you prefer. Just don't forget what you assigned it to once you have configured the Activator app!
SSH Command Line.
This is the favourite back-door for the hardcore jailbreaker. Sometime a tweak can be so badly misbehaving that the lock screen will not even appear and the device will hang at the Apple logo with a "spinning wheel of death".
Even in this state, a device with OpenSSH installed should be able to be contacted, either over WiFi or USB, to get to the command line. I tend to use Putty for this purpose. Of course the pre-requisite is that you install OpenSSH!
Once you have a command line open to your device, the following command will trigger Safe Mode:
as an alternative (if the above command does not work) try...killall -SEGV SpringBoard
I hope you found this guide useful!touch /var/mobile/Library/Preferences/com.saurik.mobilesubstrate.dat