Sunday, 18 May 2014

Ubuntu installer - Unmount partitions that are in use?

I am working on the unattended-iso project, and seeing this message:

for the bots and search engines

The installer has detected that the following disks have mounted


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?

It happens whenever you already have a filesystem on say sda1. Workaround:

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


  1. Hello, I'm trying to get this to work, and it is really frustrating. I've tried the original solution, I've tried your solution with || true added. I've even tried having a sleep command in front of the umount. But the system won't unmount the /media folder before it gets to that question (although if I pop into a virtual terminal, and unmount it before the question is asked, then it skips the question) Do you have any thoughts? I'm using Lubuntu 14.04.1

    1. Hi Jacob, I do not have experiences with Lubuntu. I'll reproduce the issue with this image: - I guess that's what you're using? Will get in touch once I am able to reproduce the issue/it's working for me. Please do comment if you found the solution in the meanwhile. Just as a thought, what about running the umount until it succeeds - assuming that you can do such magic in early command? Something like:

      /bin/bash -c "while grep /media /proc/mounts; do umount /media || true; sleep 1; done;"


    2. Thanks for the idea. I tried it, with no go. Lubuntu basically uses Ubuntu's installer but adds different packages at the end. I'm using the Alternative Install so it can fit on a CD, and also I'm using the 32 bit version, as I'm actually working on developing a specialized distribution of Ubuntu, which I'm calling VubuntuBox, which has a purpose of just being "middleware" for running virtual machines. You can check out the website I put up about it if you are interested... ( It is obviously really in its infancy, especially with this really annoying issue!!!

  2. Ok, I found a work around for my particular problem... First, I'm also using a kickstart file with my installation, and doing some tests, I'm not sure my preseed was actually running the early_command. In either case, it was running the %pre section of the kickstart file, but this happened previous to the disk being mounted (which I was able to test, by doing a read command in the %pre section, to just pause, and see from a virtual console if it was mounted yet or not.) Since it wasn't mounted yet at that point, the umount I had tried was worthless. But, since my automated installation is designed to load Lubuntu by repartitioning all drives automatically, it doesn't matter that I wipe part of the drive up front. But of course, this would be bad for automated installs that were not already in essence wiping the drive.

  3. 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.

    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;