Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: after upgrade NC to 23.0.2 app external storage support stops working #31510

Closed
5 of 8 tasks
michu-pl opened this issue Mar 10, 2022 · 10 comments · Fixed by #36905
Closed
5 of 8 tasks

[Bug]: after upgrade NC to 23.0.2 app external storage support stops working #31510

michu-pl opened this issue Mar 10, 2022 · 10 comments · Fixed by #36905
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug

Comments

@michu-pl
Copy link

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

After upgrade to 23.0.2 app external storage support (FTP) stops working and no folders / files are shown in the files panel.
Problem disappears after deactivating the application.

Steps to reproduce

  1. Upgrade NC to 23.0.2
  2. Log in to panel
  3. Go to Files

Expected behavior

Files and folders should be displayed.

Installation method

Manual installation

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "***REMOVED SENSITIVE VALUE***",
        "10.71.71.100"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "23.0.2.1",
    "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "htaccess.RewriteBase": "\/",
    "mail_smtpmode": "smtp",
    "mail_smtpsecure": "ssl",
    "mail_sendmailmode": "smtp",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpauthtype": "PLAIN",
    "mail_smtpauth": 1,
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "465",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "trashbin_retention_obligation": "auto, 30",
    "filelocking.enabled": "true",
    "memcache.local": "\\OC\\Memcache\\Redis",
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": 0,
        "dbindex": 0,
        "password": "***REMOVED SENSITIVE VALUE***",
        "timeout": 1.5
    },
    "log_type": "file",
    "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
    "loglevel": 1,
    "logtimezone": "Europe\/Warsaw",
    "theme": "",
    "default_phone_region": "PL",
    "enable_previews": true,
    "simpleSignUpLink.shown": false,
    "skeletondirectory": "",
    "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
    "allow_local_remote_servers": true,
    "maintenance": false,
    "versions_retention_obligation": "auto, 60",
    "lost_password_link": "disabled",
    "app_install_overwrite": [
        "issuetemplate"
    ]
}

List of activated Apps

