Large file downloads stop at 2.1GB

Can’t download large movie files. Download stops at about 2.1GB, regardless of file size.

Also, unable to update NextcloudPi to latest version. These seem to be related problems, as they started when I was going through several upgrades a couple months ago.

Any help appreciated, and I’ll supply more info as needed, but I’m not familiar with the procedure to generate some of the logs and outputs mentioned in the support form. Thank you.

Nextcloud version (eg, 20.0.5): v1.52.4

Operating system and version (eg, Ubuntu 20.04): Armbian 23.8.1 bullseye

Apache or nginx version (eg, Apache 2.4.25): Not familiar with procedure to determine Apache version

PHP version (eg, 7.4): 8.0.30

The issue you are facing:

Large file downloads stop at about 2.1GB.

Also unable to update the server to more recent version of NextcloudPi

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

1. Log in

2. Attempt to download a large movie file

3. Download stops at 2GB regardless of how much larger it is

The output of your Nextcloud log in Admin > Logging:

Typical failure error:

**[PHP] Error: file_put_contents(): content truncated from 2527498122 to 2147483647 bytes at /var/www/nextcloud/lib/private/Files/Storage/Local.php#313**

**MOVE /remote.php/dav/uploads/Dan/1858936242/.file**

**from by User at 2024-01-02T00:10:51+00:00**

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

***Not familiar with the procedure to generate this output***

The output of your Apache/nginx/system log in /var/log/____:

***Not familiar with the procedure to generate this output***


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

***Error log file is almost 100MB, so I will copy several recent and typical errors. More can be provided upon request.***

[PHP] Error: file_put_contents(): content truncated from 2527498122 to 2147483647 bytes at /var/www/nextcloud/lib/private/Files/Storage/Local.php#313

MOVE /remote.php/dav/uploads/User/1858936242/.file

from by User at 2024-01-02T00:10:51+00:00

[core] Error: Renewing session token failed

GET /settings/admin/logging

from at 2023-12-26T20:40:41+00:00

[remote] Error: RedisException: No such file or directory at <<closure>>

0. /var/www/nextcloud/lib/private/RedisFactory.php line 137


1. /var/www/nextcloud/lib/private/RedisFactory.php line 178

OC\RedisFactory->create("*** sensitive parameters replaced ***")

2. /var/www/nextcloud/lib/private/Memcache/Redis.php line 66


3. /var/www/nextcloud/lib/private/Memcache/Redis.php line 72


4. /var/www/nextcloud/lib/private/App/InfoParser.php line 58


5. /var/www/nextcloud/lib/private/App/AppManager.php line 506


6. /var/www/nextcloud/lib/private/legacy/OC_App.php line 607


7. /var/www/nextcloud/lib/private/AppFramework/App.php line 71


8. /var/www/nextcloud/lib/private/legacy/OC_App.php line 291


9. /var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php line 119


10. /var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php line 90


11. /var/www/nextcloud/lib/base.php line 694


12. /var/www/nextcloud/lib/base.php line 1171


13. /var/www/nextcloud/status.php line 37


GET /status.php

from at 2023-12-26T01:05:09+00:00


[ nc-update ] (Tue Dec 26 20:33:20 UTC 2023)
Downloading updates
Performing updates
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: could not find driver in /var/www/nextcloud/lib/private/DB/Connection.php:140
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1531): OC\DB\Connection->connect()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1029): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /var/www/nextcloud/lib/private/DB/Connection.php(262): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery()
#4 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /var/www/nextcloud/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /var/www/nextcloud/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#7 /var/www/nextcloud/lib/private/AppConfig.php(374): OC\AppConfig->getApps()
#8 /var/www/nextcloud/lib/private/legacy/OC_App.php(976): OC\AppConfig->getValues()
#9 /var/www/nextcloud/lib/private/Server.php(734): OC_App::getAppVersions()
#10 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}()
#11 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#12 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()
#13 /var/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()
#14 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()
#15 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(193): OC\AppFramework\Utility\SimpleContainer->get()
#16 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#17 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#18 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()
#19 /var/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()
#20 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()
#21 /var/www/nextcloud/lib/private/Server.php(1115): OC\AppFramework\Utility\SimpleContainer->get()
#22 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}()
#23 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#24 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()
#25 /var/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()
#26 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()
#27 /var/www/nextcloud/lib/private/Server.php(2074): OC\AppFramework\Utility\SimpleContainer->get()
#28 /var/www/nextcloud/lib/private/Files/View.php(120): OC\Server->getLockingProvider()
#29 /var/www/nextcloud/lib/private/Server.php(468): OC\Files\View->__construct()
#30 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}()
#31 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#32 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()
#33 /var/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()
#34 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()
#35 /var/www/nextcloud/lib/private/Server.php(1476): OC\AppFramework\Utility\SimpleContainer->get()
#36 /var/www/nextcloud/lib/base.php(629): OC\Server->boot()
#37 /var/www/nextcloud/lib/base.php(1171): OC::init()
#38 /var/www/nextcloud/console.php(48): require_once('...')
#39 /var/www/nextcloud/occ(11): require_once('...')
#40 {main}Error while applying update 1.53.0sh. Exiting...


