Thursday, March 31, 2011

Switch Between Developer Mode and Normal Mode Without A Wipe

Normally when you pull the battery and flip the developer mode switch in or out of developer mode, the Cr-48 will wipe your stateful partition meaning you'll be back to the "Out of Box" state of Chrome OS and will need to reconfigure your accounts, WiFi networks, timezone, etc. etc. However I've created a special NoWipe image that allows you to avoid the wipe. But first the standard disclaimer:

You do this at your own risk. I'm not responsible if this breaks your Chrome Notebook, lose data or have any other problems. If you have trouble, feel free to post a comment but understand that you are taking full responsibility for your actions here. I have not hacked the Cr-48 or broken it's security with this disk image. See the very bottom of this post for an understanding of what this disk image is and does.

Update: I pushed this post out and then had to yank it real quick because I suddenly realized that in some cases, Chrome OS would immediately wipe the stateful partition as soon as a user logged in after switching from normal to developer mode. I wasn't sure what exactly was causing this behavior but I believe I've narrowed it down. If you first login to your Google Account on the Cr-48 in normal mode and then use the below instructions to switch to developer mode, Chrome OS will immediately wipe. The solution is to allow a wipe and login from developer mode for the first time. Then it seems you can flip between developer and normal using the below instructions without any issues (no guarantees though, see orange disclaimer above).

If you're not 100% comfortable about your Cr-48 being wiped back to it's out of box state and all data on it lost, don't even look at these instructions.


2nd Update: It seems Chrome OS eventually wipes one way or another after using NoWipe to switch. Your welcome to give it a shot but this isn't a long-term solution. It might be good for flipping into dev mode, making a change from the VT2 shell and then flipping back to normal mode on ocassion though...

To switch from normal mode to developer mode without a data wipe:

  1. Download my NoWipe image and create a USB or SD Card drive with it using the normal instructions.
  2. Turn the Cr-48 off. The image is only about 20mb in size so just about any size drive will do.
  3. Unplug the power cord and remove the battery. Flip the developer switch but don't turn power back on yet! Put the battery back and plug in the power cord.
  4. With the NoWipe drive ready to go. Power on the Cr-48 and press the space bar immediately to start the recovery process. Pay attention! If you miss pressing space in 30 seconds the Cr-48 will boot as into Developer mode and will warn that it's about to auto-wipe. If that happens, power off quickly by holding down the power button for 10 seconds or just yank the power cord and battery out.
  5. Once you're in recovery mode, insert the NoWipe drive when prompted for the recovery disk.
  6. It takes about 5 minutes for the NoWipe image to boot. This is Google's limitation, not mine. It's meant to prevent a quick, casual hack of our Chrome Notebook. Go grab some coffee.
  7. Once booted, the NoWipe image will tell you which mode the stateful partition believes it's in. It should show "Normal Mode" here as that's what you're coming from.
  8. Choose to switch the stateful partition to developer mode and reboot. Your Cr-48 will reboot and you'll be in developer mode without having your data wiped, same account picture, timezone, WiFi profiles and other settings as you had in normal mode.
To switch from developer mode back to normal mode without a data wipe:
  1. Download my NoWipe image and create a USB or SD Card drive with it using the normal instructions. The image is only about 20mb in size so just about any size drive will do.
  2. With the Cr-48 still in developer mode, reboot the Cr-48 and press the space bar to start the recovery process.
  3. Once you're in recovery mode, insert the NoWipe drive when prompted for the recovery disk.
  4. It takes about 5 minutes fo rthe NoWipe image to boot. This is Google's limitation, not mine. It's meant to prevent a quick, casual hack of our Chrome Notebook. Go grab some coffee.
  5. Once booted, the NoWipe image will tell you which mode the stateful partition believes it's in. It should show "Developer Mode" here as that's what you're coming from.
  6. Choose to switch the stateful partition to normal mode and shutdown.
  7. Once powered off, unplug the power cord and yank the battery. Flip the developer mode switch AWAY from the gold battery contacts to return the Cr-48 to normal mode.
  8. Plug the battery and power cord back in. Boot up your Cr-48. You'll be back in normal mode without having your data wiped, same account picture, timezone, WiFi profiles and other settings as you had in developer mode.
So how does NoWipe work?
Each time the Cr-48 boots off the SSD (not a recovery), Chrome OS determines if the current stateful partition where your data is stored has been in developer or normal mode based on the presence of a single file, /mnt/stateful_partition/.developer_mode. If the file does not exist but the hardware switch is in developer mode, it's assumed the user just flipped the developer switch and a wipe needs to be performed. If the file does exist and the hardware switch is not in developer mode, it also does a wipe. NoWipe is a custom image created using Google's instructions for booting your own non-Chrome OS image on the Cr-48. It boots using an official Google supplied recovery image kernel and then calls my custom nowipe.sh script. nowipe.sh simply creates or deletes the .recovery_image file when the Cr-48 is in recovery mode, thus avoiding the wipe. Rather simple really.

4 comments:

  1. Jay, I like the idea, it is useful, but I have not tried or verified this yet.

    Do you know if the resulting partition with this procedure still has the same type verified boot that Google provides if you one gone through the normal procedure (of course, the latter losing your settings)?

    ReplyDelete
  2. A related q. Can a user get into chronos or any underlying commands to execute any script, when the hw switch in the normal mode (NOT in the Dev Mode)

    ReplyDelete