Preparing Linux Machine for Resale or Giveaway


Here is a tutorial to help you pass on or sell a Linux computer with a GNOME desktop (what most linux laptops and desktops default to). You will be able to install applications, drivers, add proprietary drivers and applications, configure hardware then prepare the machine for an initial user setup and customisation by the new owner. Although this process works for non GNOME systems it requires the use of the GNOME Display Manager (GDM) which requires a lot of GNOME support libraries which is why I’d recommend an Ubuntu or SUSE derivative instead of the systems covered here. This process works for the majority of Linux distributions but is not necessary for Ubuntu and derivatives owing to the inclusion of an OEM install option available at the installer boot screen, or accessible by pressing “F4”, and the SUSE family has a different system entirely and does not seem to work with the method covered in this tutorial so I have made a specific openSUSE tutorial.

In this tutorial I will cover Fedora, CentOS, RedHat, Debian and derived systems which should cover the majority of Linux systems available as most are based on one of these families. For a SUSE style system please refer to the following tutorial: Prepare openSUSE Computer for New Owner.

Getting the system ready

Having installed a linux system you will have likely set a root (administration) password and created a user profile which will be removed at the end of this process.

  1. Do any hardware configuration required
  2. Install proprietary driver software if needed
  3. Install any software you wish to bundle
  4. Now install “gnome-initial-setup” which is done by entering the following commands into a Terminal window, or at the shell:

Fedora, CentOS, RedHat and derivatives:

The following actions are performed by the root user. You can use the “su” command first to become root (if the root user is disabled enable it with “sudo passwd root”):

  1. dnf update #install any updates suggested
  2. dnf install gnome-initial-setup
  3. Now you need to edit the /etc/gdm/custom.conf file which can be done with the editor of your choice, but nano is very easy to use so you can do: nano /etc/gdm/custom.conf

Debian GNU/Linux and non Ubuntu derivitives

The following commands are used by Debian GNU/Linux but not Ubuntu and derivatives. Whilst this procedure may work for Ubuntu and derivatives it is generally unnecessary due to the inclusion of an OEM Install mode provided by Ubuntu.

Use the “su” command before proceeding, (if the root user is disabled enable it with “sudo passwd root”):

  1. apt update
  2. apt install gnome-initial-setup
  3. Now you need to edit the /etc/gdm3/daemon.conf file which can be done with the editor of your choice, but nano is very easy to use so you can do: nano /etc/gdm3/daemon.conf

Removing all users and enabling the “Welcome” screen (all systems)

  1. Go to the section [daemon] and add the line InitialSetupEnable=True
  2. Write out the file with Ctrl + o , then Return, then exit the editor with Ctrl + x
  3. /sbin/userdel -fr theusernameyouset
  4. Remove the root password with: passwd -d root
  5. With the root password removed you must for security reasons disable the root account: /sbin/usermod -L root
  6. Shutdown the system: shutdown -h now

The Result

When the new owner starts their system for the first time a Welcome screen will appear where they are guided through: Privacy settings, Wi-fi, Online Accounts, Username setup, and Password. A helpful “Getting Started” screen will appear explaining how to use the system. The previous user account and associated files will be gone, the root user will be disabled (but can be reenabled), and the new user will be able to do administration tasks with their new password when prompted, or by prefixing commands with “sudo” and enter their password when prompted.