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]: Upgrade to calendar 4.6.7 causes SQL error w/ SQLite #44445

Open
5 of 8 tasks
kpneal opened this issue Mar 22, 2024 · 18 comments · Fixed by nextcloud/3rdparty#1919
Open
5 of 8 tasks

[Bug]: Upgrade to calendar 4.6.7 causes SQL error w/ SQLite #44445

kpneal opened this issue Mar 22, 2024 · 18 comments · Fixed by nextcloud/3rdparty#1919

Comments

@kpneal
Copy link

kpneal commented Mar 22, 2024

⚠️ This issue respects the following points: ⚠️

Bug description

I upgraded calendar 4.6.7 using the FreeBSD pkg system and then ran "occ upgrade" like I normally do. This time I got errors:

# service php-fpm stop
Stopping php_fpm.
Waiting for PIDS: 90249.
# su -l www
$ cd /usr/local/www/nextcloud/
$ php ./occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Repair error: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 no such column: -1
Updating database schema
Updated database
Updating <calendar> ...
Updated <calendar> to 4.6.7
Repair error: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 no such column: -1
Starting code integrity check...
Finished code integrity check
Update successful
Turned off maintenance mode
Resetting log level
$ php ./occ upgrade
Nextcloud is already latest version
$ exit
# service php-fpm start
Performing sanity check on php-fpm configuration:
[22-Mar-2024 17:53:31] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful

Starting php_fpm.
# 

Reloading the https://share.neutralgood.org/index.php/settings/admin/overview page shows the error "Error occurred while checking server setup".

The error that shows up on https://share.neutralgood.org/index.php/settings/admin/logging is this:
DriverException
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 no such column: -1

Disabling the calendar app makes no difference. Removing the calendar app with the occ command makes no difference. Removing calendar with FreeBSD's "pkg remove" after removing it with occ makes no difference.

One more thing that's odd: The apps page "https://share.neutralgood.org/index.php/settings/apps/installed" will, when I click to disable an arbitrary app, open a sidebar on the right for the "Two-Factor TOTP Provider" app. That's why I had to use the occ command to disable the calendar app.

Steps to reproduce

  1. pkg upgrade
  2. su -l www
  3. cd /usr/local/www/nextcloud
  4. php ./occ upgrade

Expected behavior

I expect not to see any error messages.

Installation method

None

Nextcloud Server version

28

Operating system

Other

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

SQlite

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

Updated from a MINOR version (ex. 22.1 to 22.2)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

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

Configuration report

$ php occ config:list system
{
    "system": {
        "apps_paths": [
            {
                "path": "\/usr\/local\/www\/nextcloud\/apps",
                "url": "\/apps",
                "writable": true
            },
            {
                "path": "\/usr\/local\/www\/nextcloud\/apps-pkg",
                "url": "\/apps-pkg",
                "writable": false
            }
        ],
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "loglevel": 0,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "dbindex": 0,
            "timeout": 0
        },
        "trusted_domains": [
            "localhost",
            "share.neutralgood.org",
            "206.196.19.102",
            "[2607:f758:2280:5:9d7b:3dcd:d17c:59d1]"
        ],
        "default_phone_region": "US",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "sqlite3",
        "version": "28.0.3.2",
        "overwrite.cli.url": "http:\/\/localhost",
        "installed": true,
        "mail_smtpmode": "sendmail",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable",
        "theme": "",
        "preview_max_filesize_image": 250,
        "preview_max_memory": 768,
        "maintenance": false,
        "maintenance_window_start": 8
    }
}
$

List of activated Apps

$ php occ app:list
Enabled:
  - activity: 2.20.0
  - admin_audit: 1.18.0
  - circles: 28.0.0-dev
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contacts: 5.5.3
  - contactsinteraction: 1.9.0
  - dashboard: 7.8.0
  - dav: 1.29.1
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - firstrunwizard: 2.17.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - nextcloud_announcements: 1.17.0
  - notifications: 2.16.0
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - photos: 2.4.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.1
  - sharebymail: 1.18.0
  - support: 1.11.0
  - survey_client: 1.16.0
  - systemtags: 1.18.0
  - text: 3.9.1
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - updatenotification: 1.18.0
  - user_status: 1.8.1
  - viewer: 2.2.0
  - weather_status: 1.8.0
  - workflowengine: 2.10.0
Disabled:
  - bruteforcesettings: 2.8.0
  - encryption: 2.16.0
  - files_external: 1.20.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - suspicious_login: 6.0.0
  - twofactor_totp: 10.0.0-beta.2
  - user_ldap: 1.19.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

The log can be retrieved from:
https://www.neutralgood.org/~kpn/tmp/nextcloud.log.txt

If I put the log into this form then GitHub seems to drop the entire issue after consuming large amounts of CPU. This is my second time trying to file this report.

Additional info

uname -a: FreeBSD share.neutralgood.org 13.2-RELEASE-p8 FreeBSD 13.2-RELEASE-p8 GENERIC amd64

