Page MenuHomePhabricator

old Tor Browser versions in /var/cache/tb-binary/.tb/ accumulate in Qubes-Whonix, users run into full up disk error issues
Closed, ResolvedPublic

Description

As reported by @torjunkie.

ls -la /var/cache/tb-binary/.tb/

tor-browser.old.*

How do we solve it?

Say user customizations in /var/cache/tb-binary/.tb/ are discouraged? Just delete all /var/cache/tb-binary/.tb/tor-browser.old.* in Whonix 14?

forum discussion:
https://forums.whonix.org/t/7-0a3-tor-browser-series-defunct-in-whonix/3786/17

Details

Impact
High

Event Timeline

Patrick created this task.May 5 2017, 4:00 PM

What is the purpose of this folder? Qubes specific?
Why would user customizations ever be put in any /cache/ folder?
How does this relate to ~/.tb/ ?

Yes, Qubes specific. Background:

Why would user customizations ever be put in any /cache/ folder?

So these propagate from the TemplateVM to all TemplateBasedAppVMs.

How does this relate to ~/.tb/ ?

https://github.com/Whonix/tb-updater/blob/master/usr/lib/tb-updater/first-boot-home-population

(Running in in TemplateBasedAppVMs only.)


https://unix.stackexchange.com/questions/35832/how-do-i-get-the-md5-sum-of-a-directorys-contents-as-one-sum

What exactly is the use case when removing old /var/cache/tb-binary/.tb/tor-browser.old.* is bad?
IIUC this ticket is blocking tb-updater stable upgrade (T690), which would fix qubes-whonix build failure (T710). Which is a blocker for having Whonix templates for Qubes 4.0.

marmarek (Marek Marczykowski-Górecki):

marmarek added a comment.

What exactly is the use case when removing old `/var/cache/tb-binary/.tb/tor-browser.old.*` is bad?

Users who customized would have data loss. Probably a rare case. If
that's acceptable for you, at this point, I don't mind either. It's the
easiest solution that is doable.

IIUC this ticket is blocking tb-updater stable upgrade (https://phabricator.whonix.org/T690), which would fix qubes-whonix build failure (https://phabricator.whonix.org/T710). Which is a blocker for having Whonix templates for Qubes 4.0.

Yes.

Thank you very much for the PR!

Doesn't work.

Do we need ls? Glob (*) alone should do?

ls -r /var/cache/tb-binary/.tb/tor-browser.old.*
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:40:
start-tor-browser.desktop  Browser

/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:39:
start-tor-browser.desktop  Browser

/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:38:
start-tor-browser.desktop  Browser

/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:37:
start-tor-browser.desktop  Browser

Shows the inside of the folder.

xtrace:

+++ tb_move_old_version
+++ shopt -s nullglob
+++ local keep_counter
+++ '[' '' = true ']'
+++ '[' -d /var/cache/tb-binary/.tb/tor-browser ']'
+++ '[' -z '' ']'
+++ TB_KEEP_OLD_VERSIONS_COUNT=3
+++ '[' 3 = all ']'
+++ keep_count=3
++++ ls -r /var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:37 /var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:38 /var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:39 /var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:40
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d /var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:40: ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d start-tor-browser.desktop ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d Browser ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d /var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:39: ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d start-tor-browser.desktop ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d Browser ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d /var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:38: ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d start-tor-browser.desktop ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d Browser ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d /var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:37: ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d start-tor-browser.desktop ']'
+++ continue
+++ for old_folder in '$(ls -r "$tb_browser_folder.old."*)'
+++ '[' -d Browser ']'
+++ continue
++ tb_run_function tb_install

I've tried glob, but I need reversed order and failed to do that with glob. ls -dr should do. Unless $tb_browser_folder itself contains spaces...

That works better. But still not sufficient. It's in the wrong order.

for x in $(ls -dr /var/cache/tb-binary/.tb/tor-browser.old*) ; do echo $x ; done
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:40
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:39
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:38
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:37

for x in $(ls -tdr /var/cache/tb-binary/.tb/tor-browser.old*) ; do echo $x ; done
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:37
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:38
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:39
/var/cache/tb-binary/.tb/tor-browser.old.2017-05-05-13:45:40

Should do?

The version with that fix is now available from jessie-proposed-updates.

The idea was to keep X newest entries. not oldest, right? So the first order is right (the code skip X "first" directories). Also, I'd trust more file names, not modification time - the later is easy to mess up (and a consequence will be removing wrong directory - possibly containing just modified data).

True.

Fixed package uploaded to jessie-proposed-updates.

Patrick closed this task as Resolved.Oct 9 2017, 9:29 AM
Patrick assigned this task to marmarek.