did you check your

memory_limit =

in your php.ini ?

Hi, sambilanet, thanks for replying. No, I have not checked that. How would I do that, and what should the value be? Also, how would I change it? As you might guess, I’m rather a noob at much of this.

Also, not sure if this is important, but my Nextcloud is on a 32-bit system. I’d never had trouble with downloads until one of the updates I did a month or so ago, though.

Hmmm… :thinking:

I can’t imagine that 32-bit could be a problem.

Execute this inside your nextcloud folder, like /var/www/nextcloud

  1. Check your loglevel

sudo -u www-data php occ config:list |grep loglevel

  1. Elevate your loglevel to debug

sudo -u www-data php occ log:manage --level=debug

  1. Lower your loglevel again!

sudo -u www-data php occ log:manage --level=“to the level you had before”

  1. Try the the upload and send the logfile here. Delete ahead private infos :warning:

  2. Maybe you can check your "limit"

php -i | grep “memory_limit”

Thanks again for continuing to help with this.

  1. “Check your log level”
    Returned nothing at all - no log level shown

  2. “Elevate log level to debug”
    Returned the following:

  3. Lower log level again:
    I don’t know what it was before, because the command returned nothing. Please advise what log level is appropriate.

  4. Uploading a 2.5GB file returned the following errrors:

*NOTE: Where “No space left on device” error appears, this is not true. The storage device for the Nextcloud OS is a 32GB SD card, and less than 7GB is used.

  1. Check memory limit
    memory_limit => -1 => -1

Thanks once again!

  1. sudo -u www-data php occ log:manage --level debug
  2. Is your database running ??
/etc/init.d/yourdatabase status
  1. sudo -u www-data php occ log:manage --level info | Don’t forget :warning:
  2. 32 better 25 GB is not that much, and if there is a warning there is a warning.. Yesterday I have lost data “ignoring” this message… :sweat_smile:
    Check if you can upload 1 GB. Or better what size you can upload ?

Returns: Could not open input file: occ

Yes, database is running

I believe the answer here is in the PHP error logged that I linked earlier:
“file_put_contents(): content truncated from 2666934549 to 2147483647 bytes”

So 2147483647 bytes, or whatever that comes to in MB or GB, would be the limit.


Ok perfect,
2147483647 bytes = 2,14 GB, and if this is the solution don’t forget to mark it as such.
Have nice weekend.

Hi @Skyhooker,

you must edit the memory_limit, post_max_size and upload_max_filesize directives in the php.ini from the sapi which is talking to your webserver.

Here I described all the relevant values:

You did not mention the sapi your server is using but it is either /etc/php/8.0/apache2/php.ini (for libapache2-mod-php) or /etc/php/8.0/fpm/php.ini (for php-fpm) where you must edit this directives.

32-bit Linux operating systems have certain addressing and file size limitations. A 32-bit system can theoretically only address 2^32 bytes (4 GB) of memory. This means that each individual application, including the operating system itself, can only access a maximum of 4GB of RAM.

There is a similar limitation regarding file sizes. The file system used on a 32-bit Linux system can typically only handle files with a maximum size of 4GB. This is due to the 32-bit addressing, which points to a maximum number of 2^32, which is 4GB.

LFS (Large File Support) allows 32-bit kernels to support files larger than 2GB (often up to 4TB). This was made possible by using 64-bit file operations, even though the kernel itself is 32-bit.

The LFS feature has been incorporated into many modern 32-bit Unix-like operating systems to overcome file size limitations.

So your limitations are not because of the 32-bit Linux.

Much luck,


Oh, sorry - I meant it’s the answer to your question of the maximum upload size, not the solution to the problems I’m facing :slightly_smiling_face:

Thanks, ernolf. I finally figured out how to edit the php.ini file, and was successful, but I am still having errors. Here’s the error when uploading a 2.5GB file:

[PHP] Error: file_put_contents(): content truncated from 2621440000 to 2147483647 bytes at /var/www/nextcloud/lib/private/Files/Storage/Local.php#313

MOVE /remote.php/dav/uploads/User/3188316710/.file
from by User at 2024-01-07T05:07:33+00:00

