Stuck with undeletable folder during Enabaling 4-byte support

Nextcloud version :
Operating system and version : Ubuntu 18.04.2
Apache or nginx version: Apache/2.4.29 (Ubuntu)
PHP version: 7.2.19

The issue you are facing:
I’m stuck with a folder named “Test ?” after enabling MySQL 4-byte support. Eventhough I deleted the folder on the filesystem it is undeleteable via web and Android app.

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. I converted my database to 4-byte support following your manual Enabling MySQL 4-byte support
  2. Unfortunately I ran into some errors during step 6:
    $ sudo -u www-data php occ maintenance:repair
  3. Nevertheless I tried to create a folder named “Test :slight_smile:” on my Android phone. In the webinterface I see the folder as “Test ?” and I’m not able to delete or rename it. (I know all of that was stupid :slight_smile:)
  4. In the end I managed to successfully convert the database, but I’m still not able to delete or rename the folder.
  5. Deleted the file on the filesystem, in the app and the webinterface, but the folder always shows up again after a refresh.
  6. used occ files:repair and files:rescan to get rid of it.

The output of your Nextcloud log in Admin > Logging:

No relevant logging at hand as I did all this on 30th of June 2019

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'ocnl1xg8a5b7',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' =>
  array (
    0 => '',
    1 => 'xxx',
  'datadirectory' => '/media/mergerfsdaten/nextcloud_data',
  'overwrite.cli.url' => '',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloudadmi',
  'dbpassword' => 'xxx',
  'installed' => true,
  'mail_from_address' => 'xxx',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'xxx',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauth' => 1,
  'mail_smtpport' => '587',
  'mail_smtphost' => 'xxx',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
  'maintenance' => false,
  'updater.secret' => xxx,
  'theme' => '',
  'loglevel' => 2,
  'app_install_overwrite' =>
  array (
    0 => 'admin_notifications',
  '' => 'production',
  'mysql.utf8mb4' => true,

The output of your Apache/nginx/system log in /var/log/____:

Can't find any system log within the apache2 folder

It’s probably best to perform a mainenance scan on the files on your NC instance. First, I’d scan all the files for all users:

 sudo -u www-data php /var/www/nextcloud/occ  files:scan --all

Next, I’d have NC run a cleanup on the files:

 sudo -u www-data php /var/www/nextcloud/occ  files:cleanup

The last run should at least remove the orphan entry in the database for the folder you deleted on the storage already.

I already did this in the past, I forgot to mention. Edited my post a few minutes ago :wink:
However a scan is running at the moment, as I’m not sure if I did it in the right order the last time.

Will report later on.


Unfortunately it din’t help. The cleanup command showed
0 orphaned file cache entries deleted

The folder still magically reappers after deleting it and refreshing the view.

I apprehend some entry in the database is messed up due to the creation of the folder inbetween the change of charset.

Does anyone know where and how the folder structure is stored in the database? Can I search the database for an entry like Test*?

Yeah, there is this table oc_filecache, which holds all of the file references. You should be able to find the erratic entry in there.

You’ll need cli access to the database and if it’s mysql, try this:

select * from <DB Name>.oc_filecache where path LIKE '%/Test%'

This will print out the entries which end on /Test. See, if the entry you’re searching for is among them.

I’m using maridb but adding a ; at the end of your command showed some files:

| 154979 | 3 | files/Test ? d6bdf | 204 | Test ? | 2 | 1 | 0 | 1561887214 | 1561887214 | 0 | 31 | |

I tried to delete the entry by referring to fileid, which should be the first entry.DELETE * FROM nextcloud.oc_filecache WHERE fileid LIKE '154979';

Most likely my syntax is wrong :slight_smile:

Okay… first of all, you make yourself a copy of that table, then scratch the * from the command. It should read:

delete from nextcloud.oc_filecache WHERE fileid LIKE '154979';

That worked like charm.
Thank you very much for your support!