I was running Ubuntu Server 18.04 LTS version on Digital Ocean for hosting couple of Website. As Ubuntu 20.04.01 was recently released, I wanted to upgrade it so that I don’t have to worry about upgrading the server for next couple of years.
I was using Ubuntu 18.04.x 64 bit that came built in with Digital Ocean. I am using Webmin as a control panel. Webmin is a really nice control panel for any indie developer who wants more control over the server. As an added benefit, I can run .Net Core application on the Linux server along with WordPress (PHP, MySQL), Apache, Kestrel (.Net Core Server), Email Server (Postfix, Dovecot).
Warning: Before you read further, I want to say that I have zero experience with Linux administration and does not know anything about various application settings. This article is for my own documentation for future use.
Ubuntu Upgrade Preparation
I have quickly looked on internet how to upgrade Ubuntu. All I knew is that I need to upgrade all packages to the latest version. Once all packages are upto date execute following command to make sure package update-manager-core is installed.
sudo apt install update-manager-core
I wanted to upgrade to only LTS version so I used following command to upgrade
It started the upgrade but I faced following error.
Ubuntu Upgrade Issues
The essential package ‘ubuntu-minimal’ could not be located.
While searching online, I found this thread which provided a direction of modifying /etc/apt/sources.list file. Upgrade process was modifying this file but also commenting out the Digital Ocean repository list.
So restarted the upgrade process. When it prompted to press ENTER key to begin the process, I modified the sources.list file. I uncommented digital ocean links (marked as “#disabled on upgrade to focal”) and also changed from “bionic” to “focal” for all the links which are uncommented.
Download Sources.lists files from the above link. It contains original file, file changed by upgrade process and the file I changed to fix to proceed with upgrade.
Now upgrade proceeded further and finally asked me to Continue [yN] Details [d]. I pressed “d” to get the details but at the end of it, I did not know how to exit out of detail screen. After trial and error, pressing “q” got me out of detail screen.
As I had Apache, MySQL, Postfix, Dovecot and other components already installed, multiple times upgrade process prompted me to perform an action for new config file. For all the configuration changes, I kept the local configuration and clicked “OK”.
Apache/PHP Stopped Working
Upgrade process completed and after reboot I was able to login to Webmin control panel. I was really happy that everything went smooth but when I clicked on an uncached page link, it gave me php file with source code.
That gave me a heart attack because it means my Website and code and other secrets (well there is none) is open for everyone.
I concluded that Apache was working fine but somehow there was a problem with Apache connecting to PHP.
I searched online and tried couple of things but none of them were working. I restarted the server again but now Apache would not start.
I went into each Virtual Server and under Server Configuration > PHP Version, I changed PHP version to latest version. Even after this change, I would get raw PHP file when I access any website page.
I tried to start Apache from command line and found some weird error regarding SuEXEC which is way above my poor Linux administration experience.
I started looking for re-install option within Webmin. Luckily, under Virtualmin > System Settings > Re-check Configuration.
I believe this fixed the problem and when I started Apache, it worked.
Dovecot Stopped Working
There was another problem that I faced regarding email. Outlook failed to connect to email. I found Dovecot log and found the following error
Error: Failed to initialize SSL server context: Can't load SSL certificate: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
Searching online found this SO thread in which one answer said to add following line to 10-ssl.conf file.
ssl_dh = </usr/share/dovecot/dh.pem
I verified that this file exists on the server so when I added the above line, saved file and restarted Dovecot, it worked.
Finally after much sweating, I have the Websites up and running. To tell you a secret, I did not have snap shot or a backup (Well, I had it but it was one day old). So when I was in the middle of a mess, I started taking a backup and was about to fire up another droplet and reinstall but I thought that it would take much time so instead, focus on making Apache talk to PHP. Even though I went through this ordeal, there is no lesson learned because real men test in production.