I'm running NextCloud in a FreeBSD jail with a full OS install plus these packages:
$ pkg info
ImageMagick7-7.1.1.26_3 Image processing tools
Imath-3.1.11 C++/Python lib of 2D/3D vector, matrix, math ops for computer graphics
aom-3.8.2 AV1 reference encoder/decoder
apache24-2.4.58_2 Version 2.4.x of Apache web server
apr-1.7.3.1.6.3_1 Apache Portability Library
argp-standalone-1.5.0 Standalone version of arguments parsing functions from GLIBC
avahi-app-0.8_2 Service discovery on a local network
bash-5.2.26_1 GNU Project's Bourne Again SHell
bash-completion-2.12.0,2 Programmable completion library for Bash
brotli-1.1.0,1 Generic-purpose lossless compression algorithm
ca_root_nss-3.93_2 Root certificate bundle from the Mozilla Project
cairo-1.17.4_2,3 Vector graphics library with cross-device output support
cronolog-1.6.2_7 Web log rotation utility that provides datestamp filenames
cups-2.4.7_2 Common UNIX Printing System
curl-8.6.0 Command line tool and library for transferring data with URLs
cyrus-sasl-2.1.28_4 RFC 2222 SASL (Simple Authentication and Security Layer)
dav1d-1.4.0 Small and fast AV1 decoder
db18-18.1.40 Oracle Berkeley DB, Release 18.1
db5-5.3.28_9 Oracle Berkeley DB, revision 5.3
dbus-1.14.10_4,1 Message bus system for inter-application communication
dbus-glib-0.112_1 GLib bindings for the D-BUS messaging system
dejavu-2.37_3 Bitstream Vera Fonts clone with a wider range of characters
dialog4ports-0.1.6_2 Console Interface to configure ports
e2fsprogs-libuuid-1.47.0 UUID library from e2fsprogs package
encodings-1.1.0,1 X.Org Encoding fonts
expat-2.6.1 XML 1.0 parser written in C
ffmpeg-6.1.1_5,1 Realtime audio/video encoder/converter and streaming server
fftw3-3.3.10_5 Fast C routines to compute the Discrete Fourier Transform
font-bh-ttf-1.0.3_5 X.Org Bigelow & Holmes TTF font
font-misc-ethiopic-1.0.4 X.Org miscellaneous Ethiopic font
font-misc-meltho-1.0.3_5 X.Org miscellaneous Meltho font
fontconfig-2.15.0_2,1 XML-based font configuration API for X Windows
freetype2-2.13.2 Free and portable TrueType font rendering engine
fribidi-1.0.13_1 Free Implementation of the Unicode Bidirectional Algorithm
gdbm-1.23 GNU database manager
gdk-pixbuf2-2.42.10_2 Graphic library for GTK
gettext-runtime-0.22.3_1 GNU gettext runtime libraries and programs
ghostscript10-10.03.0_1 PostScript and PDF interpreter
giflib-5.2.1_1 Tools and library routines for working with GIF images
git-2.44.0 Distributed source code management tool
glib-2.80.0,2 Some useful routines of C programming (current stable version)
gmp-6.3.0 Free library for arbitrary precision arithmetic
gnome_subr-1.0 Common startup and shutdown subroutines used by GNOME scripts
gnutls-3.7.10_2 GNU Transport Layer Security library
gobject-introspection-1.78.1_2,1 Generate interface introspection data for GObject libraries
graphite2-1.3.14 Rendering capabilities for complex non-Roman writing systems
gsfonts-8.11_8 Standard Fonts for Ghostscript
harfbuzz-8.3.1 OpenType text shaping engine
highway-1.1.0 Performance-portable, length-agnostic SIMD with runtime dispatch
icu-74.2,1 International Components for Unicode (from IBM)
indexinfo-0.3.1 Utility to regenerate the GNU info page index
jansson-2.14 C library for encoding, decoding, and manipulating JSON data
jbig2dec-0.20_1 Decoder implementation of the JBIG2 image compression format
jbigkit-2.1_2 Lossless compression for bi-level images such as scanned pages, faxes
jpeg-turbo-3.0.2 SIMD-accelerated JPEG codec which replaces libjpeg
lame-3.100_5 Fast MP3 encoder kit
lcms2-2.16_1 Accurate, fast, and small-footprint color management engine
libICE-1.1.0_2,1 Inter Client Exchange library for X11
libSM-1.2.3_1,1 Session Management library for X11
libX11-1.8.7_1,1 X11 library
libXau-1.0.9_1 Authentication Protocol library for X11
libXdamage-1.1.6 X Damage extension library
libXdmcp-1.1.5 X Display Manager Control Protocol library
libXext-1.3.6,1 X11 Extension library
libXfixes-6.0.0_1 X Fixes extension library
libXft-2.3.7_1 Client-sided font API for X applications
libXpm-3.5.17_1 X Pixmap library
libXrandr-1.5.2_1 X Resize and Rotate extension library
libXrender-0.9.10_2 X Render extension library
libXt-1.3.0,1 X Toolkit library
libXxf86vm-1.1.4_3 X Vidmode Extension
libargon2-20190702_1 Memory hard password hashing program and library
libass-0.17.1_1 Portable ASS/SSA subtitle renderer
libdaemon-0.14_1 Lightweight C library that eases the writing of UNIX daemons
libdatrie-0.2.13_2 Double-array trie implementation library
libde265-1.0.12 Open source h.265 video codec
libdeflate-1.19 Fast, whole-buffer DEFLATE-based compression library
libdrm-2.4.120_1,1 Direct Rendering Manager library and headers
libedit-3.1.20230828_1,1 Command line editor library
libepoll-shim-0.0.20230411 Small epoll implementation using kqueue
libevent-2.1.12 API for executing callback functions on events or timeouts
libffi-3.4.4_1 Foreign Function Interface
libfontenc-1.1.8 The fontenc Library
libgcrypt-1.10.3_1 General purpose cryptographic library based on the code from GnuPG
libgd-2.3.3_10,1 Graphics library for fast creation of images
libglvnd-1.7.0 GL Vendor-Neutral Dispatch library
libgpg-error-1.48 Common error values for all GnuPG components
libheif-1.17.6_2 ISO/IEC 23008-12:2017 HEIF file format de- and encoder
libiconv-1.17_1 Character set conversion library
libidn-1.38_1 Internationalized Domain Names command line tool
libidn2-2.3.7 Implementation of IDNA2008 internationalized domain names
libimagequant-4.3.0_1 Image Quantization Library
libjxl-0.10.2 JPEG XL reference encoder/decoder
liblqr-1-0.4.2 Easy to use C/C++ seam carving library
libltdl-2.4.7 System independent dlopen wrapper
liblz4-1.9.4_1,1 LZ4 compression library, lossless and very fast
libnghttp2-1.60.0 HTTP/2.0 C Library
libogg-1.3.5,4 Ogg bitstream library
libpaper-1.1.28_1 Library providing routines for paper size management
libpciaccess-0.18 Generic PCI access library
libplacebo-6.338.2 Reusable library for GPU-accelerated video/image rendering
libpsl-0.21.5 C library to handle the Public Suffix List
libpthread-stubs-0.4 Weak aliases for pthread functions
libraqm-0.10.1 Library that encapsulates complex text layout logic
librav1e-0.5.1_2 Fast and safe AV1 encoder
libraw-0.21.2 Library for manipulating raw images
librsvg2-rust-2.58.0 Library for parsing and rendering SVG vector-graphic files
libsodium-1.0.18 Library to build higher-level cryptographic tools
libssh2-1.11.0_1,3 Library implementing the SSH2 protocol
libtasn1-4.19.0_1 ASN.1 structure parser library
libthai-0.1.29_1 Thai language support library
libtheora-1.1.1_7 Theora video codec for the Ogg multimedia streaming system
libudev-devd-0.5.2 libudev-compatible interface for devd
libunibreak-5.1,1 Implementation of the line and word breaking algorithm for Unicode
libunistring-1.2 Unicode string library
libunwind-20240221 Generic stack unwinding library
libv4l-1.23.0_3 Video4Linux library
libva-2.21.0 VAAPI wrapper and dummy driver
libvdpau-1.5 VDPAU wrapper and tracing library
libvorbis-1.3.7_2,3 Audio compression codec library
libvpx-1.14.0 VP8/VP9 reference encoder/decoder
libwmf-0.2.13_2 Tools and library for converting Microsoft WMF (windows metafile)
libx264-0.164.3095 H.264/MPEG-4 AVC Video Encoding (Library)
libxcb-1.16.1 The X protocol C-language Binding (XCB) library
libxml2-2.11.7 XML parser library for GNOME
libxshmfence-1.3.2 Shared memory 'SyncFence' synchronization primitive
libxslt-1.1.37_1 XML stylesheet transformation library
libzip-1.10.1 C library for reading, creating, and modifying ZIP archives
mkfontscale-1.2.3 Creates an index of scalable font files for X
mpdecimal-4.0.0 C/C++ arbitrary precision decimal floating point libraries
nettle-3.9.1 Low-level cryptographic library
nextcloud-contacts-php82-5.5.3 Contacts app for Nextcloud
nextcloud-php82-28.0.3 Collaboration platform which runs on your own server
oniguruma-6.9.9 Regular expressions library compatible with POSIX/GNU/Perl
openexr-3.2.2_1 High dynamic-range (HDR) image file format
openjpeg-2.5.2 Open-source JPEG 2000 codec
openldap26-client-2.6.7 Open source LDAP client implementation
opus-1.5.1 IETF audio codec
p11-kit-0.25.3_1 Library for loading and enumerating of PKCS#11 modules
p5-Authen-SASL-2.17 Perl5 module for SASL authentication
p5-CGI-4.62 Handle Common Gateway Interface requests and responses
p5-Clone-0.46 Recursively copy Perl datatypes
p5-Digest-HMAC-1.04 Perl5 interface to HMAC Message-Digest Algorithms
p5-Encode-Locale-1.05 Determine the locale encoding
p5-Error-0.17029 Error/exception handling in object-oriented programming style
p5-GSSAPI-0.28_2 Perl extension providing access to the GSSAPIv2 library
p5-HTML-Parser-3.81 Perl5 module for parsing HTML documents
p5-HTML-Tagset-3.20_1 Some useful data table in parsing HTML
p5-HTTP-Date-6.06 Conversion routines for the HTTP protocol date formats
p5-HTTP-Message-6.45 Representation of HTTP style messages
p5-IO-HTML-1.004 Open an HTML file with automatic charset detection
p5-IO-Socket-IP-0.42 Drop-in replacement for IO::Socket::INET supporting IPv4 and IPv6
p5-IO-Socket-SSL-2.085 Perl5 interface to SSL sockets
p5-LWP-MediaTypes-6.04 Guess media type for a file or a URL
p5-Mozilla-CA-20231213 Perl extension for Mozilla CA cert bundle in PEM format
p5-Net-SSLeay-1.94 Perl5 interface to SSL
p5-TimeDate-2.33,1 Perl5 module containing a better/faster date parser for absolute dates
p5-URI-5.27 Perl5 interface to Uniform Resource Identifier (URI) references
pango-1.50.14 Open-source framework for the layout and rendering of i18n text
pciids-20240202 Database of all known IDs used in PCI devices
pcre-8.45_4 Perl Compatible Regular Expressions library
pcre2-10.43 Perl Compatible Regular Expressions library, version 2
perl5-5.36.3_1 Practical Extraction and Report Language
php82-8.2.17 PHP Scripting Language (8.2.X branch)
php82-bcmath-8.2.17 The bcmath shared extension for php
php82-bz2-8.2.17 The bz2 shared extension for php
php82-ctype-8.2.17 The ctype shared extension for php
php82-curl-8.2.17 The curl shared extension for php
php82-dom-8.2.17 The dom shared extension for php
php82-exif-8.2.17 The exif shared extension for php
php82-fileinfo-8.2.17 The fileinfo shared extension for php
php82-filter-8.2.17 The filter shared extension for php
php82-gd-8.2.17 The gd shared extension for php
php82-gmp-8.2.17 The gmp shared extension for php
php82-iconv-8.2.17 The iconv shared extension for php
php82-intl-8.2.17 The intl shared extension for php
php82-ldap-8.2.17 The ldap shared extension for php
php82-mbstring-8.2.17 The mbstring shared extension for php
php82-opcache-8.2.17 The opcache shared extension for php
php82-pcntl-8.2.17 The pcntl shared extension for php
php82-pdo-8.2.17 The pdo shared extension for php
php82-pdo_mysql-8.2.17 The pdo_mysql shared extension for php
php82-pdo_sqlite-8.2.17 The pdo_sqlite shared extension for php
php82-pecl-APCu-5.1.23 APC User Caching
php82-pecl-imagick-3.7.0_3 PHP wrapper to the ImageMagick/GraphicsMagick library
php82-pecl-redis-5.3.7_1 Extension to access Redis
php82-posix-8.2.17 The posix shared extension for php
php82-session-8.2.17 The session shared extension for php
php82-simplexml-8.2.17 The simplexml shared extension for php
php82-sodium-8.2.17 The sodium shared extension for php
php82-sysvsem-8.2.17 The sysvsem shared extension for php
php82-xml-8.2.17 The xml shared extension for php
php82-xmlreader-8.2.17 The xmlreader shared extension for php
php82-xmlwriter-8.2.17 The xmlwriter shared extension for php
php82-xsl-8.2.17 The xsl shared extension for php
php82-zip-8.2.17 The zip shared extension for php
php82-zlib-8.2.17 The zlib shared extension for php
pixman-0.42.2 Low-level pixel manipulation library
pkg-1.20.9_1 Package manager
pkgconf-2.1.1,1 Utility to help to configure compiler and linker flags
png-1.6.43 Library for manipulating PNG images
poppler-data-0.4.12 Poppler encoding data
py39-packaging-23.2 Core utilities for Python packages
python39-3.9.18_2 Interpreted object-oriented programming language
readline-8.2.10 Library for editing command lines as they are typed
redis-7.2.4 Persistent key-value database with built-in net interface
shaderc-2024.0 GLSL/HLSL to SPIR-V shader compiler
shared-mime-info-2.2_2 MIME types database from the freedesktop.org project
sqlite3-3.45.1,1 SQL database engine in a C library
svt-av1-2.0.0 Scalable AV1 encoder
tiff-4.4.0_3 Tools and library routines for working with TIFF images
urw-base35-fonts-20200910 URW core35 fonts in various formats
vmaf-3.0.0 Perceptual video quality assessment based on multi-method fusion
vulkan-loader-1.3.280 Driver loader for the Vulkan graphics API
wayland-1.22.0 Core Wayland window system code and protocol
webp-1.3.2_1 Google WebP image format conversion tool
x265-3.5_1 H.265/High Efficiency Video Coding (HEVC) format
xorg-fonts-truetype-7.7_1 X.Org TrueType fonts
xorgproto-2023.2 X Window System unified protocol definitions
xvid-1.3.7,1 Opensource MPEG-4 codec, based on OpenDivx
xxhash-0.8.2_1 Extremely fast non-cryptographic hash algorithm
zstd-1.5.5_1 Fast real-time compression algorithm
$

