Disk free space left check

Bug #1657104 reported by Zygmunt Krynicki
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
In Progress
Medium
Paweł Stołowski

Bug Description

It would be good if snapd would check if there is sufficient disk space when performing operations such as refresh or install. When performing a refresh-all it would be extra beneficial to serialize the operations if limited disk space is available so that updates can still be installed.

This bug is a clone of the following github issue: https://github.com/snapcore/snapd/issues/2603

Zygmunt Krynicki (zyga)
Changed in snapd:
status: New → Confirmed
Michael Vogt (mvo)
Changed in snapd:
status: Confirmed → Triaged
importance: Undecided → Wishlist
Revision history for this message
Liam Dawson (liamdawson) wrote :

I discovered I'd run out of disk space when installing a snap "froze". Annoying, because it's happening in a privileged space, it actually used 100% of the disk, instead of respecting the root-reserved section, which mean I didn't have enough free disk space to resize my LVM volume to give myself more disk space.

In this case I could resolve it by deleting the partially-downloaded snap and doing the resize, but I feel it's a significant bug that it managed to eat up all of the disk space and hang at the same time.

Revision history for this message
Ian Johnson (anonymouse67) wrote :

I ran into this in recover mode in uc20 with a small tmpfs mounted for ubuntu-data and got the following snapd log/panic https://pastebin.ubuntu.com/p/6BkjjssQpt/

I think that at a minimum, before the full fix of having snapd estimate how much disk space is required for an operation and cancel before filling up the disk, we should figure out how to at least make snapd service failover eventually fail such that snap-failure gets started up because as it is, snapd takes so long to start up (and thus times out) that we don't hit the StartLimitBurst and StartLimitIntervalUsec default settings (and snapd.service doesn't configure these for itself) and thus snap-failure never gets started.

If we at least hit the restart limit, then that would give snap-failure an opportunity to cleanup partial downloads so that snapd could start itself back up. But note that snap-failure currently would just revert snapd which may or may not be sufficient to unbreak snapd here. Ideally also snap-failure would detect that the disk is full and instead of reverting snapd revision it would just clean up the disk for snapd and leave some kind of flag for snapd to know that it should give up on it's current set of changes/tasks in flight due to disk space issues.

Changed in snapd:
importance: Wishlist → Medium
Revision history for this message
Paweł Stołowski (stolowski) wrote :

This is being worked on, it will involve a series of PRs, e.g. https://github.com/snapcore/snapd/pull/9002

Changed in snapd:
status: Triaged → In Progress
Changed in snapd:
assignee: nobody → Paweł Stołowski (stolowski)
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Snapd is now much more aware of disk space constraints, especially around critical operations that rely on additional space, such as refreshes. The feature is still behind several experimental feature flags, and is not enabled by default.

Revision history for this message
AdlerHorst (adlerhorst) wrote (last edit ):

Since Snap I have much problem with diskspace. I permanently get diskspace warnings It seems that Snap-apps I have, using around 50% of my Root disk space. It would be much easier If I could permanently deactivate or limit the backup of old SNAP versions to certain Apps.
e.g. 'sudo snap set system refresh.retain=0'

For the record cleaning old snap is only a temporary solution.

#!/bin/bash
# Removes old revisions of snaps
set -eu

LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' |
    while read snapname revision; do
        snap remove "$snapname" --revision="$revision"
    done

I would vote for a solution which autoremove oldest SNAP if free Diskspace is lower than double the disk-space warning.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.