desktop
desktop copied to clipboard
[Bug]: Invalid warning logged on start-up
⚠️ Before submitting, please verify the following: ⚠️
- [X] This is a bug, not a question or a configuration issue.
- [X] This issue is not already reported on Github (I've searched it).
- [X] Nextcloud Server and Desktop Client are up to date. See Server Maintenance and Release Schedule and Desktop Releases for supported versions.
- [X] I agree to follow Nextcloud's Code of Conduct
Bug description
During startup, the following warning is logged: nextcloud[2402]: nextcloud.gui.application: Failed to move the old config directory to its new location ( "/home/xxxxxxx/.local/share/Nextcloud" to "/home/xxxxxxx/.config/Nextcloud" )
I believe this is an invalid warning since my ~/.config/Nextcloud
directory already contains nextcloud.cfg
and a series of monthly backups. The directory ~/.local/share/Nextcloud
does not contain nextcloud.cfg
but does contain a *_sync.log
file for each folder sync connection. There is also a *_sync.log
file for each folder sync connection under ~/.config/Nextcloud
but these no longer appear to be up-to-date compared to those under ~/.local/share/Nextcloud
. Is it possible that the *_sync.log
files in ~/.config/Nextcloud
are OBE and need to be removed? The Desktop Client appears to work at this point but I would have no way to know if the cause of this warning would eventually lead to a break in client functionality.
Steps to reproduce
Start the Nextcloud Client and view the message in the system log.
Expected behavior
The message should either correctly state the condition it is warning about or not be generated.
Which files are affected by this bug
nextcloud.cfg
Operating system
Linux
Which version of the operating system you are running.
Manjaro
Package
Distro package manager
Nextcloud Server version
24.0.12
Nextcloud Desktop Client version
3.10.1
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 Enabled
Are you using an external user-backend?
- [ ] Default internal user-backend
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
Nextcloud Server logs
No response
Additional info
No response
I also observed one warning for each folder sync connection log immediately following the one above:
Nov 06 14:13:58 dv6-2150 nextcloud[2402]: nextcloud.gui.application: Fallback move of "xxxxxx_sync.log" also failed
Nov 06 14:13:58 dv6-2150 nextcloud[2402]: nextcloud.gui.application: Fallback move of "xxxx_sync.log" also failed
Nov 06 14:13:58 dv6-2150 nextcloud[2402]: nextcloud.gui.application: Fallback move of "xxxxx_sync.log" also failed
same here, on my steam deck (checking other machines this evening):
nextcloud.gui.application: Migrating old config from "/home/deck/.var/app/com.nextcloud.desktopclient.nextcloud/data/Nextcloud" to "/home/deck/.var/app/com.nextcloud.desktopclient.nextcloud/config/Nextcloud" nextcloud.gui.application: Failed to move the old config directory to its new location ( "/home/deck/.var/app/com.nextcloud.desktopclient.nextcloud/data/Nextcloud" to "/home/deck/.var/app/com.nextcloud.desktopclient.nextcloud/config/Nextcloud" ) nextcloud.gui.application: Will move the individual files ("ccc.log", "ccc.log", "cccc.log", "cc-cccc.log", "cccc.log", "ccc.log", "ccc.log", "ccc.log", "ccc.log") nextcloud.gui.application: Fallback move of "ccc.log" also failed nextcloud.gui.application: Fallback move of "ccc.log" also failed nextcloud.gui.application: Fallback move of "ccc.log" also failed nextcloud.gui.application: Fallback move of "ccc-ccc.log" also failed nextcloud.gui.application: Fallback move of "ccc.log" also failed nextcloud.gui.application: Fallback move of "ccc.log" also failed nextcloud.gui.application: Fallback move of "ccc.log" also failed nextcloud.gui.application: Fallback move of "ccc.log" also failed nextcloud.gui.application: Fallback move of "ccc.log" also failed
note: ccc = file name
The migration only runs if oldDir exists:
https://github.com/nextcloud/desktop/blob/ab3e4e724f18601e61dca0634f31ef7571f9b3f6/src/gui/application.cpp#L492-L493
The migration itself normally would rename oldDir to newDir (aka: confDir
) and if that fails logs the message you're seeing:
https://github.com/nextcloud/desktop/blob/ab3e4e724f18601e61dca0634f31ef7571f9b3f6/src/gui/application.cpp#L504-L505
Then it falls back on trying to move the files within oldDir one-by-one:
https://github.com/nextcloud/desktop/blob/ab3e4e724f18601e61dca0634f31ef7571f9b3f6/src/gui/application.cpp#L507-L517
There are some other spots where migration can happen - e.g.:
https://github.com/nextcloud/desktop/blob/ab3e4e724f18601e61dca0634f31ef7571f9b3f6/src/libsync/configfile.cpp#L343-L366
Notably, the _sync.log
files figure out their path here:
https://github.com/nextcloud/desktop/blob/ab3e4e724f18601e61dca0634f31ef7571f9b3f6/src/gui/syncrunfilelog.cpp#L35
During startup, the following warning is logged: nextcloud[2402]: nextcloud.gui.application: Failed to move the old config directory to its new location ( "/home/xxxxxxx/.local/share/Nextcloud" to "/home/xxxxxxx/.config/Nextcloud" ) I believe this is an invalid warning since my ~/.config/Nextcloud directory already contains nextcloud.cfg and a series of monthly backups.
It's valid because for some reason the simple rename migration didn't originally cover you for some reason. It just means the fallback mode kicks in (one-by-one above). The fallback kicking in now makes sense because you have both old and new directories now so a simple rename of the old directory won't work.
The questions are:
- why weren't you migrated entirely previously? :thinking:
- any chance you had two clients running simultaneously - or two versions installed - at some point or something?
- why are your
_sync.log
logs being written to your old path? :thinking:
The directory ~/.local/share/Nextcloud does not contain nextcloud.cfg but does contain a *_sync.log file for each folder sync connection. There is also a *_sync.log file for each folder sync connection under ~/.config/Nextcloud but these no longer appear to be up-to-date compared to those under ~/.local/share/Nextcloud. Is it possible that the *_sync.log files in ~/.config/Nextcloud are OBE and need to be removed? The Desktop Client appears to work at this point but I would have no way to know if the cause of this warning would eventually lead to a break in client functionality.
P.S. Manjaro's package data is weird. It says 3.10.1 on the listing on their web site but when you click on it it's for 3.9 and links to an invalid broken build source link.
@joshtrichards Thanks for helpfull insight. On my Manjaro desktop, the *_sync.log files under .local/share/Nextcloud have a current modification date (Nov 16) whereas those under .config/Nextcloud have not been modified since Nov 6. The update history for my system shows 23-11-06T07:50:38-0500] [ALPM] upgraded nextcloud-client (2:3.10.0-2 -> 2:3.10.1-1)
so it appears that after that upgrade, the *_sync.log files under .config/Nextcloud are being ignored.
Based on the code blocks you included, it makes sense that the *_sync.log files are expected to be found in the standard data location whereas the nextcloud.cfg is expected to be in the standard config location. Given this, "oldDir" for the *_sync.log files would be .config/Nextcloud directory. However, this was created by Nextcloud more than two years ago and as the standard config location is still being used to contain the nextcloud.cfg file (and backups) as well as cookies0.db, sync-exclude.lst, and a logs subdirectory containing the application log, i.e., 20231116_0812_nextcloud.log.1 with previous logs as archives. In this configuration, renaming oldDir to newDir does not really make sense. It may just be simply that the *_sync.log files under .config/Nextcloud are now OBE and should be removed.
The old directory is re-created every time:
rm -rf ~/.local/share/Nextcloud/
nextcloud &
ls -d ~/.local/share/Nextcloud/
/home/.../.local/share/Nextcloud/
and it contains a new log file for each sync target. I'm here on Linux with version 3.10.1
Same problem here on Linux with 3.10.1: .local/share/Nextcloud
gets recreated. Next start shows error message because of failed migration. The only way to prevent the error message is to delete .local/share/Nextcloud
manually before each start of Nextcloud Client.
Just updated the desktop client Linux Appimage from https://nextcloud.com/install/#install-clients from version 3.10.0 to the latest 3.11.0 and seeing the same thing.
nextcloud.gui.application: Migrating old config from "/home/username/.local/share/Nextcloud" to "/home/username/.config/Nextcloud"
nextcloud.gui.application: Failed to move the old config directory to its new location ( "/home/username/.local/share/Nextcloud" to "/home/username/.config/Nextcloud" )
nextcloud.gui.application: Will move the individual files ("Nextcloud_sync.log")
nextcloud.gui.application: Fallback move of "Nextcloud_sync.log" also failed
Tried deleteing /home/username/.local/share/Nextcloud but still getting the error message. The client still seems to work though.
Is this is a cosmetical problem only, or may things keel over later?
Also on 3.11.1 Appimage Client
I can confirm this. If you delete .local/share/Nextcloud and start nextcloud, no error message appears. But only on the first start. After that, however, the error "Failed to move the old config directory to its new location" occurs again and again All files are migrated to ./config/Nextcloud except for the log file Nextcloud_sync.log. This is always created under .local/share/Nextcloud.
@joshtrichards said:
why are your
_sync.log
logs being written to your old path? 🤔
That's because, as you mentioned, the _sync.log
files created by the SyncRunFileLog::start()
function are created in the QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
directory, which expands to ~/.local/share/Nextcloud/
.
Then, on the following application launch, the Application::setupConfigFile() function sees the previously created ~/.local/share/Nextcloud/
directory, and (wrongly) tries to move it to ~/.config/Nextcloud/
, failing because it already exists.
In my opinion, to properly fix this issue a couple of things have to change:
- Logs shouldn't be written in
~/.local/share/Nextcloud/
nor in~/.config/Nextcloud/logs/
, but should be instead be created in$XDG_STATE_HOME
(~/.local/state/
), as explicitly mentioned in the XDG Base Directory Specification. - The migration logic should be modified to only try to move
.cfg
files from~/.local/share/Nextcloud/
to/.config/Nextcloud/
, and not the whole directory. Then, it should remove all files from~/.local/share/Nextcloud/
matching known patterns like_sync.log
, and try to delete the~/.local/share/Nextcloud/
folder as if usingstd::filesystem::remove()
so that the directory doesn't get deleted if users put some custom file there.
As far as I understand, this should fix this issue, and make the desktop client a bit more conforming to the XDG guidelines :)
Edit: QStandardPaths
doesn't seem to have an enum value representing $XDG_STATE_HOME
, but I guess QStandardPaths::CacheLocation
(expanding to ~/.local/cache/
) should be a good enough alternative.
Any news on this? (I am not sure if this issue is the cause, but I have 700MB of logs in .config/Nextcloud currently. Not sure if that is caused by the multiple attempts to migrate things or if it is unrelated)
It seems it works if you delete the folder ~/.local/share/Nextcloud/ . No new folder is created which caused the bug.
At least over here with Nextcloud version 3.12.5git
Git revision 29df09454e6da423d4f3c788a491b1eb8636236d
, the folder ~/.local/share/Nextcloud/
is recreated after deleting it (of course I stopped the client, deleted the folder, ...). This is on Fedora 40.
I use Nextcloud-3.13.0-x86_64.AppImage and recently I upgraded my Kubuntu from 22.04 to 24.04 LTS (maybe that has an impact?)
It seems it works if you delete the folder ~/.local/share/Nextcloud/ . No new folder is created which caused the bug.
This is not right. Folder will recreated. See my comment on 14 February.
Oh sorry, I was wrong. I paused synchronization, that's why it seemed to work. I started a few times. Still not fixed, sorry :(
Edit:
QStandardPaths
doesn't seem to have an enum value representing$XDG_STATE_HOME
, but I guessQStandardPaths::CacheLocation
(expanding to~/.local/cache/
) should be a good enough alternative.
@Tachi107 Don't know if I'm missing something, but how about StateLocation
?
https://doc.qt.io/qt-6/qstandardpaths.html
Edit: I guess that path is new in Qt 6.7 and Nextcloud client uses a previous version? :(
Yeah, that's the direct Qt abstraction. It has been added in Qt 6.7 though, and wasn't available when I submitted my suggestion.
I had the problem that nextcloud client was hangig for long times and sometimes even wasn't able to sync at all. This could be worked around here under Fedora 40 with client 3.13.2-1 and now the client is responsive again and syncs as it should:
- Turn off the Settings - General - Launch on system startup option
- Exit the Nextcloud client if it is running (not only closing -- check that the process isn't running anymore)
- If there are newer (by date and time) bla_sync.log files in the old
~/.local/share/Nextcloud/
than in the new~/.config/Nextcloud
folder: Copy them from old to new - Move away the old
~/.local/share/Nextcloud/
- Create a symlink (
ln -s ~/.config/Nextcloud ~/.local/share/Nextcloud
)
This creates even more journalctl entries "Failed to move" and "Fallback move ... also failed" but in the end it works. We shouldn't forget to check from time to time if the problem is fixed and to take away the symlink then.