@kpneal kpneal added the bug label Mar 22, 2024
@joshtrichards joshtrichards changed the title [Bug]: Upgrade to calendar 2.6.7 causes SQL error [Bug]: Upgrade to calendar 4.6.7 causes SQL error Mar 23, 2024
@solracsf solracsf transferred this issue from nextcloud/server Mar 23, 2024
@tcitworld
Copy link
Member

@solracsf This isn't related to the calendar app, we don't currently have repair steps. Sounds like a core issue.

@tcitworld tcitworld transferred this issue from nextcloud/calendar Mar 25, 2024
@szaimen szaimen added 0. Needs triage Pending check for reproducibility or if it fits our roadmap 28-feedback labels Mar 25, 2024
@nbakker
Copy link

nbakker commented Mar 28, 2024

Similar setup (FreeBSD in a jail, php-8.2, SQLite backend), similar error since upgrading the port to 28.0.3:

root@nextcloud:/usr/local/www/nextcloud # su -fm www -c 'php occ app:enable polls'
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 no such column: -1

occ maintenance:repair complains here:

...
 - Add preview cleanup background jobs
 - Migrate oauth2_clients table to nextcloud schema
     - ERROR: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 no such column: -1
 - Fix potential broken mount points
     - No mounts updated

@kpneal
Copy link
Author

