GNU bug report logs - #51547
Erase / on boot

Previous Next

Package: guix;

Reported by: Tom Fitzhenry <tom <at> tom-fitzhenry.me.uk>

Date: Mon, 1 Nov 2021 11:15:02 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51547 in the body.
You can then email your comments to 51547 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#51547; Package guix. (Mon, 01 Nov 2021 11:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tom Fitzhenry <tom <at> tom-fitzhenry.me.uk>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 01 Nov 2021 11:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tom Fitzhenry <tom <at> tom-fitzhenry.me.uk>
To: bug-guix <at> gnu.org
Subject: Erase / on boot
Date: Mon, 1 Nov 2021 22:13:43 +1100
This issue tracks the creation of a Guix System implementation of 
https://grahamc.com/blog/erase-your-darlings :

    "I erase my systems at every boot.
    [...]
    NixOS can boot with only two directories: /boot, and /nix."

I have a working prototype of 
https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/ . I will submit some 
small fixes in the short term, and later some larger patches.

Ideally this will result in a cookbook entry, and a CI test.




Information forwarded to bug-guix <at> gnu.org:
bug#51547; Package guix. (Mon, 01 Nov 2021 12:20:02 GMT) Full text and rfc822 format available.

Message #8 received at 51547 <at> debbugs.gnu.org (full text, mbox):

From: Tom Fitzhenry <tom <at> tom-fitzhenry.me.uk>
To: 51547 <at> debbugs.gnu.org
Subject: Erase / on boot
Date: Mon, 1 Nov 2021 23:19:08 +1100
Adventures so far...

I've pasted a working system configuration at the bottom.

The idea is to boot / as tmpfs, and to mount the minimal set of 
directories from persistent storage:
* /boot
* /gnu
* /home is not strictly required, but is useful!
* /var/guix

What's working:
* Booting to GNOME
* `guix system reconfigure`
* Booting previous generations
* /etc and /var are empty upon boot, woo!

A few issues:

* Bootstrapping all this is non-trivial. It requires fiddling with 
partitions, and getting it wrong can easily make your system unbootable. 
Suggestions? Maybe the user could set up bind-mounts to map to their 
preferred partition scheme? A basic cookbook entry could bind-mount 
directories from a single ext4 partition to the required directories.

* I tried setting up /gnu and /var/guix as bind-mounts per 
<https://guix.gnu.org/cookbook/en/html_node/Setting-up-a-bind-mount.html>, 
but this didn't seem to work from initrd: the kernel panic'd on boot. I 
need to confirm this and raise a bug.

* Mounting / as tmpfs falsely requires a device, otherwise it waits 
forever on boot. I need to confirm this and raise a bug.

* Activation-on-boot fails due to inexistence of /run and /var/run. 
<https://issues.guix.gnu.org/51548> fixes this.


Here's the config:



(use-modules (gnu))
(use-service-modules desktop networking ssh xorg)

(operating-system
 (timezone "Australia/Sydney")
 (host-name "test")
 (users (cons* (user-account
                (name "tom")
                (comment "Tom")
                (group "users")
                (home-directory "/home/tom")
		;; Needed since /etc/passwd is not persisted.
		(password (crypt "password" "foobar"))
                (supplementary-groups
                 '("wheel" "netdev" "audio" "video")))
               %base-user-accounts))
 (packages
  (append
   (list
    (specification->package "emacs-next"))
   %base-packages))
 (services
  (append
   (list (service gnome-desktop-service-type)
         (set-xorg-configuration
          (xorg-configuration
           (keyboard-layout keyboard-layout))))
   %desktop-services))
 (bootloader
  (bootloader-configuration
   (bootloader grub-bootloader)
   (target "/dev/sda")
   (keyboard-layout keyboard-layout)))
 (file-systems
  (cons* (file-system
          (mount-point "/")
          (device
	   ;; TODO: Raise bug that root-as-tmpfs falsely requires a partition.
           (uuid "59457d60-2b08-4f5c-b1c7-e29cd5f7a3da"
                 'btrfs))
	  (options "size=1G")
          (type "tmpfs"))
	 (file-system
	  (mount-point "/boot")
          (device
           (uuid "59457d60-2b08-4f5c-b1c7-e29cd5f7a3da"
                 'btrfs))
	  (options "subvol=boot")
	  (needed-for-boot? #t)
          (type "btrfs"))	
	 (file-system
	  (mount-point "/home")
          (device
           (uuid "59457d60-2b08-4f5c-b1c7-e29cd5f7a3da"
                 'btrfs))
	  (options "subvol=home")
          (type "btrfs"))
 	 (file-system
	  (mount-point "/var/guix")
          (device
           (uuid "59457d60-2b08-4f5c-b1c7-e29cd5f7a3da"
                 'btrfs))
	  (options "subvol=var/guix")
	  ;; Needed to boot old generations, which needs /var/guix/profiles/
	  (needed-for-boot? #t)
          (type "btrfs"))
	 (file-system
	  (mount-point "/gnu")
          (device
           (uuid "59457d60-2b08-4f5c-b1c7-e29cd5f7a3da"
                 'btrfs))
	  (options "subvol=gnu")
	  (needed-for-boot? #t)
          (type "btrfs"))
         %base-file-systems)))




Information forwarded to bug-guix <at> gnu.org:
bug#51547; Package guix. (Wed, 03 Nov 2021 13:36:02 GMT) Full text and rfc822 format available.

Message #11 received at 51547 <at> debbugs.gnu.org (full text, mbox):

From: Tom Fitzhenry <tom <at> tom-fitzhenry.me.uk>
To: 51547 <at> debbugs.gnu.org
Subject: Re: Erase / on boot
Date: Thu, 4 Nov 2021 00:35:37 +1100
On 1/11/21 23:19, Tom Fitzhenry wrote:
> A few issues:

Another issue: /var/tmp/ is not created on boot, which breaks vi:

tom <at> computer ~/src$ vi
ex/vi: Error: /var/tmp/vi.recover: No such file or directory
ex/vi: Modifications not recoverable if the session fails
ex/vi: Error: /var/tmp/vi.recover/vi.u8Kkbb: No such file or directory




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Tue, 12 Jul 2022 14:14:02 GMT) Full text and rfc822 format available.

Notification sent to Tom Fitzhenry <tom <at> tom-fitzhenry.me.uk>:
bug acknowledged by developer. (Tue, 12 Jul 2022 14:14:02 GMT) Full text and rfc822 format available.

Message #16 received at 51547-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Tom Fitzhenry <tom <at> tom-fitzhenry.me.uk>
Cc: 51547-done <at> debbugs.gnu.org
Subject: Re: bug#51547: Erase / on boot
Date: Tue, 12 Jul 2022 10:13:28 -0400
Hi Tom,

Tom Fitzhenry <tom <at> tom-fitzhenry.me.uk> writes:

> On 1/11/21 23:19, Tom Fitzhenry wrote:
>> A few issues:
>
> Another issue: /var/tmp/ is not created on boot, which breaks vi:
>
> tom <at> computer ~/src$ vi
> ex/vi: Error: /var/tmp/vi.recover: No such file or directory
> ex/vi: Modifications not recoverable if the session fails
> ex/vi: Error: /var/tmp/vi.recover/vi.u8Kkbb: No such file or directory

While interesting, this effort is not an actual bug and is a WIP it
seems, so I'm closing it.

Feel free to share progress or ask for guidance or guix-devel <at> gnu.org!

Thanks!

Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Aug 2022 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 231 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.