[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Atomic file updates

From: Ludovic Courtès
Subject: Atomic file updates
Date: Mon, 13 Jun 2016 17:00:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Danny Milosavljevic <address@hidden> skribis:

> However, I think the actual point is to have all the "update" actions be 
> atomic. Because there's something in the Linux kernel config (only on GuixSD; 
> works just fine on Ubuntu) which makes my laptop crashy (on the first larger 
> disk write after standby wakeup) I have some experience with Guix 
> non-atomicity and let me tell you it's not good. (Just the other day it broke 
> the substitute cache - so I couldn't use substitutes at all anymore; I've 
> since found and deleted the cache directory contents)

When you stumble upon issues like this, please report them to
address@hidden with as many details as possible.

In the case of substitutes, files under /var/guix/substitute/cache are
written atomically; in guix/scripts/substitute.scm, it looks like this:

        (with-atomic-file-output file
          (lambda (out)
            (write (cache-entry cache-url narinfo) out)

and effectively it writes to a temporary file, which is then rename(2)d.
I’m adding an fsync(2) call in ‘with-atomic-file-output’, which was
missing until now.

Regardless, you were very unlucky to end up with a truncated file.  ;-)

Anyway, if your “crashy” setup allows you to uncover other issues in
this area, please do report them!

> Therefore, while I wouldn't replace (or re-symlink) the entire /boot on guix 
> reconfiguration (it might be on its own partition, too), it *may* be useful 
> to use include files and put these there atomically, one file per version. 
> I'm not sure whether grub supports something like "include *.inc" with 
> wildcards but that would be an idea.

Under /boot, the only thing that GuixSD’s code controls is grub.cfg,
which is created atomically (see ‘install-grub’ in (gnu build install).)
The other files are installed by ‘grub-install’.

Thanks for your feedback,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]