kpneal commented Mar 29, 2024

I didn't know about that command. I also think we may have the same issue. Here's what I get:

$ 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
  • Move .step file of updater to backup location
  • Add move avatar background job
    • Repair step already executed
  • Add preview cleanup background jobs
  • Migrate oauth2_clients table to nextcloud schema
    • ERROR: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 no such column: -1
  • Fix potential broken mount points
    • No mounts updated
  • Repair language codes
  • Add log rotate job
  • Clear frontend caches
    • Image cache cleared
    • JS cache cleared
  • Clear every generated avatar
  • Add preview background cleanup job
  • Queue a one-time job to cleanup old backups of the updater
  • Cleanup invalid photocache files for carddav
  • Add background job to cleanup login flow v2 tokens
  • Remove potentially over exposing share links
    • No need to remove link shares.
  • Clear access cache of projects
  • Reset generated avatar flag
  • Keep legacy encryption enabled
  • Check encryption key format
  • Remove old dashboard app config data
  • Add job to cleanup the bruteforce entries
  • Queue a one-time job to check for user uploaded certificates
  • Repair DAV shares
  • Add background job to set the lookup server share state for users
  • Add token cleanup job
  • Clean up abandoned apps
  • Add possibly missing system config
  • Add AI tasks cleanup job
  • Queue a job to generate metadata
  • Upgrading Circles App
  • Fix component of birthday calendars
    • 6 birthday calendars updated.
  • Regenerating birthday calendars to use new icons and fix old birthday events without year
    • Repair step already executed
  • Fix broken values of calendar objects
    0 [->--------------------------]
  • Registering building of calendar search index as background job
    • Repair step already executed
  • Register building of social profile search index as background job
  • Registering background jobs to update cache for webcal calendars
    • Added 0 background jobs to update webcal calendars
  • Registering building of calendar reminder index as background job
    • Repair step already executed
  • Clean up orphan event and contact data
    • 0 events without a calendar have been cleaned up
    • 0 properties without an events have been cleaned up
    • 0 changes without a calendar have been cleaned up
    • 0 cached events without a calendar subscription have been cleaned up
    • 0 changes without a calendar subscription have been cleaned up
    • 0 contacts without an addressbook have been cleaned up
    • 0 properties without a contact have been cleaned up
    • 0 changes without an addressbook have been cleaned up
  • Remove activity entries of private events
    • Removed 0 activity entries
  • Clean up old calendar subscriptions from deleted users that were not cleaned-up
    0 [----->----------------------]
    • 0 calendar subscriptions without an user have been cleaned up
  • Remove invalid object properties
    • 0 invalid object properties removed.
  • Fix the share type of guest shares when migrating from ownCloud
  • Copy the share password into the dedicated column
  • Set existing shares as accepted
  • Update OAuth token expiration times
  • Switches from default updater server to the customer one if a valid subscription is available
    • Repair step already executed
  • Send an admin notification if monthly report is disabled
  • Force-reset all Text sessions before Yjs migration
  • Initialize migration of background images from dashboard to theming app
  • Add background job to check for backup codes
  • Populating added database structures for workflows
    $

@kpneal
Copy link
Author

kpneal commented Mar 29, 2024

Oh, and I'm not aware of using any oauth2 anything at all. I wonder if that's part of the problem?

@nbakker
Copy link

nbakker commented Mar 29, 2024

It shouldn't be. The failing call is here: https://github.com/nextcloud/server/blob/master/lib/private/Repair/Owncloud/MigrateOauthTables.php#L55

