I destroyed my nginx config after upgrading :(

This isn’t really a question, I guess, as I think I can recover things, but perhaps it’s a cautionary tale, and maybe someone has some insight to offer.

I recently upgraded a droplet from Ubuntu 20.04 to 22.04. One of the last steps of do-release-upgrade is to remove outdated packages, but it warns that could take hours, so I deferred that until after the machine was back up and running. Everything seemed fine, so I went about removing old packages. Based on advice found online, I also removed config files for everything marked RC in dpkg -l. That was a mistake, as one of the packages was nginx, and that wiped out my /etc/nginx directory, as well as /var/log/nginx, and perhaps others.

It was extremely puzzling, because the server was still running just fine. I realized it only reads the config when it starts up and doesn’t need it again.

Now, there’s still an nginx installed, as shown by dpkg -l, so I don’t know why the dpkg --purge removed the config files. I consider this a bug.

Fortunately, I did a snapshot just before the upgrade, and I’m instantiating a new droplet from it, hoping to copy over the nginx config.

It’s too bad one can’t mount a snapshot as a filesystem on an existing droplet. I think that would be a very useful feature.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
March 6, 2024

Hey @jetforme,

Great idea, sounds like it’d be super useful!

The best thing to do to get your voice heard regarding this would be to head over to our Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.

Hope that helps! - KFSys.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel