Add-on to live mode: qubes in RAM, store detached during the session

Read this first. This is a small addition on top of someone else’s work, not a project of its own. The amnesic session it runs in is @linuxuser1’s live mode, start there: Qubes OS live mode. dom0 in RAM. Non-persistent Boot. RAM-Wipe. Protection against forensics. Tails mode. Hardening dom0. Root read‑only. Paranoid Security. Ephemeral Encryption

What is mine is only the layer that carries the workload: qubes kept in an encrypted store, loaded into RAM, worked on with the store closed, saved back. Everything below was written before I understood that, and parts of it are corrected later in the thread.


The problem. A normal Qubes session keeps writing your work to the internal disk. An amnesic session fixes that for the system, but the workload goes with it, so nothing you did survives. Neither end gives you qubes that live across sessions without ever touching the disk.

Where this is now. The cycle works and I have run it on real hardware: qubes load into RAM out of an encrypted store, the store is closed and gone from the system while you work, changes are saved back into it. The roadmap at the end of this post says where each piece stands.

Three ways to run a qube, pick by what the qube is.

Whole thing in RAM. The qube is standalone, it goes into memory and the store closes behind it and is gone from the system. This is the only one with a real air gap. Small and secret things go here: the vault with keys, a wallet, a messenger. Gigabytes, not more.

Template in the store, only the qube’s own data in RAM. The store stays open so there is no air gap, but memory costs little and one template is shared by several qubes. Use it when the system is heavy and the data is light: a build environment, a browser qube on a large template.

Whole thing stays in the store. A chain node, an indexer. Hundreds of gigabytes, they will never fit in memory, and that is not a defeat: there are no secrets there, a public chain is public by definition. The strong protection goes to what deserves it instead of to everything.

What I run: keys and wallet the first way, node and indexer the third. The second is for qubes that are a bit large for memory but hold little data.


Hi all,

I’d like to share an experimental project and, mostly, ask for adversarial review of its threat model before I take it any further.

Why I built it

I built this because it was the piece missing for me. The ingredients are all well-documented here already, Qubes compartmentalization, encrypted media, RAM-only tricks, but I couldn’t find a workflow that combined them the way I needed: a normal, updatable base that leaves no trace of my real work on the internal disk, where each sensitive task is its own encrypted, portable qube, loaded into RAM only when needed and living at rest only on media I physically control. This is my attempt at that missing workflow.

The idea in one paragraph

Full-disk encryption protects data at rest once the machine is off, but a normal Qubes session keeps writing to the internal disk: qube images grow, dom0 logs record qube names, swap may page sensitive memory to persistent storage. What this does is boot a clean empty Qubes, make a storage pool backed by RAM, and restore into it only the qubes you need, out of an encrypted store. The store is then closed and gone from the system, and you work entirely from RAM. When you are done you open it again, save the qubes back, tear everything down and power off. The goal is that the internal disk looks the same after the session as before it. It is the Tails amnesic idea, but per qube, and built out of Qubes’ own backup, restore and storage pool machinery.

How this relates to existing forum work

This is not standalone. It sits on work this forum already did, and the list below says what I take from each and where I go differently.

Qubes OS live mode / dom0 in RAM is the base I build on now. It makes dom0 itself amnesic, with a read only root and an ephemeral overlay, and that removes a whole class of leftovers I had been cleaning by hand: logs, panel state, metadata. What it does not do is keep workload state, and messengers whose crypto only moves forward need exactly that (I tested this, see further down the thread). So this sits on top of it rather than next to it: the session is ephemeral as in that guide, and the working qubes come out of an encrypted store and are saved back into it, forward only. Qubes in tmpfs and Qubes 100% in RAM are earlier work in the same direction.
Ephemeral DVMs in fully ephemeral thin pools achieves pure ephemerality, nothing survives. The qubes here are persistent but portable: real AppVM state that survives across sessions, but only inside the encrypted store, never on the internal disk.
Detached LUKS header on USB covers the system disk side, which this composes with rather than replaces.

So the one line difference: prior work makes the system amnesic; this makes the workload live in RAM and persist only in an encrypted store that is closed while you work, and it runs on either kind of base underneath.

Two-layer design

I split the problem deliberately:

Layer A, how the machine boots and opens its system disk. Platform-specific: measured-boot platforms vs. platforms using a detached LUKS header are genuinely different trust models. Handled per-platform.
Layer B, “the ghost”: the RAM pool, the encrypted-vault protocol, and the load/save/teardown lifecycle. Identical everywhere. This is what the project is really about, so the same minimal-template “ghost image” is reusable no matter how a given machine boots.

What is actually implemented

One script, scripts/ghost, does the whole cycle: open the store and bring up the RAM pool, restore qubes into RAM, close the store, work, save back, tear everything down.

