On Tue, Oct 26, 2021 at 10:31:54AM -0700, Han wrote: > Hi, > This might be a dumb question: is dpkg installing (or updating) a package > using a .deb file atomic in the event of power outage? > By atomic, I meant either the new version of the application is fully > installed, or not at all. Is this always guaranteed? > I read the `man dpkg` doc, but couldn't find a clear answer. I might have > missed it though. > Thanks, > Han
It's not a dumb question. The installation of a package might seem, from the user perspective, like it could be atomic, but it is really made up of a variety of steps. Broadly, the package is downloaded, then unpacked, then any included pre-installation script is executed, the unpacked contents are placed in their location on the system, and then any included post-installation script is executed. A power outage at any point in the process could leave the package in a state where is it is not fully installed. Though, generally speaking, a situation like that can almost always be recovered from by a command like 'apt-get install --reinstall <pkg>'. However, there might circumstances where more advanced techniques might be required. Regards, -Roberto -- Roberto C. Sánchez