- accessibility: 1.9.0
 - activity: 2.15.0
 - admin_audit: 1.13.0
 - bruteforcesettings: 2.3.0
 - circles: 23.0.1
 - cloud_federation_api: 1.6.0
 - comments: 1.13.0
 - contactsinteraction: 1.4.0
 - dashboard: 7.3.0
 - dav: 1.21.0
 - federatedfilesharing: 1.13.0
 - federation: 1.13.0
 - files: 1.18.0
 - files_antivirus: 3.2.2
 - files_external: 1.15.0
 - files_pdfviewer: 2.4.0
 - files_rightclick: 1.2.0
 - files_sharing: 1.15.0
 - files_trashbin: 1.13.0
 - files_versions: 1.16.0
 - files_videoplayer: 1.12.0
 - firstrunwizard: 2.12.0
 - issuetemplate: 0.7.0
 - logreader: 2.8.0
 - lookup_server_connector: 1.11.0
 - nextcloud_announcements: 1.12.0
 - notifications: 2.11.1
 - oauth2: 1.11.0
 - onlyoffice: 7.3.2
 - password_policy: 1.13.0
 - photos: 1.5.0
 - privacy: 1.7.0
 - provisioning_api: 1.13.0
 - recommendations: 1.2.0
 - serverinfo: 1.13.0
 - settings: 1.5.0
 - sharebymail: 1.13.0
 - survey_client: 1.11.0
 - systemtags: 1.13.0
 - text: 3.4.0
 - theming: 1.14.0
 - twofactor_backupcodes: 1.12.0
 - twofactor_totp: 6.2.0
 - updatenotification: 1.13.0
 - user_ldap: 1.13.1
 - user_status: 1.3.1
 - viewer: 1.7.0
 - weather_status: 1.3.0
 - workflowengine: 2.5.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"Ocx2qv93MhCkEsdkFCZe","level":3,"time":"2022-03-07T13:12:20+01:00","remoteAddr":"37.30.19.172","user":"admin","app":"index","method":"GET","url":"/apps/recommendations/api/recommendations","message":"Call to a member function getTimestamp() on bool in file '/var/www/nextcloud/httpdocs/apps/files_external/lib/Lib/Storage/FTP.php' line 358","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36","version":"23.0.2.1","exception":{"Exception":"Exception","Message":"Call to a member function getTimestamp() on bool in file '/var/www/nextcloud/httpdocs/apps/files_external/lib/Lib/Storage/FTP.php' line 358","Code":0,"Trace":[{"file":"/var/www/nextcloud/httpdocs/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/httpdocs/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/httpdocs/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/httpdocs/lib/private/AppFramework/Http/Dispatcher.php","Line":158,"Previous":{"Exception":"Error","Message":"Call to a member function getTimestamp() on bool","Code":0,"Trace":[{"file":"/var/www/nextcloud/httpdocs/lib/private/Files/Storage/Wrapper/PermissionsMask.php","line":157,"function":"getDirectoryContent","class":"OCA\\Files_External\\Lib\\Storage\\FTP","type":"->"},{"function":"getDirectoryContent","class":"OC\\Files\\Storage\\Wrapper\\PermissionsMask","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Files/Cache/Scanner.php","line":410,"function":"iterator_to_array"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Files/Cache/Scanner.php","line":390,"function":"handleChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Files/Cache/Scanner.php","line":342,"function":"scanChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Files/View.php","line":1349,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Files/View.php","line":1393,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Files/Node/Root.php","line":200,"function":"getFileInfo","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Files/Node/Node.php","line":286,"function":"get","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/var/www/nextcloud/httpdocs/apps/recommendations/lib/Service/RecentlyEditedFilesSource.php","line":57,"function":"getParent","class":"OC\\Files\\Node\\Node","type":"->"},{"function":"OCA\\Recommendations\\Service\\{closure}","class":"OCA\\Recommendations\\Service\\RecentlyEditedFilesSource","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/httpdocs/apps/recommendations/lib/Service/RecentlyEditedFilesSource.php","line":65,"function":"array_map"},{"file":"/var/www/nextcloud/httpdocs/apps/recommendations/lib/Service/RecommendationService.php","line":90,"function":"getMostRecentRecommendation","class":"OCA\\Recommendations\\Service\\RecentlyEditedFilesSource","type":"->"},{"function":"OCA\\Recommendations\\Service\\{closure}","class":"OCA\\Recommendations\\Service\\RecommendationService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/httpdocs/apps/recommendations/lib/Service/RecommendationService.php","line":91,"function":"array_reduce"},{"file":"/var/www/nextcloud/httpdocs/apps/recommendations/lib/Controller/RecommendationController.php","line":70,"function":"getRecommendations","class":"OCA\\Recommendations\\Service\\RecommendationService","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"index","class":"OCA\\Recommendations\\Controller\\RecommendationController","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/httpdocs/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/httpdocs/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/httpdocs/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/httpdocs/apps/files_external/lib/Lib/Storage/FTP.php","Line":358},"CustomMessage":"--"},"id":"6225f852167d2"}

Additional info

No response

@michu-pl michu-pl added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Mar 10, 2022
@karol-exe

This comment was marked as off-topic.

@endallas
Copy link

did the ftp use another port than 21?
My external ftp that is using another port does not work. But when i change the port to 21 it works..

@michu-pl
Copy link
Author

My ftp uses the standard port 21.

@solracsf
Copy link
Member

solracsf commented Apr 1, 2022

Can you try to modify the file:

/var/www/nextcloud/httpdocs/apps/files_external/lib/Lib/Storage/FTP.php

by replacing the line 358:

$data['mtime'] = \DateTime::createFromFormat('YmdGis', $file['modify'])->getTimestamp();

with these 2 lines:

$timestamp = \DateTime::createFromFormat('YmdGis', $file['modify']);
$data['mtime'] = $timestamp ? $timestamp->getTimestamp() : (int) strtotime('YmdGis', $file['modify']);

and see if it helps?

@solracsf solracsf added 2. developing Work in progress needs info and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Apr 1, 2022
@guijusto
Copy link

guijusto commented Jul 9, 2022

@solracsf your suggestion worked great, thank you. Is there a way to keep it working after upgrading NC? Or could you merge the modification?

@manurosado
Copy link

just like @michu-pl , I use a custom port, in the "Host" field I used to put "ip":"customPort" and it used to worked when I was running on NextCloud version 22.XX ,

I upgraded to 24, via a couple of updates

and now it errors on trying to the connection, but can't say which version was the breaking version

[PHP] Error: Error: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known at /var/www/redacted/apps/files_external/lib/Lib/Storage/FtpConnection.php#37 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError()
 1. /var/www/redacted/apps/files_external/lib/Lib/Storage/FtpConnection.php line 37
    ftp_connect()
 2. /var/www/redacted/apps/files_external/lib/Lib/Storage/FTP.php line 81
    OCA\Files_External\Lib\Storage\FtpConnection->__construct()
 3. /var/www/redacted/apps/files_external/lib/Lib/Storage/FTP.php line 189
    OCA\Files_External\Lib\Storage\FTP->getConnection()
 4. /var/www/redacted/apps/files_external/lib/MountConfig.php line 131
    OCA\Files_External\Lib\Storage\FTP->test()
 5. /var/www/redacted/apps/files_external/lib/Controller/StoragesController.php line 288
    OCA\Files_External\MountConfig::getBackendStatus("*** sensitive parameters replaced ***")
 6. /var/www/redacted/apps/files_external/lib/Controller/GlobalStoragesController.php line 201
    OCA\Files_External\Controller\StoragesController->updateStorageStatus("*** sensitive parameters replaced ***")
 7. /var/www/redacted/lib/private/AppFramework/Http/Dispatcher.php line 225
    OCA\Files_External\Controller\GlobalStoragesController->update("*** sensitive parameters replaced ***")
 8. /var/www/redacted/lib/private/AppFramework/Http/Dispatcher.php line 133
    OC\AppFramework\Http\Dispatcher->executeController()
 9. /var/www/nx.pinku.moe/lib/private/AppFramework/App.php line 172
    OC\AppFramework\Http\Dispatcher->dispatch()
10. /var/www/redacted/lib/private/Route/Router.php line 298
    OC\AppFramework\App::main()
11. /var/www/redacted/lib/base.php line 1023
    OC\Route\Router->match()
12. /var/www/redacted/index.php line 36
    OC::handleRequest()

PUT /index.php/apps/files_external/globalstorages/4

But if I change the "Host" port to "21" , it works fine and gets a connection, but it does not read the contents of the folder on the ftp server

is it possible that a new PHP version does not like to use custom ports for FTP?

at least on the nextcloud code I can see that they are using port variables

any help on this would be great

kesselb pushed a commit that referenced this issue Nov 13, 2022
kesselb pushed a commit that referenced this issue Nov 13, 2022
Context: #31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
kesselb pushed a commit that referenced this issue Nov 13, 2022
Context: #31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
kesselb pushed a commit that referenced this issue Nov 13, 2022
Context: #31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
kesselb pushed a commit that referenced this issue Nov 14, 2022
Context: #31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
kesselb pushed a commit that referenced this issue Nov 23, 2022
Context: #31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb
Copy link
Contributor

kesselb commented Dec 21, 2022

Hi, do you know which ftp server software is used?

kesselb pushed a commit that referenced this issue Dec 21, 2022
Context: #31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
kesselb pushed a commit that referenced this issue Dec 21, 2022
Context: #31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
kesselb pushed a commit that referenced this issue Dec 22, 2022
Context: #31510
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@szaimen
Copy link
Contributor

szaimen commented Jan 23, 2023

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

@szaimen szaimen added 0. Needs triage Pending check for reproducibility or if it fits our roadmap and removed 2. developing Work in progress labels Jan 23, 2023
@DanZirnhelt
Copy link

I actually have been running into this same issue. I recently installed 25.0.3 and I am not able to connect with FTP.
I have tried every form of host that I can think of with ftp:// without, doesn;t seem to matter.

Error pasted below. I have also made sure that FTP service is turned on (trueNas Scale). I also have been able to verify that I can connect to the external storage through FileZilla. THis all works fine, just cant seem to get it working in NextCloud.


Error: ftp_connect(): php_network_getaddresses: getaddrinfo for ftp://192.168.86.216:21 failed: Name or service not known at /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/FtpConnection.php#37
<<closure>>

OC\Log\ErrorHandler::onError()

/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/FtpConnection.php - line 37:

ftp_connect()

/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/FTP.php - line 81:

OCA\Files_External\Lib\Storage\FtpConnection->__construct()

/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/FTP.php - line 189:

OCA\Files_External\Lib\Storage\FTP->getConnection()

/var/www/html/nextcloud/apps/files_external/lib/MountConfig.php - line 131:

OCA\Files_External\Lib\Storage\FTP->test()

/var/www/html/nextcloud/apps/files_external/lib/Controller/StoragesController.php - line 288:

OCA\Files_External\MountConfig::getBackendStatus("*** sensiti ... *")

/var/www/html/nextcloud/apps/files_external/lib/Controller/GlobalStoragesController.php - line 201:

OCA\Files_External\Controller\StoragesController->updateStorageStatus("*** sensiti ... *")

/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 225:

OCA\Files_External\Controller\GlobalStoragesController->update("*** sensiti ... *")

/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 133:

OC\AppFramework\Http\Dispatcher->executeController()

/var/www/html/nextcloud/lib/private/AppFramework/App.php - line 172:

OC\AppFramework\Http\Dispatcher->dispatch()

/var/www/html/nextcloud/lib/private/Route/Router.php - line 298:

OC\AppFramework\App::main()

/var/www/html/nextcloud/lib/base.php - line 1047:

OC\Route\Router->match()

/var/www/html/nextcloud/index.php - line 36:

OC::handleRequest()

@virtuallysurreal
Copy link

virtuallysurreal commented Jul 9, 2023

Prepackaged VM from hanssonit.se just installed and upgraded to 25.0.8. Going through initial configuration experiences this issue.

I was finally trying to upgrade an old v11 instance that was having to use local insecure connections (on non-standard ports).

This is throwing a couple of different errors that I was finally able to at least get connected.

Found on another thread, I first added the port option to the php, so it could be entered on the settings page in the GUI: /var/www/nextcloud/apps/files_external/lib/Lib/Backend/FTP.php

			->addParameters([
				new DefinitionParameter('host', $l->t('Host')),
				(new DefinitionParameter('root', $l->t('Remote subfolder')))
					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
				(new DefinitionParameter('secure', $l->t('Secure ftps://')))
					->setType(DefinitionParameter::VALUE_BOOLEAN)
					->setDefaultValue(true),
			])

to

			->addParameters([
				new DefinitionParameter('host', $l->t('Host')),
                                (new DefinitionParameter('port', $l->t('Port')))
                                        ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
				(new DefinitionParameter('root', $l->t('Remote subfolder')))
					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
				(new DefinitionParameter('secure', $l->t('Secure ftps://')))
					->setType(DefinitionParameter::VALUE_BOOLEAN)
					->setDefaultValue(true),
			])

Then for another error having to do with IUser and saving Session Credentials, I had to disable several Apps to get rid of that: Activity, Versions, and I removed several others cleaning things up for the initial install and trying to get it to at least work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug
Projects
None yet
10 participants