NC20 Installation faulty on Manjaro ARM

After I’ve had problems installing NC19, I’ve decided to wait until NC20 for another go at it :slight_smile:

Sadly, roughly the same errors are happening.
Could not find resource js/setup.js to load is logged to nextcloud.log when the setup page is shown.
The setup page looks really meh.

Nginx config is practically identical to the docs.
Only port, hostname, and SSL file paths have been changed.

These are notable entries in config.php:

'datadirectory' => '/mnt/nextcloud/data',
'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/mnt/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
  ),

This time around, I’ve documented the entire installation.

  pacman -S php-fpm

  sed -i 's/^;env\[PATH\]/env[PATH]/' /etc/php/php-fpm.d/www.conf
  sed -i 's/^;env\[TMP\]/env[TMP]/' /etc/php/php-fpm.d/www.conf

  systemctl enable --now php-fpm.service

  pacman -S nginx
  systemctl enable --now nginx
  # copy config

  pacman -S certbot

  certbot certonly \
    --standalone -m moomoomoo@grrr.de --agree-tos --non-interactive --expand \
    --keep-until-expiring \
    --deploy-hook "systemctl reload nginx" \
    --cert-name nextcloud -d redacted

  mkdir -p "$MOUNT"
  sed -i '/^LABEL=nextcloud/d' /etc/fstab
  cat >>/etc/fstab <<-EOF
    LABEL=nextcloud   $MOUNT   ext4    defaults        0       0
EOF
  mount -a

  local pgroot="$MOUNT/pgroot"
  pacman -S postgresql php-pgsql
  EDITOR=tee systemctl edit postgresql.service <<-EOF
  [Service]
  Environment=PGROOT=$pgroot
EOF

  mkdir "$pgroot"
  chown postgres:postgres "$pgroot"

  local rootpw="$(cat /tmp/pgpass)"

  su - postgres -c "initdb --locale en_US.UTF-8 -D '$pgroot/data'"

  systemctl enable --now postgresql

  su - postgres <<-EOF
    echo "create user nextcloud password '$rootpw';" | psql
    createdb -O nextcloud nextcloud
EOF

  systemctl enable --now postgresql

  if ! grep -q 'opcache.enable=1' /etc/php/php.ini
    cat >>/etc/php/php.ini <<EOF
opcache.enable=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
EOF
  fi

  for n in zend_extension=opcache extension=intl extension=gd extension=pgsql extension=pdo_pgsql
  do
    sed -i 's/^;'"$n"'/'"$n"'/' /etc/php/php.ini
  done

  cat > /etc/pacman.d/hooks/nextcloud.hook <<EOF
[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = nextcloud
Target = nextcloud-app-*

[Action]
Description = Update Nextcloud installation
When = PostTransaction
Exec = /usr/bin/runuser -u http -- /usr/bin/php /usr/share/webapps/nextcloud/occ upgrade
EOF

  pacman -S nextcloud php-intl

  EDITOR=tee systemctl edit php-fpm.service <<EOF
[Service]
ReadWritePaths = /etc/webapps/nextcloud/config

ReadWritePaths = $MOUNT/apps
ReadWritePaths = $MOUNT/data
EOF

  #pacman -S binutils fakeroot yay
  yay -S nextcloud-systemd-timers
  systemctl enable --now nextcloud-cron.timer

# copy config
chown http:http /etc/webapps/nextcloud/config/config.php

Anyone got an idea?

the value of script in JSResourceLocator.php:doFind is js/setup.
app_path and app_url are both false when it reaches line 95 and the message from jsresourceloader is printed.

I installed docker on the RockPro64 and used the nextcloud:fpm image.

docker run -d -v /mnt/nextcloud/root:/var/www/html \
   -p 127.0.0.1:9000:9000 \
   -p [::1]:9000:9000 \
  nextcloud:fpm

Now the setup page looks better.
But I’m still getting the setup.js error.

Additionally, the database connection doesn’t work. Well, it does - just not from nextcloud.
To enable access to PG, nginx listens on docker0 with a stream forwarder.
I’ve installed psql inside the container and psql -h rockpro64 -d nextcloud -U nextcloud works. Nextcloud prints this:

Failed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] server closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.

Next up is using the nginx docker as well and putting a second nginx in front just for SSL-termination. I wanted to avoid that because it seems there is some kind of magic going on with nextcloud detecting the hostname and stuff like that.

fresh run. this time around, using the apache image [1] and a tiny nginx config [2].
still getting the setup.js error and others [3].
the database error is likely to be of my owm making. again, psql -h rockpro64 -U nextcloud -d nextcloud succeeds from inside the container.

[1]

docker run -d -v /mnt/nextcloud/root:/var/www/html \
   -p 127.0.0.1:8123:80 \
   -p [::1]:8123:80 \
  nextcloud

[2]

worker_processes 2;

events {
    worker_connections 12;
}

http {
    upstream nc {
        server localhost:8123;
    }

    server {
        listen 1212      ssl http2;
        listen [::]:1212 ssl http2;
        listen 12;
        listen [::]:12;
        server_name cloud.upsii.de;

        ssl_certificate     /etc/letsencrypt/live/nextcloud/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/nextcloud/privkey.pem;

        client_max_body_size 512M;

       location / {
           proxy_pass http://nc;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;

           add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
        }
    }
}

