To those using Arch on a server: how do you handle the frequent kernel-upgrade-induced restarts?
I know Debian or CentOS are the more traditional choice for a server, but I also know there are a few people around here using Arch on all their systems. I'd be interested in your experiences.
How often do you update, and do you restart every time there's a kernel upgrade? I've seen people brag about months of uptime while kernel-updates would force me to restart at least once a week. Or do you use something fancy like live-kernel-patching?
Edit: my personal use case would not be customer facing, but more like a homeserver for familiy/friends and one for a small non-profit. Nothing that requiered 100% uptime (I know there are other technologies for that). So the occasional restart – for me – would be perfectly fine, but I still wouldn't want to happen them in the middle of the day when multiple people are connected. As I said I'm interested in your experiences.
Edited 24 Apr 2021. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 33 · 89% up
- Kind
- Text
- ID
- mxil5e
55 comments
If I was using arch for a server, and that's a big if (most I've done is a tiny nas for videos and game installs), I'd use the LTS kernel. I don't think I'd update much until there's specific reasons why. Critical security patches or newly included hardware support/ features. Otherwise, there's no real reason to update?
The LTS kernel receives 3-4 updates/week which would require a restart.
It’s what I use and so long as I time it correctly my family don’t moan at me too much for lacking plex etc.
It was different when I also ran adguard home as well but switched to nextdns recently
all kernel updates are security updates.
Deleted before we saved it.
This is why canonical livepatch is a thing - reducing reboots helps. I do honestly think it helps the medium businesses more than a large sometimes - when you have 150,000 servers to patch like my last employer you get some really good automation.
clouds have been a wonder for this scenario. I just upgrade the base image and then start nuking servers in the cluster. basically at that point its just your disk storage servers you need to be slightly careful when rebooting.
Or a night relops worker that can perform the requisite backups and upgrades during the work week.
Yeah, I know I don't need 100% uptime (probably not even 98%) as this would be a personal/non-business server. I just want to make sure I don't accidentially reboot when other people are connected (or, god forbid, a family member streaming a video off it). And reboots in the middle of the night? – well, that's when want to be sleeping, too.
Clustering is a neat idea though. Not that I would need it, but would like to play with it.
Deleted before we saved it.
Automation and backups...
I'm running multiple devices at home, all arch or arch-arm with btrfs. They all do updates/reboots at least once a week (mostly around 5-6am), create snapshots before and after, backup the snapshots every once in a while via lan to an external hd (and clear out old ones) and send me a mail if either update or boot produced any errors.
So the worst case scenario is waking up, reading a mail and spending about 5 minutes rerolling to the last backup (mental note to take a look at the problem some time in the next few days included). I can still count the times this actually happened on one hand, with 5-6 devices each running for at least 2 years...
Upgrading the kernel doesn't require an immediate restart, the old kernel can continue running as-is forever – it's only when you want to use some feature and suddenly you have no corresponding kernel module that the problem occurs.
This shouldn't be a concern on production servers (big or small) – they won't really need anything new once it's up and running. IPsec? Btrfs? Wireguard? LUKS? All that stuff was loaded on boot and continues working fine, so there's no rush to reboot.
To be on the safe side, you can use kernel-modules-hook from AUR. It backs up the current kernel's modules, so they can still be loaded after an upgrade, e.g. if you suddenly need to add a firewall rule. (This is similar to how Debian preserves the old kernel package installed alongside the new one.) It's what I use on my personal servers where I tinker with new features a lot.
(You can also preload modules you know you'll need via modules-load.d. Once the module is loaded, it stays loaded even if unused.)
In fact, userspace library upgrades might hurt more than kernel updates. For example, if you upgrade Dovecot or Samba, those services have to be immediately restarted or they stop working – e.g. smbd starts failing to load vfs libraries, etc.
However, you can also just reboot it. Nothing wrong with rebooting once a week if that's how you do updates. Don't care about uptime, care about availability. Use load balancers, HA, etc. If I reboot a router at work, another one takes over via VRRP and nobody notices.
Lacking HA, schedule the reboot during a maintenance period when you know its availability is not required. Again, you're not forced to do a full reboot immediately after a kernel update, you can defer it. So reboot the mail server on a Sunday evening, nobody cares because it's a Sunday evening.
And if it's a small server with 5 users, chances are nobody will notice, especially if it's a VPS that reboots in 10 seconds flat. Yolo it when everyone's out for lunch. Does a falling tree make a noise if nobody hears it?
Also: if you reboot often, you get into the habit of making things reboot-proof and everything just goes smoothly. If you only do it once a year, you tend to run things and forget, and then a quick reboot turns into a hour-long "whoops the iptables rules weren't saved" untangling session...
As for livepatching: That exists on Linux, but it's something you'd use to apply very specific fixes, not swap whole kernels. Someone needs to actually create those patches, tailored for your current kernel, so if you must have 100% uninterrupted uptime, you have to e.g. run Ubuntu and pay Canonical for their livepatching service – not on Arch.
Most people who brag about long uptime achieve it by not upgrading at all. Maybe they know that their current packages aren't affected by any issues that would make upgrades necessary (see e.g. the
arch-audittool for security issues) or maybe they don't care.Deleted before we saved it.
Deleted before we saved it.
It depends what you're doing on the server. What level of downtime is acceptable for your customers? How does your service(s) or codebase(s) handle reboots? Why do you use Arch instead of some other distro?
If all your customer servers are nearly identical you could have a test server you update at some determined cadence, whether that be weekly, bi-monthly, monthly, whatever. If all goes well on the test server, you could reboot your other servers which should only take a few minutes at most plus the stop/startup time for any services running on those servers.
Disclaimer: I don't administrate Arch on our customer's systems for the company I work for, but I think my points above are still relevant. I use Arch for my own NAS systems, so I don't have to worry as much about these kinds of concerns.
Thanks. See my edit, my use case is mostly a homeserver too (should have mentioned that), but I still want a low downtime.
I guess I could do planned restarts at night to not anger anyone else who might be connected…
In that case, you should come up with a cadence you and your non-profit are okay with. Send them an email, reminder, or operate under the assumption that on Sundays at 2am their server is going to get updated/rebooted. Or whatever time if you want to be online to watch things happen and interact should there be an issue.
Planned, automatic updates are not a good idea as you should always monitor the updates for potential issues or gotchas etc.. You also don't want to do it during business hours as it could impact running processes. What is your business use case for using a rolling release in production? What are the benefits? My arch server is a test server to explore future updates to newer kernels and packages to my production software. Arch's package manager is top notch and fast and easy making it the best rolling release distro for my needs.
Couple things. Firstly bragging about long uptimes is ridiculous, just means their kernel is sorely out of date.
Secondly why arch for a server? It is enticing, but the amount of updates is a little much for something meant to be an appliance (server). You usually want very low maintenance for a server, security patches only until EOL.
Because I already know Arch, and like its minimal and upstream-centric model. It would just be for a hobby project, and I'm just toying around with the idea, that's why I asked for experience from the people that do this.
I've read it a couple times and always wondered how they managed to do that…
I can understand wanting to use Arch for a server as a hobby for sure. I’ve been tempted to give it a go as well, nice and minimal, nothing to get in the way of what you want to do.
Regarding uptime, professionally I’ve had servers with multi-year uptimes. When it came time for an inevitable reboot (power supply failure or whatever), there were always countless problems with bringing it back up. And of course there’s huge security concerns as well with long uptimes.
In a home setting, uptime only matters as much as you want it to. I wouldn't under any circumstances consider running Arch in a business context outside of maybe VMs.
That's true. But I don't want to restart my homeserver if, say my mother currently streams a film off it. Just trying to mitigate my family's wrath.
Sanest solution there is to pick an update time that conflicts with the least possible people. Maybe overnight when they're sleeping.
Honestly, just don't use arch as a server...
Or if you do and the kernel updates are the problem, use the hook (it's in the AUR) that saves your kernel modules so everything continues to work perfectly fine with the old kernel u til you choose to reboot. I do that and I never reboot after kernel updates. I update when I feel like it later on.
I just reboot as it's not dependent on 99.9% uptime for customer driven support. If that was the case I would not be using Arch or I would not be cutting edge on package upgrades, which defeats the point with using Arch in the first place.
I've two archlinux server , I run a -Syu once a month and reboot , that's all
Kexec c: Just reboot Linux, not the entire machine Possible caveats: Might not restart all services You might not do it properly It may just hang for no reason You replace the running Linux It may break something else Atleast it's faster than rebooting server machine
I use the kernel-modules-hook package.
I do update my Arch server once a month and restart them afterwards
this also helps to properly run my web server and docker at the latest version since this two services typically also run constantly otherwise snapshots to revert an upgrade if ever something happens (spoiler: It never did)
if you cannot reboot at least once a month
the choice between latest and LTS kernel doesn't really matter, both get updated frequently
for availability I would always have a redundant server available to pick up the downtime, for my home server the half a minute of downtime doesn't matter
I do a manteinance day once a month, which means I'll update everything, reboot, and check nothing is broken. Usually nothing is and the "day" is just half an hour.
active-active cluster with virtual ip addresses. Any shutdown will failover the ip address to the surviving one.
I handle it the same way as on Debian: reboot whenever there's a kernel update. for anything that really needs to be up 24/7, I run multiple servers and just don't reboot all of them at the same time.
I run https://xmr.insanitystudios.com on an arch server. Basically update when the pool software requires an update. Managing all blockchain daemons with systemd services, RPC with systemd services, and pool software with a systemd service. This pretty much automates all maintenance except for recompiling the pool software, and updating via pacman. Miners automatically reconnect upon reboot. It's possible with some of vmware's non-free software to have automatic fail over, load balancing, etc, so you could run a backup server as failover and update your main whenever you felt like it, it wouldn't interrupt service in the slightest.
For both my desktop and my servers, I lock the kernel packages in pacman.conf and upgrade once a month.
I update Arch about once a week, and reboot about that often. Then again, I track the standard linux package. If I wanted to avoid rebooting that often I'd use the linux-lts package.
I also just recently started using the needrestart package, that tells me when I need to restart services in addition to the kernel when I upgrade. It even prompts to restart services, which is kind of nice. Be careful restarting the DBus service, that can wreak all kinds of havoc.
I use Arch to run a reverse proxy and https frontend on two twins VM servers. Both running keepalived in failover mode, so I update one server, reboot and all the trafic is handled by the second one. This method also give me the chance to test updates and configs on the slave VM and wait before update the master if something goes wrong.
I don't use it on a critical server, but I do use it on a home server, and occasionally boot it on my most powerful x86_64 desktop. I do update it semi-regularly. And I do know about LTS kernels, but on Arch, even those update every few days.
personally i don't do frequent kernel updates, i check the changelogs to see if an critical CVE's are added then decide. i will still update regardless every now and again though.
Deleted before we saved it.
Hmm, that would be another nice thing to play around with…
Or do like I do, blacklist the kernel using IgnorePkg = linux linux-hardened in /etc/pacman.conf . Then only update the kernel on major releases. So I would update on 5.12 but not on 5.11.11 if that makes sense.
This is on one of my home servers but I would do the same if I was maintaining Arch on one of our servers at work. Also, remember that you do not have to update Archlinux (or any distro) if you do not want to. The longer you wait, the more chance of breakage but you can work through that as well.
Like most things in IT, you do never update or test on production. You do that stuff in the middle of the night and test it on other assets before deploying.
Do what you want but a server running Arch is ironic.