It is late here, so I hope to pick this up tomorrow. Thank you.

The chunks are written to /tmp, which is normaly mounted to tmpfs, so it is limited to your ram size.

You can find out if your /tmp file is mounted to tmpfs with this query:

mount | grep '/tmp'

You can define a dedicated tmp folder for nextcloud and php, which is not limited by your ram space:

  • first create the tmp dir

    mkdir /tmp_nc
    chown www-data.www-data /tmp_nc
  • add to config.php

      'tempdirectory' => '/tmp_nc',
  • add to (or edit) php.ini

    upload_tmp_dir = "/tmp_nc"

What php.ini file (path) did you edit exactly?

Meanwhile you are only writing about upload (the title of this theme is about download), so the file is not yet stored on your Pi?

My first question would be, did you restart the services?

  • sudo systemctl restart apache2 php8.0-fpm
    (as you can see, I’m assuming you’re using php-fpm, but I don’t know because you’re stingy with information)

Otherwise, given this error message, I might have to retract my previous statement about 32-bit limitations.
This could (very unlikely) be a 2GB limit as described here:
Since I’m not familiar with the architecture of the CPU and kernel used in your Pi, I can’t say anything definitive or rule it out. I can’t find anything online that indicates a 2GB limit in Raspbery Pi either. More like a 3GB limit.

The echoes from following queries could deliver more insights:

grep pae /proc/cpuinfo
cat /proc/cmdline
grep HIGHMEM /usr/src/*/.config

But after all, it could also be something completely different, something that I didn’t take into account. As you can see, I’m not a Pi, nor an Armbian expert, perhaps someone who is more familiar with Pi problems can provide more detailed help.

Much luck,

1 Like

Hi, ernolf, and thank you for your help and for following up. I have a pretty busy day today, but will answer your questions as I get the time. I don’t mean to withhold information, but I’m rather new to most of this, and it’s a bit overwhelming.

The file I edited is /etc/php/8.0/fpm/php.ini
The memory limit is set to -1
post_max_size is set to 16G
upload_max_filesize also set to 16G

mount | grep ‘/tmp’
returns: tmpfs on /tmp type tmpfs (rw,nosuid,relatime)

I was not aware that restarting the services was required (I’m a noob), but I have done so now, and also restarted the server itself. No improvement.

I included the uploads because they generated log entries that showed up when filtering for errors. I don’t see errors logged when downloading, but instead the files themselves are ruined. I just tried downloading two files that had been uploaded several months ago, before I began updating NextcloudPi (which is when the problems began). One was 2.5GB, the other 2.8GB. Both files stopped at the exact same filesize: 2,097,152KB, as shown in Windows file manager.

Thank you for your help!

I don’t think we’re talking about the same component of my system. The “No space left on device” errors I’m getting always refer to a directory that is part of the operating system, which is on the 32GB SD card, and I have seen them most often when trying to do updates.

The file sizes mentioned in the errors are very small, on the order of megabytes, not gigabytes, so my 2GB memory should have no part in the errors. They don’t refer to the SATA storage HDD on my system, or to the large files I’m trying to upload or download.

This means, that your /tmp directory is not located on that 32GB SD card but on tmpfs, which is in fact inside of your ram and therefore limited by the space of your ram.

The error “No space left on device” has always a reason and must be taken serious, always!


1 Like

OK, thank you, that makes sense.

What I mean, though, is that the “no space left” errors themselves don’t mention a /tmp directory, but what seems to be a directory on the SD card itself. For instance:

“1. [PHP] Error: fread(): Write of 4096 bytes failed with errno=28 No space left on device at /var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php#55”

Unless I’m just misunderstanding things.

You are correct in that the error is just mentioning where in the code it was encountered without giving the exact paths to which a write was being done, it could be that those parameters (the paths) are elsewhere in the stacktrace and it could be they are just not being logged.

OK, thanks. I guess I’ll try moving the tmp directory from RAM to physical storage as ernolf suggested. I have been hesitant because it wasn’t clear to me that this would solve the problems I’m having, and I don’t want to create a new problem in the process.

If I’m not mistaken you wrote before that you are running of an SD card in which case you will definitely be creating new problems since running /tmp/ on it will speed up its’ demise.

Hmmm, thanks, Keeper. That’s why I’ve been hesitant to make such changes, especially since everything worked fine before I started the series of updates a couple months ago. I’d much rather find out what broke the system, and fix that. I keep hoping someone may have a solution.

Those “no space left on device” errors don’t make any sense to me, since there’s plenty of space on the physical device, and the changes that generate them are from very small files, not very large ones. I am very much a noob at this, though.