FreeBSD An exception occurred while executing 'INSERT INTO "oc_calendars"

Good day
I have been fighting this for a couple of days now. I have tried the FreeBSD repositories for contact calendar and addressbook downloading directly and cli. Nextcloud postgreql php are run in the same jail.

uname -a
FreeBSD nextcloud.local 11.1-RELEASE-p8 FreeBSD 11.1-RELEASE-p8

pkg info nextcloud
nextcloud-13.0.1
Name           : nextcloud
Version        : 13.0.1
Installed on   : Wed Apr 18 11:00:59 2018 EDT
Origin         : www/nextcloud
Architecture   : FreeBSD:11:*
Prefix         : /usr/local
Categories     : www
Licenses       : AGPLv3
Maintainer     : brnrd@FreeBSD.org
WWW            : https://nextcloud.com
Comment        : Personal cloud which runs on your own server
Options        :
        EXIF           : on
        LDAP           : on
        MYSQL          : off
        OPCACHE        : on
        PGSQL          : on
        SMB            : on
        SQLITE         : off
        SSL            : on
Annotations    :
        cpe            : cpe:2.3:a:nextcloud:nextcloud:13.0.1:::::freebsd11:x64

# sudo -u www php occ dav:create-calendar admin calendar

  [Doctrine\DBAL\Exception\TableNotFoundException]
  An exception occurred while executing 'INSERT INTO "oc_calendars" ("principaluri", "uri", "synctoken", "transparent", "components", "displayname") VALUES(?, ?, ?
  , ?, ?, ?)' with params ["principals\/users\/admin", "calendar", 1, 0, "VEVENT,VTODO", "calendar"]:
  SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "oc_calendars" does not exist
  LINE 1: INSERT INTO "oc_calendars" ("principaluri", "uri", "synctoke...
                      ^
  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "oc_calendars" does not exist
  LINE 1: INSERT INTO "oc_calendars" ("principaluri", "uri", "synctoke...
                      ^
  [PDOException]
  SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "oc_calendars" does not exist
  LINE 1: INSERT INTO "oc_calendars" ("principaluri", "uri", "synctoke...
                      ^

dav:create-calendar

 pkg info postgresql10-server
postgresql10-server-10.3_1
Name           : postgresql10-server
Version        : 10.3_1
Installed on   : Wed Apr 18 10:49:53 2018 EDT
Origin         : databases/postgresql10-server
Architecture   : FreeBSD:11:amd64
Prefix         : /usr/local
Categories     : databases
Licenses       : PostgreSQL
Maintainer     : pgsql@FreeBSD.org
WWW            : http://www.postgresql.org/
Comment        : PostgreSQL is the most advanced open-source database available anywhere
Options        :
        DEBUG          : off
        DTRACE         : off
        GSSAPI         : off
        INTDATE        : on
        LDAP           : off
        NLS            : on
        OPTIMIZED_CFLAGS: off
        PAM            : off
        SSL            : on
        TZDATA         : on
        XML            : on
Shared Libs required:
        libicui18n.so.61
        libintl.so.8
        libpq.so.5
        libicuuc.so.61
        libxml2.so.2
Annotations    :
        FreeBSD_version: 1101001
        cpe            : cpe:2.3:a:postgresql:postgresql:10.3:::::freebsd11:x64:1
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 19.7MiB

sudo -u www php /usr/local/www/nextcloud/occ config:list system
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "10.0.0.204",
            "nextcloud.local",
            "local"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/10.0.0.204",
        "dbtype": "pgsql",
        "version": "13.0.1.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "log_type": "file",
        "logfile": "\/var\/log\/nextcloud.log",
        "loglevel": "0",
        "logdateformat": "F d, Y H:i:s",
        "logtimezone": "America\/Toronto",
        "log_rotate_size": 52428800,
        "memcache.local": "\\OC\\Memcache\\Memcached",
        "memcache.distributed": "\\OC\\Memcache\\Memcached",
        "memcached_servers": [
            [
                "10.0.0.204",
                11211
            ]
        ],
        "appstoreenabled": true,
        "apps_paths": [
            {
                "path": "\/usr\/local\/www\/nextcloud\/apps",
                "url": "\/apps",
                "writable": true
            },
            {
                "path": "\/usr\/local\/www\/nextcloud\/apps-pkg",
                "url": "\/apps-pkg",
                "writable": false
            }
        ],
        "defaultapp": "calendar",
        "mail_smtpmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": 25,
        "mail_smtptimeout": 30,
        "mail_smtpsecure": "",
        "mail_smtpauth": true,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "updatechecker": false,
        "check_for_working_webdav": true,
        "check_for_working_wellknown_setup": true,
        "enable_previews": true,
        "preview_max_x": 4096,
        "preview_max_y": 4096,
        "preview_libreoffice_path": "\/usr\/local\/bin\/libreoffice",
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "maintenance": false,
        "cache_path": "\/var\/db\/nextcloud\/data\/",
        "max_filesize_animated_gifs_public_sharing": 50
    }
}

Thanks for looking

Hi Geoinsbay,

Same issue here.
Don’t know where to look… can’t find any information nowhere.

Did you manage to fix it ?


Léo.

Additional info :

> [root@xxx /usr/local/www/nextcloud]# sudo -u www php occ maintenance:repair
> [...]
>   [Doctrine\DBAL\Exception\TableNotFoundException]
>   An exception occurred while executing 'UPDATE `oc_calendars` SET `components` = ? WHERE `uri` = ?' with params ["VEVENT", "contact_birthdays"]:
>   SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_calendars' doesn't exist
> 
>   [Doctrine\DBAL\Driver\PDOException]
>   SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_calendars' doesn't exist
> 
>   [PDOException]
>   SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_calendars' doesn't exist

Seems like something wrong with the table creation process…


Léo.

Hi again,

For those having the same issue, I managed to fix this bug by going to the nextcloud root directory, and type :
sudo -u www php occ app:enable dav
or
sudo -u www-data php occ app:enable dav
… depending on your server config.

Cheers,


Léo.

Good Day
I did not set up /var/log/postgresql.log for this run The third time doing this today There a lot of lines to screw up, but I think I got most of the previous fat finger itess under control

Keep gettimg the same errors So something is wrong

Technical information

The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results

  • core
    • EXTRA_FILE
      • file.

Raw output

Array
(
[core] => Array
(
[EXTRA_FILE] => Array
(
[file.] => Array
(
[expected] =>
[current] => ff9f010b5bdd7591d052fdb8cfc6e7b842f8f973ab37a91ea5e16449c17e9278d9f95f265b0508f083348376aeb16d7f02b7b86cde634e8c9f875287049360de
)

            )

    )

)
sudo -u www php occ maintenance:repair

  • Repair MySQL collation
    • Not a mysql database -> nothing to do
  • Repair mime types
  • Clean tags and favorites
    • 0 tags of deleted users have been removed.
    • 0 tags for delete files have been removed.
    • 0 tag entries for deleted tags have been removed.
    • 0 tags with no entries have been removed.
  • Repair invalid shares
  • Remove shares of a users root folder
  • Move .step file of updater to backup location
  • Add move avatar background job
    • Repair step already executed
  • Add preview cleanup background jobs
  • Fix potential broken mount points
    • No mounts updated
  • Repair language codes
  • Install new core bundle components
  • Repair invalid paths in file cache
  • Rename folder with user specific keys
  • Add log rotate job
  • Clear frontend caches
    • Image cache cleared
    • SCSS cache cleared
    • JS cache cleared
  • Fix component of birthday calendars

[Doctrine\DBAL\Exception\TableNotFoundException]
An exception occurred while executing ‘UPDATE “oc_calendars” SET “components” = ? WHERE “uri” = ?’ with params [“VEVENT”, “contact_birthdays”]:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation “oc_calendars” does not exist
LINE 1: UPDATE “oc_calendars” SET “components” = $1 WHERE “uri” = $2
^

[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation “oc_calendars” does not exist
LINE 1: UPDATE “oc_calendars” SET “components” = $1 WHERE “uri” = $2
^

[PDOException]
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation “oc_calendars” does not exist
LINE 1: UPDATE “oc_calendars” SET “components” = $1 WHERE “uri” = $2
^
Postgresql setup

su postgres

psql
psql (10.3)
Type “help” for help.
postgres=# CREATE USER nextcloud WITH PASSWORD ‘{NEXTCLOUD_DB_PASSWORD}’;
CREATE ROLE
postgres=# CREATE DATABASE nextcloud TEMPLATE template0 ENCODING ‘UNICODE’;
CREATE DATABASE
postgres=#CREATE DATABASE nextcloud TEMPLATE template0 ENCODING ‘UNICODE’;
ALTER DATABASE
postgres=#GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
postgres-# \q

/var/log messages
Apr 20 18:18:12 nextcloud postgres[57405]: [8-1] 2018-04-20 18:18:12.257 EDT [57405] FATAL: role “root” does not exist
Apr 20 20:46:57 nextcloud postgres[44565]: [8-1] 2018-04-20 20:46:57.519 EDT [44565] ERROR: relation “oc_calendars” does not exist at character 8
Apr 20 20:46:57 nextcloud postgres[44565]: [8-2] 2018-04-20 20:46:57.519 EDT [44565] STATEMENT: UPDATE “oc_calendars” SET “components” = $1 WHERE “uri” = $2
Apr 20 20:53:24 nextcloud postgres[97523]: [8-1] 2018-04-20 20:53:24.669 EDT [97523] ERROR: relation “oc_calendars” does not exist at character 159
Apr 20 20:53:24 nextcloud postgres[97523]: [8-2] 2018-04-20 20:53:24.669 EDT [97523] STATEMENT: SELECT “displayname”, “description”, “timezone”, “calendarorder”, “ca
lendarcolor”, “id”, “uri”, “synctoken”, “components”, “principaluri”, “transparent” FROM “oc_calendars” WHERE “principaluri” = $1 ORDER BY “calendarorder” ASC
Apr 20 20:53:53 nextcloud postgres[4746]: [8-1] 2018-04-20 20:53:53.221 EDT [4746] ERROR: relation “oc_calendars” does not exist at character 159
Apr 20 20:53:53 nextcloud postgres[4746]: [8-2] 2018-04-20 20:53:53.221 EDT [4746] STATEMENT: SELECT “displayname”, “description”, “timezone”, “calendarorder”, “cale
ndarcolor”, “id”, “uri”, “synctoken”, “components”, “principaluri”, “transparent” FROM “oc_calendars” WHERE “principaluri” = $1 ORDER BY “calendarorder” ASC
Apr 20 20:57:14 nextcloud postgres[75146]: [8-1] 2018-04-20 20:57:14.968 EDT [75146] ERROR: relation “oc_calendars” does not exist at character 8
Apr 20 20:57:14 nextcloud postgres[75146]: [8-2] 2018-04-20 20:57:14.968 EDT [75146] STATEMENT: UPDATE “oc_calendars” SET “components” = $1 WHERE “uri” = $2

The question is why don’t you have a calendar table in the first place. Did you try to enable and disable the calendar app?

Did you do a fresh install of NC13 or something update from a previous version or migrated from ownCloud?

@tflidd This is a fresh install in a jail on a Freebsd 11.1 p8 server. The last error messages was just after booting into the admin account for the first time. I saw the core array error and ran sudo -u www php occ maintenance:repair Which gave the above mentioned following errors. This is my sixth or seven try in the last week to get this to work. Failed so far. Postgresql 10 seems to connect but things seem to fail after that. I am not sure where “FATAL: role “root” does not exist” is coming from. As side note I do have another postgresql9.6 instance running in another jail and I have enabled raw_sockets on both jails

 # cat /etc/jail.conf
nextcloud {
  host.hostname = nextcloud.local;
  jid = 4;
  ip4.addr = 10.0.0.204;
  interface = igb0;
  path = /jails/nextcloud;
  allow.raw_sockets;
  sysvsem = new;
  sysvshm = new;
  sysvmsg = new;
}

I tried installing calendar, contacts and addressbook through FreeBSD port system, via pkg and the app store but has no effect.

So I am at a lost as to why to why it is not connecting.

Sorry about the formatting, I very rarely participate on forums, I read a lot on them, so formatting skills here are not good
Thank you for the reply

@gorby
Thank you Thank you Thank you

sudo -u www php occ app:enable dav

worked like a charm

and no complaints from

sudo -u www php occ maintenance:repair

And calendars actually seem to work

Progress that is wonderful

1 Like