FS#37402 - [pacman] pacman try to download packages enen if no space left on deice

Attached to Project: Pacman
Opened by Pablo Lezaeta (Jristz) - Saturday, 19 October 2013, 00:54 GMT
Last edited by Allan McRae (Allan) - Wednesday, 02 November 2016, 04:11 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To No-one
Architecture All
Severity High
Priority Normal
Reported Version 5.0.1
Due in Version 5.1.0
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

Description:
PAcman try to download (and obvious fail) packages on standar location een if that location is a mount point and is full (aka 100%)

I think that this is because pacman check space only for intal but not for download
the other part is that the error mesage is cryptic:
Package error (size != sizetotal)
and in english.

so the feature is a proper mesaje of 'Cache is full' or make packman check space after download

Additional info:
* pacman in core

Reproduce:
Make /var/cache/pacman a mount point, make it full and try to download throw pacman a big package like linux
This task depends upon

Closed by  Allan McRae (Allan)
Wednesday, 02 November 2016, 04:11 GMT
Reason for closing:  Fixed
Additional comments about closing:  should be fixed in git commit 8c55c009
Comment by Dave Reisner (falconindy) - Saturday, 19 October 2013, 01:09 GMT
CheckSpace already does this...

# mkdir tmp
# mount -t tmpfs none tmp -o size=1M
# pacman --cachedir=$PWD/tmp -Sddw sage-mathematics

Package (1) New Version Net Change Download Size

community/sage-mathematics 5.11-1 2259.18 MiB 370.22 MiB

Total Download Size: 370.22 MiB

:: Proceed with download? [Y/n]
error: Partition /root/tmp too full: 94790 blocks needed, 256 blocks free
error: failed to commit transaction (not enough free disk space)
Errors occurred, no packages were upgraded.
Comment by Allan McRae (Allan) - Saturday, 19 October 2013, 01:47 GMT
Also, "git grep sizetotal" gives me no results. So where is that message coming from? Or is there a typo?
Comment by Pablo Lezaeta (Jristz) - Saturday, 19 October 2013, 03:34 GMT
I use btrfs and /var/cache/pacma is inside /var that is a mountpoint (so a mountpoint inside a mounpoint) in a i686
additional maybe another thing is that a package was downloaded partially but the error rise when pacman try to resume that because I do a upgrade that consoume space.

I can reproduce it as I want and eery time I want (so here is 100% reproducible) but I need time (slow internet during weekend...really slow), so please wait until monday for all type of logs
Comment by Allan McRae (Allan) - Saturday, 19 October 2013, 04:19 GMT
Please post:

1) pacman.conf
2) /etc/fstab
3) a pacman log from the error happening with --debug
Comment by Pablo Lezaeta (Jristz) - Saturday, 19 October 2013, 04:39 GMT
Pacman log using --debug comming on moonday, so I post the other 2 for now
Comment by Pablo Lezaeta (Jristz) - Saturday, 19 October 2013, 04:44 GMT
defrag is know to be default in the stable btrfs (if reach it some time)
   pacman.log (814.5 KiB)
   fstab (0.9 KiB)
Comment by Allan McRae (Allan) - Saturday, 19 October 2013, 04:48 GMT
Not the pacman.log file. We need the output when running pacman with the --debug flag. And pacman.conf.

Both those will be much smaller than the pacman.log you just uploaded.
Comment by Pablo Lezaeta (Jristz) - Monday, 21 October 2013, 22:31 GMT
I bet a pony that the problem are btrfs metadata

I think (in my ignorance) that btrfs metadata isn't taken correctly in concideration on pacman for determinate if is possible or continue whit the operation
Comment by Allan McRae (Allan) - Tuesday, 22 October 2013, 00:25 GMT
debug: loading fsinfo for /var/cache/pacman
debug: partition /var/cache/pacman, needed 11990, cushion 5121, free 185216


