What happens if the PC shuts down while installing updates?

What happens if the PC shuts down while installing updates?
Does Fedora proactively create a backup snapshot of the system before installing updates? If this is not the case, how do you solve problems due to the PC turning off during updates?

If you mean Workstation, then the user should exploit the snapshot feature of the BTRFS filesystem, and there is no guarantee the transaction isn’t corrupt. DNF is pretty good at restarting an update that failed part way through. In Silverblue and the like those transactions (updating/installing/removing) are atomic, so if power failure during updating happens, you simply would end up booting into whatever version of commit you had when you began the update.

2 Likes

If the user has configured snapshots on the btrfs file system then recovery using the snapshot may be possible.

If the system was writing something to a critical location/file at the time power was lost then all bets are off.

It may be necessary to do several recovery steps depending upon the conditions at the time the power was lost so there is no definitive single answer. More information is required.

Does the system boot now – even with an older kernel?
Do you have a live media USB device that can be used for recovery?
What version of fedora is installed?
What is the hardware? (laptop, desktop, etc.)

We might be able to assist but need enough information to provide a starting point.

So it still works on both Silverblue and standard distribution? Is it an automated process?

This is not a situation that really happened but a hypothesis. Given the maturity of the operating system, perhaps it is the case that an automatic recovery function is implemented if these problems occur. The average user would not know what to do in a situation like this.
The main risk is for those who use a workstation powered by the electrical network rather than a battery. The sudden loss of electricity in the update phase could cause issues that cannot be easily solved for a beginner user.

Loss of power creates problems if it happens while writing data to storage. Updates are no different from many other types of processing. The effects of power outages are one reason large enterprises are minimizing the use of desktop systems in favour of laptops.

There are tried and true ways (UPS, backups, btrfs snapshots) to minimize the impact of power failures.

Please try to use ask fedoraproject dot org responsibly. This question is not an actual problem you want us to help with but something you should spend some time to research and test on your own and share result with the community , especially if you feel it is something of value to even just yourself. From the POV of someone who tries their best to help people use fedora in it’s many flavours, I am a bit insulted by my time getting wasted on hypothetical exercises.
[Edit] I closed this topic. If you want to discuss this concept further please post in the watercooler section.

Hypothetically everyone could have their PC powered from a UPS or battery.
Since that is not the case there are machines that are subject to data corruption if the machine is writing to storage at the same time as power is lost.

Experts as well as beginners may encounter this problem. Each may ask for assistance and it may be possible to recover – or recovery may not be possible.

Automatic recovery would be meaningless since that would mean extreme cost to ensure the power loss situation could never happen. Even enterprise data centers are only able to afford the infrastructure to protect the data servers and not the individual workstations that may use that data.

For everyone, there is a balancing act between resources and wants.

1 Like