[SOLVED] How to fix NextCloud

Hi,

I’ve been using Mail-in-a-Box for many years and early on (back with the previous version of Ubuntu), at that time, OwnCloud didn’t work properly for me and none of the fixes suggested worked.

I had been using Davical for CalDav and CardDav services from back when I had a roll-your-own mail server. But now Davical seems to have hosed my calendar so now I’m wondering if it isn’t possible to fix NextCloud now.

Currently, I have the line:

source setup/nextcloud.sh

commented out in start.sh and updates work fine. But if I try to run it with that line, I get voluminous errors (pasted at the end). Any ideas/suggestions on how to fix this?

Many thanks in advance!

			An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [14] unable to open database file in /usr/local/lib/owncloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /usr/local/lib/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1040): OC\DB\Connection->connect()
#1 /usr/local/lib/owncloud/lib/private/DB/Connection.php(216): Doctrine\DBAL\Connection->executeUpdate('PRAGMA read_unc...', Array, Array)
#2 /usr/local/lib/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(683): OC\DB\Connection->executeUpdate('PRAGMA read_unc...')
#3 /usr/local/lib/owncloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#4 /usr/local/lib/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(195): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOSqlite\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#5 /usr/local/lib/owncloud/lib/private/DB/ConnectionFactory.php(158): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /usr/local/lib/owncloud/lib/private/Server.php(636): OC\DB\ConnectionFactory->getConnection('sqlite3', Array)
#7 /usr/local/lib/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#8 /usr/local/lib/owncloud/lib/private/ServerContainer.php(120): Pimple\Container->offsetGet('OCP\\IDBConnecti...')
#9 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(161): OC\ServerContainer->query('OCP\\IDBConnecti...')
#10 /usr/local/lib/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#11 /usr/local/lib/owncloud/lib/private/ServerContainer.php(120): Pimple\Container->offsetGet('DatabaseConnect...')
#12 /usr/local/lib/owncloud/lib/private/Server.php(1556): OC\ServerContainer->query('DatabaseConnect...')
#13 /usr/local/lib/owncloud/lib/private/Server.php(363): OC\Server->getDatabaseConnection()
#14 /usr/local/lib/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#15 /usr/local/lib/owncloud/lib/private/ServerContainer.php(120): Pimple\Container->offsetGet('OC\\Authenticati...')
#16 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(69): OC\ServerContainer->query('OC\\Authenticati...', true)
#17 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(99): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#18 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(114): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#19 /usr/local/lib/owncloud/lib/private/ServerContainer.php(145): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...', true)
#20 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(69): OC\ServerContainer->query('OC\\Authenticati...', true)
#21 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(99): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#22 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(114): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#23 /usr/local/lib/owncloud/lib/private/ServerContainer.php(145): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...', true)
#24 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(161): OC\ServerContainer->query('OC\\Authenticati...')
#25 /usr/local/lib/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#26 /usr/local/lib/owncloud/lib/private/ServerContainer.php(120): Pimple\Container->offsetGet('OC\\Authenticati...')
#27 /usr/local/lib/owncloud/lib/private/Server.php(375): OC\ServerContainer->query('OC\\Authenticati...')
#28 /usr/local/lib/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#29 /usr/local/lib/owncloud/lib/private/ServerContainer.php(120): Pimple\Container->offsetGet('OC\\User\\Session')
#30 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(161): OC\ServerContainer->query('OC\\User\\Session')
#31 /usr/local/lib/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#32 /usr/local/lib/owncloud/lib/private/ServerContainer.php(120): Pimple\Container->offsetGet('UserSession')
#33 /usr/local/lib/owncloud/lib/private/Server.php(1432): OC\ServerContainer->query('UserSession')
#34 /usr/local/lib/owncloud/lib/private/Server.php(689): OC\Server->getUserSession()
#35 /usr/local/lib/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#36 /usr/local/lib/owncloud/lib/private/ServerContainer.php(120): Pimple\Container->offsetGet('OC\\App\\AppManag...')
#37 /usr/local/lib/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(161): OC\ServerContainer->query('OC\\App\\AppManag...')
#38 /usr/local/lib/owncloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#39 /usr/local/lib/owncloud/lib/private/ServerContainer.php(120): Pimple\Container->offsetGet('AppManager')
#40 /usr/local/lib/owncloud/lib/private/Server.php(1727): OC\ServerContainer->query('AppManager')
#41 /usr/local/lib/owncloud/lib/private/legacy/app.php(346): OC\Server->getAppManager()
#42 /usr/local/lib/owncloud/lib/private/legacy/app.php(114): OC_App::getEnabledApps()
#43 /usr/local/lib/owncloud/lib/base.php(640): OC_App::loadApps(Array)
#44 /usr/local/lib/owncloud/lib/base.php(1078): OC::init()
#45 /usr/local/lib/owncloud/console.php(46): require_once('/usr/local/lib/...')
#46 /usr/local/lib/owncloud/occ(11): require_once('/usr/local/lib/...')
#47 {main}

