From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: guix-devel@gnu.org
Subject: Atomic file updates
Date: Mon, 13 Jun 2016 17:00:20 +0200 [thread overview]
Message-ID: <87twgxcewr.fsf_-_@gnu.org> (raw)
In-Reply-To: <20160613112138.6a76d09b@scratchpost.org> (Danny Milosavljevic's message of "Mon, 13 Jun 2016 11:21:38 +0200")
Danny Milosavljevic <dannym@scratchpost.org> 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
bug-guix@gnu.org 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,
Ludo’.
next prev parent reply other threads:[~2016-06-13 15:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-05 22:29 Implementing guix system rollback / switch-generation Chris Marusich
2016-06-06 8:10 ` Ludovic Courtès
2016-06-09 7:19 ` Chris Marusich
2016-06-12 16:46 ` Ludovic Courtès
2016-06-13 9:21 ` Danny Milosavljevic
2016-06-13 15:00 ` Ludovic Courtès [this message]
2016-06-06 12:10 ` Leo Famulari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87twgxcewr.fsf_-_@gnu.org \
--to=ludo@gnu.org \
--cc=dannym@scratchpost.org \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).