2 questions - 1 topic: Migrate Virtualmin - to LXD?!
2 questions - 1 topic: Migrate Virtualmin - to LXD?!
tl;dr: I cannot migrate (because backup + restore is broken) my Virtualmin.
If I knew who to turn to. If I knew, I'd have already bought them/you a beer.
Introduction: I am a veteran Linux, BSD, user, sysadmin, power user. Not to brag, just wasted too many years of my life fixing my xorg config. Get the joke? But, for real. So. I was paying for a hosting because I didn't want to bother with the whole stack of things. I did set up my own host setup at some point, several times in my life, but there is so many things to look out for, I was looking to streamline that. That's where the hosting came in. Long story short, the hosting got hacked. I had enough at that point, and went looking for a suite.
There was ISPConfig, cPanel, some others and Virtualmin. Webmin looked always nice, so Virtualmin felt great out of the box.
Friend told me he was using it for years, he is happy with it, can back it up, restore. I was like, great!
I purchased a license (10) first, then a (50), and now another. So happy three license owner here, yayyy.
So, this is a 2-in-1, but they are related, and I don't think it deserves two topic, as they are related.
I'll try to be as short as possible to avoid posting a 5 page old thread, so here it goes.
- Basically I used Virtualmin for months now on a virtual machine under Hyper-V.
- Start was rough, there were a few bugs here and there, I even wrote a document about it, but you know, small things. like milter not working.
- So, I set it all up, fixed the quirks, I was up and running. I did backups, I did script to backup, all the stuff. Which all turned out to be utterly useless. But hey. REMEMBER KIDS, ALWAYS TEST YOUR BACKUPS!
- Time went by, and I was paying a bit much for this server. Like a simple VPS could do all this. Meanwhile I also learned how to work with LXC.
- How great it would be to rent a new virtual server, put LXC/LXD on it, and run Virtualmin in that. Oh boy. Oh, the joy.
- So I got a new virtual server, started a new Ubuntu 18.04. All superb! Here is where the love story becomes grim. Individual backup files just don't work.. at least for me.
- So I tried importing the individual smaller files. Nothing. It just didn't import anything. Great!
- I started doing a full backup. Error. Ruh-roh. What could it be?
DomainExample.com has user "admin".
Uh, okay? I did NOT name the users, or groups, or anything? But sure it has? So what?
Well, turns out, until I fix that, I will NOT get a complete backup until I fix that.
Maybe this is why the individual backup / restore failed too.
What was the problem?
Turns out, Virutalmin has it's own conciousness. And when you add a new virtual server, it can name it three ways. Three is what I saw, there may be others.
Let's call our domain "DomainA.com".
User/group can be: domaina
Path can be: /home/domaina
User/group can be: domaina.com
Path can be: /home/domaina.com
User can be "admin" ! I am not kidding.
- So I had to rename these. How do you do that? Well, the Change Domain feature does NOT work if you have sub-domains.
- You can make it work if you disable DNS under each sub-domain, for the parent you rename.
- But oh joy, the rename will NOT be complete. Once Virtualmin says it's done, it'll simply crash. It will start the eternal slumber.
- Turns out, the subs were not renamed. I had to use "grep" and "sed", to look for all occurences for "/home/domain/" and replace with "/home/domain.com/".
- So you think our journey has come to an end? Worry not, there is lot more.
- At this point, I had the domains renamed, and the old host worked fine. Oh my.
- So, backup again. Back it all up, then SCP from new host, then try to load it back up.
- Restore complete. Yay! Oh wait... some sites are missing.... what now... well, this remains a mistery to this day. Some sites just did not import, and there were 0 errors.
- Oh well, I'll just use the command line. So I did. Full backup again there, move it over. Import from the new site. You writing notes? Backup on the live server, import on website on new one. Good.
- All the sites. All the stuff. OH BOY. Minus the tunes I did, like fixing milter, but you know, nothing biggie. So I change DNS, check the site... it's not loading. HTTPS won't load.
- At this point I spent I think 8-10 hours digging without luck. No webmin, apache, or any error. Nothing. Ports all good, lxc forward good, yet it's not working.
At this point... Big Brain Time.
If they are both Ubuntu 18.04. (new and old).. They both use Virtualmin, they both are updated.... can't I just like copy files over and call it a day?
And so I did. This is NOT a backup, it's not what anyone would want to use live but you get by with what you've got. I was like, I'll just export the lxc container, back that up, all good.
Well, this worked surprisingly well! But I have to start /etc/init.d/webmin by hand. Hmm, most interesting.
In fact, everything loads up, there are the sites, everything. But I have to start everything by hand.
There must be some kind of service setting for systemd that I missed or that gets messed upon copying.
What are the two things here?
- How do I backup and restore so that it actually works?
- How do you copy a Virtualmin (so to say) over to a new server and make it work, like the services?
Ps.: Yes, each and evry time I re-deployed the LXC container. Such as between two backups, I redeployed it, did a clean virtualmin install, then proceeded. I didn't want to risk contamination.