This error suggests some low-level issue opening the database file that Nextcloud uses, which is at /home/user-data/owncloud/owncloud.db. You could try simply deleting the file (or make a backup first) and trying the setup again.

The Nextcloud database is separate from Mail-in-a-Box’s database for user accounts etc., so I don’t think there’s any reason to start over with Mail-in-a-Box.

Thanks Josh! That worked! I could have sworn I tried that back in the day and that it didn’t work.

This got me past one problem, but into another…

Installing SpamAssassin...
Installing Nginx (web server)...
Installing Roundcube (webmail)...
wal
Installing Nextcloud (contacts/calendar)...
Upgrading Nextcloud --- backing up existing installation, configuration, and database to directory to /mnt/HC_Volume_3104428/user-data/owncloud-backup/2023-11-02-15:46:39...

Upgrading to Nextcloud version 21.0.7


Upgrading to Nextcloud version 22.2.6


Upgrading to Nextcloud version 23.0.12


Upgrading to Nextcloud version 24.0.12


Upgrading to Nextcloud version 25.0.7

<!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en" >
	<head
 data-requesttoken="lw/r7is6YgJ1hxdaqx90vsFw/65OebOZas6Q9nMAdRg=:p36bvn1eBWRa/kcyzioQ17AhrecHC8bVWKmlz0VCJGw=">
		<meta charset="utf-8">
		<title>
			Nextcloud		</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
				<meta name="apple-itunes-app" content="app-id=1125420102">
				<meta name="theme-color" content="#0082c9">
		<link rel="icon" href="/cloud/core/img/favicon.ico">
		<link rel="apple-touch-icon" href="/cloud/core/img/favicon-touch.png">
		<link rel="mask-icon" sizes="any" href="/cloud/core/img/favicon-mask.svg" color="#0082c9">
		<link rel="manifest" href="/cloud/core/img/manifest.json">
		<link rel="stylesheet" href="/cloud/core/css/server.css?v=ba222ded25d957b900c03bef914333cd">
<link rel="stylesheet" href="/cloud/apps/theming/css/default.css?v=ba222ded25d957b900c03bef914333cd">
<link rel="stylesheet" href="/cloud/core/css/guest.css?v=ba222ded25d957b900c03bef914333cd">
		<script nonce="bHcvcjdpczZZZ0oxaHhkYXF4OTB2c0Z3LzY1T2ViT1phczZROW5NQWRSZz06cDM2YnZuMWVCV1JhL2tjeXppb1ExN0FocmVjSEM4YlZXS21sejBWQ0pHdz0=" defer src="/cloud/dist/core-common.js?v=ba222ded25d957b900c03bef914333cd"></script>
<script nonce="bHcvcjdpczZZZ0oxaHhkYXF4OTB2c0Z3LzY1T2ViT1phczZROW5NQWRSZz06cDM2YnZuMWVCV1JhL2tjeXppb1ExN0FocmVjSEM4YlZXS21sejBWQ0pHdz0=" defer src="/cloud/dist/core-main.js?v=ba222ded25d957b900c03bef914333cd"></script>
<script nonce="bHcvcjdpczZZZ0oxaHhkYXF4OTB2c0Z3LzY1T2ViT1phczZROW5NQWRSZz06cDM2YnZuMWVCV1JhL2tjeXppb1ExN0FocmVjSEM4YlZXS21sejBWQ0pHdz0=" defer src="/cloud/dist/core-install.js?v=ba222ded25d957b900c03bef914333cd"></script>
			</head>
	<body id="body-login">
		<noscript>
	<div id="nojavascript">
		<div>
			This application requires JavaScript for correct operation. Please <a href="https://www.enable-javascript.com/" target="_blank" rel="noreferrer noopener">enable JavaScript</a> and reload the page.</div>
	</div>
