System Rollback

System Rollback

Snapshot and Restore the System

Many system problems can be corrected by rolling back the root and boot filesystems to an earlier point in time. System Rollback allows you to create snapshots of these filesystems, restore them later, delete them when they are no longer needed, and compare them to the current system state. It additionally provides functions for optimizing the filesystem, showing disk usage estimates, and automatically taking snapshots periodically and before software installation and updates.

System Rollback is available on all 24.04 LTS (Noble) systems with BTRFS. It is not available on ext4 systems, or on 22.04 LTS (Jammy).

Please read the disclaimer before proceeding. We review and update guided solutions regularly. If you have suggestions or requests, please write support@kfocus.org.

Launching System Rollback

System Rollback may be launched in one of two ways - either through Start Menu > Kubuntu Focus Tools > System Rollback, or by clicking the System Rollback icon in the system tray. If neither of these items exist, the system does not support System Rollback.

Accessing System Rollback

Accessing System Rollback without a GUI

If the system is unable to start a graphical desktop, but does allow you to log in via a virtual terminal, you may access System Rollback through the CLI. This is particularly useful if a failed upgrade or deleted file is preventing KDE Plasma from starting.

1. Switch to a virtual terminal by pressing [Ctrl][Alt][F3] simultaneously.

2. Log in with your username and password.

3. Run /usr/lib/kfocus/bin/kfocus-rollback to launch System Rollback.

4. Use the arrow keys and [Tab] for navigation. Select items using [Space].

System Rollback in a virtual terminal

Creating Snapshots

System Rollback provides two ways to create snapshots - manually, and automatically. By default, snapshots are only created upon user request, however enabling automatic snapshotting is easy. Automatic snapshotting comes with both advantages and disadvantages, which are explained below.

Create a Snapshot Manually

Open System Rollback. You will be shown the Manage Snapshots menu. Ensure CREATE Snapshot is selected, then click [OK]. Confirm that you are ready to create a snapshot, then enter your password. Snapshot creation usually only takes a couple of seconds.

Snapshot creation confirmation window
Enable Automatic Snapshots

Open System Rollback, and select SWITCH between AUTO and MANUAL modes from the menu. Then click [OK]. In the menu that appears, select AUTO - Snapshots created automatically and regularly, and click [OK] once more. Confirm that you want to switch modes, then enter your password.

Snapshot mode switch dialog
Automatic Snapshotting Pros and Cons

Pros:

Cons:

Restore a Snapshot

Snapshot restoration reverts your boot and root filesystems to the state they were in when the snapshot was taken. This reverts all files on the system to an earlier state, except for:

While most user data is stored underneath /home, some applications, most notably database engines and web servers, will store or encourage the user to store data somewhere outside of /home. Unless this data is stored on a secondary or external drive, it will be reverted along with system files. To avoid data loss, System Rollback creates a pre-rollback snapshot immediately before restoring a snapshot. This allows you to recover up-to-date versions of reverted files if necessary.

1. Open System Rollback.

2. In the System Rollback menu, select RESTORE Snapshot. Then click [OK].

3. Select the snapshot you wish to restore and click [OK].

4. Ensure all open work on the system has been saved, then click [OK] to restore the snapshot. You will be prompted for your password. Once you have authenticated, the system will reboot.

5. You will be shown confirmation that the rollback was successful once you are logged in again. Click [OK] to dismiss the notice, or click [More Info] for guidance on how to compare the system's restored state to its previous state.

List of snapshots to restore

Other Features

In addition to creating and restoring snapshots, System Rollback provides several functions for managing snapshots and keeping the filesystem maintained. All of these features can be reached from the Manage Snapshots menu of System Rollback, and all are well-documented within System Rollback itself.

DELETE Snapshot

Allows the user to delete an arbitrary snapshot of their choice. This is useful for purging a snapshot that is consuming excessive disk space, or for clearing out unneeded snapshots to prevent useful ones from being trimmed automatically.

DELETE ALL and Optimize Disk

Deletes all snapshots on the machine, and runs multiple disk optimization routines to improve the filesystem's speed and free up disk space. This routine should be run if you receive a low disk space notification, if you notice disk space getting low for no apparent reason, or if the system's performance seems degraded when working with some files.

EXPLAIN How to Compare Snapshots

Shows the list of snapshots and provides guidance on how to compare the system's current state with the state of the selected snapshot. If you only need to recover some files from a previous snapshot, or if you need to recover a file that was rolled back during a restore operation, this will be helpful.

SHOW BTRFS Disk-Use Estimate

Quickly summarizes the available free and unallocated space on the primary disk. To avoid issues, you should keep your root filesystem's unallocated space at or above 15% of the filesystem's total capacity, while the boot filesystem should have at or above 25% unallocated space. Click here for an explanation of the difference between free space and unallocated space.

SWITCH between AUTO and MANUAL modes

Enables or disables automatic snapshotting. See Creating Snapshots above for more info.

Troubleshooting

Q: What is the difference between free and unallocated space?

A: BTRFS handles data in "blocks". Empty blocks are allocated for use as data is written to the disk. Blocks containing data are deallocated when all data in them has been deleted or moved to other blocks. All unallocated space is free, but not all free space is unallocated.

If unallocated space is exhausted, the system can suddenly become unable to write any more data to the disk even if free space is still available. For this reason, it is crucial that a reasonable buffer of unallocated space is maintained at all times. On Kubuntu Focus systems, you will receive a warning if unallocated space on either your root or boot filesystems is getting low.

Q: How do I free up unallocated space on the system?

A: To increase unallocated space on the main (/) filesystem, one can remove large software packages, data files, or database containers. On the boot (/boot) filesystem, one can purge unused kernels.

Another option, is to use System Rollback to delete snapshots, or in more extreme cases, "DELETE ALL and Optimize Disk".

Revisions

This is a partial revision history. See the git repository for all entries.

Disclaimer

We try hard to provide a useful solution validated by professionals. However, we cannot anticipate every situation, and therefore cannot guarantee this procedure will work for your needs. Always backup your data and test the solution to determine the correct procedure for you.

THIS SOLUTION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOLUTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

HAVE QUESTIONS? Call 844-536-2871 or write
TellMeMore@kfocus.org | GET FOCUS GEAR

KFocus Logo