Closed bbx-github closed 4 months ago
Maybe add Label 29-feedback
as well?
Hello, same for me after update to nc 29. message: Returned value: /volume1/Nextcloud/Nextcloud-temp. Any solution?
That value is coming from PHP's sys_get_temp_dir()
which doesn't use the PHP INI parameter upload_tmp_dir
, but the sys_temp_dir
parameter.
The open_basedir
restriction is preventing the configured PHP INI sys_temp_dir
(/tmp
in this csae) from being useful to Nextcloud.
There may be some room here to adjust this check a bit though it seems like. It's currently only checking sys_get_temp_dir()
, but our real temporary folder selector is much smarter than the setup check:
We only use the return value of sys_get_temp_dir()
(aka: the value of the sys_temp_dir
PHP INI setting) as a last resort in practice.
EDIT: Even if the setup check gets adjusted, it would probably be a good idea to make sure your PHP environments sys_temp_dir
is pointed somewhere that can actually be accessed. It should make the error go away.
@joshtrichards Thanks a lot!
Setting sys_temp_dir
fixed it for me.
But to me it is really strange that this change was introduced from 28.0.4 -> 28.0.5 and broke my setup.
@joshtrichards Thanks a lot!
Setting
sys_temp_dir
fixed it for me.
Great, but I've no idea what to do exactly! Could you please provid me with more details? Which file? Which entry do I have to change or to add? I'm not realy experienced!
@joshtrichards Thanks a lot!
Setting
sys_temp_dir
fixed it for me. But to me it is really strange that this change was introduced from 28.0.4 -> 28.0.5 and broke my setup.
How did it "broke" your setup?
@joshtrichards Thanks a lot! Setting
sys_temp_dir
fixed it for me.Great, but I've no idea what to do exactly! Could you please provid me with more details? Which file? Which entry do I have to change or to add? I'm not realy experienced!
Me neither ...
After update to 28.0.5 having the same message: "Error while checking the available disk space of temporary PHP path or no free disk space returned. Temporary path: /tmp"
@joshtrichards please explain - thank you!
EDIT: Even if the setup check gets adjusted, it would probably be a good idea to make sure your PHP environments
sys_temp_dir
is pointed somewhere that can actually be accessed. It should make the error go away.
I have both parameters upload_tmp_dir
and sys_temp_dir
pointed to /tmp
This directory fully accessible for web-server and php (and other users and groups which need it) and i still have this error...
I have this issue with apache2 + nginx (php as apache mod_php) with NC 29, so the topic starter have this issue with php-fpm. It looks like a bug which appears on different systems.
Other apps and sites which uses this parameter and write data to tmp have no issues with it. ONLY Nextcloud have this issue.
Given the problem with setting up PHP access to system temp directory, I don't see why would not use upload_tmp_dir always?
EDIT: Even if the setup check gets adjusted, it would probably be a good idea to make sure your PHP environments
sys_temp_dir
is pointed somewhere that can actually be accessed. It should make the error go away.I have both parameters
upload_tmp_dir
andsys_temp_dir
pointed to /tmp This directory fully accessible for web-server and php (and other users and groups which need it) and i still have this error...I have this issue with apache2 + nginx (php as apache mod_php) with NC 29, so the topic starter have this issue with php-fpm. It looks like a bug which appears on different systems.
Other apps and sites which uses this parameter and write data to tmp have no issues with it. ONLY Nextcloud have this issue.
I have added to my php.ini: sys_temp_dir=/tmp upload_tmp_dir=/tmp
And I have added to Nextcloud's config.php: 'tempdirectory' => '/tmp',
Directory root/tmp has these rights: 775
PHP version: 8.2.19 Nextcloud version: 28.0.5
Still getting this: "Error while checking the available disk space of temporary PHP path or no free disk space returned. Temporary path: /tmp"
Even 777 for /tmp does not make a difference to the problem. In previous Nextcloud version there was no problem with /tmp (the Nextcloud files are still stored there).
Please fix asap - thank you!
Greetings, Gerald
In the meantime my webhoster informed me about following: Nextcloud uses 'disk_free_space', which function is disabled by the webhoster for security reasons. This seems to cause the problem after the update to 28.0.5 now. Is this the same with you guys, who are also facing the "Error while checking the available disk space of temporary PHP path or no free disk space returned. Temporary path: ..."?
EDIT:
Seems, as if there is the lack of the check
if (function_exists('disk_free_space')) {
at some places now.
Hello, same for me after update to nc 29. message: Returned value: /volume1/Nextcloud/Nextcloud-temp. Any solution?
So, I found a realy easy solution for me: I just createt that missing folder and the message disappears! And what's funny: nothing is inside that folder !
Thanks for the note, @gersteba . According to https://www.php.net/manual/en/function.sys-get-temp-dir.php#115199 and https://www.php.net/manual/en/ini.list.php , sys_temp_dir is, indeed, an option, although undocumented.
Aaaandd… YES! Setting php_admin_value sys_temp_dir …
to a suitable value removes the alert in diagnostics.
In the meantime my webhoster informed me about following: Nextcloud uses 'disk_free_space', which function is disabled by the webhoster for security reasons.
Then move your project to a hoster that did not lost its sanity.
Then move your project to a hoster that did not lost its sanity.
Why do you say this?
Then move your project to a hoster that did not lost its sanity.
Why do you say this?
Because function by itself is not a threat, no matter what parameters you pass to it. It MAY be an information disclosure, IF you display its output to the user.
I understand, why I disable eval
(and I hope you do too), I can understand, why somebody want to disable phpinfo()
(although in a sufficiently secured installation, it couldn't be used for anything sensible), but disabling some random functions just because somebody could lay an eye on their output… it all seems rather random.
Aaaandd… YES! Setting
php_admin_value sys_temp_dir …
to a suitable value removes the alert in diagnostics.
Doesn't work
Then you did something wrong.
Then you did something wrong.
no, i didn't.
Besides, this prolem appears after NC upgrade, without changes of my server by me. So, it’s more logical to assume that the NC developers did something wrong in one of the updates.
With each new version there are more and more problems, because each new version requires more and more changes in the server infrastructure. It seems to me that development should not proceed this way. Changes of this kind must go through multiple stages of testing on various benches and systems. Don't show up unexpectedly and cause inconvenience.
Now it goes something like this:
- developers in the previous version: in this version the system requirements have changed - now your server should look like this...
- developers in the new version: in this version the system requirements have changed - now your server should look like this...
And the community be like this:
This solution works for me, so it should work for everyone. And if it doesn’t work for you, you’re doing something wrong. I don’t know what experience you have in administration, what system you have and what infrastructure components, but I’m sure that you’re doing it wrong, because everything works for me.
Please, let's look at the problem using an objective approach and find the correct and universal solution that will suit everyone.
Dude. Don't set it to /tmp. That's why it complains. Your FPM don't have access to /tmp.
php_admin_value sys_temp_dir "/where/is/your/nextcloud/upload_temp_dir"
intervisionlord is absolutely right. I got the same issue since NC 28 upwards on my test installation. My live installation is still on NC 27 and runs without any issues. NC development is heading the wrong way. They just bring in new issues with upgrades. This one is just one of them. I will never upgrade my live install until all the issues in the newer versions are resolved.
Your FPM don't have access to /tmp
Are you sure? I am asking because you make strange statements like access permissions and my web-server. Firstly, because i don't use php as Fast CGI FPM. i use php as mod-apache. secondly, i granted enough permissions to web-server user and group (as i said, other sites on this web-server can use /tmp without any issues) So, i am just curious, why are you making statements based on your guesses, which have nothing to do with the parameters of my server? "Dude"...
So, as I suggested earlier, let’s still take a more objective approach to finding a solution to the problem, and not accuse each other of incompetence based only on our guesses and assumptions about the configurations of each other’s servers. If your web server is configured in one way and a specific solution works for you, do not assume that everyone is configured the same way.
Again, that warning SPECIFICALLY happens, when your PHP process is unable to access sys_temp_dir (which is, by default, unless altered, is /tmp). To get around it, you have to, either,
When a process cannot access a directory, this is displayed in the web server logs if the PHP is correctly configured in the error reporting parameter
There is no need to confuse the web application message, (which can be displayed if the accessibility check method is incorrect (which is what is discussed in this thread) or because of errors in programming logic,) and the system message from the web server and its application components, such as PHP.
If I put my script near to the NC installation, which will try to gain access to the /tmp and show that everything is working correctly, will you stop trying to prove to me that the error is on my side and join in an objective and unbiased discussion, a constructive and joint search for the problem?
> cat temp_test.php
<?
$test_file = fopen("/tmp/test_file.txt", "w");
fwrite($test_file, "test message");
fclose($test_file);
?>
> /opt/php82/bin/php temp_test.php
>
> ls -la /tmp/test_file.txt
-rw-r--r-- 1 <web-user> <web-group> 12 июн 19 21:03 /tmp/test_file.txt
>
> cat /tmp/test_file.txt
test message
>
> /opt/php82/bin/php -v
PHP 8.2.0 (cli) (built: Jun 29 2020 09:25:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
with Zend OPcache v8.2.0, Copyright (c), by Zend Technologies
>
> pwd
/var/www/<username>/data/www/<NC-site-folder>
>
> whoami
<web-user>
>
> ls -la / | grep -i tmp
drwxrwxrwt 10 root root 20480 июн 19 21:12 tmp
>
php_admin_value sys_temp_dir "/where/is/your/nextcloud/upload_temp_dir"
You will probably be very surprised, but I also have this directory /tmp and (surprise surprise) there are no problems or errors with it, which once again proves that the problem is precisely in the incorrect determination of the directory’s availability specifically for temporary files on the part of the NC
How do you think why does NC have no problems in the case of upload_temp_dir, but in the case of sys_temp_dir there are?
PHP CLI app and PHP run by Apache webserver are TWO DIFFERENT APPS. With different process restrictions. Stop trying to prove in shell that a web app works fine.
PHP CLI app and PHP run by Apache webserver are TWO DIFFERENT APPS. With different process restrictions. Stop trying to prove in shell that a web app works fine.
Another surprise for you, maybe, but my CLI version and WEB version are the same.
ughhh... i am really tired to talk with you...
<?
echo sys_get_temp_dir();
$test_text = " testing tmp dir availability";
$file = "/tmp/test_file.txt";
file_put_contents($file, $test_text);
$test_file_content = file_get_contents("/tmp/test_file.txt");
echo $test_file_content;
?>
Think as you like, as I understand it, no one is going to solve the problem. Okay, whatever you want. I'm just tired of proving something to people who are sure that they know better than me how my server is configured and give advice based on their conjectures.
Same version does not mean same executable and same configuration.
If your /tmp is writable from your Nextcloud install, you should not see this warning.
If you still see it, that means an instance running your Nextcloud server have different configuration from what you use in your tests.
Most obvious suspicion would be open_basedir
restriction, which I consider a good idea, in general. I've had it set myself, and fixed the resulting warning with abovementioned tweak to relevant **host.conf
file.
The code for the setup check: https://github.com/nextcloud/server/blob/master/apps/settings/lib/SetupChecks/TempSpaceAvailable.php#L54
If you comment, please mention the exact error message to map it to the right code.
The check looks at our temp manager, which uses a couple of available paths and php's sys_get_temp_dir. Most likely because our temp manager is only used in Nextcloud and 3rdparty libraries usually use sys_get_temp_dir. Actually, our temp manager should only look at sys_get_temp_dir and ignore the other options. However dropping those will likely break someone else's setup out there. However the most correct approach because most php libraries will follow, is to rely on sys_get_temp_dir.
See https://github.com/php/php-src/blob/106581b1b6564971489e5b0ac80a760c6689fdd7/main/php_open_temporary_file.c#L235 to understand what php does internally.
I'd probably break somebody's cardboard castle, but no PHP program should rely on sys_get_temp_dir, if it does not runs in CLI. In a context of web request, it could be reasonable expected that the available directories are the only those directly related to the request. The code directory and the upload_tmp_dir. Nothing else.
Hi,
I've prepared a pull request for 29.0.4 (2024-07-1) changing the check a bit: https://github.com/nextcloud/server/pull/46190
@kesselb Thank you for the fix. Will there also be an update for NC28?
Also, just to be sure, users with this error message can use their NC just as normal, including updating?
users with this error message can use their NC just as normal
Yes, this is merely a warning that the configuration is probably suboptimal, but otherwise, by itself it does not stop you from using your instance.
Ok, thx for the info. However the message is cleary displayed as an error message in NC. It would be good, to change it to a warning then.
Thank you for changing the error message into a warning message in version 29.0.4: "The PHP function "disk_free_space" is disabled, which prevents the check for enough space in the temporary directories."
Maybe a more informative explanation, what probable disadvantage or actually harmlessness of that function being disabled has, might be useful for non-involved users. See i. e. AnrDaemon's comment above: "Yes, this is merely a warning that the configuration is probably suboptimal, but otherwise, by itself it does not stop you from using your instance."
⚠️ This issue respects the following points: ⚠️
Bug description
Error while checking the temporary PHP path - it was not properly set to a directory. Returned value: /tmp
The error seems to be plain wrong since php config was not changed.
Happens
in use:
Steps to reproduce
Expected behavior
Everything just works.
Installation method
Community Manual installation with Archive
Nextcloud Server version
28.0.5.1, 29.0.0
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
apache, nginx
Database engine version
MariaDB, postgresql
Is this bug present after an update or on a fresh install?
Both
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
The error disappears if
/tmp
is added toopen_basdir