• intrigeri's avatar
    Upgrader wrapper: make the check for free memory smarter. · b8a97e4f
    intrigeri authored
    Quoting anonym (#8263#note-1):
    In our Live system context, where a lot of stuff is in tmpfs:es, looking
    at the values of free or /proc/meminfo alone isn't accurate for
    determining how much memory "really" is free, since the tmpfs usage is
    included in the buffers. Hence, MemFree is the lower (and safe) bound of
    how much "really" free memory we have, and MemFree + Buffers + Cache is
    the upper (and unsafe) bound. The true value should be (at least closer
    to) MemFree + Buffers + Cache - (sum of usage by tmpfs:es). We should
    check once against that value instead.
    The 300 MB magic number (minimum "real memory" available) was found
    after bisecting with an ISO built from current feature/jessie:
     * with 278000 kB of "real memory" available, Tails Upgrader could
       successfully tell me that no upgrade was available (which is indeed
       the case), or that I should manually upgrade (after tweaking
       /etc/os-release; because I started from DVD);
     * with 255000 kB of "real memory" available, the check for upgrades
       failed and the desktop session froze;
    => so 300x1024 kB should give us a small safety margin.
    For the record, a VM with 1GB of RAM allocated (891 MB visible due to
    the QXL video adapter stealing some) on current feature/jessie has
    336MB (137MB free + 39MB buffers + 212MB cache - 52MB tmpfs) of "real
    memory" available once Tor is ready and Tor Browser is started, so in
    practice any system that's beefy enough to use Tails 2.0 can check
    for upgrades.
    Closes: #10540, #8263
tails-upgrade-frontend-wrapper 1.79 KB