Staterestore

Hi all

This is a quick app I made to help automate going back to earlier states of Haiku.

It’s pretty handy I think, especially if you can’t access the boot menu.

Other nifty options are the ability to delete multiple old states, and states that can not actually be restored. In my cause I freed up around 1.5 GB of states that could not be restored, and another 1GB of states I didn’t need hanging around.

Download

For free up space occupied by previous states (and more) there is FilWip.

1 Like

@walaki Filwip is okay, but I like my version better. I rather not delete every old state, but just the ones I select.

1 Like

That shouldn’t happen unless you are deleting states without knowing what you are doing. Any idea how you got in that situation?

1 Like

@maxmax, “never” is a strong word.

In ordinary use, where people change packages only with pkgman, the state records are almost always clean. In rarer cases, someone moves or deletes package files by hand (easy to do while developing a package, exploring Haiku, or other), and then the old file is never archived into the state folder, so older states that need it can’t be restored.

There is also another case: a forced shutdown or power loss around a package change can leave the activation file itself corrupt. That’s what I hit on the VM after it was force-stopped. The syslog on the next boot said “Invalid packages activation file content”, and the file was full of random bytes. I suspect the data didn’t reach the disk before the shutdown, but I haven’t confirmed that.

While exploring this I noticed that, in my copy of the source (from Oct 15, so it may be out of date), the daemon writes activated-packages.tmp and renames it over the real file without a Sync(). I’m not 100% sure, but adding a Sync() before the rename might help avoid this kind of corruption.

All in all I want to thank your comment which made me dig properly instead of just assuming the tool was right.

I’ve bumped the app to 1.0.4 with some adjustments.

1 Like