Files Versions (1.22) missing initial version for files on new aio install

I’m having an issue with files versions. I’m not sure if it’s a bug or I’m missing a step somewhere.

If I open a file, make a change, then look at the versions, it shows one version “current version”. There’s nothing to revert back to.

If I first click on the modified column for a file, it also shows the available version of “current version”. However, if I repeat previous attempt I have 2 entries for version. “Current version” and “Initial Version”.

–In the second scenario I am able to revert back to the original version before my change.

It doesnt matter whether the file was last updated a couple of days ago or a year ago.

This is a newly created docker install of nextcloud aio (29.0.2) on an unraid server.
I copied all the files from my “old” nextcloud server (not aio), scanned and indexed the files.
There are no external mounts/files.
The behavior is consistent and repeatable.

Hoping somebody can help point me in the right direction.

Thanks!

Same behavior exists after updating 29.0.3.

I have found that if I create a file fresh, it maintains all the versions (including the initial version) as indicated in the documentation.

Is anyone aware of a job or command that can be run which scans all files and creates the initial version for a file if one does not exist?

Thanks!

How, precisely, did you transfer over your files? And did you also transfer over your database?

I copied using filesystem command scp between servers.

The only thing i brought from the old server was exported/imported the users from within nextcloud using the user migration tool. (No files, just contact/calendar)

I can post the actual commands when i get home if needed, but i scanned/added the files to the new install using occ files scan (there were a few different command variations i ran to make sure i get everything)
I then did the same thing with building the index for the elastic search.

The elastic search works fine as far i can tell.

I don’t know if it matters but im using group folders and all the files are in the same folder.

If I’m understanding the migration approach you used, which is a bit of an odd hybrid of the various approaches[1][2], you didn’t migrate your version history at all so all those old files are brand new files from your new Nextcloud instance’s perspective.

[1] https://docs.nextcloud.com/server/latest/admin_manual/maintenance/migrating.html

[2] all-in-one/migration.md at main · nextcloud/all-in-one · GitHub

The reason for this approach was to clean up data and switch to AIO.

On the original nextcloud server it kept doing a recursive folder structure and duplicating files.
For example, in nextcloud I could have two files:
mydir1/mydir2/myfile1
mydir1/mydir2/myfile2

But if I look at the filesystem it could show: mydir1/mydir2/mydir1/mydir2/myfile2
mydir1/mydir2/mydir1/mydir2/mydir1/mydir2/mydir1/mydir2/myfile1

I suspect it has something to do with versioning…but I could not find any mention of anyone having a similar issue…so I assumed I screwed something up on the setup…hence part of the reason for moving to AIO.
I also began running into sporadic issues caused by the directory/filename path is too long.

After I copy everything over I consolidate the folders/files removing all the nesting and duplicate files. (600G down to about 50G)

After the files are cleaned up and ready, I start up nextcloud and run these commands…probably some overkill, but didn’t see any harm

sudo docker exec --user www-data nextcloud-aio-nextcloud php occ db:add-missing-columns
sudo docker exec --user www-data nextcloud-aio-nextcloud php occ db:add-missing-primary-keys
sudo docker exec --user www-data nextcloud-aio-nextcloud php occ db:add-missing-indices
sudo docker exec --user www-data nextcloud-aio-nextcloud php occ db:convert-filecache-bigint --no-interaction
sudo docker exec --user www-data nextcloud-aio-nextcloud php occ files:scan --all --generate-metadata
sudo docker exec --user www-data nextcloud-aio-nextcloud php occ files:scan-app-data && sudo docker exec --user www-data nextcloud-aio-nextcloud
php occ files:scan --all
sudo docker exec --user www-data nextcloud-aio-nextcloud php occ serverinfo:update-storage-statistics

Wouldn’t the way I’m bringing the files over be no different then adding any file to the data directory and scanning it to add it to the database?

Here is a step by step of what I am doing, it may make more sense of what I’m seeing as an issue with screenshots.

I click on the doc, edit it, and close it…

Now I click “a few seconds” under modified and it just has the Current version. (ignore the times, I had a phone call)

image

So at this point, the only “version” I have is the change I just made. The original one no longer exists…I have nothing to go back to.

Now with this one

I click on “3 months ago” under modified. It shows a single entry: “Current version”

I click on the file, edit it, and close it

I click on the “a few seconds” under modified

Interesting enough, click on Current version, brings up the doc with the changes I just made even though it says it’s from 3 months ago.
Now when I look at versions again, It now has both the current version and the initial version showing correctly and if I revert to the Initial version, it is in fact the original version of the file from before my changes.

Hi, the correct way for migrating to aio would have been this: all-in-one/migration.md at main · nextcloud/all-in-one · GitHub

Regarding, the migration, in essence I did the file only migration, but for what I was needing to do it didn’t exactly fit so I had to tweak the process a bit.

I do not believe the issue is related to the migration, but with adding files to group folders and them being scanned in. (My original files were not in group folders before)

So to take the “migration” completely out of the equation, I created a completely new AIO instance.
I created a groupfolder and granted access to admin.
Nothing else. No users, no imports, no files, etc.

I copied (using cp) a file to a “normal” folder, ran the file scan, file versions worked as expected, no issues.

I then copied (using cp) a file to a “groupfolder” repeated the same process and was able to reproduce the issue where an Initial version was not created.
–This makes sense as the files were all in a group folder.

This made me realize I was missing the group folder scan, but running it made no difference. I also tried running the expire command to try to kick start it to make an initial version, but no luck.

These are the commands I ran without success:

sudo docker exec --user www-data nextcloud-aio-nextcloud php occ groupfolders:scan 1

sudo docker exec --user www-data nextcloud-aio-nextcloud php occ files:scan-app-data && sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ files:scan --all

sudo docker exec --user www-data nextcloud-aio-nextcloud php occ groupfolders:expire

Is there some other command that needs to be run for files added to groupFolders?

After looking more closely at the group folder app, there also appear to be quite a few bugs relating to sync’ing and sharing, both of which are my main use cases. They’ve been opened for quite some time (year or two) so I’m assuming solutions/fixes are not imminent

Between my issue with file versions and those bugs, group folders is not a viable solution for me right now.

Thanks everyone for their assistance.