From: Michael Raskin <7c6f434c@mail.ru>
To: hi@alyssa.is, devel@spectrum-os.org
Cc: jpo@vt.edu
Subject: [spectrum-devel] Re: [PATCH www] design: state subdirectories, not block devices
Date: Thu, 17 Oct 2019 09:47:12 +0200 [thread overview]
Message-ID: <E1iL0O3-0005Zx-1X.7c6f434c-mail-ru@smtp33.i.mail.ru> (raw)
In-Reply-To: <87pniwb7tp.fsf@alyssa.is>
>>>+State directories and applications will be <var>m</var>:<var>n</var>.
>>
>> Note (probably not affecting the design right now): this can also be
>> a source of annoyance with running everything under unique single-use
>> UIDs: to have multiple UIDs access the same resource, setting ACLs is
>> a natural idea. It works well, but might require some cleanup of
>> obsolete ACLs for a workflow with a large churn of instances ??? the
>> maximum length of an ACL is limited.
>
>Yeah, we'll need something like that. ACLs sound sensible.
Of course, this is a persistent state related to a large number of
inodes that requires keeping track of used unique UIDs (to avoid reuse
before cleanup) and cleanup (I have learned it hte hard way: one does
run out of ACL capacity without removing the obsolete ones), including
some kind of cleanup in case of VM crash or unclean host reboot.
>> Given that it is sometimes convenient to spawn multiple VMs with almost
>> identical settings on the fly (e.g. Firefox instances but with different
>> state directories for downloads/uploads), should we commit to define
>> a CLI layer for starting VMs (probably similar to the underlying VMM
>> software CLI, but adapted to the notions we want to use), with the
>> Nix-based management of VM fleet built on top of this CLI?
>
>Yeah, I've been thinking about this too and agree. We should have a nix
>run analogue for temporary VMs. It would be nice for scripts that use
>multiple VMs to be able to start them on the fly as well. (But we
>should definitely not have a nix-env -i analogue, because there should
>be no hidden state on a host.)>
I think it is better to avoid evaluation, actually.
So I want a level where there is a Spectrum Profile Generation with
named prebuilt VMs complexity levels (console-only, for stuff like
ImageMagick on images downloaded from 4chan; GUI-but-no-HW, to remove
GPU attack surface and guarantee lack of sound; full-GUI, which is still
not guaranteed to get access to everything, of course), and prebuilt
application sets (just buildEnv stuff, no fancy stuff).
Then I say:
spectrum-vm --base full-gui --net nat --app firefox-esr-js-profile \
--app gvim --dri card0 --rw-directory user:conf/nixcon-2020 \
-- firefox https://nixos.org/
This should not do anything in run time that can be safely cached. VM is
prebuilt, application bunches are prebuilt and just mounted into store,
even Firefox profile is prebuilt and changes are going to be discarded.
No builds, no Nix evaluations.
(yes, there is also the annoying question of RAM amount management, not
sure how to do it well, ballooning would be the nicest thing if it is
feasible)
>> I suspect that building things the other way round is not much simpler,
>> but building a single VM image usable with slightly different settings
>> will have smaller overhead than evaluating a Nix expression for each
>> extra VM.
>
>Maybe. I'll have to think more about that. tbh I think we can assume
>that the evaluator will get faster at some point (because there's big
>potential for optimisations and caching in safe mode). It might be nice
Oh well, in the safe mode there is even a potential for precompiling Nix
functions. It's another question whether we want to experiment with
workflows without having access to such speedups.
And even a pure evaluation of a checkout needs to stat all the relevant
files (even if we accept the risk of not checksumming them).
>to invent yet another way to do options, and just keep that in Nix. But
>I could be swayed either way.
I assume there are good arguments for the config to be structured (and
in my current system there are some interface boundaries with structured
config and some wrapper scripts that manage to generate almost all the
usecases using command-line arguments, but sometimes parts of the
structure need to be passed to them).
On the other hand, JSON can be parsed and written easily in all
languages we might want to use, even in Bash using jq. And we need some
code to setup the namespaces, but nsjail/firejail/bubblewrap are C code
so in the long term there would be some rewrite, probably in Rust??? And
having Nix preprocess arguments for Rust code sounds strange.
And whatever you do, Nix evaluation is always just another layer before
running the actual code for setting up the isolated environments that
still needs to interpret its arguments.
Also, I might want to use some binary cache, but when I am offline Nix
builds wait for a long time for a reply from a binary cache. It's not so
bad if I am intentionally building something and can pass an empty value
for binary-caches via the command line, but doing it for each new
command I execute sounds excessive.
Also, it might be convenient to pass entire Nix store inside some VMs,
but if all the _environments_ of all the currently running VMs are
visible in the Nix store??? I really shouldn't.
I guess if I mention multiuser systems you would say that we need to
allow chmod a-x on /nix/store?
next prev parent reply other threads:[~2019-10-17 7:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 20:28 [spectrum-devel] [PATCH www] design: state subdirectories, not block devices Alyssa Ross
2019-10-16 21:33 ` Michael Raskin
2019-10-16 23:15 ` [spectrum-devel] " Alyssa Ross
2019-10-17 7:47 ` Michael Raskin [this message]
2019-10-17 11:36 ` Alyssa Ross
2019-10-17 12:09 ` Michael Raskin
2019-10-18 18:51 ` Alyssa Ross
2019-10-18 18:56 ` Alyssa Ross
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1iL0O3-0005Zx-1X.7c6f434c-mail-ru@smtp33.i.mail.ru \
--to=7c6f434c@mail.ru \
--cc=devel@spectrum-os.org \
--cc=hi@alyssa.is \
--cc=jpo@vt.edu \
/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://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
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 NNTP newsgroup(s).