Ubuntu QA:
BlogBrainstormPackage status
Log in
Ubuntu QA
Update manager
Idea sandbox Idea sandbox
Popular ideas Popular ideas
Ideas in development Ideas in development
Implemented ideas Implemented ideas

Contributor l.billon on Update manager

Protect package/system upgrades from power outage  
Written by 10110111 the 24 Mar 10 at 13:46. New
Currently, if a package/the system is being upgraded, loss of power can bring the system to non-booting state because of half-upgraded/half-installed packages (especially the system ones).
165
votes
up equal down
Solution #1: Make backups before upgrading package
Written by 10110111 the 24 Mar 10 at 13:46.
Before upgrading the package, the package manager should make backups of the package AND its dependencies (i.e. move them to backup directory) and mark the system as 'not completed update'. Then, if the system crashes/loses power/etc., ramdisk will see that 'not completed update' mark and will offer to restore it from backup.
After successful upgrade, sync() should be done, and the system marked as updated.
-63
votes
up equal down
Solution #2: Install package to seperate directory first
Written by danielt998 the 24 Mar 10 at 17:36.
Install the software to a seperate directory and then copy it to usr/bin or wherever
62
votes
up equal down
Solution #3: Make snapshot on filesystem level
Written by dino the 25 Mar 10 at 07:58.
Saving the packages as backup still might end into a unbootable system. Install scripts may be get aborted while running leaving files corrupted behind - with no way to detect which files.

With a snapshot of the whole filesystem, at no time during the backup the system becomes into an unbootable state.

This does not take as much space as its sounds, if the snapshot is handled incremental.

Technical solutions:
* btrfs does have good snapshot support buildin
* LVM
* ...


Pro:
* much more robust
* fast
* less diskspace for backup needed

Con:
* only works well if /home is on another partition
(otherwise userdata will be reset as well)
* does not work out-of-the-box with ext3/4

Taking the snapshot this way is really fast! Also this does NOT take up diskspace. Only the changes done while upgrading takes diskspace.

For more information check:
http://blogs.igalia.com/aperez/2008/06/more-btrfs-goodness-snapshots/
http://en.wikipedia.org/wiki/Copy-on-write
45
votes
up equal down
Solution #4: Use logging to allow recovery on restart
Written by ChrisB the 27 Mar 10 at 13:39.
If your computer loses power during an upgrade, when its restarted this should be detected by checking the logs. The problem should then be rectified by re-installing half installed packages and completing the upgrade process.

This should all happen behind the scenes in the boot process to provide minimum disturbance to the user.

-14
votes
up equal down
Solution #5: Use a 'System Restore Point' system
Written by tomjb24 the 3 Apr 10 at 10:02.
Create automatic system restore points before updating system files - and give users the option a creating a manual restore point, restore through recovery mode if unbootable
3
votes
up equal down
Solution #6: Include a Revision Control System in APT
Written by janozaurus the 18 Apr 10 at 20:44.
There's a package etchkeeper that keeps /etc in a git or hg repository. APT/Dpkg does already share some features of RCSs (tracks how files belong to packages, can keep old versions, keeps meta data).

Why not improve APT to allow rolling back a broken upgrade/install?

See the 6 comments or propose a solution (latest comment the 7 Apr 10 at 08:14) >>