Migrating From WUBI to Full Ubuntu Install

Note: This blog post could also be titled “Reinstalling Ubuntu and Keeping Your Applications and Data” or “Migrating Ubuntu Data and Applications from One Machine to Another”.

I went over to a my friend Nicks house last night for a watch TV / play PS3 / geek out type evening. He’s got an old IBM Thinkpad running Windows with Ubuntu in a WUBI setup. For those that don’t know WUBI is an ultra cool way to install Ubuntu on top of Windows. It’s simple to setup and lets you dual boot between Windows and Ubuntu without having to repartition your disk, or lose your Windows setup.

Whilst I was there Nick ran out of space in the Ubuntu install, so after confirming that he didn’t need his Windows install any more we set about migrating from a WUBI setup to a more traditional ‘Full’ Ubuntu install, taking up the whole 40GB disk.

Nick had a USB hard disk handy which we used as a backup for his Ubuntu based data and apps. The whole process took a couple of hours – which inculdes the time taken to reinstall Ubuntu, re-download all the apps he previously had and backup/restore his data. Not bad for an old machine and a so-so internet connection.

I believe there is work done on an official migration tool to take you from a WUBI install to a native install, but we didn’t use that method.

Here’s what we did, in case it’s useful to someone else, with a couple of issues outlined at the bottom:-

Boot into the Ubuntu desktop, plugin the USB hard disk

The disk showed up as /media/SEA_DISC on the desktop and we confirmed there was plenty of space, and we could write to it. I didn’t even bother to check the disk format (FAT32/NTFS) because it just worked. Nice.

Logout of the Ubuntu desktop, switch to a console (CTRL+ALT+F1) and login there

This was to ensure we didn’t have loads of files open whilst backing up his data.

Backup his data

The data in this case consists of everything in /home/nick, no configuration changes in /etc, no other data anywhere else on the system. Clearly if Nick had put data in /var for example then we’d not have backed this up with our method.

We decided to tar/gzip up his data to one big tarball on the USB disk rather than just drag/copy all the data over for a couple of reasons. Firstly if we copied it over and the filesystem of the USB disk was FAT/NTFS then we may lose some meta data (permissions/ownership) along the way (as I understand it). We also wanted to reduce the amount of space we took up on the USB disk.

$ mkdir /media/SEA_DISC/Ubuntu_Backup
$ tar czvf /media/SEA_DISC/Ubuntu_Backup/nick.tgz /home/nick

Backup his applications

We’re not technically backing up Nicks applications in this step, but backing up a list of his applications and where he got them. After the reinstall we restore the list and let the Ubuntu package management apps sort it all out. It’s magic.

I’d heard (section “Can I clone an existing Debian install on another machine?”) of this method of copying the package list from one machine to another a few years ago via my local Linux User Group in Hampshire but never actually used it. Now I have, and it works a treat.

First we backup the sources.list(s). There’s the main one in /etc/apt/sources.list, but there may also be others in /etc/apt/sources.list.d/. On Nicks laptop there was just /etc/apt/sources.list, so we backed that up.

$ cp /etc/apt/sources.list /media/SEA_DISC/Ubuntu_Backup/

Next we backup the list of applications he had installed, this includes everything we installed from the main repositories and any additional applications installed from other repositories we enabled.

$ dpkg --get-selections > /media/SEA_DISC/Ubuntu_Backup/list_of_applications.txt

That’s it. We just confirmed that all those files got written to the USB disc by browsing them, and then removed the USB drive from the system.

Re-install Ubuntu

I had an Ubuntu 9.04 CD with me (handy to carry around) so we booted off that and did a standard install. Nothing really special to note about this other than the issues listed at the bottom of this page. During the install we had some opportunity to play Call Of Duty on his PS3. I highly recommend having something else to do than watch a percentage bar cross the screen, and gaming is an ideal pastime for this.. Moving on..

Restore the data

Once the Ubuntu install was finished we booted up and logged into the desktop, plugged in the USB disc and once again confirmed we could read from it. We then logged out again, back to the graphical logon screen, and then switched to a console with CTRL+ALT+F1 and logged in again.

Now to wipe the existing home folder created during the install, and replace it with his home folder we backed up earlier.

$ sudo -s
# cd /home
# rm -rf /home/nick
# tar zxvf /media/SEA_DISC/Ubuntu_Backup/nick.tgz

Using CTRL+D twice to exit from the root logon prompt, and from Nicks own logon. This switched automatically back to the GUI logon screen (I like that feature) where we then logged in again to the desktop. We quickly checked all the files we expected to be there had been restored, connected to the wifi (see issues below) and opened up a terminal for the next section.

Restore the applications

Logged into the desktop, with a terminal open, now we reinstall all the applications Nick previously had installed.

$ sudo cp /media/SEA_DISC/Ubuntu_Backup/sources.list /etc/apt/
$ sudo apt-get update
$ sudo dpkg --set-selections < /media/SEA_DISC/Ubuntu_Backup/list_of_applications.txt
$ sudo apt-get -u dselect-upgrade

At this point apt gets busy downloading package updates and new software to install, restoring everything back to how it was before. Worth noting that during the download the gaming ceased due to poor ping. This was a good time to flick through the TV and watch rubbish.

All done

Finally we checked apps were installed as expected, had a bit of a poke about with the machine, and called it a night. A job well done.

Things to consider

If we had installed apps via a method other than using the repo the we may have had problem restoring those applications, perhaps having to re-install them manually.

