Google Compute Engine Upgrade from Debian 9 Stretch to Debian 10 Buster
Background I had installed a Debian 9 Stretch GCE test single-user instance that I now wanted to upgrade to Buster. This is a simple f1-micro “free tier” instance with Apache2 and PHP7.3-FPM, Docker, and with no database other than sqlite3. Both Apache and PHP versions were the latest from the sury.org repositories. In searches, I found very little info on how to do the upgrade. Note that Google's Debian installs have some differences from standard Debian images.
Some preparatory very helpful tips that I found are that (1) GCE instance boot disks can be attached and reattached, (2) a new persistent disk can be made from a saved snapshot of an instance's boot disk and then attached to the instance (basically swapping out the original boot disk with the new one created from the snapshot, and (3) a debian.org article on how to upgrade from version 9 to 10.
With this info, I felt I had two upgrade choices:
(1) Create a new GCE instance installing Debian 10, update it to match the configurations, apps, and data of the original v9 install, then detach that persistent disk and attach it as a new boot disk on the original instance. After verification that all was properly working, the second VM instance could be deleted along with the original boot disk with the old v9 install.
(2) Make a snapshot of the current v9 disk, use it to create a new persistent disk, attach this new disk as the boot disk of the original instance, then try an upgrade and see if that would work ok. This would avoid having to create a second VM instance.
I preferred the second option (the first one seemed like more work and I wanted to avoid starting over with reconfiguring a new install), though I found no write-ups online from anyone's experience trying that. But even if the upgrade in-place didn't work, I would still have the original v9 boot disk and could swap that back in if needed. So I went with the in-place upgrade.
In-Place Upgrade Steps So here's the basic steps I used and they worked without incident! (however, do note that this was a simple single-user instance with few apps).
I basically followed the steps in the debian.org doc on how to upgrade from version 9 to 10. Below I'll just mention any differences from those procedures.
In addition to the backups suggested in Section 4.1.1, I backed up the entire webroot (
/var/www/html/) folders and some other data and config files (e.g., in my home folder) to a Cloud Storage Bucket. I also would have the detached original boot disk available if needed.
Section 4.1.6. Verify network interface name support was noted but I did nothing in response to it. I did have an eth0 network interface both before and after the upgrade, and there were no problems with it.
The non-Debian sources I had were the sury.org packages, Docker, and the Google Cloud guest packages for Debian. As noted in the Debian upgrade doc, I updated all references from stretch to buster in
/etc/apt/sources.source.list and to the files in
/etc/apt/sources.list.d. Those were the only changes I made to these files. I noted that the
/etc/apt/truteed.gpg.d folder included gpg keys for Buster, sury.org, and Google Cloud.
I didn't record the session as recommended in Section 4.4.1, though in retrospect that would have been a prudent thing to do.
As recommended in Section 4.4, I first did the 'minimal upgrade'. This went without incident and 384 packages were updated. I then proceeded immediately (did not reboot) to the full-upgrade. 146 packages were upgraded, 69 newly installed, 1 was removed, and 0 not upgraded. There was a message that a number of packages were no longer required and could be removed with
sudo apt autoremove, which I subsequently did after verifying that the upgrade was successful.
There were only two prompts during the full-upgrade. One was whether to install a new
/etc/ntp.conf or keep the old. After looking at the diffs and verifying that they were due to new statements and that I had not customized anything in the old, I selected the new version. The second prompt was whether to install the new
/etc/sshd_config. I kept the old as I had made customizations and there were no new statements in the v10 version that weren't in v9.
I then rebooted the VM, and everything worked, no glitches were encountered. The new kernel is
As recommended in Section 4.7.1 Purging Removed Packages, I issued those commands. There were only 4 packages to be purged.
There are 410 packages files in
/var/cache/apt/archives/, most of them probably due to the upgrade. I will probably delete them at some point with
Updated Info Edits After working with the new install for a while, there might be additional useful comments. If so, this post will be updated with a timestamp for the update added below.
Original post version: 03-Dec-2019