Exception with backtrace from /var/log/nextcloud/nextcloud.log after executing occ maintenance:repair
{
   "app" : "no app in context",
   "exception" : {
      "Code" : 1,
      "CustomMessage" : "Exception while executing repair step Migrate oauth2_clients table to nextcloud schema",
      "Exception" : "Doctrine\\DBAL\\Exception\\DriverException",
      "File" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php",
      "Line" : 83,
      "Message" : "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 no such column: -1",
      "Previous" : {
         "Code" : 1,
         "Exception" : "Doctrine\\DBAL\\Driver\\PDO\\Exception",
         "File" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
         "Line" : 28,
         "Message" : "SQLSTATE[HY000]: General error: 1 no such column: -1",
         "Previous" : {
            "Code" : "HY000",
            "Exception" : "PDOException",
            "File" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php",
            "Line" : 71,
            "Message" : "SQLSTATE[HY000]: General error: 1 no such column: -1",
            "Trace" : [
               {
                  "args" : [
                     "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq"
                  ],
                  "class" : "PDO",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php",
                  "function" : "query",
                  "line" : 71,
                  "type" : "->"
               },
               {
                  "args" : [
                     "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq"
                  ],
                  "class" : "Doctrine\\DBAL\\Driver\\PDO\\Connection",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
                  "function" : "query",
                  "line" : 1100,
                  "type" : "->"
               },
               {
                  "args" : [
                     "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq",
                     [],
                     [],
                     null
                  ],
                  "class" : "Doctrine\\DBAL\\Connection",
                  "file" : "/usr/local/www/nextcloud/lib/private/DB/Connection.php",
                  "function" : "executeQuery",
                  "line" : 261,
                  "type" : "->"
               },
               {
                  "args" : [
                     "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq",
                     []
                  ],
                  "class" : "OC\\DB\\Connection",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
                  "function" : "executeQuery",
                  "line" : 763,
                  "type" : "->"
               },
               {
                  "args" : [
                     "main"
                  ],
                  "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
                  "function" : "selectForeignKeyColumns",
                  "line" : 590,
                  "type" : "->"
               },
               {
                  "args" : [
                     "main"
                  ],
                  "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
                  "function" : "fetchForeignKeyColumnsByTable",
                  "line" : 98,
                  "type" : "->"
               },
               {
                  "args" : [
                     "main"
                  ],
                  "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
                  "function" : "fetchForeignKeyColumnsByTable",
                  "line" : 410,
                  "type" : "->"
               },
               {
                  "args" : [],
                  "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
                  "function" : "doListTables",
                  "line" : 57,
                  "type" : "->"
               },
               {
                  "args" : [],
                  "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
                  "function" : "listTables",
                  "line" : 1651,
                  "type" : "->"
               },
               {
                  "args" : [
                     "*** sensitive parameters replaced ***"
                  ],
                  "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
                  "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
                  "function" : "createSchema",
                  "line" : 1663,
                  "type" : "->"
               },
               {
                  "args" : [],
                  "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
                  "file" : "/usr/local/www/nextcloud/lib/private/DB/Migrator.php",
                  "function" : "introspectSchema",
                  "line" : 97,
                  "type" : "->"
               },
               {
                  "args" : [
                     "*** sensitive parameters replaced ***"
                  ],
                  "class" : "OC\\DB\\Migrator",
                  "file" : "/usr/local/www/nextcloud/lib/private/DB/Connection.php",
                  "function" : "createSchema",
                  "line" : 569,
                  "type" : "->"
               },
               {
                  "args" : [
                     "*** sensitive parameters replaced ***"
                  ],
                  "class" : "OC\\DB\\Connection",
                  "file" : "/usr/local/www/nextcloud/lib/private/DB/SchemaWrapper.php",
                  "function" : "createSchema",
                  "line" : 43,
                  "type" : "->"
               },
               {
                  "args" : [
                     [
                        "OC\\DB\\Connection"
                     ]
                  ],
                  "class" : "OC\\DB\\SchemaWrapper",
                  "file" : "/usr/local/www/nextcloud/lib/private/Repair/Owncloud/MigrateOauthTables.php",
                  "function" : "__construct",
                  "line" : 48,
                  "type" : "->"
               },
               {
                  "args" : [
                     [
                        "OC\\Repair"
                     ]
                  ],
                  "class" : "OC\\Repair\\Owncloud\\MigrateOauthTables",
                  "file" : "/usr/local/www/nextcloud/lib/private/Repair.php",
                  "function" : "run",
                  "line" : 127,
                  "type" : "->"
               },
               {
                  "args" : [],
                  "class" : "OC\\Repair",
                  "file" : "/usr/local/www/nextcloud/core/Command/Maintenance/Repair.php",
                  "function" : "run",
                  "line" : 120,
                  "type" : "->"
               },
               {
                  "args" : [
                     [
                        "Symfony\\Component\\Console\\Input\\ArgvInput"
                     ],
                     [
                        "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                     ]
                  ],
                  "class" : "OC\\Core\\Command\\Maintenance\\Repair",
                  "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
                  "function" : "execute",
                  "line" : 298,
                  "type" : "->"
               },
               {
                  "args" : [
                     [
                        "Symfony\\Component\\Console\\Input\\ArgvInput"
                     ],
                     [
                        "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                     ]
                  ],
                  "class" : "Symfony\\Component\\Console\\Command\\Command",
                  "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
                  "function" : "run",
                  "line" : 1040,
                  "type" : "->"
               },
               {
                  "args" : [
                     [
                        "OC\\Core\\Command\\Maintenance\\Repair"
                     ],
                     [
                        "Symfony\\Component\\Console\\Input\\ArgvInput"
                     ],
                     [
                        "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                     ]
                  ],
                  "class" : "Symfony\\Component\\Console\\Application",
                  "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
                  "function" : "doRunCommand",
                  "line" : 301,
                  "type" : "->"
               },
               {
                  "args" : [
                     [
                        "Symfony\\Component\\Console\\Input\\ArgvInput"
                     ],
                     [
                        "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                     ]
                  ],
                  "class" : "Symfony\\Component\\Console\\Application",
                  "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
                  "function" : "doRun",
                  "line" : 171,
                  "type" : "->"
               },
               {
                  "args" : [
                     [
                        "Symfony\\Component\\Console\\Input\\ArgvInput"
                     ],
                     [
                        "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                     ]
                  ],
                  "class" : "Symfony\\Component\\Console\\Application",
                  "file" : "/usr/local/www/nextcloud/lib/private/Console/Application.php",
                  "function" : "run",
                  "line" : 213,
                  "type" : "->"
               },
               {
                  "args" : [],
                  "class" : "OC\\Console\\Application",
                  "file" : "/usr/local/www/nextcloud/console.php",
                  "function" : "run",
                  "line" : 100,
                  "type" : "->"
               },
               {
                  "args" : [
                     "/usr/local/www/nextcloud/console.php"
                  ],
                  "file" : "/usr/local/www/nextcloud/occ",
                  "function" : "require_once",
                  "line" : 11
               }
            ]
         },
         "Trace" : [
            {
               "args" : [
                  [
                     "PDOException",
                     [
                        "HY000",
                        1,
                        "no such column: -1"
                     ]
                  ]
               ],
               "class" : "Doctrine\\DBAL\\Driver\\PDO\\Exception",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php",
               "function" : "new",
               "line" : 76,
               "type" : "::"
            },
            {
               "args" : [
                  "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq"
               ],
               "class" : "Doctrine\\DBAL\\Driver\\PDO\\Connection",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
               "function" : "query",
               "line" : 1100,
               "type" : "->"
            },
            {
               "args" : [
                  "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq",
                  [],
                  [],
                  null
               ],
               "class" : "Doctrine\\DBAL\\Connection",
               "file" : "/usr/local/www/nextcloud/lib/private/DB/Connection.php",
               "function" : "executeQuery",
               "line" : 261,
               "type" : "->"
            },
            {
               "args" : [
                  "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq",
                  []
               ],
               "class" : "OC\\DB\\Connection",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
               "function" : "executeQuery",
               "line" : 763,
               "type" : "->"
            },
            {
               "args" : [
                  "main"
               ],
               "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
               "function" : "selectForeignKeyColumns",
               "line" : 590,
               "type" : "->"
            },
            {
               "args" : [
                  "main"
               ],
               "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
               "function" : "fetchForeignKeyColumnsByTable",
               "line" : 98,
               "type" : "->"
            },
            {
               "args" : [
                  "main"
               ],
               "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
               "function" : "fetchForeignKeyColumnsByTable",
               "line" : 410,
               "type" : "->"
            },
            {
               "args" : [],
               "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
               "function" : "doListTables",
               "line" : 57,
               "type" : "->"
            },
            {
               "args" : [],
               "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
               "function" : "listTables",
               "line" : 1651,
               "type" : "->"
            },
            {
               "args" : [
                  "*** sensitive parameters replaced ***"
               ],
               "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
               "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
               "function" : "createSchema",
               "line" : 1663,
               "type" : "->"
            },
            {
               "args" : [],
               "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
               "file" : "/usr/local/www/nextcloud/lib/private/DB/Migrator.php",
               "function" : "introspectSchema",
               "line" : 97,
               "type" : "->"
            },
            {
               "args" : [
                  "*** sensitive parameters replaced ***"
               ],
               "class" : "OC\\DB\\Migrator",
               "file" : "/usr/local/www/nextcloud/lib/private/DB/Connection.php",
               "function" : "createSchema",
               "line" : 569,
               "type" : "->"
            },
            {
               "args" : [
                  "*** sensitive parameters replaced ***"
               ],
               "class" : "OC\\DB\\Connection",
               "file" : "/usr/local/www/nextcloud/lib/private/DB/SchemaWrapper.php",
               "function" : "createSchema",
               "line" : 43,
               "type" : "->"
            },
            {
               "args" : [
                  [
                     "OC\\DB\\Connection"
                  ]
               ],
               "class" : "OC\\DB\\SchemaWrapper",
               "file" : "/usr/local/www/nextcloud/lib/private/Repair/Owncloud/MigrateOauthTables.php",
               "function" : "__construct",
               "line" : 48,
               "type" : "->"
            },
            {
               "args" : [
                  [
                     "OC\\Repair"
                  ]
               ],
               "class" : "OC\\Repair\\Owncloud\\MigrateOauthTables",
               "file" : "/usr/local/www/nextcloud/lib/private/Repair.php",
               "function" : "run",
               "line" : 127,
               "type" : "->"
            },
            {
               "args" : [],
               "class" : "OC\\Repair",
               "file" : "/usr/local/www/nextcloud/core/Command/Maintenance/Repair.php",
               "function" : "run",
               "line" : 120,
               "type" : "->"
            },
            {
               "args" : [
                  [
                     "Symfony\\Component\\Console\\Input\\ArgvInput"
                  ],
                  [
                     "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                  ]
               ],
               "class" : "OC\\Core\\Command\\Maintenance\\Repair",
               "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
               "function" : "execute",
               "line" : 298,
               "type" : "->"
            },
            {
               "args" : [
                  [
                     "Symfony\\Component\\Console\\Input\\ArgvInput"
                  ],
                  [
                     "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                  ]
               ],
               "class" : "Symfony\\Component\\Console\\Command\\Command",
               "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
               "function" : "run",
               "line" : 1040,
               "type" : "->"
            },
            {
               "args" : [
                  [
                     "OC\\Core\\Command\\Maintenance\\Repair"
                  ],
                  [
                     "Symfony\\Component\\Console\\Input\\ArgvInput"
                  ],
                  [
                     "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                  ]
               ],
               "class" : "Symfony\\Component\\Console\\Application",
               "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
               "function" : "doRunCommand",
               "line" : 301,
               "type" : "->"
            },
            {
               "args" : [
                  [
                     "Symfony\\Component\\Console\\Input\\ArgvInput"
                  ],
                  [
                     "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                  ]
               ],
               "class" : "Symfony\\Component\\Console\\Application",
               "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
               "function" : "doRun",
               "line" : 171,
               "type" : "->"
            },
            {
               "args" : [
                  [
                     "Symfony\\Component\\Console\\Input\\ArgvInput"
                  ],
                  [
                     "Symfony\\Component\\Console\\Output\\ConsoleOutput"
                  ]
               ],
               "class" : "Symfony\\Component\\Console\\Application",
               "file" : "/usr/local/www/nextcloud/lib/private/Console/Application.php",
               "function" : "run",
               "line" : 213,
               "type" : "->"
            },
            {
               "args" : [],
               "class" : "OC\\Console\\Application",
               "file" : "/usr/local/www/nextcloud/console.php",
               "function" : "run",
               "line" : 100,
               "type" : "->"
            },
            {
               "args" : [
                  "/usr/local/www/nextcloud/console.php"
               ],
               "file" : "/usr/local/www/nextcloud/occ",
               "function" : "require_once",
               "line" : 11
            }
         ]
      },
      "Trace" : [
         {
            "args" : [
               [
                  "Doctrine\\DBAL\\Driver\\PDO\\Exception"
               ],
               [
                  "Doctrine\\DBAL\\Query"
               ]
            ],
            "class" : "Doctrine\\DBAL\\Driver\\API\\SQLite\\ExceptionConverter",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
            "function" : "convert",
            "line" : 1938,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "Doctrine\\DBAL\\Driver\\PDO\\Exception"
               ],
               [
                  "Doctrine\\DBAL\\Query"
               ]
            ],
            "class" : "Doctrine\\DBAL\\Connection",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
            "function" : "handleDriverException",
            "line" : 1880,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "Doctrine\\DBAL\\Driver\\PDO\\Exception"
               ],
               "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq",
               [],
               []
            ],
            "class" : "Doctrine\\DBAL\\Connection",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
            "function" : "convertExceptionDuringQuery",
            "line" : 1105,
            "type" : "->"
         },
         {
            "args" : [
               "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq",
               [],
               [],
               null
            ],
            "class" : "Doctrine\\DBAL\\Connection",
            "file" : "/usr/local/www/nextcloud/lib/private/DB/Connection.php",
            "function" : "executeQuery",
            "line" : 261,
            "type" : "->"
         },
         {
            "args" : [
               "            SELECT t.name AS table_name,\n                   p.*\n              FROM sqlite_master t\n              JOIN pragma_foreign_key_list(t.name) p\n                ON p.\"seq\" != \"-1\" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq",
               []
            ],
            "class" : "OC\\DB\\Connection",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
            "function" : "executeQuery",
            "line" : 763,
            "type" : "->"
         },
         {
            "args" : [
               "main"
            ],
            "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
            "function" : "selectForeignKeyColumns",
            "line" : 590,
            "type" : "->"
         },
         {
            "args" : [
               "main"
            ],
            "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
            "function" : "fetchForeignKeyColumnsByTable",
            "line" : 98,
            "type" : "->"
         },
         {
            "args" : [
               "main"
            ],
            "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
            "function" : "fetchForeignKeyColumnsByTable",
            "line" : 410,
            "type" : "->"
         },
         {
            "args" : [],
            "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php",
            "function" : "doListTables",
            "line" : 57,
            "type" : "->"
         },
         {
            "args" : [],
            "class" : "Doctrine\\DBAL\\Schema\\SqliteSchemaManager",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
            "function" : "listTables",
            "line" : 1651,
            "type" : "->"
         },
         {
            "args" : [
               "*** sensitive parameters replaced ***"
            ],
            "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
            "file" : "/usr/local/www/nextcloud/3rdparty/doctrine/dbal/src/Schema/AbstractSchemaManager.php",
            "function" : "createSchema",
            "line" : 1663,
            "type" : "->"
         },
         {
            "args" : [],
            "class" : "Doctrine\\DBAL\\Schema\\AbstractSchemaManager",
            "file" : "/usr/local/www/nextcloud/lib/private/DB/Migrator.php",
            "function" : "introspectSchema",
            "line" : 97,
            "type" : "->"
         },
         {
            "args" : [
               "*** sensitive parameters replaced ***"
            ],
            "class" : "OC\\DB\\Migrator",
            "file" : "/usr/local/www/nextcloud/lib/private/DB/Connection.php",
            "function" : "createSchema",
            "line" : 569,
            "type" : "->"
         },
         {
            "args" : [
               "*** sensitive parameters replaced ***"
            ],
            "class" : "OC\\DB\\Connection",
            "file" : "/usr/local/www/nextcloud/lib/private/DB/SchemaWrapper.php",
            "function" : "createSchema",
            "line" : 43,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "OC\\DB\\Connection"
               ]
            ],
            "class" : "OC\\DB\\SchemaWrapper",
            "file" : "/usr/local/www/nextcloud/lib/private/Repair/Owncloud/MigrateOauthTables.php",
            "function" : "__construct",
            "line" : 48,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "OC\\Repair"
               ]
            ],
            "class" : "OC\\Repair\\Owncloud\\MigrateOauthTables",
            "file" : "/usr/local/www/nextcloud/lib/private/Repair.php",
            "function" : "run",
            "line" : 127,
            "type" : "->"
         },
         {
            "args" : [],
            "class" : "OC\\Repair",
            "file" : "/usr/local/www/nextcloud/core/Command/Maintenance/Repair.php",
            "function" : "run",
            "line" : 120,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "Symfony\\Component\\Console\\Input\\ArgvInput"
               ],
               [
                  "Symfony\\Component\\Console\\Output\\ConsoleOutput"
               ]
            ],
            "class" : "OC\\Core\\Command\\Maintenance\\Repair",
            "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
            "function" : "execute",
            "line" : 298,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "Symfony\\Component\\Console\\Input\\ArgvInput"
               ],
               [
                  "Symfony\\Component\\Console\\Output\\ConsoleOutput"
               ]
            ],
            "class" : "Symfony\\Component\\Console\\Command\\Command",
            "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
            "function" : "run",
            "line" : 1040,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "OC\\Core\\Command\\Maintenance\\Repair"
               ],
               [
                  "Symfony\\Component\\Console\\Input\\ArgvInput"
               ],
               [
                  "Symfony\\Component\\Console\\Output\\ConsoleOutput"
               ]
            ],
            "class" : "Symfony\\Component\\Console\\Application",
            "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
            "function" : "doRunCommand",
            "line" : 301,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "Symfony\\Component\\Console\\Input\\ArgvInput"
               ],
               [
                  "Symfony\\Component\\Console\\Output\\ConsoleOutput"
               ]
            ],
            "class" : "Symfony\\Component\\Console\\Application",
            "file" : "/usr/local/www/nextcloud/3rdparty/symfony/console/Application.php",
            "function" : "doRun",
            "line" : 171,
            "type" : "->"
         },
         {
            "args" : [
               [
                  "Symfony\\Component\\Console\\Input\\ArgvInput"
               ],
               [
                  "Symfony\\Component\\Console\\Output\\ConsoleOutput"
               ]
            ],
            "class" : "Symfony\\Component\\Console\\Application",
            "file" : "/usr/local/www/nextcloud/lib/private/Console/Application.php",
            "function" : "run",
            "line" : 213,
            "type" : "->"
         },
         {
            "args" : [],
            "class" : "OC\\Console\\Application",
            "file" : "/usr/local/www/nextcloud/console.php",
            "function" : "run",
            "line" : 100,
            "type" : "->"
         },
         {
            "args" : [
               "/usr/local/www/nextcloud/console.php"
            ],
            "file" : "/usr/local/www/nextcloud/occ",
            "function" : "require_once",
            "line" : 11
         }
      ],
      "exception" : {},
      "message" : "Exception while executing repair step Migrate oauth2_clients table to nextcloud schema"
   },
   "level" : 3,
   "message" : "Exception while executing repair step Migrate oauth2_clients table to nextcloud schema",
   "method" : "",
   "remoteAddr" : "",
   "reqId" : "ZUKWX03NWk6bxSprwVVc",
   "time" : "2024-03-29T13:36:37+00:00",
   "url" : "--",
   "user" : "--",
   "userAgent" : "--",
   "version" : "28.0.3.2"
}

