nextcloud / nextcloud/nextcloudpi

nc-fix-permissions not working

Open
#1,747 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
2.9k
Forks
318
PR merge metrics
No merged PRs in 30d

Description

System information

NextcloudPi diagnostics

NextcloudPi version  v1.51.0
NextcloudPi image    NextcloudPi_03-17-23
OS                   Debian GNU/Linux 11. 5.15.84-v8+ (aarch64)
automount            yes
USB devices          sda
datadir              /media/myCloudDrive/ncdata/data
data in SD           no
data filesystem      btrfs
data disk usage      734M/7.3T
rootfs usage         2.8G/3.4G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    25.0.3.2
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
HPB service          up
Postfix service      up
Internet check       ok
Public IPv4          ***REMOVED SENSITIVE VALUE***
Public IPv6          ***REMOVED SENSITIVE VALUE***
Port 80              closed
Port 443             closed
IP                   ***REMOVED SENSITIVE VALUE***
Gateway              ***REMOVED SENSITIVE VALUE***
Interface            eth0
Certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
Uptime               2:50

Nextcloud configuration

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "7": "nextcloudpi",
            "5": "nextcloudpi.local",
            "8": "nextcloudpi.lan",
            "3": "nextcloudpi",
            "11": "178.17.116.16",
            "1": "192.168.0.200",
            "14": "nextcloudpi"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "25.0.3.2",
        "overwrite.cli.url": "https:\/\/nextcloudpi\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "tempdirectory": "\/media\/myCloudDrive\/ncdata\/data\/tmp",
        "mail_smtpmode": "sendmail",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "overwriteprotocol": "https",
        "maintenance": false,
        "logfile": "\/media\/myCloudDrive\/ncdata\/data\/nextcloud.log",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***"
    }
}

HTTPd logs

[Tue Mar 21 19:30:03.524024 2023] [authz_host:error] [pid 48151:tid 548299665792] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /img/favicon.png failed, reason: unable to get the remote host name
[Tue Mar 21 19:30:10.774679 2023] [authz_host:error] [pid 48151:tid 548257620352] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:30:20.862580 2023] [authz_host:error] [pid 48151:tid 548249211264] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:30:42.209795 2023] [authz_host:error] [pid 48151:tid 548240802176] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:30:42.209795 2023] [authz_host:error] [pid 48151:tid 548223984000] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:30:42.209799 2023] [authz_host:error] [pid 48151:tid 548232393088] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /img/green-circle.svg failed, reason: unable to get the remote host name, referer: https://192.168.0.13:4443/css/ncp.css
[Tue Mar 21 19:42:03.972406 2023] [authz_host:error] [pid 48151:tid 548257620352] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:42:19.826973 2023] [authz_host:error] [pid 48151:tid 548249211264] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:43:01.707031 2023] [authz_host:error] [pid 48151:tid 548173529472] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:46:31.749753 2023] [authz_host:error] [pid 48151:tid 548324876672] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:47:52.891772 2023] [authz_host:error] [pid 48151:tid 548299665792] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:50:47.721617 2023] [authz_host:error] [pid 48151:tid 548223984000] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:56:13.648596 2023] [authz_host:error] [pid 48151:tid 548333269376] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:56:17.659066 2023] [authz_host:error] [pid 48151:tid 548341662080] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 19:56:30.042709 2023] [authz_host:error] [pid 48151:tid 548299665792] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 20:00:32.138385 2023] [authz_host:error] [pid 48151:tid 548223984000] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 20:01:46.782217 2023] [authz_host:error] [pid 48151:tid 548190347648] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 20:04:34.978893 2023] [authz_host:error] [pid 48151:tid 548173529472] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 20:05:50.773573 2023] [authz_host:error] [pid 48151:tid 548181938560] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Tue Mar 21 20:08:49.390986 2023] [authz_host:error] [pid 48151:tid 548249211264] [remote 192.168.0.26:51848] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name

Database logs

tail: cannot open '/var/log/mysql/*.log' for reading: No such file or directory

Nextcloud logs

