You are not logged in.

#1 2020-01-13 19:37:45

Pupsi
Member
Registered: 2020-01-13
Posts: 2

[Question] Making Arch Linux as stateless as possible

Hi Arch-Community,


Intro:
I am currently trying to make my Arch Linux setup as stateless as possible. To do this I gathered some information about tmpfs, the FHS-Standard and tmpfiles.d.
I had good progress, but currently I was not able to make any further progress. This is more or less a hobby project for me (I personally like the Idea of a clean unaltered setup, which is "kind of" stateless). I won't suggest anyone to do this, except they know what they are doing, because of eventual data loss and the ability to gather information from log-files after reboot. I am using Arch Linux for a bit now, I mad different types of builds, but this time this catches me really hard. If someone could help me to do this, I will be very happy.



The basic concept:
The Idea is to mount everything that stores/holds data, which is recreatable by the systemd to be on an tmpfs(5). A quit simple task to do, as it sound like. The benefit of doing this on an filesystem-level is to don't configure each system part individually. But what I was not able to gather is how compliant Arch Linux really is. According to the file-hierarchy(7) standard.

PERSISTENT VARIABLE SYSTEM DATA wrote:

...[applications should be able to reconstruct necessary files and directories]....Persistency is recommended, but optional, to support ephemeral systems...

Currently, /var/lib for example is not save. Pacman stores crucial information in it. /var/lib/pacman


What I can say is safe:
/home/'username'
/root
/var/cache
/var/log

probably save to be mounted on to tmpfs **needs confirmation**
/var/db --- are they rebuild if missing?
/var/games --- for game saves?
/var/spool ---- includes /var/mail as symlink -- for mailboxes and printing queues

probably **confirmation needed**, senseless to mount onto an tmpfs:
/var/local ---- storage place for none binary data of manually installed programs "sudo make install" ?
/var/opt --- optional storage for packages in /opt, which are optional by themselves
/var/tmp --- the propose of it is to hold data between boots
/var/empy like /dev/null for directories?


already volatile:
/var/lock ---- currently just an symlink to ../run/lock

As I already mentioned /var/lib is not save because of /var/lib/pacman, other sub-folders like /var/lib/dhcpcd probably are, depending on the package.


/srv---- ?

All other directories should be volatile or stateless **confirmation needed**



Any bit of information is wanted and needed. I am also planning write an wiki article, about a stateless Arch setup in conjunction with the use of tmpfiles.d.

Best regards.

Last edited by Pupsi (2020-01-13 19:44:49)

Offline

#2 2020-01-13 20:20:53

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,390

Re: [Question] Making Arch Linux as stateless as possible

Not sure if this is what you are asking for, but check https://github.com/alfredopalhares/Arch … ter/README
...maybe the part about cow snapshots?


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#3 2020-01-13 23:40:00

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Question] Making Arch Linux as stateless as possible

Pupsi wrote:

Currently, /var/lib for example is not save. Pacman stores crucial information in it. /var/lib/pacman

Stateless systems and updating packages are not concepts that agree with each other. Your stateless system should be based on a static, never-modified archlinux system snapshotted from one with a pacman database.

That being said, you can configure the DBPath in /etc/pacman.conf to be anywhere you like.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2020-01-14 10:57:28

sabroad
Member
Registered: 2015-05-24
Posts: 242

Re: [Question] Making Arch Linux as stateless as possible

Pupsi wrote:

I am currently trying to make my Arch Linux setup as stateless as possible.

Check out systemd.volatile=overlay - it's quite straightforward to use.

man systemd-fstab-generator wrote:

If this setting is set to "overlay" the root file system is set up as "overlayfs" mount combining the read-only root directory with a writable "tmpfs", so that no modifications are made to disk, but the file system may be modified nonetheless with all changes being lost at reboot.

For true stateless, however, additional work required to support systemd.volatile=yes . YMMV.


--
saint_abroad

Offline

#5 2020-01-14 11:21:21

latalante1
Member
Registered: 2018-08-30
Posts: 110

Re: [Question] Making Arch Linux as stateless as possible

sabroad wrote:

Check out systemd.volatile=overlay - it's quite straightforward to use.

An essential part:

man systemd-fstab-generator wrote:

If true the generator ensures systemd-volatile-root.service(8) is run as part of the initial RAM disk ("initrd").

so systemd must be in initrd, and dracut must be used for this.

Offline

#6 2020-01-14 12:17:26

sabroad
Member
Registered: 2015-05-24
Posts: 242

Re: [Question] Making Arch Linux as stateless as possible

latalante1 wrote:

so systemd must be in initrd, and dracut must be used for this.

mkinitcpio has supported systemd init since as long as I can remember.


--
saint_abroad

Offline

#7 2020-01-14 16:49:07

Pupsi
Member
Registered: 2020-01-13
Posts: 2

Re: [Question] Making Arch Linux as stateless as possible

I just want to say thanks for the already posted hints. In the meantime, I am reevaluating the whole concept. Maybe I will start over from scratch to build a “stateless” Arch.
Especially, but also all the other ideas are as good as well:

sabroad wrote:

Check out systemd.volatile=overlay - it's quite straightforward to use. ...

The only thing that maybe conflicts with this idea using the overlay, already mentioned by:

eschwartz wrote:

Stateless systems and updating packages are not concepts that agree with each other. …

Which is true indeed, so I would have to boot normally to update my system, which in turn would alter data (wanted in the update process) and write recreatable data to the system as well (unwanted), that’s the reason, why I used a normal setup with tmpfs mounts. As I already mentioned:

Pupsi wrote:

… The benefit of doing this on an filesystem-level is to don't configure each system part individually …

In addition, I would also have to add. Not to break and not to be too far away from upstream, to prevent incompatibility and other mayor issues affecting the systems stability.


In the meantime If any idea pops up, I am pleased to hear it.

Offline

#8 2020-01-15 01:07:22

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: [Question] Making Arch Linux as stateless as possible

Some guy on reddit did a similar "stateless" system. He reinstalled the entire system whenever he wanted to update or install a new package.

As absurd as the idea may sound, he documented the full process (I'll leave finding it on /r/archlinux to you).

Last edited by Alad (2020-01-15 01:07:48)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#9 2020-01-15 19:21:27

NuSkool
Member
Registered: 2015-03-23
Posts: 141

Re: [Question] Making Arch Linux as stateless as possible

Alad wrote:

Some guy on reddit did a similar "stateless" system.

t_hunger was the user I read about doing a stateless system on reddit. Really interesting read.

Offline

#10 2020-01-29 15:44:41

phunni
Member
From: Bristol, UK
Registered: 2003-08-13
Posts: 768

Re: [Question] Making Arch Linux as stateless as possible

I am extremely keen to set up a Stateless arch system and have looked at Tobias Hunger's (reddit u/t_hunger) cleanroom system. It's good, although the documentation is poor. That said - he's very helpful and patient! It wasn't for me, however, since it requires a system which support EFI boot and some of mine are too old for that. I then looked at Darch. The docs here are much better (though still far from perfect), but the dev has moved on to using Ubuntu as his daily driver and, while he tries to help with problems since arch is still technically supported, he often ends up defaulting to "use Ubuntu".

As I say, I'm very keen on this and would love to be a part of any conversation about how to get this to work. Not sure how much I can contribute - beyond my failed attempts at using existing systems (cleanroom and darch), but I'm here anyway!

Offline

Board footer

Powered by FluxBB