ubuntu14.04 installation hang on "The installer has detected that the following disks have mounted partitions"

Bug #1347726 reported by bugproxy on 2014-07-23
This bug affects 23 people
Affects Status Importance Assigned to Milestone
debian-installer (Ubuntu)

Bug Description

---Problem Description---
ubuntu14.04 installation hang on

               [!!] Partition disks

     The installer has detected that the following disks have mounted
     partitions:? /dev/sda

  Do you want the installer to try to unmount the partitions on these
      disks before continuing? If you leave them mounted, you will not be
  able to create, delete, or resize partitions on these disks, but you may be able to install to existing partitions there.

      Unmount partitions that are in use?
     <Go Back> <Yes> <No>

---uname output---
 ~ # uname -a Linux ubucn 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 GNU/Linux

Machine Type = vm on dx360m4 host

---System Hang---
 The preseed conf is:
root@ubumn14:~# cat /install/autoinst/ubucn

### Localization
d-i debian-installer/locale string en_US
d-i localechooser/supported-locales multiselect en_US.UTF-8

# Keyboard Selection
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string en

### Network Configuration

d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i netcfg/dhcp_timeout string 120
### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.

d-i mirror/country string manual
d-i mirror/protocol string http
d-i mirror/http/directory string /install/ubuntu14.04/x86_64
d-i mirror/http/proxy string

# Suite to install.
#d-i mirror/suite string testing
# Suite to use for loading installer components (optional).
#d-i mirror/udeb/suite string testing

### Partitioning
# This creates a small /boot partition, suitable
# swap, and uses the rest of the space for the root partition:
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman/unmount_active boolean true
#create the /tmp/partitioning based on the uefi or legacy bios

d-i partman/early_command string \
    debconf-set partman-auto/disk ""
d-i partman-auto/expert_recipe_file string /tmp/partitioning

# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.

d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

### Account setup

d-i passwd/root-login boolean true
d-i passwd/make-user boolean false

d-i passwd/root-password-crypted password !!!!edited out!!!!

### Clock and time zone setup

d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string
d-i clock-setup/utc boolean true
d-i time/zone string America/New_York

### Apt setup

d-i apt-setup/multiverse boolean false
d-i apt-setup/universe boolean false
d-i apt-setup/backports boolean false
d-i apt-setup/updates boolean false

### Boot loader installation

d-i grub-installer/only_debian boolean true

### Package selection

tasksel tasksel/first multiselect standard

# gawk required for the xCAT scripts to work
# Otherwise it installs mawk, which doesn't work

d-i pkgsel/include string openssh-server ntp gawk nfs-common snmpd

d-i debian-installer/allow_unauthenticated string true
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean false

### Finishing up the installation
d-i finish-install/reboot_in_progress note

### X configuration
xserver-xorg xserver-xorg/autodetect_monitor boolean true

xserver-xorg xserver-xorg/config/monitor/selection-method \
  select medium

xserver-xorg xserver-xorg/config/monitor/mode-list \
  select 1024x768 @ 60 Hz

d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoinst/ubucn.pre; \
     chmod u+x ubucn.pre; \

d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/ubucn.post; \
     chmod u+x ubucn.post; \
     cp ./ubucn.post /target/root/post.script; \
     mount -o bind /proc /target/proc -t proc; \
     mount -o bind /dev /target/dev; \
     mount -o bind /dev/pts /target/dev/pts -t devpts; \
     mount -o bind /sys /target/sys; \
     chroot /target /root/post.script

Install method: Network

Install disk info:
The partition script:
ubuntu-boot ::
100 50 100 ext3
    $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ /boot }
500 10000 1000000000 ext3
    method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / }
2048 512 300% linux-swap
    method{ swap } format{ }

Install ISO Information: # cat /install/ubuntu14.04/x86_64/.disk/info Ubuntu-Server 14.04 LTS "Trusty Tahr" - Release amd64 (20140416.2)root@ubumn14

> Hi Song Yang,
> Have you tried using the latest iso build available at
> http://cdimage.ubuntu.com/ubuntu-server/trusty/daily/current/ ?
> Can you please let us know if the iso here fixes the issue ?
> Thanks.

hi, I just tried this trusty-server-amd64+mac.iso, the problem still exist.

Default Comment by Bridge

tags: added: architecture-x8664 bugnameltc-113702 severity-critical targetmilestone-inin1404

Default Comment by Bridge

Default Comment by Bridge

Luciano Chavez (lnx1138) on 2014-07-23
affects: ubuntu → debian-installer (Ubuntu)

------- Comment From <email address hidden> 2014-08-20 06:07 EDT-------
-- Externalizing comment from Song Yang --

is there any update on this? this is a block issue for my project

Dan Kegel (dank) wrote :

I ran into this, too, running a script that sets up a system using virtualbox.

Dan Kegel (dank) wrote :

Affects both ubuntu-14.04-server-amd64.iso and ubuntu-14.10-server-amd64.iso.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in debian-installer (Ubuntu):
status: New → Confirmed
Martijn Koster (makuk66) wrote :

This was reported on the forums too: http://ubuntuforums.org/showthread.php?t=2215103 where directhex2 mentioned:

 I've tracked down the problem to a change in debian-installer-utils 1.98