{"reqId":"leuCzzLcez5tKm4IxtYs","level":3,"time":"2023-03-17T17:55:03+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Not installed","userAgent":"--","version":"","exception":{"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":680,"function":"checkInstalled","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1144,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/cron.php","line":43,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/base.php","Line":284,"CustomMessage":"--"}}
{"reqId":"Fhe8RD5XgKP4MHu2XZjD","level":3,"time":"2023-03-17T18:00:04+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Not installed","userAgent":"--","version":"","exception":{"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":680,"function":"checkInstalled","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1144,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/cron.php","line":43,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/base.php","Line":284,"CustomMessage":"--"}}
{"reqId":"kgllbzsv6oB9oGhqyKuR","level":3,"time":"2023-03-17T18:05:13+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Not installed","userAgent":"--","version":"","exception":{"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":680,"function":"checkInstalled","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1144,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/cron.php","line":43,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/base.php","Line":284,"CustomMessage":"--"}}
{"reqId":"SJ2EEv5ayHSyagiZfK8F","level":3,"time":"2023-03-17T18:10:02+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Not installed","userAgent":"--","version":"","exception":{"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":680,"function":"checkInstalled","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1144,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/cron.php","line":43,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/base.php","Line":284,"CustomMessage":"--"}}
{"reqId":"c8Rvncx92KhmkLRCSa3D","level":3,"time":"2023-03-17T18:13:10+00:00","remoteAddr":"","user":"ncp","app":"PHP","method":"","url":"--","message":"exif_read_data(): File not supported at /var/www/nextcloud/lib/private/Metadata/Provider/ExifProvider.php#59","userAgent":"--","version":"25.0.3.2","exception":{"Exception":"Error","Message":"exif_read_data(): File not supported at /var/www/nextcloud/lib/private/Metadata/Provider/ExifProvider.php#59","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Metadata/Provider/ExifProvider.php","line":59,"function":"exif_read_data"},{"file":"/var/www/nextcloud/lib/private/Metadata/MetadataManager.php","line":68,"function":"execute","class":"OC\\Metadata\\Provider\\ExifProvider","type":"->"},{"file":"/var/www/nextcloud/lib/private/Metadata/FileEventListener.php","line":101,"function":"generateMetadata","class":"OC\\Metadata\\MetadataManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php","line":87,"function":"handle","class":"OC\\Metadata\\FileEventListener","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":88,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":100,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Node/HookConnector.php","line":118,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Hook.php","line":106,"function":"postWrite","class":"OC\\Files\\Node\\HookConnector","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":641,"function":"emit","class":"OC_Hook","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":692,"function":"emit_file_hooks_post","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Node/File.php","line":71,"function":"file_put_contents","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":257,"function":"putContent","class":"OC\\Files\\Node\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":216,"function":"copyr","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/private/User/Session.php","line":553,"function":"copySkeleton","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/private/User/Session.php","line":403,"function":"prepareUserLogin","class":"OC\\User\\Session","type":"->"},{"file":"/var/www/nextcloud/lib/private/User/Session.php","line":616,"function":"completeLogin","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/User/Session.php","line":355,"function":"loginWithPassword","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Setup.php","line":433,"function":"login","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/core/Command/Maintenance/Install.php","line":105,"function":"install","class":"OC\\Setup","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OC\\Core\\Command\\Maintenance\\Install","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1009,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":273,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":149,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}
{"reqId":"KNARWR9Gi1ZQWhY1sIbD","level":2,"time":"2023-03-17T18:17:41+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /var/www/nextcloud/data/tmp is not present or writable","userAgent":"--","version":"25.0.3.2","data":[]}
{"reqId":"KNARWR9Gi1ZQWhY1sIbD","level":2,"time":"2023-03-17T18:17:41+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /var/www/nextcloud/data/tmp is not present or writable","userAgent":"--","version":"25.0.3.2","data":[]}
{"reqId":"Jpraj79tOcka7bjJeTo4","level":2,"time":"2023-03-17T18:17:43+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /var/www/nextcloud/data/tmp is not present or writable","userAgent":"--","version":"25.0.3.2","data":[]}
{"reqId":"Jpraj79tOcka7bjJeTo4","level":2,"time":"2023-03-17T18:17:43+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /var/www/nextcloud/data/tmp is not present or writable","userAgent":"--","version":"25.0.3.2","data":[]}
{"reqId":"JmdVi9XNQZZfMnwaFTUY","level":2,"time":"2023-03-21T16:55:01+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /opt/ncdata/data/tmp is not present or writable","userAgent":"--","version":"25.0.3.2","data":[]}
{"reqId":"QDL4Rd1I5EEaF4FhXv0c","level":2,"time":"2023-03-21T16:55:02+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /opt/ncdata/data/tmp is not present or writable","userAgent":"--","version":"25.0.3.2","data":[]}
{"reqId":"ZamdIFzyPrzhwuc9h5Up","level":2,"time":"2023-03-21T16:55:04+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /opt/ncdata/data/tmp is not present or writable","userAgent":"--","version":"25.0.3.2","data":[]}

I was trying to transfer some files manually (via SCP, then fixing permissions, then scan) because I'm preparing to start moving some 8TB of data from assorted HDDs and using client would be just too slow.

Anyway, in process, I think I've hit some issues.

Running nc-fix-permissions.sh in any way (Web UI or SSH/CLI) I've noticed that - it does nothing. I've even created a folder on purpose with weird ownership and permissions, and even though script said it was fine - it wasn't. Stayed the same.

I've then tried looking into code and running get_nc_config_value datadirectory and I get error. But ok, I'm not much of a programmer so I may be missing something.
But looking at the previous commit, I ran cd /var/www/nextcloud; sudo -u www-data php occ config:system:get datadirectory and got the correct data dir path.

I've also noticed that command says "$DATADIR"/*/files so I've tried creating folder files and giving it weird permissions. After running the command via ncp-config still the same.

I've tried to fix permissions myself, giving the whole thing chown -R www-data:www-data and chmod -R u+rw manually via SSH, and sure enough that works.

chmod -R u+rw /media/myCloudDrive/ncdata/data
chown -R www-data:www-data /media/myCloudDrive/ncdata/data

But even after that I keep failing the scan, tried Web UI and SSH/CLI, ncp-config, manually, even stuff like this, but error is always the same:

ncc files:scan -n -v -p /media/myCloudDrive/ncdata/data/luxzg
Unknown user 1 media

Unsure if I'm doing the scan and transfer right, but I'm pretty sure something isn't working right with nc-fix-permissions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload does not identify a repository file, test, or reproducible failure beyond the nc-fix-permissions command and system diagnostics. Start by locating the nc-fix-permissions implementation and reproducing the problem on the reported Debian 11, Btrfs-based setup; clarify the expected permissions and define done with a reproducible test or verification procedure.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.