Clean Slate

Article from Issue 211/2018

If you have totally messed up your Debian, Ubuntu, Linux Mint, elementary OS, or Linux Deepin, you can simply reset with Resetter.

In case of a broken system, beginners tend to grab a DVD or a USB stick and reinstall the system. This is fast, they think – and the thinking here is not wrong. But you do not have to resort to this anymore, thanks to Resetter [1]. Under the hood, Resetter is a Python script that supports resetting to the default installation for some distributions, much like the procedure for smartphones.

Resetter's way of working is quite simple: Using the appropriate manifest list, the tool determines which packages were originally installed (and in which versions) when the operating system was installed. Resetter will remove anything that does not match and reinstall the default packages according to the manifest. Besides two reset modes, the software offers another possibility to search Personal Package Archives (PPAs) directly in Launchpad and install them without any further manual work (via the Easy Install button).

Resetter reads the flags in Ubuntu, Linux Mint, and some other distributions to return to the state immediately after installation. The list of officially supported distributions includes the 64-bit versions of Debian 9.2 in the standard output with Gnome, Ubuntu from 14.04, Linux Mint from 17.3, elementary OS from 0.4, and Linux Deepin from 15.4.

I thoroughly tested Resetter under Linux Mint 18.3 and the current Debian "Stretch." Under Ubuntu 17.10, I could not persuade the application to cooperate; under Ubuntu MATE 17.10, even the program terminated – with bad consequences.

Easy Installation

Resetter can be set up in a flash, especially for distributions where the gdebi package is available. gdebi installs DEB packages and their dependencies downloaded from the Internet. Debian itself uses the dpkg -i <Package> command. However, since the command does not resolve any dependencies, you need to type apt -f install here to complete the installation.

In practice, you would usually download the two add-apt-key and resetter Debian packages directly from GitHub [2]. If necessary, set up gdebi via the package manager, and then finally use it to install the two DEBs (Listing 1). Resetter is then ready for initial use.

Listing 1

Installing the DEB Packages

$ sudo apt install gdebi
$ sudo gdebi add-apt-key_1.0-0.5_all.deb
$ sudo gdebi resetter_2.1.0-stable_all.deb

Before using the tool, make sure you back up, in case something goes wrong. Additionally, depending on the operating mode, Resetter may remove all user accounts and the corresponding home directories without being asked. Of course, these usually contain data that are still needed, such as browser profiles, manually customized package configurations, and the like.

Automatic or Controlled?

After starting Resetter, you will see a window with three buttons: Easy Install, Automatic Reset, and Custom Reset (Figure 1). I briefly described the function of the first button at the beginning; here, I am only interested in the main function of the program: resetting an installation. Resetter gives you the choice between an automatic and a user-controlled mode.

Figure 1: After startup, Resetter offers three options, including an automatic and a user-controlled reset.

Automatic Reset mercilessly removes all user accounts and their home directories. If you select this, a warning prompt appears, reminding you of what you are doing (Figure 2). If you approve, Resetter first shows a window with all packages to be removed. Here you can exclude packages (Figure 3). If you do not do so, the tool removes all applications installed by the users, including packages in Snap format. Then, it creates a default account and adds any packages removed from the default installation again.

Figure 2: If Automatic Reset is selected, an urgent warning appears.
Figure 3: Automatic Reset offers a selection of packages to be deleted.

Custom Reset gives you more control over the cleanup: You decide which user accounts, packages, and dependencies (Figure 4) Resetter should keep. If you want to keep user accounts and their home directories, use this mode. You can enter a username and password for the automatically created standard user. You can also instruct the tool to remove old kernels.

Figure 4: Custom Reset lets you optionally delete packages and their dependencies, as well as old kernels.

Slightly Inconsistent

A system in our lab with the current Debian "Stretch," with both Gnome and the KDE Plasma desktop installed, had initial start-up problems. At program launch time, Resetter output two warnings that neither a manifest nor a user list could be found; I was told that I would have to select them; otherwise, the tool would not work. After clicking on OK, the normal start window appeared.

If you see one or both of these warnings, you will find a remedy in the File menu at the top of the application. Clicking on File reveals two menu items that refer to the error messages. Select the appropriate entry for your distribution from the two options, then click on one of the two reset variants, and the program starts. In a window, Resetter informs you where it is in the reset process and the overall progress (Figure 5). On Debian 9, it took less than five minutes to reset.

Figure 5: The software tells the user where it is in the reset process. The process only takes a few minutes.

At the end, another window appears telling you that Resetter has created a new user with the name default and reveals the corresponding password. The default username and password are always the same, no matter what distribution you use. You will want to create a new username with your own password immediately after a restart.

After a reboot, my Debian test system presented itself again with the standard Gnome desktop. Resetter also worked with Linux Mint 18.3 and initially with Ubuntu MATE 17.10. However, under Ubuntu MATE, the program came to a standstill at 99 percent, which led to a system that was no longer bootable to a graphical interface. Under Ubuntu 17.10, Resetter didn't even start – I only saw a blank window.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus