{"id":107,"date":"2008-04-27T12:46:15","date_gmt":"2008-04-27T11:46:15","guid":{"rendered":""},"modified":"2010-10-26T07:01:43","modified_gmt":"2010-10-26T07:01:43","slug":"it-upgrading-to-ubuntu-8-04","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=107","title":{"rendered":"IT: Upgrading To Ubuntu 8.04"},"content":{"rendered":"<p>This entry is about upgrading a machine running Ubuntu 7.10 to Ubuntu 8.04 which is only just out. But not in the standard way which would be quite boring.<\/p>\n<p>I have at least two computers running Ubuntu, both configured in a fairly complex way and both fairly important (in the sense I <em>really<\/em> don&#8217;t need to try an upgrade and end up with a broken system). Whilst Ubuntu frequently does upgrade without a hitch, it can occasionally choke; this is seemingly more common with more complex installations.<\/p>\n<p>Why not preserve an old copy of the install around to revert to ? Well with LVM it is perfectly possible. Ignoring what happens underneath, I have an LVM volume group called &#8220;internal&#8221; (actually I don&#8217;t, but I would if I were to re-install) which has :-<\/p>\n<ul>\n<li>var &#8211; 4Gbytes to be mounted as <tt>\/var<\/tt><\/li>\n<li>root &#8211; 8Gbytes to be mounted as <tt>\/<\/tt><\/li>\n<li>home &#8211; &#8220;enough&#8221; to be mounted as <tt>\/home<\/tt><\/li>\n<\/ul>\n<p>Note I do <em>not<\/em> believe in allocating all available disk space with a storage management system like LVM available; I do a great deal of storage management work and the biggest mistake anyone can make is assuming that they know the storage requirements of a system throughout it&#8217;s whole lifetime. This applies in spades to a desktop machine. Without some free space, the suggested upgrade mechanism won&#8217;t work.<\/p>\n<p>Now with modern hard disks, we are likely to have more than enough storage to allocate. For instance on this machine right away I have 138Gbytes of free storage (mirrored). And that it is on a two year old machine; a newer machine would have larger disks. Easily enough storage to have two or more &#8220;copies&#8221; of different versions of Ubuntu around.<\/p>\n<p>It would be nice if Ubuntu could do much of the work for us, but for now it&#8217;s pretty much a manual process. As an aside, the Ubuntu developers should probably think about using LVM in the default installer to assist in the development of this kind of feature.<\/p>\n<p>The first stage is to create new logical volumes and build filesystems on them. I chose to name the logical volumes after the operating system version they would be running &#8230;<\/p>\n<pre>lvcreate -n 804root --size=8G \/dev\/internal\r\nlvcreate -n 804var --size=4G \/dev\/internal\r\nmkfs -t xfs \/dev\/internal\/804root\r\nmkfs -t xfs \/dev\/internal\/804var<\/pre>\n<p>Now the key here is not to look at the current size of your <tt>\/var<\/tt> filesystem and decide you need a much smaller filesystem &#8230; or the upgrade process will refuse to start. You can always reduce it later if you really want to quibble over 1-2Gbytes.<\/p>\n<p>The next stage is to copy the relevant filesystems across. At this point you should avoid running as much as possible and probably do this from a text terminal after shutting down GDM &#8230;<\/p>\n<pre>\/etc\/init.d\/gdm stop\r\napt-get install star\r\n     (If you don't have it installed already)\r\nmount \/dev\/internal\/804var \/mnt\r\nstar -v -xdev -acl -copy \/var\/* \/mnt\r\numount \/mnt\r\nmount \/dev\/internal\/804root \/mnt\r\nstar -v -xdev -acl -copy \/ \/mnt<\/pre>\n<p>This stage will take some time to complete. You will want to do a quick check of the new \/ and \/var to ensure they look roughly like the originals (I always seem to come up with the equivalent of \/var\/var when I do something like this). Notice that the new root filesystem is still mounted &#8230; you need to edit <tt>\/mnt\/etc\/fstab<\/tt> to alter what devices are mounted for \/ and \/var.<\/p>\n<p>The next stage is a bit tricky because I didn&#8217;t do it &#8220;right&#8221;, so I will be suggesting something that I didn&#8217;t try myself. The task is to modify <tt>\/boot\/grub\/menu.lst<\/tt> in such a way as to result in two separate menu entries that will boot either the old operating environment or the new operating environment.<\/p>\n<p>I would suggest that you :-<\/p>\n<ol>\n<li>Create an entry outside of the &#8220;DEBIAN AUTOMAGIC KERNELS LIST&#8221; that essentially replicates one of the entries. It should not be modified to boot off the new root filesystem.<\/li>\n<li>Modify all of the entries in the &#8220;DEBIAN AUTOMAGIC KERNELS LIST&#8221; (it makes sense when you review the <tt>menu.lst<\/tt> file) to alter the &#8220;root=&#8217; kernel parameter to point to the new root filesystem. This is <em>not<\/em> the &#8220;root (hd0,0)&#8221; part, but the kernel parameter &#8220;root&#8221;. It will specify the old root filesystem logical volume (something like &#8220;root=\/dev\/internal\/root&#8221;) and you want to change this to &#8220;root=\/dev\/internal\/804root&#8221;.<\/li>\n<\/ol>\n<p>At this point you should probably reboot to check that both environments work. Just make sure you have a recent rescue CD knocking around before you do.<\/p>\n<p>After you have done the checking you can boot the new environment and use &#8216;update-manager&#8217; to upgrade the new environment to Ubuntu 8.04. This will probably work (it worked fine for me).<\/p>\n<p>Undoubtedly the next time I try this, I will figure out how to make it work better, but it is good enough to have a &#8220;fallback&#8221; option in case an upgrade goes badly. For instance until last week, running Vmware Server under 8.04beta was pretty tricky and if it were still the case I would have to revert back to 7.10.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\nThis entry is about upgrading a machine running Ubuntu 7.10 to Ubuntu 8.04 which is only just out. But not in the standard way which would be quite boring.<\/p>\n<p>\nI have at least two computers running Ubuntu, both configured in a fairly complex way and both fairly important (in the sense I <em>really<\/em> don&#8217;t need to try an upgrade and end up with a broken system). Whilst Ubuntu frequently does upgrade without a hitch, it can occasionally choke; this is seemingly more common with more complex installations.<\/p>\n<p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[4],"tags":[485,61,520],"class_list":["post-107","post","type-post","status-publish","format-standard","hentry","category-it","tag-lvm","tag-ubuntu","tag-upgrade","category-4-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-1J","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=107"}],"version-history":[{"count":2,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":1329,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions\/1329"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}