shutdown a computer when you shouldn’t computer breaks
how could a computer do this
Power outages do happen, and I’m pretty sure 90% of the people on this community are not using an UPS.
Given enough users and enough time, it’s inevitable that a power outage will happen to some people at an inopportune moment, like while updating an important package like the kernel.
Blaming the user for this is not fair, it’s just dumb bad luck.
That said, OP could have done a bit more to fix the issue instead of being an angry man yelling at the cloud. When you’re using Arch, the expectation is that you are able to fix relatively simple problems like this, or that you’re at least willing to learn it. If you find yourself getting angry when Arch doesn’t hold your hand, you probably shouldn’t have chosen Arch.
To be fair a lot of Linux distros and other operating systems try to be careful on how they do things. Arch is the odd man out.
I was installing Nobara 40 and discovered that the live session is allowed to suspend the PC during the install process. The system ended up having problems with some basic functions…
The power is out and my laptop has less than 10% battery left?
It’s pacman -Syu time.
Exactly my thoughts as well.
Why update on that little battery life left… the power will return sooner or later, going without updates even for a week or two is no real problem. Hell, I update like once every 3 weeks to a month, it’s not that big of a deal.
Wait if the power is out, how do they have Internet to load new packages? Something doesn’t make sense here
Average Linux solution.
“Got an emergency? It’s so EZ. Just open up the terminal and copy/paste [long string of unreadable text]. Btw fuck windows.”
Cable internet tends to stay online even if your power is out. You’d need a battery backup for your modem/router, but it is possible to stay online. Houses can be clever like that, almost all of your utilities will partially work, even when service is interrupted.
It first downloads all packages from net, then it proceed totally offline starting by verifying downloaded files, signatures, extracting new packages and finally rebuilding initramfs.
Because arch is replacing the kernel and inittamfs in-place there is a chance that it will not boot if interrupted.
This issue was long resolved on other distro.
One way to mitigate it is by having multiple kernels (like LTS or hardened) that you can always pick in grub if the main one fail.
This issue was solved on Slackware in 1993.
It installs a “huge” kernel that contains all drivers to run on almost any hardware by default, alongside the “generic” kernel with only the modules you need. If the generic kernel fails to boot, you always have the backup, which is known to work, cause it’s the kernel you first boot into after installation.
My router has a 5G backup connection and a battery. Light could be out and I’d still have internet. So, yeah, it’s possible :P
But if the power goes out isn’t the stuff from your ISP/mobile carrier out too?
I don’t think I’ve had a pacman update take longer than 10 minutes before. Sounds like OP was updating all their AUR packages too.
Still absolutely a terrible thing to do on 10% battery life. I bet there’s an AUR package for “check battery level before update” out there somewhere though.
OPs meme is "use distro whose model is ‘give users enough rope to hang themselves’ " and complaining he’s at the gallows
That’s why UPS boxes exist … Or Timeshift if you don’t have the cash
Image says “laptop”. op could have just charge the battery a but before running the update.
I think I didn’t make it clear enough: My laptop was on the power during the update process, when the power randomly cut out - for the first time in about 6 years, it doesn’t happen often. Of course you can interpret it as user error - but I think it’s reasonable to update my system when plugged into, normally reliable power. The laptop battery is pretty much dead, so it would’ve shut itself down automatically anyway.
I mean any which way you try to frame this, saying that you won’t use Arch anymore because you didn’t take the precautions necessary based on your situation is gonna take some heat here.
What precaution would you expect OP to would’ve done though? A fallback kernel would be my guess - that’s something many casual oriented distro do out of the box basically. . I read your post as “you’re right, don’t use arch” - something btw which I tend to agree with although I wouldn’t say that’s because of the precautions.
I use arch because there’s no black box magic. For an end user who expects or wants that… Yes, arch might not be the right choice.
I don’t think lack of precaution was the issue here given that it was an unexpected power failure, but it is a fairly easy fix with a chroot.
I still don’t get the problem. Are you complaining you have to chroot into your system and finish the update because your power got interrupted? Is a 5 min detour into a live system making you unconfortable? This is how you would fix it in any distro except the image based ones and the arch wiki will guide you excellently how to do it. Good luck!
Plus in Linux you can actually fix this with a live USB, while on Windows you can run startup repair and hope for the best.
If it was on something like BTRFS it’d probably be fine, though I imagine there’s still a small window where the FS could flush while the file is being written. renameat2
has the EXCHANGE flag to atomically switch 2 files, so if arch maintainers want to fix it they could do
- Write to temporary file
- Fsync temporary file
- Renameat2 EXCHANGE temporary and target
- Fsync directory (optional, since a background flush would still be atomic, just might take some time)
Just about any Linux I’ve ever used keeps the previous kernel version and initrd around. And nowadays snapper makes a new snapshot before and after every package installation or update.
So, I’d think there are a lot.
Windows doesn’t in my experience, it’s surprisingly robust.
But also I thought Linux distros normally keep the old Kernel around after an update so stuff like this doesn’t cause a boot failure?
But also I thought Linux distros normally keep the old Kernel around after an update so stuff like this doesn’t cause a boot failure?
Arch has no concept of “previous package”, so it doesn’t do this.
You could install linux-lts
(or one of the other alternative kernels) side by side with the linux
package, so you always have a bootable fallback, but like most things on Arch it’s not enforced.
Windows updates (and Windows Installer) are transactional. If the update or installation fails, it knows exactly how to revert back to the previous state.
Windows Installer supports this across multiple packages too - for example, a game might need some version of DirectX libraries which needs some version of the Visual C++ runtime (probably showing my age because I doubt games come bundled with DirectX any more). If one of the packages fails to install, it can handle rolling everything back. Linux can sometimes leave your system in a broken state when this happens, requiring you to manually resolve the issue - for example, on a Debian-based system if the postinst
script for a package fails.
Any immutable distro, Debian, Ubuntu, all their derivatives, Fedora, all its derivatives, OpenSUSE, Slackware, …
Basically, 95+% of installed Linux systems would retain the old or a backup kernel during an upgrade.
Any immutable distro, Debian, Ubuntu, all their derivatives
Debian and Ubuntu are not immutable distributions by default, unless I am mistaken.
How dead are we talking here? Even on an older laptop a kernel update doesn’t take that long. Should have just kept it going, hoping for the best.