desktop icon indicating copy to clipboard operation
desktop copied to clipboard

[Bug]: Directory Symbolic Link _and_ Junction from a Nextcloud share to another Nextcloud share is synced on Windows, with errors

Open Sieboldianus opened this issue 1 year ago • 3 comments

⚠️ Before submitting, please verify the following: ⚠️

Bug description

With the latest Nextcloud client on Windows 11, I started seeing upload errors with "unknown" in the client. After inspecting, I traced the errors to a Directory symbolic link I created from a share within my Nextcloud sync folder to another sync folder. I tested with Junctions and saw the same effect.

Steps to reproduce

  1. Create a NTFS Directory symbolic link with mklink /D from a folder that is synced to a Nextcloud server to another folder that is also synced to the same Nextcloud server
mklink /D C:\Users\user\nc_share1\junction_folder C:\Users\user\Nextcloud\nc_share2\junction_folder_target
symbolische Verknüpfung erstellt für C:\Users\user\nc_share1\junction_folder <<===>> C:\Users\user\Nextcloud\nc_share2\junction_folder_target

The same applies to Junctions:

mklink /J C:\Users\user\nc_share1\junction_folder C:\Users\user\Nextcloud\nc_share2\junction_folder_target
Verbindung erstellt für C:\Users\user\nc_share1\junction_folder <<===>> C:\Users\user\Nextcloud\nc_share2\junction_folder_target
  1. Observe Nextcloud attempting to upload files again grafik

  2. Observe Nextcloud to fail after scanning files with "Unknown Server error"

grafik

  • after repeating with Junctions/Hardlinks, I sometimes saw a few files being actually synced to the server; but it always fails after a few files (<100).

I have both folders as individual shares: grafik

Other observations:

  • There's no error on the Nextcloud Server.
  • The folder on the server is also shared with many different users and contains a lot of files (3000, about 15GB). I don't think this is the cause.
  • If I create a shortcut (*.lnk), it is not synced (only the *.lnk file is synced, as expected)
  • I searched and found #4770, which is also related to Junctions. This indicates that the client may have some unidentified issues with Junctions/Hardlinks.

Expected behavior

Directory Junctions are not synced, as is documented.

Which files are affected by this bug

ExpNature1to5.pdf

Operating system

Windows

Which version of the operating system you are running.

Windows 11

Package

Official Windows MSI

Nextcloud Server version

28.0.9

Nextcloud Desktop Client version

4.14.0

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

Updated from a minor version (ex. 3.4.2 to 3.4.4)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

Are you using an external user-backend?

  • [x] Default internal user-backend
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Nextcloud Server logs

No response

Additional info

No response

Sieboldianus avatar Sep 19 '24 06:09 Sieboldianus

I recently saw something that also looks to be related to this issue.

On a windows laptop, "My Documents" and "My Pictures" are synchronised to the sever to separate folders. Since the installation of 3.14.0, the 'My Documents' sync included the standard hidden junctions: "My Music", "My Pictures" and "My Videos". Some files in both "My Music" and "My Pictures" were sent to the server with also some "Unknown server errors" in the log.

When I checked https://github.com/nextcloud/desktop/issues/4770, it describes local junction contents being deleted if they are removed from the sync list so for now I just added the folders to the exclude list.

My investigation was prompted by some performance issues where I saw nextcloud taking more CPU then usual and also being unresponsive whilst opening the drop down list of folders in the sync connection. Reverting to 3.13.4 avoids any performance issues.

I can collect more detailed logs if they would be useful.

stevehuk avatar Oct 01 '24 17:10 stevehuk

I recently saw something that also looks to be related to this issue.

On a windows laptop, "My Documents" and "My Pictures" are synchronised to the sever to separate folders. Since the installation of 3.14.0, the 'My Documents' sync included the standard hidden junctions: "My Music", "My Pictures" and "My Videos". Some files in both "My Music" and "My Pictures" were sent to the server with also some "Unknown server errors" in the log.

When I checked #4770, it describes local junction contents being deleted if they are removed from the sync list so for now I just added the folders to the exclude list.

My investigation was prompted by some performance issues where I saw nextcloud taking more CPU then usual and also being unresponsive whilst opening the drop down list of folders in the sync connection. Reverting to 3.13.4 avoids any performance issues.

I can collect more detailed logs if they would be useful.

I just ran in to the very same issue with a fresh Windows 11 24H2 installation and desktop client v3.14.1.

#4770 was just recently closed without reference to any fix

Update: I tried another time and reproduced the issue with Windows 24H2 and Nextcloud Client v3.14.1

  1. In a fresh profile the folder Documents includes three junction points: Image

  2. When adding a sync between local and remote "Documents" folder the junction points for "My Pictures" a.s.o. will get created as subfolder in the remote documents folder

  3. Trying to avoid this by adding the folders in ignore list didn't help for me.

It seems to me that symbolic links / junction points in Windows aren't ignored anymore by default. Cleaning this up is turning into a nightmare as I'm usually syncing the very same folders from multiple clients.

At the moment I'm stuck. Please help!

plauderer avatar Oct 12 '24 08:10 plauderer

Same here with at least Windows 10 22H2 (OS Build 19045.4529) and at least Nextcloud client 3.14.1.20240927. Happens (at least) with the "My Pictures" junction point. Stopped synchronization immediately, but I assume this will be the same for the other junctions. Image Image Image Image Image

woody30r0 avatar Oct 13 '24 09:10 woody30r0

I reverted back to "Version 3.13.4stable-Win64 (build 20240912)" (3.13.4.20240912) on the same machine (and disabled automatic updates - see "Preventing Automatic Updates" at https://docs.nextcloud.com/desktop/3.14/autoupdate.html). It now works again as expected. Junction points are being recognized correctly and not being synchronized twice. This seems to be an issue with 3.14.x only (Product Version: 3.14.1.20240927 and/or 3.14.0.20240914 (not verified explicitly with this previously installed version), Product Language: 1033) .

woody30r0 avatar Nov 02 '24 11:11 woody30r0

Confirming I've noticed this in 3.14.x as well - junction mishandling caused massive data loss of family photos for me...

CorneliousJD avatar Nov 11 '24 22:11 CorneliousJD

Seems confirmed this was an issue with the .lnk handling in 3.14.x see here https://help.nextcloud.com/t/did-the-junction-folder-handling-changed-in-the-windows-client/207362

CorneliousJD avatar Nov 11 '24 22:11 CorneliousJD

Also confirming I see this issue in 3.14.x. Took me quite a long time to realize it was Nextcloud that was doing it though. It effectively caused the deletion of all of my pictures, videos, and music, but fortunately I had a snapshot backup system in place that I was able to restore from.

tairabiteru avatar Nov 17 '24 02:11 tairabiteru

This is outrageous. The Nextcloud client for Windows and thus my entire installation have been unusable for weeks.

How do I get out of this? Where can I find previous versions of the Windows client? I assume 3.13.3 is the last version without this bug, correct?

philipgo avatar Nov 17 '24 18:11 philipgo

This is outrageous. The Nextcloud client for Windows and thus my entire installation have been unusable for weeks.

How do I get out of this? Where can I find previous versions of the Windows client? I assume 3.13.3 is the last version without this bug, correct?

First, in 3.14.x turn off the option to auto check for updates.

Then uninstall and install 3.13.4 from here https://download.nextcloud.com/desktop/releases/Windows/

Don't update until they fix this then. That's what I'm doing and it's okay for now.

CorneliousJD avatar Nov 17 '24 19:11 CorneliousJD

It deleted all my photos and videos, what a mess.

@Rello This is a fatal bug! Who can do something about it?

philipgo avatar Nov 17 '24 21:11 philipgo

How do I get rid of this in the meantime? All measures described in the documentation to prevent automatic updates appear to only prevent the check for new versions. However the new version has already been downloaded and Nextclouded continues to attempt to install it.

Image

philipgo avatar Nov 18 '24 22:11 philipgo

How do I get rid of this in the meantime? All measures described in the documentation to prevent automatic updates appear to only prevent the check for new versions. However the new version has already been downloaded and Nextclouded continues to attempt to install it.

I have already mentioned this First, in 3.14 turn off the option to auto check for updates. Download the latest 3.14.x version, install it, then turn off the auto update check option. Once you're on the latest version, turn off the auto update check, uninstall, then install 3.13.4

CorneliousJD avatar Nov 18 '24 22:11 CorneliousJD

Just noting, I just got a new computer today and installed Nextcloud 3.15.0. I've just been manually synchronizing my Documents folder since this bug was found, and today I got this message while synchronizing: Image It's not even been a day yet and previously this issue took a while to manifest, but I did not notice this message before when running 3.14.x. It's possible 3.15 fixes this issue.

tairabiteru avatar Dec 01 '24 02:12 tairabiteru

Just noting, I just got a new computer today and installed Nextcloud 3.15.0. I've just been manually synchronizing my Documents folder since this bug was found, and today I got this message while synchronizing: Image It's not even been a day yet and previously this issue took a while to manifest, but I did not notice this message before when running 3.14.x. It's possible 3.15 fixes this issue.

Image And, strike that. Issue is present in 3.15.0 as well.

tairabiteru avatar Dec 01 '24 16:12 tairabiteru

I've just been hit with something similar.

I've got separate syncs for Documents, Pictures and Music, and found that that client kept diligently deleting the contents of the Pictures and Music syncs. It was as if it was trying to replace the contents with the contents of the 'empty' hardlinks found under the Documents sync.

This happened shortly after updating Windows 11 to 24H2, using the latest 3.15.0 client.

Just in case someone else might find it useful, I used the following to batch restore the deleted files (all ~10k of them). Just glad I noticed it in time before the trash was purged.

./occ trashbin:restore --since "04.12.2024 04:00:00" --until "05.12.2024 05:12:40" MyUsername

thrnz avatar Dec 05 '24 05:12 thrnz

This happened shortly after updating Windows 11 to 24H2, using the latest 3.15.0 client.

I can say for sure it's not a 24H2 issue. I experienced it on 2 different machines both on Win 11 23H2 still. It started in the 3.14.x client and continues/persists in 3.15.x

Wish Someone from Nextcloud would actually acknowledge this issue though... Since nobody has I'm going to (reluctantly) tag some top contributors over past 3 months and all-time.

@claucambra @mgallien @camilasan @dragotin @ogoffart @danimo

CorneliousJD avatar Dec 05 '24 15:12 CorneliousJD

Yes, I saw the error on three different systems, 1x Win 10 22H2 and 2x Win 11.

Sieboldianus avatar Dec 06 '24 05:12 Sieboldianus

I've got separate syncs for Documents, Pictures and Music, and found that that client kept diligently deleting the contents of the Pictures and Music syncs. It was as if it was trying to replace the contents with the contents of the 'empty' hardlinks found under the Documents sync.

I can confirm this was basically my exact use case, and I also observed this behavior. The first time it happened I didn't notice for a long time and so had some files get lost. I fortunately have a backup system I was able to restore from. Each subsequent time I was simply able to restore from the trash can as you described since I was keeping a closer eye on it. This was on 3.14.x too, so both versions are affected.

For now, I've mitigated the issue by moving the contents of my Documents folder into another folder. I'm instead synchronizing that, however this is far from an ideal solution for me because save games, powershell profiles, and a bunch of other items by default are placed into the Documents folder. One of the largest uses of Nextcloud for me is to keep this data synchronized across systems so that I don't have to maintain a development environment (or save games) on six different computers.

tairabiteru avatar Dec 06 '24 14:12 tairabiteru

bugfix build out of master branch please do not use it outside testing environment feedback very much welcome https://cloud.nextcloud.com/s/PXRH2m4JGCk8Gr3

mgallien avatar Dec 06 '24 18:12 mgallien

Just noting I've been using the bugfix build on my own personal installation for a few days now without issue. I reconnected the synchronization to my Documents folder, and I've not seen any improper junction syncing since installing it. Granted, I've only installed it on one system, so perhaps tomorrow I'll try installing it elsewhere to see if it misbehaves. But so far so good!

tairabiteru avatar Dec 09 '24 02:12 tairabiteru

bugfix build out of master branch please do not use it outside testing environment feedback very much welcome https://cloud.nextcloud.com/s/PXRH2m4JGCk8Gr3

I see this issue is now closed and backported - will this be available in 3.15.1 or when should we expect to see versioned released w/ this change? I don't want to jump the gun w/ upgrading!

CorneliousJD avatar Dec 09 '24 21:12 CorneliousJD

bugfix build out of master branch please do not use it outside testing environment feedback very much welcome https://cloud.nextcloud.com/s/PXRH2m4JGCk8Gr3

I see this issue is now closed and backported - will this be available in 3.15.1 or when should we expect to see versioned released w/ this change? I don't want to jump the gun w/ upgrading!

yes. this will be 3.15.1, planned for the next days....

Rello avatar Dec 09 '24 21:12 Rello