</noscript>
					<input type="hidden" id="initial-state-core-versionHash" value="ImJhMjIyZGVkMjVkOTU3YjkwMGMwM2JlZjkxNDMzM2NkIg==">
				<div class="wrapper">
			<div class="v-align">
									<header role="banner">
						<div id="header">
							<div class="logo"></div>
						</div>
					</header>
								<main>
					<h1 class="hidden-visually">
						Nextcloud					</h1>
					<input type='hidden' id='hasMySQL' value=''>
<input type='hidden' id='hasSQLite' value='1'>
<input type='hidden' id='hasPostgreSQL' value=''>
<input type='hidden' id='hasOracle' value=''>
<form action="index.php" method="post" class="guest-box install-form">
<input type="hidden" name="install" value="true">
		<fieldset class="warning">
		<legend><strong>Error</strong></legend>
				<p>
							Username is invalid because files already exist for this user					</p>
			</fieldset>
			<fieldset id="adminaccount">
		<legend>Create an <strong>admin account</strong></legend>
		<p>
			<label for="adminlogin">Username</label>
			<input type="text" name="adminlogin" id="adminlogin"
				value="root"
				autocomplete="off" autocapitalize="none" autocorrect="off" autofocus required>
		</p>
		<p class="groupbottom">
			<label for="adminpass">Password</label>
			<input type="password" name="adminpass" data-typetoggle="#show" id="adminpass"
				value="1f7013756abe1e5682751654f36f3d"
				autocomplete="off" autocapitalize="none" autocorrect="off" required>
			<button id="show" class="toggle-password" aria-label="Show password">
				<img src="/cloud/core/img/actions/toggle.svg" alt="Toggle password visibility">
			</button>
		</p>
	</fieldset>

		<fieldset id="advancedHeader">
		<legend><a id="showAdvanced" tabindex="0" href="#">Storage &amp; database<img src="/cloud/core/img/actions/caret.svg" /></a></legend>
	</fieldset>
	
		<fieldset id="datadirField">
		<div id="datadirContent">
			<label for="directory">Data folder</label>
			<input type="text" name="directory" id="directory"
				placeholder="/usr/local/lib/owncloud/data"
				value="/mnt/HC_Volume_3104428/user-data/owncloud"
				autocomplete="off" autocapitalize="none" autocorrect="off">
		</div>
	</fieldset>
	
		<fieldset id='databaseBackend'>
				<legend>Configure the database</legend>
		<div id="selectDbType">
						<p class="info">
			Only SQLite is available.			Install and activate additional PHP modules to choose other database types.<br>
			<a href="https://docs.nextcloud.com/server/25/go.php?to=admin-source_install" target="_blank" rel="noreferrer noopener">
				For more details check out the documentation. ↗</a>
		</p>
		<input type="hidden" id="dbtype" name="dbtype" value="sqlite">
						</div>
	</fieldset>

			
			<div id="sqliteInformation" class="notecard warning">
			<legend>Performance warning</legend>
			<p>You chose SQLite as database.</p>
			<p>SQLite should only be used for minimal and development instances. For production we recommend a different database backend.</p>
			<p>If you use clients for file syncing, the use of SQLite is highly discouraged.</p>
		</div>
	
	<div class="icon-loading-dark float-spinner">&nbsp;</div>

	<div class="buttons"><input type="submit" class="primary" value="Install" data-finishing="Installing …"></div>

	<p class="info">
		<span class="icon-info-white"></span>
		Need help?		<a target="_blank" rel="noreferrer noopener" href="https://docs.nextcloud.com/server/25/go.php?to=admin-install">See the documentation ↗</a>
	</p>
</form>
				</main>
			</div>
		</div>
		<footer role="contentinfo">
			<p class="info">
				<a href="https://nextcloud.com" target="_blank" rel="noreferrer noopener">Nextcloud</a> – a safe home for all your data			</p>
		</footer>
	</body>
</html>

FAILED: sudo -u www-data php8.0 /usr/local/lib/owncloud/console.php app:disable firstrunwizard
-----------------------------------------
Nextcloud is not installed - only a limited number of commands are available

                                                         
  There are no commands defined in the "app" namespace.  
                                                         

-----------------------------------------