Can you provide the output of "df -a"?
Comment by Pablo Lezaeta (Jristz) - Tuesday, 22 October 2013, 00:34 GMT
I win my pony?

/dev/sda6 7.0G 6.3G 0 100% /var/cache/pacman
and say 100% because btrfs not respect standards..or that I think
   df-a (2 KiB)
Comment by Allan McRae (Allan) - Tuesday, 22 October 2013, 00:42 GMT
Do you have df aliased as "df -h"? Run "\df -a". I want to see block counts.
Comment by Pablo Lezaeta (Jristz) - Tuesday, 22 October 2013, 00:51 GMT
/dev/sda6 7340032 6599168 0 100% /var/cache/pacman
remmember btrfs + autodefrag, I run whitout autodefrag but no change in output
Comment by Allan McRae (Allan) - Tuesday, 22 October 2013, 01:05 GMT
The available output from coreutils is correct. I guess we need to look at what they are doing differently for btrfs to calculate that.
Comment by Pablo Lezaeta (Jristz) - Tuesday, 22 October 2013, 01:09 GMT
so this is confirmed now?

and maybe metadata have influence here??
Comment by Kenny MacDermid (kenmacd) - Tuesday, 21 January 2014, 00:03 GMT
Ran into this issue on an RPi today running btrfs. Initial partition is 2G. Pacman attempted to install python and made it half way through before failed with a bunch of write errors.

Once the FS was expanded pacman hadn't handled the install gracefully and the existing python files were treated as unowned, so the package had to be reinstalled with --force.
Comment by Pablo Lezaeta (Jristz) - Monday, 14 April 2014, 03:34 GMT
I was looking to btrfs faq and under 'Aaargh! My filesystem is full, and I've put almost nothing into it!' part there some info
https://btrfs.wiki.kernel.org/index.php/FAQ

I hope this could help to almos know why this happend
Comment by Martin Kühne (mar77i) - Monday, 10 October 2016, 11:06 GMT
the difference seems clear to me:

df.c:888: bv->available = fsu->fsu_bavail;
vs.
diskspace.c:348ff:
_alpm_log(handle, ALPM_LOG_DEBUG,
"partition %s, needed %jd, cushion %ju, free %ju\n",
mp->mount_dir, (intmax_t)mp->max_blocks_needed,
(uintmax_t)cushion, (uintmax_t)mp->fsp.f_bfree);
if(needed >= 0 && (fsblkcnt_t)needed > mp->fsp.f_bfree) {
_alpm_log(handle, ALPM_LOG_ERROR,
_("Partition %s too full: %jd blocks needed, %ju blocks free\n"),
mp->mount_dir, (intmax_t)needed, (uintmax_t)mp->fsp.f_bfree);
return 1;
}

Are we supposed to switch the diskspace calculation to f_bavail?

Comment by Allan McRae (Allan) - Tuesday, 11 October 2016, 13:51 GMT
f_bavail is the amount available to an unprivileged user. pacman is running as root.

Looks like all the real work is done in lib/fsusage.c
Comment by Martin Kühne (mar77i) - Tuesday, 11 October 2016, 15:06 GMT
I kicked off quite the discussion on freenode.net/#btrfs, interviewing them on the fact that they report some things only on f_bavail, for example in https://patchwork.kernel.org/patch/7367271/ .
As a general rule of thumb applications should rely on the more pessimistic estimate f_bavail.

`man statvfs` says "It is unspecified whether all members of the returned struct have meaningful values on all filesystems."

According to irc, f_bfree's assumed meaning that it is greater because "space may be reserved for root" is not true for btrfs and these days and for some filesystems also includes free space for eg. filesystem-internal mechanisms.

It is reported to be always >= f_bavail because anything else would drive some applications crazy.

Btrfs updates metadata storage exhaustion only in f_bavail, and also gnu core utils run as root do their calculations using f_bavail.

Loading...