I can't quite follow the SQL syntax here but it seems "-1" should have been a column name:

# sqlite3 -column -header /usr/local/www/nextcloud/data/owncloud.db
SQLite version 3.45.1 2024-01-30 16:01:20
Enter ".help" for usage hints.
sqlite>             SELECT t.name AS table_name,
   ...>                    p.*
   ...>               FROM sqlite_master t
   ...>               JOIN pragma_foreign_key_list(t.name) p
   ...>                 ON p."seq" != "-1" WHERE t.type = 'table' AND t.name NOT IN ('geometry_columns', 'spatial_ref_sys', 'sqlite_sequence') ORDER BY t.name, p.id DESC, p.seq
   ...> ;
Parse error: no such column: -1
sqlite> 

Maybe because there are no foreign keys defined in any schema and this upsets pdo_sqlite or something?

@kpneal
Copy link
Author

kpneal commented Mar 31, 2024

Trim it down a bit:

sqlite> SELECT t.name as table_name, p.* FROM sqlite_master t JOIN pragma_foreign_key_list(t.name) p on p."seq" != "-1";
Parse error: no such column: -1
sqlite> SELECT t.name as table_name, p.* FROM sqlite_master t JOIN pragma_foreign_key_list(t.name) p on p."seq" != "-2";
Parse error: no such column: -2
sqlite>

