Shared Links broken after Ubuntu Dist Upgrade

Nextcloud version (eg, 20.0.5): 27.0.2
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.29
PHP version (eg, 7.4): PHP8.0

The issue you are facing:
I’ve been trying for a while to upgrade the Ubuntu as well as the Nextcloud for a customer. After a Ubuntu Dist-upgrade to 20.04 or 22.04 (tried both) all shared links and external shares stop working. After checking the Logs i discovered that during the Update something with SMB/Icewind breaks. I managed to get the external Shares and Links working again, but only one by one. This isn’t a solution, there are simply too many links to fix them seperately. Anyone got an Idea what could cause this and how to prevent it? Thanks!

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. Create Shared link
  2. Upgrade Distribution and Nextcloud
  3. Check the link

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!) I’ve made some adjustments after the Upgrade, this is the Original:

<?php
$CONFIG = array (
  'instanceid' => 'id',
  'passwordsalt' => 'salt',
  'secret' => 'secret',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.domain.com',
    1 => 'nextcloud.domain.com',
  ),
  'datadirectory' => '/nextcloud',
  'dbtype' => 'mysql',
  'version' => '27.0.2.1',
  'dbname' => 'name',
  'dbhost' => 'host',
  'dbport' => 'port',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'user',
  'dbpassword' => 'password',
  'installed' => true,
  'skeletondirectory' => '',
  'mysql.utf8mb4' => true,
  'maintenance' => false,
  'overwrite.cli.url' => 'http://nextcloud.domain.com',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => port,
  ),
  'default_phone_region' => 'region',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'ldapUserCleanupInterval' => 5,
  'mail_from_address' => 'address',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'domain.com',
  'mail_smtphost' => 'domain.com',
  'theme' => '',
  'loglevel' => 1,
  'app_install_overwrite' =>
  array (
    0 => 'sharelisting',
  ),
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
);

Logs won’t be of use, the Server was reverted via Snapshot. I saved this Output from nextcloud.log (never figured out what exactly breaks during Dist-Upgrade):
No App in Context / Icewind\SMB\Exception\Exception: Unknown error (NT_STATUS_OBJECT_NAME_INVALID) for /

Unfortunately, I have no real idea either. But maybe this much, that the PHP version 8.0 you are using does not match the Ubuntu releases 20.04 LTS nor 22.04 LTS. Why do you use this version? Maybe you accidentally still have old PHP components, maybe you haven’t installed the correct version of PHP, e.g. php-smbclient, or maybe something else is broken in your PHP version.

If you have a test system then maybe you can install a new Ubuntu with the same same Nextcloud version of your backup, backup/restore only data and database and test there the upgrade.

Sorry, forgot to mention: php7.4 was installed, i tried 8.0 to see if it would make a difference. There were some old/inconsistent PHP components, i replaced them before the second upgrade.

I might have to Upgrade again to see if /var/log/dist-upgrade shows any results.

Do you know if a backup/restore like in the Documentation will maintain all Public Links? That might be the easiest solution.

I think yes because the links are stored in the database e.g. MariaDB. But for correct links you must also use the same domain name.

I would first perform a restore on a system with the same Nextcloud version under a different domain such as test.server.tld. Then moving the domain is easy. This way you can make sure that you don’t break your productive system right away.

1 Like

It looks like Links driving to the External Shared drives. Probably they stop working or path changed after upgrade. Are you using SAMBA drives connected to Nextcloud?

All external Drives are SMB Shares from a Windows Server. A Delete/Reinstall fixed the shares, but not the links.
Is there a way to force the Upgrade to use the same path already used up until now? I don’t think there’s a way to fix the links after Upgrading, so i need to prevent the SMB package from breaking.