Skip to content

Prevent saving xfce cache data onto the disk#28

Closed
mati7337 wants to merge 1 commit into
QubesOS:masterfrom
mati7337:master
Closed

Prevent saving xfce cache data onto the disk#28
mati7337 wants to merge 1 commit into
QubesOS:masterfrom
mati7337:master

Conversation

@mati7337

Copy link
Copy Markdown

Set XDG_CACHE_HOME to /tmp/xfce-cache/$LOGNAME to prevent forensic artifacts related to dispVMs from being saved onto the disk.

@marmarek

Copy link
Copy Markdown
Member

Maybe better something based on XDG_RUNTIME_DIR? That should be automatically created, with proper permission (contrary to new subdir in /tmp, which creating could be racy).

Set XDG_CACHE_HOME to `/tmp/xfce-cache/$LOGNAME` to prevent forensic
artifacts related to dispVMs from being saved onto the disk.
@marmarek

Copy link
Copy Markdown
Member

There is (at least) one issue with setting XDG_CACHE_HOME to something tmpfs-based globally - it could grow beyond the available space in there. For example qvm-template uses it by default to cache downloaded template (about 1-2GB of data). Other applications may do so too (although there aren't many in dom0 anyway).

Maybe there is a way to set it only for xfwm4 process? Or alternative method to avoid saving this piece of data (some setting?) ?

@DemiMarie

Copy link
Copy Markdown
Contributor

There is (at least) one issue with setting XDG_CACHE_HOME to something tmpfs-based globally - it could grow beyond the available space in there. For example qvm-template uses it by default to cache downloaded template (about 1-2GB of data). Other applications may do so too (although there aren't many in dom0 anyway).

Maybe there is a way to set it only for xfwm4 process? Or alternative method to avoid saving this piece of data (some setting?) ?

Time for an XFWM4 patch?

@marmarek

Copy link
Copy Markdown
Member

Time for an XFWM4 patch?

If there is no other option, maybe. But I hope it won't be necessary.

@mati7337

Copy link
Copy Markdown
Author

I don't think there's a way to set an environmental variable just for xfce as every process executed by xfce will also inherit that variable, but it should be possible to change the fallback directory in libxfce4util's makefile and not set the XDG_CACHE_HOME variable at all. The problem now is that we trust that nothing else will set that variable, which may or may not be true in the future
Another option is to modify xfce's code to add a setting to disable saving session data (technically there's the Automatically save sessions on logout checkbox, but it doesn't seem to affect the saving of these files) or to chmod 500 ~/.cache/sessions.

@marmarek

Copy link
Copy Markdown
Member

Another option is to modify xfce's code to add a setting to disable saving session data

IMO it's worth exploring this option. If the change is simple, we can go this way. And hopefully the patch should be acceptable upstream, so we won't need to maintain it indefinitely.

@mati7337

Copy link
Copy Markdown
Author

Another option is to modify xfce's code to add a setting to disable saving session data

IMO it's worth exploring this option. If the change is simple, we can go this way. And hopefully the patch should be acceptable upstream, so we won't need to maintain it indefinitely.

It turns out that getting rid of ~/.cache/sessions/thumbs-dom0:0 is just a matter of setting an undocumented xfconf setting - /general/ShowScreenshots in xfce4-session channel.
As for the *.state files, I've made a patch that makes xfwm only save them if /general/SaveOnExit is set in xfce4-session channel, which gets set by the Save session for future logins checkbox. Should I send it upstream or to https://github.com/QubesOS/qubes-desktop-linux-xfce4-xfwm4 ?

@marmarek

Copy link
Copy Markdown
Member

As for the *.state files, I've made a patch that makes xfwm only save them if /general/SaveOnExit is set in xfce4-session channel, which gets set by the Save session for future logins checkbox. Should I send it upstream or to https://github.com/QubesOS/qubes-desktop-linux-xfce4-xfwm4 ?

Upstream first. When it get accepted, it will probably be worth backporting in our repo to older version.

@marmarek

Copy link
Copy Markdown
Member

for the record, upstream patch: https://gitlab.xfce.org/xfce/xfwm4/-/merge_requests/98

@ben-grande

Copy link
Copy Markdown

for the record, upstream patch: https://gitlab.xfce.org/xfce/xfwm4/-/merge_requests/98

@mati7337 Upstream patch was not accepted yet, but there is a merge conflict. Can you fix it? It increases the chance of it every being accepted.

@marmarek

Copy link
Copy Markdown
Member

The rebased version of that MR is at https://gitlab.xfce.org/xfce/xfwm4/-/merge_requests/181. There is some more discussion there, with final conclusion it's probably a correct change. But still not merged...

@marmarek

Copy link
Copy Markdown
Member

And there is a separate PR to our xfwm4 package - QubesOS/qubes-desktop-linux-xfce4-xfwm4#23

@marmarek marmarek closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants