Unable to add profile picture

Nextcloud version (eg, 18.0.2): 19.0.4
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.0.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.25
PHP version (eg, 7.1): 7.3

The issue you are facing:
Fresh install of NC 19. I am unable to add a profile picture. See log below. Furthermore, I am getting an error on the Overview page which is strange. It reads like this:

You access your instance via a secure connection, but your instance generates insecure URLs. This most likely means that you are behind a reverse proxy and the configuration variables for overwriting are not set correctly. Please read the documentation.

However, my instance runs only on localhost. This puzzles me.

The output of your Nextcloud log in Admin > Logging:

[PHP] Error: Error: file_put_contents(/mnt/sda1/nextcloud/nc_data/appdata_ocu3klcbsqe5/avatar/user/avatar.jpg): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#276 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError(2, "file_put_conten ... y", "/var/www/nextcl ... p", 276, {path: "appdata_ ... l})
 1. /var/www/nextcloud/lib/private/Files/Storage/Local.php line 276
    file_put_contents("/mnt/sda1/nextc ... g", null)
 2. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 257
    OC\Files\Storage\Local->file_put_contents("appdata_ocu3klc ... g", null)
 3. /var/www/nextcloud/lib/private/Files/View.php line 1159
    OC\Files\Storage\Wrapper\Wrapper->file_put_contents("appdata_ocu3klc ... g", null)
 4. /var/www/nextcloud/lib/private/Files/View.php line 696
    OC\Files\View->basicOperation("file_put_contents", "/appdata_ocu3kl ... g", ["create","write"], null)
 5. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 187
    OC\Files\View->file_put_contents("/appdata_ocu3kl ... g", null)
 6. /var/www/nextcloud/lib/private/Files/SimpleFS/NewSimpleFile.php line 133
    OC\Files\Node\Folder->newFile("avatar.jpg", null)
 7. /var/www/nextcloud/lib/private/Avatar/UserAvatar.php line 109
    OC\Files\SimpleFS\NewSimpleFile->putContent(null)
 8. /var/www/nextcloud/core/Controller/AvatarController.php line 334
    OC\Avatar\UserAvatar->set(null)
 9. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 170
    OC\Core\Controller\AvatarController->postCroppedAvatar({x: "302.08",y:  ... "})
10. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 100
    OC\AppFramework\Http\Dispatcher->executeController(OC\Core\Controller\AvatarController {}, "postCroppedAvatar")
11. /var/www/nextcloud/lib/private/AppFramework/App.php line 137
    OC\AppFramework\Http\Dispatcher->dispatch(OC\Core\Controller\AvatarController {}, "postCroppedAvatar")
12. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OC\\Core\\Controller\\AvatarController", "postCroppedAvatar", OC\AppFramework\ ... {}, {_route: "core.avatar.postCroppedAvatar"})
13. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({_route: "core.avatar.postCroppedAvatar"})
14. /var/www/nextcloud/lib/private/Route/Router.php line 297
    call_user_func(OC\AppFramework\ ... {}, {_route: "core.avatar.postCroppedAvatar"})
15. /var/www/nextcloud/lib/base.php line 1011
    OC\Route\Router->match("/avatar/cropped")
16. /var/www/nextcloud/index.php line 37
    OC::handleRequest()

POST /index.php/avatar/cropped
from IP by user at 2020-10-15T18:20:30+00:00

You access your instance via a secure connection, but your instance generates insecure URLs. This most likely means that you are behind a reverse proxy and the configuration variables for overwriting are not set correctly. Please read the documentation.

However, my instance runs only on localhost. This puzzles me.

  • What does this mean IN DETAIL?
  • How does the url look like which you’re entering in your web browser to access Nextcloud?
  • How have you set the overwrite parameters in your config.php file?

My instance runs on local ip:80. Config.php:

{
"system": {
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "IP"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "19.0.4.2",
    "overwrite.cli.url": "http:\/\/IP",
    "htaccess.RewriteBase": "\/",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "memcache.local": "\\OC\\Memcache\\APCu",
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": 0,
        "timeout": 0
    },
    "maintenance": false,
    "loglevel": 2
},
"apps": {
    "accessibility": {
        "enabled": "yes",
        "installed_version": "1.5.0",
        "types": ""
    },
    "activity": {
        "enabled": "yes",
        "installed_version": "2.12.1",
        "types": "filesystem"
    },
    "backgroundjob": {
        "lastjob": "39"
    },
    "bruteforcesettings": {
        "enabled": "yes",
        "installed_version": "2.0.1",
        "types": ""
    },
    "cloud_federation_api": {
        "enabled": "yes",
        "installed_version": "1.2.0",
        "types": "filesystem"
    },
    "comments": {
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": "logging"
    },
    "contactsinteraction": {
        "enabled": "yes",
        "installed_version": "1.0.0",
        "types": "dav"
    },
    "core": {
        "backgroundjobs_mode": "cron",
        "enterpriseLogoChecked": "yes",
        "installed.bundles": "[\"CoreBundle\"]",
        "installedat": "1601928783.4782",
        "lastcron": "1602965102",
        "lastupdateResult": "[]",
        "lastupdatedat": "1602953274",
        "oc.integritycheck.checker": "[]",
        "public_files": "files_sharing\/public.php",
        "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php",
        "theming.variables": "b92d206521717ac032f8aa58d3c7ff2f",
        "updater.secret.created": "1602777487",
        "vendor": "nextcloud"
    },
    "dav": {
        "buildCalendarReminderIndex": "yes",
        "buildCalendarSearchIndex": "yes",
        "chunks_migrated": "1",
        "enabled": "yes",
        "installed_version": "1.15.0",
        "regeneratedBirthdayCalendarsForYearFix": "yes",
        "types": "filesystem"
    },
    "federatedfilesharing": {
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": ""
    },
    "federation": {
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": "authentication"
    },
    "files": {
        "cronjob_scan_files": "500",
        "enabled": "yes",
        "installed_version": "1.14.0",
        "types": "filesystem"
    },
    "files_pdfviewer": {
        "enabled": "yes",
        "installed_version": "1.8.0",
        "types": ""
    },
    "files_rightclick": {
        "enabled": "yes",
        "installed_version": "0.16.0",
        "types": ""
    },
    "files_sharing": {
        "enabled": "yes",
        "installed_version": "1.11.0",
        "types": "filesystem"
    },
    "files_trashbin": {
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": "filesystem,dav"
    },
    "files_versions": {
        "enabled": "yes",
        "installed_version": "1.12.0",
        "types": "filesystem,dav"
    },
    "files_videoplayer": {
        "enabled": "yes",
        "installed_version": "1.8.0",
        "types": ""
    },
    "firstrunwizard": {
        "enabled": "yes",
        "installed_version": "2.8.0",
        "types": "logging"
    },
    "logreader": {
        "enabled": "yes",
        "installed_version": "2.4.0",
        "levels": "00011",
        "types": ""
    },
    "lookup_server_connector": {
        "enabled": "yes",
        "installed_version": "1.7.0",
        "types": "authentication"
    },
    "nextcloud_announcements": {
        "enabled": "yes",
        "installed_version": "1.8.0",
        "pub_date": "Thu, 24 Oct 2019 00:00:00 +0200",
        "types": "logging"
    },
    "notifications": {
        "enabled": "yes",
        "installed_version": "2.7.0",
        "types": "logging"
    },
    "oauth2": {
        "enabled": "yes",
        "installed_version": "1.7.0",
        "types": "authentication"
    },
    "password_policy": {
        "enabled": "yes",
        "installed_version": "1.9.1",
        "types": "authentication"
    },
    "photos": {
        "enabled": "yes",
        "installed_version": "1.1.0",
        "types": ""
    },
    "privacy": {
        "enabled": "yes",
        "installed_version": "1.3.0",
        "types": ""
    },
    "provisioning_api": {
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": "prevent_group_restriction"
    },
    "recommendations": {
        "enabled": "yes",
        "installed_version": "0.7.0",
        "types": ""
    },
    "serverinfo": {
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": ""
    },
    "settings": {
        "enabled": "yes",
        "installed_version": "1.1.0",
        "types": ""
    },
    "sharebymail": {
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": "filesystem"
    },
    "support": {
        "SwitchUpdaterServerHasRun": "yes",
        "enabled": "yes",
        "installed_version": "1.2.1",
        "types": "session"
    },
    "survey_client": {
        "enabled": "yes",
        "installed_version": "1.7.0",
        "types": ""
    },
    "systemtags": {
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": "logging"
    },
    "text": {
        "enabled": "yes",
        "installed_version": "3.0.1",
        "types": "dav"
    },
    "theming": {
        "enabled": "yes",
        "installed_version": "1.10.0",
        "types": "logging"
    },
    "twofactor_backupcodes": {
        "enabled": "yes",
        "installed_version": "1.8.0",
        "types": ""
    },
    "updatenotification": {
        "core": "18.0.10.2",
        "enabled": "yes",
        "installed_version": "1.9.0",
        "types": "",
        "update_check_errors": "0"
    },
    "viewer": {
        "enabled": "yes",
        "installed_version": "1.3.0",
        "types": ""
    },
    "workflowengine": {
        "enabled": "yes",
        "installed_version": "2.1.0",
        "types": "filesystem"
    }
}
}
  • What does this mean IN DETAIL?
  • How does the url look like which you’re entering in your web browser to access Nextcloud?

What about the answers on the first and second question?

The url I enter is the IP assigned to my server in the local network. I set the overwrite parameters like this in the config.php:

"overwrite.cli.url": "http://IP",
    "htaccess.RewriteBase": "/",

I think this is the problem here. I also did update the .htaccess file accordingly like shown in the administration manual.

An url cannot be an ip address, because it always consists of a protocol + a ip or fqdn + addtional resource information. Therefore, if you’re ask what url you’re using to access the server the answer can never be “the ip address” :wink:

A correct answer could e.g. be similar to this:

Ah sorry. Of course I meant http://IP

Fixed the profile picture issue. Just added a folder /username/avatar inside the appdata folder of the datadirectory. Works like a charm.

1 Like