WINE and any applications installed within it were in /home/nick/.wine so whilst they're apps, we're backing them up as if they're data.

There was only one user account to backup, but we'd obviously have to change the data backup/restore process if there were multiple users.

We didn't back up any data outside /home/ so if he did inadvertently create a mysql database or website in /var, that would be lost.

Issues

We left the USB disc plugged in after backing up, and during the Ubuntu re-install, which caused a little confusion for us during the partitioning stage. The partitioner showed up sdb (the USB drive) at the top of the window saying 'No OS installed' and the default action was to install onto that device - which would have been sub-optimal given it housed his home backup and also lots of photos and videos from other machines.

So we had to specifically choose the 'Erase entire disk' option and make sure we chose the right disk from the drop down list. Another option (which I suggested above) was to just unplug the USB disk during the install, or alternatively make sure you're not doing this at midnight as we were :)

The Ubiquity installer doesn't have the same password rules as the WUBI installer. As a result the 'old' password Nick had could not be used by Ubiquity when we did the re-install. Once we logged in to the finally installed desktop with the 'new' password, network manager attempted to connect to his WPA secured WiFi access point. At this stage the gnome keyring password prompt came up and asked for his 'old' password (because it was in his home directory we backed up) and would not accept the new password.

Not knowing how to fix this we simply resorted to changing his password back to the 'old' one he knew so his logon and keyring passwords were in sync. This was harder than expected becuase the 'About Me' application used to change the password follows similar rules to Ubiquity. So we instead dropped to a bash prompt and used 'sudo passwd nick' to get root to change the password - where it seems the rules didn't apply.

Questions/comments, leave them below, thanks.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
This entry was posted in Advocacy, Linux, Ubuntu. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

11 Comments

  1. Posted July 16, 2009 at 1:21 pm | Permalink

    Interesting, thanks Al.

    One comment I’d make is about the user’s home dir. You appear to have assumed that the old user and the new user would have the same UID/GID. If they were the first users to be created on both machines then that is fine. However, if say the old (wubi) user was created subsequently then his UID would most likely not be 1000, more like 1001,2 etc…

    It would probably be worth checking this to make sure.

    Al

      More from author
  2. Posted July 16, 2009 at 1:22 pm | Permalink

    You can change the keyring passwords in seahorse. In Hardy it is Edit->Preferences, click ‘login’ then ‘Change unlock password’. In Jaunty you can just go to the ‘password’ tab and right click on a key ring I think.

      More from author
  3. _sr
    Posted July 16, 2009 at 1:58 pm | Permalink

    I’d like to add that it surely won’t hurt to backup /etc and some other stuff if you’ve got the space temporarily on the USB disk.
    I mean…just in case :P
    But maybe I’m too paranoid, still won’t hurt to keep those for a day or two

    • Posted July 16, 2009 at 2:05 pm | Permalink

      Oh sure, I just happened to know this had nothing outside of his /home, so I was confident in my case not to have to do it.

        More from author
  4. Steve Pearce
    Posted July 16, 2009 at 2:35 pm | Permalink

    Hello Popey,

    One tip I would suggest is to copy downloaded packages out of /var/cache/apt/archives/ before re-installing, assuming the user didn’t remove the cache manually beforehand (apt-get clean).

    After installation, you can copy those packages back and run the following as you said:

    $ sudo cp /media/SEA_DISC/Ubuntu_Backup/sources.list /etc/apt/
    $ sudo apt-get update
    $ sudo dpkg –set-selections < /media/SEA_DISC/Ubuntu_Backup/list_of_applications.txt
    $ sudo apt-get -u dselect-upgrade

    apt should pick up that the packages are already downloaded and will hopefully skip the long download process.

    I recently learned that Yum (In Fedora) also acts like this providing you enable keepcache=1 in /etc/yum.conf.

    It would be very useful to have a graphical tool to achieve this, I believe apt-on-cd does similar like this.

    I hope this is useful to yourself and your readers,
    Steve.

    • Posted July 16, 2009 at 3:03 pm | Permalink

      Ooo, another good tip, but will apt find them? I’ll have to try it to see.

      Of course if I had taken my hard disk containing an Ubuntu mirror with me, we could have continued playing Call Of Duty whilst the system updated off my local disk! :)

        More from author
  5. John
    Posted July 17, 2009 at 5:16 am | Permalink

    Istalling ubuntu using WUBI, isn’t really running ubuntu on top of windows. it is storing it as a file on a current windows partition. When it boots to ubunutu there is nothing windows about it. You are running the full ubuntu OS. I think this was a great Idea , and they should make a genereic linux windows installer that will work with any disto. It can just as for your favorite distro like puppy and set up the same thing.

  6. Posted August 1, 2009 at 2:20 pm | Permalink

    you can use aptoncd program to backup all of your installed software in your ubuntu.
    first you need install it on your ubuntu os, then the program appear in your administartive or… menu.
    use this program.
    it make an iso file that contain all of your packages.
    so, after install new os, reinstall aptoncd and use your cd image.
    you can write this image file on cd or use as file.

      More from author
  7. Posted August 4, 2009 at 3:32 pm | Permalink

    Thanks for the write up Popey, I heard about this on the Podcast and decided to check it out. The Debian packages get/set installer thing is quite cool.

      More from author

One Trackback

  1. [...] Pope: Migrating from WUBI to Full Ubuntu Install. Have you (or a friend of yours) looked at Ubuntu with the WUBI tools running on Windows? If so you [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Additional comments powered by BackType