If I change the double quotes to single quotes, or eliminate the quotes from the negative one, I get this:

sqlite> SELECT t.name as table_name, p.* FROM sqlite_master t JOIN pragma_foreign_key_list(t.name) p on p."seq" != '-1';
sqlite> SELECT t.name as table_name, p.* FROM sqlite_master t JOIN pragma_foreign_key_list(t.name) p on p."seq" != -1;
sqlite> 

No error message. I don't know what the "-1" is supposed to be, but could this be as simple as changing those double quotes?

@nbakker
Copy link

nbakker commented Mar 31, 2024

I think you're on to something. Editing 3rdparty/doctrine/dbal/src/Schema/SqliteSchemaManager.php to change "-1" to '-1' fixes my problem of not being able to install an app. occ maintenance:repair also stopped complaining.

@kpneal
Copy link
Author

kpneal commented Mar 31, 2024

I looked up SQL syntax. A single quote is a string, a double quote is something in the database. So the code is trying to join two tables with one column matching up against another column, but the column doesn't exist so it fails. Now, why is '"-1"' hard coded as a database something? And it is hard coded at line 747 of that SqliteSchemeManager.php file. I'm a little worried that something as general sounding as "selectForeignKeyColumns()" shouldn't be hacked by changing the type of quotes. Not long term, anyway.