I ran all of it on the laptop, not in a VM. Wrote a marker in a qube, closed the store so it was gone from the system, kept writing into the qube with it gone, saved, destroyed the RAM pool completely, brought it back up, restored. Everything was there.

The four older scripts are still in the repo. They used to do things the one script did not, the placement and completeness checks in particular, and those have since moved across.

Threat model, please poke holes

In scope: no session residue on the powered-off internal disk; no sensitive memory paged to persistent swap; no sensitive qube names in dom0 logs; vault air-gapped during work.

Out of scope: cold-boot/DMA against live RAM; a compromised dom0 or malicious template; coercion beyond the outer volume; anything the platform’s boot layer can’t guarantee.

Questions I asked here, and where they stand

  1. Other on-disk writes during a restore into a non-default pool. Still open. I have not audited it.

  2. Whether repointing the default pool is the right way to force restore placement. Answered by trying. There is no option for the target pool, so switching the default pool for the duration is what works.

  3. dom0 logs recording qube names. Gone, and not because I solved it. The amnesic session makes dom0’s root ephemeral, so there is nothing left to scrub. That whole class went away with the design change.

  4. Whether noswap tmpfs is enough against paging. Still open. The swap here is zram and stays in memory, but I have not proven the general case.

  5. Paranoid-mode restore. Dropped. The default policy refuses the volume import and I am not using it. Allowing it needs a policy for that call, which I have not written.

One clarification on device handling, since it matters for the trust story: the raw USB device is never attached to dom0, it stays behind sys-usb, only the block device is passed to the offline vault, and the volume passphrase is entered inside the vault. The dom0 exposure is limited to the backup archive stream during restore (see question 5).

Prior art

This is glue on top of others’ work: Qubes OS (pools, backup/restore, DispVMs, qrexec, admin-client), Tails (the amnesic model), Whonix/Kicksecure (minimal hardened templates), and qusal by Ben Grande (minimal provisioning, and the sys-usb/grub warning). Thanks to all of them.

Roadmap

The cycle itself, done. Qubes restored into RAM, store closed while working, changes saved back, proven on real hardware.

One script for the whole cycle, done.

Refuse to load anything but the newest archive, and prune old ones on save. Done, with tests. A save seals the archive and only then removes the older ones, so there is never a moment with nothing to load. Going back on purpose is still possible, but the archive name has to be typed out in full and the step is recorded as a new generation. The seal lives in the store, so it catches a mistake and a swapped archive, not someone who restores an old copy of the whole volume.

Check that restored volumes really landed in RAM and fail closed if not. Done. The chain is followed rather than assumed: the pool, its volume group, the one physical volume under it, the loop file behind that, and the filesystem the file sits on, which has to be tmpfs.

Hash the archive and mark it complete only after verifying. Done.

Keep only the crypto state of a messenger instead of a whole qube image. Done. Tested against a stand-in filesystem, not yet against a real messenger.

Sterility checks before power off. Done. The teardown ends with a verdict and names whatever is still holding on.

Matrix: closed, and not the way I first reported it. See the correction further down the thread.

Code + full README (mirror). It’s MIT-licensed, experimental, and not affiliated with the Qubes OS Project.

Grateful for any review, especially the “here’s how your disk still leaks X” kind.

Thanks!

1 Like

Here is one recent resource for you and your project to analyze:

2 Likes

Good point, and it hits my project directly.

My teardown clears the Qubes logs, journald, libvirt logs and shell history, but it does not touch dom0 desktop state. So on my setup those SSIDs would survive a session. That is my gap, not a Qubes one.

The wider problem is dom0 DE state in general: panel config, recent files lists, thumbnails, WM session data. I was watching the obvious forensic places and missed the boring ones.

The tmpfs mitigation from this thread fits my design, I already keep the qubes in RAM. I will test it and report back.

1 Like

Following up with a reproduction, and it turns out my own guess about the cause was wrong.

Fresh Qubes 4.3.1 install, minimal Debian template, qvm-backup-restore --paranoid-mode -d <storage-qube> <archive>. The DispVM starts, the archive is decrypted and verified, the qube list is read correctly, I confirm — and then it dies with Service call error: Request refused, leaving the restored qube created but empty.

My first assumption was that the volume import was being refused by policy. That’s not it. The shipped /etc/qubes/policy.d/85-admin-backup-restore.policy does contain the expected rules, including:

admin.vm.volume.Import          * @tag:backup-restore-mgmt @tag:backup-restore-in-progress allow target=dom0
admin.vm.volume.ImportWithSize  * @tag:backup-restore-mgmt @tag:backup-restore-in-progress allow target=dom0

