9

When re-installing Ubuntu on a partition where an existing Ubuntu installation already exists, and not choosing to format the partition, the installer shows a warning message before it begins installing:

The file system on /dev/sda5 assigned to / has not been marked for formatting. Directories containing system files (/etc, /lib, /usr, /var, ...) that already exist under any defined mountpoint will be deleted during the install.

Please ensure that you have backed up any critical data before installing.

The list of "system directories" here does not seem complete. Furthermore, I would expect /home to be a system directory, but from experience I know that /home is not erased.

What is the complete list of directories that will be removed during install?

Tomas Aschan
  • 2,922
  • 1
    My two cents: /home/ is not a system directory. If during the install process you create a username that is the same as an existing user on the old install it might delete the old directory. Otherwise it would just create a new user folder and leave the old one be. Some people have a separate home partition and use it across reinstalls. – adempewolff May 27 '12 at 15:08
  • 1
    Actually, installing with the same username as a user already present in the /home directory uses the old one where possible, and does not override anything (I did this less than an hour ago :P). But an Ubuntu installation without a /home directory (containing at least one user directory) will, as far as I understand, not function - therefore, I would call /home a system directory. (Corollary: not all system directories are deleted when reinstalling Ubuntu!) – Tomas Aschan May 27 '12 at 15:43
  • Just found that ubiquity detect the presence of these directories even after reformatting the partition with erase option if both old and new file system types were ext4. I had the shred the partition to prevent the installer from picking up old files and going awry. – Aelian Dec 29 '22 at 07:28

2 Answers2

10

I wasn't able to find a hardcoded list in the ubiquity source code. The documentation says that partitioning is handled by d-i (debian installer) code to avoid duplication and maintenance effort. But I wasn't able to find an answer in the related packages or the Debian documentation.

Fortunately /var/log/syslog, respectively /var/log/installer/syslog post installation, contains useful information about ubiquity and the installation process. Here is an excerpt from a 12.04 install over a 12.04 install in my VM:

May 27 21:20:12 ubuntu ubiquity[8109]: switched to page partman
May 27 21:20:35  ubiquity[8109]: last message repeated 5 times
May 27 21:20:35 ubuntu kernel: [  598.116238] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
May 27 21:20:35 ubuntu ubiquity: umount: /tmp/tmp.5jn9BTMDwz: device is busy.
May 27 21:20:35 ubuntu ubiquity:         (In some cases useful info about processes that use
May 27 21:20:35 ubuntu ubiquity:          the device is found by lsof(8) or fuser(1))
May 27 21:20:35 ubuntu ubiquity: 
May 27 21:20:37 ubuntu ubiquity[8109]: debconffilter_done: ubi-partman (current: ubi-partman)
May 27 21:20:37 ubuntu ubiquity[8109]: Step_before = stepPartAdvanced
May 27 21:20:37 ubuntu clock-setup: Sun May 27 21:20:37 UTC 2012
May 27 21:20:37 ubuntu clock-setup: rdate: adjust local clock by -0.063701 seconds
May 27 21:20:40 ubuntu ubiquity[8109]: switched to page timezone
May 27 21:20:42 ubuntu kernel: [  605.076359] Adding 784380k swap on /dev/sda5.  Priority:-1 extents:1 across:784380k 
May 27 21:20:42 ubuntu kernel: [  605.225583] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
May 27 21:20:51 ubuntu ubiquity: not installable: 
May 27 21:20:51 ubuntu ubiquity: version mismatch: 
May 27 21:20:51 ubuntu clear_partitions: Considering /,/dev/sda1. 
May 27 21:20:51 ubuntu kernel: [  614.038996] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
May 27 21:20:51 ubuntu clear_partitions: Removing bin from / (/dev/sda1).
May 27 21:20:51 ubuntu clear_partitions: Removing dev from / (/dev/sda1).
May 27 21:20:51 ubuntu clear_partitions: Removing etc from / (/dev/sda1).
May 27 21:20:52 ubuntu clear_partitions: Removing lib from / (/dev/sda1).
May 27 21:20:52 ubuntu clear_partitions: Removing lib64 from / (/dev/sda1).
May 27 21:20:52 ubuntu clear_partitions: Removing proc from / (/dev/sda1).
May 27 21:20:52 ubuntu clear_partitions: Removing sbin from / (/dev/sda1).
May 27 21:20:52 ubuntu clear_partitions: Removing sys from / (/dev/sda1).
May 27 21:20:52 ubuntu clear_partitions: Removing usr/bin from / (/dev/sda1).
May 27 21:20:52 ubuntu clear_partitions: Removing usr/games from / (/dev/sda1).
May 27 21:20:52 ubuntu clear_partitions: Removing usr/include from / (/dev/sda1).
May 27 21:20:53 ubuntu clear_partitions: Removing usr/lib from / (/dev/sda1).
May 27 21:20:53 ubuntu clear_partitions: Removing usr/not-formatted from / (/dev/sda1).
May 27 21:20:53 ubuntu clear_partitions: Removing usr/sbin from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing usr/share from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/backups from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/cache from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/crash from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/games from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/lib from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/lock from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/log from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/mail from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/not-formatted from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/opt from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/run from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/spool from / (/dev/sda1).
May 27 21:21:02 ubuntu clear_partitions: Removing var/tmp from / (/dev/sda1).
May 27 21:21:02 ubuntu kernel: [  625.522422] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: errors=remount-ro

Basically the directories bin, dev, etc, lib, lib32, lib64, proc, sbin and sys are deleted as are the contents of usr and var (/usr/local and /var/local seem to be an exception, but test folders I had in usr and var were deleted). The boot directory does not seem to be deleted and is just overwritten by the packages related to grub and the kernel.

LiveWireBT
  • 28,763
0

I'm pretty annoyed at ubiquity right now. I told 15.04beta2's installer to use / on a raid10f2 md device, without formatting. Fine, I'd already done a mkfs.xfs on that device. I also told it to use my existing /home and /var/tmp md devices, without formatting. /home survived, but my /var/tmp is now empty!

What the hell? It's a well-defined place to store persistent user data. I didn't lose anything that I can't find and re-download, or back up again from other machines, but it's very uncool. I didn't think the warning dialog was even talking about partitions other than the root filesystem. (I thought I would have gotten another warning for the device to be mounted on /var/tmp specifically, if it was going to be mounted somewhere that wasn't safe from the rm -r.)

I knew there was a slight risk telling the installer about my other filesystems, instead of just editting fstab later, but this is just dumb.

so anyway, the list of directories that Ubiquity blows away includes /var/tmp, but not /home.

Opened https://bugs.launchpad.net/ubuntu-manual-tests/+bug/1445196

Peter Cordes
  • 2,197