@kpneal
Copy link
Author

kpneal commented Mar 31, 2024

It's weird that in the same function, close enough to be on screen at the same time, we have 'p."seq"' and 'p.seq'. Wouldn't these be the same thing in SQL?

And if 'p.seq' is supposed to be a sequence number, which one could assume from its use as the last column in an ORDER BY clause, then eliminating the quotes to leave a number behind might actually be correct. A quick grep on '\.seq' doesn't show anything conclusive.

@kpneal
Copy link
Author

kpneal commented Apr 1, 2024

I checked, and pragma_foreign_key_list() returns a table with the "seq" field being a number. So quotes around the '-1' are incorrect because it is not a string and it is not a column.

This is the bug.

@kpneal
Copy link
Author

kpneal commented Apr 1, 2024

FreeBSD now has 28.0.4 in the ports tree. With the '"-1"' changed to have no quotes at all I am able to upgrade to 28.0.4 and reinstall the calendar app as well.

@kpneal
Copy link
Author

kpneal commented Apr 1, 2024

I've opened a PR against nextcloud/3rdparty "Quote error with pragma_foreign_key_list() causes errors and upgrade failures. nextcloud/3rdparty#1767" but reviewers are needed.

@kpneal

This comment was marked as outdated.

@nbakker
Copy link

nbakker commented Apr 1, 2024

You linked to a long closed PR from 2016, was that intentional?

Edit: nextcloud/3rdparty#1767 is the correct link which wasn't in the email GitHub sent but is mentioned here.

@joshtrichards
Copy link
Member

doctrine/dbal#6325

@joshtrichards joshtrichards added dependencies 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Apr 1, 2024
@joshtrichards joshtrichards changed the title [Bug]: Upgrade to calendar 4.6.7 causes SQL error [Bug]: Upgrade to calendar 4.6.7 causes SQL error w/ SQLite Apr 1, 2024
@paulz-gh
Copy link

Please update this 3rdparty module. They have resolved this issue months ago.
Now I have to change "-1" to '-1' in the php file manually every time I update nextcloud.

@joshtrichards joshtrichards self-assigned this Sep 16, 2024
@joshtrichards joshtrichards removed the 1. to develop Accepted and waiting to be taken care of label Sep 16, 2024
@joshtrichards
Copy link
Member

Fixed via nextcloud/3rdparty#1919 + #48330 (at least in stable30 for the next maintenance release).

Pending for v28/v29+(future)v31.

@joshtrichards joshtrichards added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Sep 26, 2024
@nbakker
Copy link

nbakker commented Oct 24, 2024

Confirmed fixed per 30.0.1 which has recently landed in the FreeBSD ports tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants