← Back to team overview

aims team mailing list archive

[Bug 1265192] Re: Install/reinstall wipes out all/other partitions

 

This patch should fix Ubiquity not detecting Windows EFI installs.

Ubiquity uses os-prober to detect installed operating systems. os-prober
iterates through each disk and each partition, calling a series of
scripts to attempt to identify a given partition, and printing results
to stdout in the form:

/dev/sda1:Windows XP Professional:Windows:chain
/dev/sda2:Windows 8 (loader):Windows:chain
/dev/sda3:Ubuntu 14.04.1 (14.04):Ubuntu:linux
/dev/sda4:Mac OS X:MacOSX:macosx
/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi

Note the final result: on Windows EFI systems, os-prober runs the script
/usr/lib/os-probes/mounted/efi/20microsoft, which prints not just the
partition device, but also the '@' character followed by the full path
to the Windows EFI boot manager. This causes Ubiquity to fail to detect
Windows, because the string comparison of '/dev/sda1' to
'/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi' fails.

The patch fixes this by limiting the device path to only regular
characters and digits. I should point out that I haven't fully tested
this patch as I do not have a Windows EFI system to test on, but I have
tested by replacing /usr/bin/os-prober with a shell script that just
echoes the full EFI line to the output, eg.:

 #!/bin/sh
echo "/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi"

With this technique it is possible to test different layouts in a VM
without having to install any other operating systems. Just make the
bare partitions and then have os-prober report that something is
installed there.

There is another serious bug I noticed in Ubiquity:

    - os-prober returns a list of installed operating systems but the
code of calculate_autopartitioning_options() in ubiquity/plugins/ubi-
partman.py just gets passed a basic list of all the detected operating
systems on all drives. The logic assumes that all of the operating
systems are on the same drive, so on a multi-disk system it will report
all operating systems on every disk as being "installed" at the same
time, and when OSes are on different disks it will warn, for example,
that "both Windows and Ubuntu will be deleted", which isn't true because
Windows and Ubuntu are on different disks and only one disk is going to
be deleted.

    - If there are two disks, and os-prober shows no operating systems
on sda and Ubuntu on sdb, then the Ubiquity "Install" screen will have
title "Erase Ubuntu 12.04 and reinstall" and will incorrectly select
drive "sda" (Ubuntu is not on sda). If the user clicks continue, the
installer will go ahead and overwrite all partitions on the first disk
while claiming to be "erasing Ubuntu 12.04". It does say that "4
partitions will be deleted" (another bug, it seems to include free space
gaps in the partition count) but it's easy to miss that text, given the
reassuring big font text "Erase Ubuntu xx and reinstall".

The problem code was introduced in this patch:
http://bazaar.launchpad.net/~ubuntu-
installer/ubiquity/trunk/revision/4515.1.1/ubiquity/plugins/ubi-
partman.py - unless I am missing something, it seems that the
calculate_autopartitioning_options() code is based on the assumption
that the user will only have one drive, and never dealt correctly with
multiple drives.

Unless someone has time to fix the multiple drive automatic partitioning
I would recommend just disabling it and forcing multiple drive owners to
manually partition. It's better than losing data.

** Patch added: "ubiquity-os-prober-windows-efi.patch"
   https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1265192/+attachment/4192672/+files/ubiquity-os-prober-windows-efi.patch

-- 
You received this bug notification because you are a member of AIMS,
which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1265192

Title:
  Install/reinstall wipes out all/other partitions

Status in elementary OS:
  New
Status in “ubiquity” package in Ubuntu:
  Triaged
Status in “ubuntu-livecd-image” package in Ubuntu:
  Confirmed
Status in “ubiquity” source package in Trusty:
  Triaged
Status in “ubuntu-livecd-image” source package in Trusty:
  Confirmed

Bug description:
  Brand new Samsung laptop with UEFI. I had installed 13.04 Ubuntu but on reboot I never saw the 'grub' style menu. It just kept going into Windows 8.1.  So I got the 13.10 version (64 bit) and choose "Reinstall Ubuntu" (That may not be the exact text)
  It removed all the partiions including the recovery partitions. I do have a backup for the windows install, but I was very surprised that this happened.
  On a positive note I now have Ububtu up and running on my machine. 
  This is not my first time with Ubuntu. I have installed Ubuntu alongside WinXp, Vista and Windows 7. I've used Ubuntu desktop for over 6 years.
  If you would like me to try something to replicate this. .. I could shrink my existing partion make another one - reinstall and see if it whacks that one. I can do this now .. I'm still moving into this laptop so starting over is not so bad.

  Steve Devine

To manage notifications about this bug go to:
https://bugs.launchpad.net/elementaryos/+bug/1265192/+subscriptions