Looking at the changelog (https://launchpad.net/ubuntu/saucy/+source/debian-installer-utils/+changelog) I see:

 [ Joey Hess ]
  * fetch-url: Try to mountmedia when getting a file, to support preseed
    via USB from netboot.

That change adds a call to mountmedia (http://anonscm.debian.org/cgit/d-i/debian-installer-utils.git/commit/?id=916a613577c5cd747d15b3d20f16b9518d7d54ea)

That code will list the disk partitions (http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/mountmedia/wily/view/head:/mountmedia#L24).

In my case that finds /dev/sda1 (my existing HD boot partition) and mounts that as /media.
My CD is on /dev/sr0 is mounted as /cdrom. I have no other media I need to have mounted.

The forum suggested a workaround: unmount /media in an early preseed command.
You want to ignore failures when you run on a system where /media does not get mounted (blank HD).
This worked for me:

    d-i preseed/early_command string umount /media || true

What is the right fix here? I can't imagine how mountmedia picking a HD partition on the target disk and mounting it makes a lot of sense in the overwhelming majority of cases. Should it not be doing that? Should debian-installer-utils not use mountmedia? Should there be an installer option to skip it? Are there any better ways to avoid this?

Koji (kj-tanaka) wrote :

I have the same issue, but "d-i preseed/early_command string umount /media || true" doesn't let it bypass the issue. I still see the partition, in my case /dev/sda2, is mounted.

Is there any other way to workaround?

Koji (kj-tanaka) wrote :

I figured out that the workaround suggested by Martijin works for 14.04.1, but doesn't work for 14.04.2. If you end up in the same situation as mine, try 14.04.1 on this link.

tweej (tweej) wrote :

Patch attached for workaround on >= 14.04.2.

tweej (tweej) wrote :

Above is patch for partman-base, not debian-installer which Martijn says is root cause.

The attachment "020-allow_preseed_of_unmount_active.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
john (john-l-montes) wrote :

I ran into a similar situation with Ubuntu 14.04.3 during an exercise to have complete un-attended system provisioning of VM's and Baremetal
The work-around helped by adding--> d-i preseed/early_command string umount /media

doshinirav (doshinirav) wrote :

Same problem on Ubuntu 14.04.4 during a VM install on /dev/sda1 which is a /boot partition from previous install get automounted even with folllowing commands in the kickstart.

 preseed partman/umount_active boolean true
 preseed preseed/early_command string umount /media || true

coli (sebastian-coli) wrote :

Still a problem with Ubuntu 16.04 Xenial.

Seth Fitzsimmons (mojodna) wrote :

Preseed-based workarounds are insufficient when installing from a USB device onto a bare (unpartitioned) drive, as it's not possible for the preseed to actually load (the installer gets stuck "loading the CD-ROM" since the proper device has already been mounted on /media).

mountmedia runs prior to to the preseed and picks the first suitable device. With a bare drive (attached as /dev/sda), it's the USB drive (/dev/sdb1).

MartinL (landa-martin) wrote :

I can confirm this issue when installing from a USB device onto a bare drive. Is there any way how to customize image using d-i? I tested Ubuntu 16.04 server image.

Tobias Volfing (tobiasvv) wrote :

I can confirm this issue when installing from ubuntu-16.04.1-server-amd64.iso on a USB device to a bare drive, but also to a drive with Ubuntu currently installed.

Jb (jebsolutions) wrote :

This is a really annoying bug. In my opinion there is no good really to mount /dev/sda1, the /boot partition from my previous install...

I was able to work around the bug by adding this to the %pre section in the kickstart config:

# -- Hack starts! block installer mounting /dev/sda1 on /media
# We do this...by mounting the install media (/dev/sd0 or /dev/sd?) onto /media first!
# so when the installer tries it's bad mount it silently fails
INSTALL_MEDIA=$(mount | grep /cdrom | grep -E -o '/dev/[^ ]*')
mount "$INSTALL_MEDIA" /media
# -- Hack ends

This might also work around the 33% partition freeze on /dev/sda1...I can't trigger that any more so can't test it.

Jb (jebsolutions) wrote :

Just an addendum. The above works for cd (which always forced read only). To also work for usb I had to add the "-oro" to the command:

# -- Hack starts! block installer mounting /dev/sda1 on /media
# We do this...by mounting the install media (/dev/sd0 or /dev/sd?) onto /media first!
# so when the installer tries it's bad mount it silently fails
INSTALL_MEDIA=$(mount | grep /cdrom | grep -E -o '/dev/[^ ]*')
mount -oro "$INSTALL_MEDIA" /media
# -- Hack ends

dragon788 (dragon788) wrote :

I was running into the same issue and finally by luck happened upon a set of slides that allowed me to automate this and there was an accompanying code repository with the full preseed file. https://github.com/uweplonus/adia-install/blob/master/initrd/preseed.cfg#L3

Many people suggest using `preseed/early_command umount /media/*` but this hasn't worked for quite some time due to the timing of when the preseed portion runs compared to the partitioning.

The correct way to do this is to add the following anywhere in your preseed file that is referenced by the boot command.

```d-i partman/early_command string \
USBDEV=$(list-devices usb-partition | sed "s/\(.*\)./\1/");\
BOOTDEV=$(list-devices disk | grep -v "$USBDEV" | head -1);\
debconf-set partman-auto/disk $BOOTDEV;\
debconf-set grub-installer/bootdev $BOOTDEV; \
umount /media;

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers