Since I last reinstalled my laptop, I try to keep my usually insanely long list of installed packages to a bare minimum. I’d usually have hundreds if not thousands of libraries and development packages as these are required by a bunch of packages I maintain or code I work on.
To achieve this and still be as productive as before (if not more), I’m using arkose quite a lot to generate temporary dev/build environment that are wiped as soon as I close the shell.
This helps maintain the number of extra libraries to a minimum, avoiding situations where something mysteriously works fine on my laptop but not on another machine and avoids the maintenance needed when dealing with chroots.
An example of this is when I’m working on ubiquity (the Ubuntu graphical installer).
Ubiquity depends on quite a few libraries and development packages that are required even if you just want to build its source package.
So having arkose installed on my system, I usually start working on a bug with:
sudo arkose -n -h -c "cd $PWD; $SHELL"
You can make that an alias if you use it quite often. At this point, you’ll see your shell showing a different hostname, like “arkose-tmpaF9yqa”, that’s how you know you’re in a container.
The command above creates a new container using copy-on-write for all the file system but your home directory and lets the container access the network without any restriction.
I then install all the packages I’ll need to work
sudo apt-get build-dep ubiquity
Then work as usual in that container, run debuild, dput, … everything should work as usual as it has direct access to my home directory.
Once I’m done and I don’t need all these packages anymore, I just exit that shell and all the changes done outside of /home will be lost.