The restore never gets that far. What actually fails is the created-by-dom0 tag, and it fails on two different layers:

qrexec: admin.vm.tag.Set+created-by-dom0: disp-backup-restore -> ptest: allowed to dom0
qubesd:  WARNING: permission denied for call b'admin.vm.tag.Set'+b'created-by-dom0'
         (b'disp-backup-restore' → b'ptest') with payload of 0 bytes
qrexec: admin.vm.tag.Get+created-by-dom0: disp-backup-restore -> ptest: denied: no matching rule found

So tag.Set is permitted by the qrexec policy but rejected by qubesd itself at the Admin API layer, and tag.Get has no matching policy rule at all. Everything before that works — admin.vm.Create.AppVM, admin.vm.List, admin.vm.feature.Set+menu-items, admin.vm.tag.Set+audiovm-dom0 and +guivm-dom0 are all allowed and succeed.

My question for people who know this code better than I do: is the restore DispVM supposed to be touching created-by-dom0 at all, or is the shipped policy simply missing a tag.Get rule for it? The qubesd-side rejection of tag.Set looks deliberate — that tag family appears to be dom0-managed by design — which makes me suspect the restore path is doing something it shouldn’t, rather than the policy being incomplete.

Happy to file this as an issue with full logs if that’s the right next step.

1 Like
#!/bin/bash
# ghost-teardown.sh — remove RAM-resident qubes and scrub their traces before power-off.
...
    rm -f /var/log/qubes/*"$vm"* /var/log/libvirt/libxl/"$vm"* 2>/dev/null
...

As I have said in other discussions, deleting files (especially on an SSD) is a theater, not anti-forensics. Nobody should rely on such measures for hiding anything.

Anti-forensics starts from hardware.

4 Likes

One more piece of prior art that belongs in the opening post, which I missed before publishing.

Really disposable (RAM based) qubes is the closest precedent to my RAM pool mechanism — the same core idea of a tmpfs-backed storage pool registered with qvm-pool. Its stated goal is reducing SSD writes rather than anti-forensics, and it doesn’t cover the encrypted removable vault or the load/save/air-gap lifecycle, but the mechanism overlap is real and it deserves the credit. It also does two things I didn’t: redirecting qube logs to /dev/null instead of scrubbing them afterwards, and trap-based cleanup that survives a forced kill. I intend to adopt both.

I’ll fold this into the first post once I can edit it.

1 Like

You are right about deletion and I will not defend that line. On an SSD rm is not erasure, wear levelling and the FTL can keep the blocks alive. As a wipe it is weak and I should not present it as one.

What it is there for is a bit different. The sensitive qubes live in a tmpfs pool and on removable media, so their data never reaches the internal disk. The teardown only scrubs dom0 metadata, log lines that happen to contain qube names. Remove that scrubbing and the main property of the design still holds.

I already said I will redirect qube logs to /dev/null instead of cleaning them afterwards. That is your argument applied.

One thing I would like your view on. For the metadata dom0 writes by itself, the panel config that kept SSIDs, journald, the qubesd log, I cannot stop the writes without patching Qubes. Either mount those paths on tmpfs for the session, or call them out of scope and say so in the threat model. Which one do you consider honest?

1 Like

Here’s the most successful implementation of amnesic mode, used by many users and by me for a long time. It completely solves issues such as metadata leaks, memory shortages, and so on.

You can use this as a starting point and simply add some extra conveniences and improvements. It works very well and lets you make flexible use of anti-forensic features through several different modes. For example, my PC with 16 GB of RAM doesn’t perform well in RAM-based modes - it starts freezing pretty quickly. So I use an encrypted overlay in an ephemeral 100GB-container, which lets me run Windows.

This solution are very inconvenient and can be dangerous in some scenarios because of a serious misuse of dracut - I’ve run into this myself. For example, if the letter Y is the first letter of the disk password, amnesic mode may fail to start entirely. And if a user relies on this guide and nuke password matches Y, it can result in the system being destroyed.

1 Like

That is the most complete answer to what I have been circling around.

The principle is what I take from it. I was handling dom0 state path by path, panel config here, session cache there, recent files somewhere else. Making all of dom0 ephemeral removes the list, so there is nothing to forget. The encrypted overlay also answers the RAM limit, I had assumed amnesic meant everything has to fit in memory.

Three things stop me from adopting it as is.

Your own warning first. A boot mode where the first letter of the disk passphrase can decide whether the system starts, and where a collision with a nuke passphrase can destroy it, is not something I put on a machine I need working. If you have the details of that failure, or a thread where it was dissected, I would like to read it.

Second, it moves the layer I left alone on purpose. My premise is that the base install stays ordinary, updatable and auditable, and only the workload is ephemeral. Putting dom0 itself in an overlay makes my project mostly yours with extra steps. Not a criticism, just a different trade.

Third, practical. I am on measured boot. Every dracut or GRUB change means re-attesting, and a mistake means a machine that does not come up, often when I am not in front of it.

One data point back. I went looking for the SSID leak on my own install and could not reproduce it. The panel config is there but contains no network names at all. That machine is wired, which I think is the whole explanation, no wireless applet means nothing for the tray to persist. So the leak looks real but conditional on actually using Wi-Fi in dom0.

1 Like

One workload class worth naming, because it cuts across both approaches. Ratcheting end to end messengers, SimpleX and Matrix clients. Their encryption state only moves forward, per device, and both sides advance together.

Under full amnesia that means no long lived sessions. Every boot is a new identity because the ratchet cannot carry across. Not a flaw, just a poor fit.

My own design has the mirror problem and I would rather state it than be caught with it. Ghost saves a qube and restores it later. That is fine while the newest snapshot is always the one restored. Restore an older archive, after a crash or from a copy of the volume, and the ratchet goes backwards and the sessions break.

I am going to test exactly that. SimpleX and a Matrix client through a full load, use, save, power off, reload cycle, plus a deliberate rollback to an older archive.

As a control I add a third application with equally persistent local state but no forward only ratchet, a mail client with a local store where the crypto is PGP style. If the two ratcheting clients break on rollback and the control comes back intact, the cause is the ratchet and not snapshotting in general.

The class is the Double Ratchet family, the same construction under Signal and under OMEMO in XMPP. I will report results only for what I actually run.

Separate note on where full amnesia stops fitting. It is less about size than duration. A machine running a chain node and an indexer stays up for days, and an interrupted initial index means starting over. There the exposure window is the running system, not the powered off disk.

1 Like

This looks very much like AI language, copy and paste.

Nevertheless, I would have thought the only way to have a clean ephemeral session would be to load the entire system ephemeral? Dom0 and all VM’s, everything. Overlay?

3 Likes

I think the SSID issue needs to be fixed by the Qubes devs.

On hardware being the starting point: agreed as a floor, though I’d note that not writing in the first place is a software property that doesn’t depend on erasure guarantees — which is the line Tails walks too.

AFAIK, Tails runs entirely in RAM, so you can’t really compare it to Qubes that was never designed with the goals of Tails.

What I am saying is that you don’t know what the hardware actually does and when exactly it does it. You only know what you tell it to with the expectation that it will obey instantly.

Example:

You instruct the computer “write a file”. 10 seconds later you tell it “delete that file”.

What actually happened?

A) The data was not deleted but remained (due to SSD specifics)
B) The data was deleted (SSD firmware took care after a TRIM)
C) The data was never written persistently (stayed in volatile cache)

Add to that the additional intricacies of FS caching, journaling, possible driver and firmware bugs, etc. There are many layers between the hardware and a bash script and a qualified forensic analyst will look at all of them. You just can’t address the full spectrum.

1 Like

Im sorry I have to ask, is this @Base64 a bot?

1 Like

No, the code in the repository is genuine.

Filed your code findings as issues 1 to 7 in the repo, one per finding, so they do not get lost.

On the threat model half you are right and I am not going to defend that sentence. An ordinary minimal Qubes install is a population claim, the reference class is picked by the examiner and it moves in time, and the base carries the tooling anyway. I opened issue 8 to decide between dropping the claim and the front approach.

One difference in our use cases. My sensitive workloads include ratcheting messengers, state that must only move forward. Load into RAM and leave a near stock machine breaks them as soon as an older archive is restored. Those qubes have to stay persistent but portable on the encrypted volume and never be rolled back. So I take the front side from you and keep forward only saves for the messengers.

Will report back on issue 8.

1 Like

Please for the love of dog

4 Likes

looks pretty AI Bottish to me l :rofl:

2 Likes

Fair hit. English isn’t my first language and I lean on an assistant to clean up my writing - I clearly let it over-format this one. The code, the testing and the bug findings are mine. I’ll keep it short from here.

1 Like

Agreed on the uncertainty, and I will put that in the threat model instead of claiming the wipe covers it. But that argument lands on wiping, and the design does not rest on wiping: the sensitive qubes live in tmpfs and on removable media, so the write is never issued, and whatever the FTL may retain on the internal disk is LUKS ciphertext. On the SSID, agreed it belongs upstream - I will open an issue unless someone already has.

1 Like

Checked before filing anything: it is already tracked upstream as QubesOS/qubes-issues#11135, opened on 21 Sep, and it covers the SSID case directly. It points at xfce4-panel keeping known systray icon titles in xfce4-panel.xml, and suggests redacting the title in qubes-guid. So nothing for me to add there.

1 Like