reynhout / chrx

Chromebook Unix
419 stars 56 forks source link

[suggestion] Alert against clobbering Chrome OS on installation #108

Closed AllTradesz closed 1 year ago

AllTradesz commented 3 years ago

I tried to be careful and read a lot prior to running chrx, but my assumption about what would happen to my base Chrome OS when I repartitioned proved wrong.

My Chromebox is older and space-constrained to 15GB on /dev/sda of which 10.8 was given to sda1. Because it has been used a lot over the years however, the space used on sda1 was 5.5GB, mostly cache from Chrome (70%), leaving 5.3GB of unused space there.

I wanted to set aside 6GB on the sda7 partition via chrx, so naturally I was concerned that sda1 would then have too little space. So I read through the documentation and issues here and studied the scripts. Nothing was mentioned clearly that Chrome OS would clobber itself and reinstall if it lacked space on sda1, rather I saw mentions that it would repair itself automatically when it saw that the partition table had been changed. Since no one had mentioned that her base Chrome OS had been clobbered and since no mention was in the README warning about this which seemed to me a not-unusual scenario, I decided to go ahead and do it, assuming that the "repair" mentioned that Chrome OS would undertake would involve the not unreasonable step of clearing out cached Chrome-browsing artifacts, and so free up more than enough space for me. Unfortunately this was incorrect, and after ten minutes or so of "repairing" itself, Chrome OS punted to a full reinstall of the OS, clobbering of course then all my downloads and other stuff I'd done over time in the terminal in developer mode.

So my bad for assuming when I knew the danger, due diligence done or not.

Still, since chrx remains active, I think it would be a great idea for you to add some warning/explanation to the README about this scenario, and indeed you could do a little work on the install script to calculate whether the space left in sda1 will be inadequate for the current amount of space used there, and warn right there to make sure the user understands the implications.

Thanks for considering, and thanks for the cool utility!

reynhout commented 3 years ago

@PCRyan I'm sorry to hear about that.

"Repairing ChromeOS" is Google's terminology (in firmware) for performing a "Powerwash", which is their terminology (in documentation) for wiping user data. This is forced when you switch to Developer Mode, due to the differing security models, and any time there's a partition map change, even if not necessary. This is generally not an issue -- Google considers ChromeOS to be a cloud OS, and most users do also.

IIRC, chrx used to have a token warning, but it was removed in an effort to simplify and not alarm unnecessarily. It sounds like you fall into the very small set of people who a) understand the issue, b) would be affected by the action, and c) trusted ChromeOS to work intelligently to preserve your important user data.

I will see if I can find a way to (re)introduce a warning that adds more clarity than confusion. It's a difficult balance to strike.

AllTradesz commented 3 years ago

@reynhout So every Chrome OS "repair" is a powerwash? That surprises me to learn because I would have expected collaborators here to have alluded to that quite a bit. I read pretty closely as I said, worried about this possible outcome, and didn't get that takeaway. I took away rather that Chrome OS would try to work with the new state of "STATE" (sda1) and not resort to a wipe if it didn't have to. Anyway, just curious if that's truly what you mean that "repair" = powerwash..

Just to be clear, the reset (powerwash?) occurred not because of a switch to developer mode (i.e. the first step in the preparatory steps for chrx). My box has been in developer mode for years. Long-time crouton user here. Also, I have been under the impression that a "powerwash" includes a reset of the state of the box to regular-user mode? In this case that did not happen. The box remained in developer mode.

Anyway if it is the case that any change to the size of the STATE partition will cause Chrome OS to reset/powerwash and so that partition will be wiped, then yeah, I think that should be made clear in the readme. :)

dragon788 commented 3 years ago

The developer mode "flag" is a value set in the NVRAM that persists through a Powerwash. You can view the flags in Developer Mode using crossystem in the VT2 terminal (after a login) via Ctrl+Alt+F2 or in ChromeOS via the Crosh shell after typing shell to get into the system shell.

Any changes to the partition table that resize partitions will trigger a repair, the ONE operation I've found that doesn't is reformatting the STATE partition yourself, but this has much the same effect as a repair, though it will run faster because typically the Google repair process includes writing zeroes or random data to the disk to prevent snooping after the disk has been formatted (like for resale or recycling).