stream {
    upstream pg {
        server localhost:5432;
    }

    server {
        listen 172.17.0.1:5434;
        proxy_pass pg;
    }
}

[3]

{"reqId":"BXZ7mNUopWVxCrbESg1d","level":3,"time":"2020-11-06T10:02:01+00:00","remoteAddr":"84.118.3.241","user":"--","app":"jsresourceloader","method":"GET","url":"/","message":"Could not find resource js/setup.js to load","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":""}
{"reqId":"2BVP7wdDlP6mlOVPNtMV","level":2,"time":"2020-11-06T10:03:08+00:00","remoteAddr":"84.118.3.241","user":"--","app":"no app in context","method":"POST","url":"/index.php","message":"Could not detect any host in http:///data/htaccesstest.txt","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":""}
{"reqId":"2BVP7wdDlP6mlOVPNtMV","level":2,"time":"2020-11-06T10:03:08+00:00","remoteAddr":"84.118.3.241","user":"--","app":"no app in context","method":"POST","url":"/index.php","message":"Could not detect any host in https:///data/htaccesstest.txt","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":""}
{"reqId":"2BVP7wdDlP6mlOVPNtMV","level":3,"time":"2020-11-06T10:03:08+00:00","remoteAddr":"84.118.3.241","user":"--","app":"no app in context","method":"POST","url":"/index.php","message":{"Exception":"Doctrine\\DBAL\\DBALException","Message":"Failed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host \"rockpro64\" (192.168.0.46) and accepting\n\tTCP/IP connections on port 5432?","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":428,"function":"connect","class":"OC\\DB\\Connection","type":"->","args":[]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":388,"function":"getDatabasePlatformVersion","class":"Doctrine\\DBAL\\Connection","type":"->","args":[]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":330,"function":"detectDatabasePlatform","class":"Doctrine\\DBAL\\Connection","type":"->","args":[]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":119,"function":"getDatabasePlatform","class":"Doctrine\\DBAL\\Connection","type":"->","args":[]},{"file":"/var/www/html/lib/private/Setup/PostgreSQL.php","line":54,"function":"expr","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/Setup.php","line":359,"function":"setupDatabase","class":"OC\\Setup\\PostgreSQL","type":"->","args":["admin"]},{"file":"/var/www/html/core/Controller/SetupController.php","line":75,"function":"install","class":"OC\\Setup","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/base.php","line":947,"function":"run","class":"OC\\Core\\Controller\\SetupController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/DB/Connection.php","Line":67,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":"20.0.1.1"}
{"reqId":"2BVP7wdDlP6mlOVPNtMV","level":2,"time":"2020-11-06T10:03:08+00:00","remoteAddr":"84.118.3.241","user":"--","app":"no app in context","method":"POST","url":"/index.php","message":"Error trying to connect as \"postgres\", assuming database is setup and tables need to be created","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":"20.0.1.1"}
{"reqId":"2BVP7wdDlP6mlOVPNtMV","level":3,"time":"2020-11-06T10:03:08+00:00","remoteAddr":"84.118.3.241","user":"--","app":"no app in context","method":"POST","url":"/index.php","message":{"Exception":"Doctrine\\DBAL\\DBALException","Message":"Failed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host \"rockpro64\" (192.168.0.46) and accepting\n\tTCP/IP connections on port 5432?","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Setup/PostgreSQL.php","line":98,"function":"connect","class":"OC\\DB\\Connection","type":"->","args":[]},{"file":"/var/www/html/lib/private/Setup.php","line":359,"function":"setupDatabase","class":"OC\\Setup\\PostgreSQL","type":"->","args":["admin"]},{"file":"/var/www/html/core/Controller/SetupController.php","line":75,"function":"install","class":"OC\\Setup","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/base.php","line":947,"function":"run","class":"OC\\Core\\Controller\\SetupController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/DB/Connection.php","Line":67,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":"20.0.1.1"}
{"reqId":"2BVP7wdDlP6mlOVPNtMV","level":3,"time":"2020-11-06T10:03:08+00:00","remoteAddr":"84.118.3.241","user":"--","app":"jsresourceloader","method":"POST","url":"/index.php","message":"Could not find resource js/setup.js to load","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":"20.0.1.1"}
{"reqId":"LokdJA3K23cfsF2AFqMz","level":3,"time":"2020-11-06T10:03:23+00:00","remoteAddr":"84.118.3.241","user":"--","app":"index","method":"POST","url":"/index.php","message":{"Exception":"OC\\DatabaseException","Message":"An exception occurred while executing 'SHOW SERVER_VERSION':\n\nFailed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host \"rockpro64\" (192.168.0.46) and accepting\n\tTCP/IP connections on port 5432?","Code":0,"Trace":[{"file":"/var/www/html/lib/private/legacy/OC_DB.php","line":139,"function":"prepare","class":"OC_DB","type":"::","args":["SHOW SERVER_VERSION",null,null]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":984,"function":"executeAudited","class":"OC_DB","type":"::","args":[{"sql":"SHOW SERVER_VERSION","limit":null,"offset":null}]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":964,"function":"checkDatabaseVersion","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":661,"function":"checkServer","class":"OC_Util","type":"::","args":[{"__class__":"OC\\SystemConfig"}]},{"file":"/var/www/html/lib/base.php","line":1092,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/legacy/OC_DB.php","Line":73,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":"20.0.1.1"}
{"reqId":"bGLlE4mE1HNGtMJtMZvU","level":3,"time":"2020-11-06T10:03:25+00:00","remoteAddr":"84.118.3.241","user":"--","app":"index","method":"POST","url":"/index.php","message":{"Exception":"OC\\DatabaseException","Message":"An exception occurred while executing 'SHOW SERVER_VERSION':\n\nFailed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host \"rockpro64\" (192.168.0.46) and accepting\n\tTCP/IP connections on port 5432?","Code":0,"Trace":[{"file":"/var/www/html/lib/private/legacy/OC_DB.php","line":139,"function":"prepare","class":"OC_DB","type":"::","args":["SHOW SERVER_VERSION",null,null]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":984,"function":"executeAudited","class":"OC_DB","type":"::","args":[{"sql":"SHOW SERVER_VERSION","limit":null,"offset":null}]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":964,"function":"checkDatabaseVersion","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":661,"function":"checkServer","class":"OC_Util","type":"::","args":[{"__class__":"OC\\SystemConfig"}]},{"file":"/var/www/html/lib/base.php","line":1092,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/legacy/OC_DB.php","Line":73,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":"20.0.1.1"}
{"reqId":"C1PFxrVyE6tHiGnHicMY","level":3,"time":"2020-11-06T10:03:26+00:00","remoteAddr":"84.118.3.241","user":"--","app":"index","method":"POST","url":"/index.php","message":{"Exception":"OC\\DatabaseException","Message":"An exception occurred while executing 'SHOW SERVER_VERSION':\n\nFailed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host \"rockpro64\" (192.168.0.46) and accepting\n\tTCP/IP connections on port 5432?","Code":0,"Trace":[{"file":"/var/www/html/lib/private/legacy/OC_DB.php","line":139,"function":"prepare","class":"OC_DB","type":"::","args":["SHOW SERVER_VERSION",null,null]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":984,"function":"executeAudited","class":"OC_DB","type":"::","args":[{"sql":"SHOW SERVER_VERSION","limit":null,"offset":null}]},{"file":"/var/www/html/lib/private/legacy/OC_Util.php","line":964,"function":"checkDatabaseVersion","class":"OC_Util","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":661,"function":"checkServer","class":"OC_Util","type":"::","args":[{"__class__":"OC\\SystemConfig"}]},{"file":"/var/www/html/lib/base.php","line":1092,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/index.php","line":35,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/legacy/OC_DB.php","Line":73,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36","version":"20.0.1.1"}
1 Like

I got rid of one hop between nextcloud and postgres.
Now, this is the error:

{
  "reqId": "0mcfa8tESk997Rw9qG6R",
  "level": 3,
  "time": "2020-11-06T10:21:28+00:00",
  "remoteAddr": "84.118.3.241",
  "user": "--",
  "app": "PHP",
  "method": "POST",
  "url": "/index.php",
  "message": {
    "Exception": "Error",
    "Message": "Undefined index: dbtype at /var/www/html/lib/private/Setup.php#287",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/Setup.php",
        "line": 287,
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          8,
          "Undefined index: dbtype",
          "/var/www/html/lib/private/Setup.php",
          287,
          {
            "options": "*** sensitive parameter replaced ***",
            "l": {
              "__class__": "OC\\L10N\\LazyL10N"
            },
            "error": [

            ]
          }
        ]
      },
      {
        "file": "/var/www/html/core/Controller/SetupController.php",
        "line": 75,
        "function": "install",
        "class": "OC\\Setup",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 947,
        "function": "run",
        "class": "OC\\Core\\Controller\\SetupController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": [

        ]
      }
    ],
    "File": "/var/www/html/lib/private/Log/ErrorHandler.php",
    "Line": 91,
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.1 Chrome/80.0.3987.163 Safari/537.36",
  "version": ""
}
1 Like

and now i got it to work.
with the apache container.
turned out, the worker_processes (4) and the worker_connections (256) had to be increased.

It is now working reliably.
Setup page still looked broken but after that everything looked fine.
It won’t work with postsgres selected in the setup so I select sqlite and run the conversion immediately afterwards (via).

Tested the procedure twice and I am getting the setup.js error even if it’s successful.

2 Likes

This workaround also solved it for me - after trying to run the https://github.com/spantaleev/nextcloud-docker-ansible-deploy/ playbook with nextcloud 20.0.0 docker image I got a similar error message with setup.js and an additional “Warning: Could not detect any host in https:///data/htaccesstest.txt”…
After installing SQLite first converting it worked so I could manually convert to postgres, although it did not work out as smoothly as thought with the official occ way ( I had to manually reset the password of the postgres nextcloud user, then run the conversion for it to finally work…)

1 Like