You are not logged in.

#1 2013-06-04 08:19:32

aweb
Member
Registered: 2010-12-18
Posts: 17

Move /var/lib/pacman/local to /usr/something?

I've been administering unix systems since long before linux, and have always felt the holy grail would be to make administering an arbitrary number of identically configured machines as easy as administering a single one.  Arch is pretty good, but I still had to write a bunch of scripts to call pacman to install identical packages on all machines.  When an upgrade "irregularity" is announced on the front page of archlinux.org, it often means I have to update my scrips to make pacman work.  On one cluster, I ended up writing a custom install initramfs that I boot over the network and that re-initializes the whole root file system, for times when the upgrade path is too complicated.  This all works fine, but is a bit crufty.  It's not something I could easily hand off to someone who just wants to "do the default."  Obviously it would be easier if I could always just update one machine manually and "image over" all the other ones to make them identical.

This new move of /bin, /sbin and earlier /lib to /usr brings the dream closer to reality.  It's getting to the point that I can imagine just copying /usr wholesale between machines.  Basically every machine in a cluster would have an identical /usr partition, all the configuration would be done in /etc, and /var would consist entirely of soft-state and other data that should not be replicated.  Some packages require directory initialization in /var, but this can probably be handled by extracting the relevant files and install scripts from package files.

The remaining sticking point is that local package information residing in /var isn't really soft state.  The most obvious example is /var/lib/pacman/local, but see also, for example, /var/lib/texmf/arch.  I understand why these directories were put in /var (the state is built up dynamically, not directly extracted from package tar files).  However, it isn't really soft-state because it describes the contents of the /usr directory.  One only modifies /var/lib/pacman/local when also modifying /usr, and a pre-installed /usr becomes a lot less useful if you don't have a matching /var/lib/pacman/local directory.

Anyway, I'm curious what people think.  Should the metadata describing /usr also reside in /usr?

Offline

#2 2013-06-04 08:39:03

progandy
Member
Registered: 2012-05-17
Posts: 2,151

Re: Move /var/lib/pacman/local to /usr/something?

It is an interesting thought, but there are also packages targeting /opt, /boot and /etc. If you need the metadata on /usr, why don't you create a bindmount?

Offline

#3 2013-06-04 18:25:27

aweb
Member
Registered: 2010-12-18
Posts: 17

Re: Move /var/lib/pacman/local to /usr/something?

progandy wrote:

It is an interesting thought, but there are also packages targeting /opt, /boot and /etc. If you need the metadata on /usr, why don't you create a bindmount?

Yes, /opt should definitely move to /usr/opt, but that's easy enough to do.  You can set it up and put a symlink in place.  That's not such a big deal since only AUR packages seem to use /opt.  Also, bindmount isn't really necessary, as I can set up a symbolic link from /var/whatever to /usr/var/whatever.  (It would be nice if pacman's DBPath configuration could be split.)

So all of these are workable solutions.  In fact, one really neat thing about arch is that you can achieve them pretty easily by creating a custom filesystem package.  (I love that there's nothing special about the base directory hierarchy--it's a package like any other and a different package can "provide" it.)  However, it would be particularly nice and clean if these things happened by default.

Here's another example of something neat that could happen.  Right now, there is one official way to install an arch machine, which is to run pacstrap.  Consolidating everything in /usr would enable a second way:  rsync  /usr from an existing arch machine whose configuration you like and run a simple hypothetical script like varetcstrap.sh that creates pristine /etc and /var directories.

varetcstrap.sh would be relatively easy easy to write given access to pacman's local DB directory.  For example, out of 1307 packages installed on my machine, only 25 of them install regular files (as opposed to directories) under /var.  The directories are easy to create just based on the files information in /var/lib/pacman/local, though the files would need access to the cached packages.

etc is a slightly more complicated story.  190 of my packages put files in etc, and there you really need the pristine version.  So that might require 190 package files.  However, an alternative would be for pacman to save original versions of installed files in /etc, which would have the added benefit of permitting three-way merges.

Once a script like varetcstrap.sh exists, a whole bunch of other things become easy.  For example, want to create a live cd just like your machine?  Super simple--create a squashfs or your /usr, use a tmpfs for /, and have an initramfs HOOK execute varetcstrap.sh to populate /.

Last edited by aweb (2013-06-04 18:26:06)

Offline

Board footer

Powered by FluxBB