Tell us what should happen
Upload should begin and finish with no issue
Tell us what happens instead
The file is trying to upload but exits with the error on top:
Could not rename part file to final file
Operating system:
Ubuntu 18.04 LTS
Web server:
Apache 2
Database:
MariaDB
PHP version:
PHP 7.1
Nextcloud version: (see Nextcloud admin page)
NC 14.0.0.19
Updated from an older Nextcloud/ownCloud or fresh install:
Updated from 13.0.6
Where did you install Nextcloud from:
Tech and me prepared VM installation
Signing status:
Signing status
Login as admin user into your Nextcloud and access
http://example.com/index.php/settings/integrity/failed
paste the results here.
No errors have been found.
List of activated apps:
App list
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder
Nextcloud configuration:
Config report
{
"system": {
"passwordsalt": "REMOVED SENSITIVE VALUE",
"secret": "REMOVED SENSITIVE VALUE",
"trusted_domains": [
"localhost",
"192.168.50.28",
"nextcloud",
"cloud.gertex.de",
"gertex.net",
"192.168.50.47"
],
"datadirectory": "REMOVED SENSITIVE VALUE",
"overwrite.cli.url": "https:\/\/cloud.gertex.de\/",
"dbtype": "mysql",
"version": "14.0.0.19",
"dbname": "REMOVED SENSITIVE VALUE",
"dbhost": "REMOVED SENSITIVE VALUE",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "REMOVED SENSITIVE VALUE",
"dbpassword": "REMOVED SENSITIVE VALUE",
"installed": true,
"instanceid": "REMOVED SENSITIVE VALUE",
"quota_include_external_storage": false,
"maintenance": false,
"mail_smtpmode": "smtp",
"log_rotate_size": "10485760",
"memcache.local": "\OC\Memcache\Redis",
"filelocking.enabled": true,
"memcache.distributed": "\OC\Memcache\Redis",
"memcache.locking": "\OC\Memcache\Redis",
"redis": {
"host": "REMOVED SENSITIVE VALUE",
"port": 0,
"timeout": 0,
"dbindex": 0,
"password": "REMOVED SENSITIVE VALUE"
},
"htaccess.RewriteBase": "\/",
"ldapIgnoreNamingRules": false,
"ldapProviderFactory": "\OCA\User_LDAP\LDAPProviderFactory",
"mail_from_address": "REMOVED SENSITIVE VALUE",
"mail_smtpauthtype": "LOGIN",
"mail_domain": "REMOVED SENSITIVE VALUE",
"mail_smtphost": "REMOVED SENSITIVE VALUE",
"loglevel": 1,
"updater.release.channel": "production",
"theme": ""
}
}
Are you using external storage, if yes which one: local/smb/sftp/...
SMB
Are you using encryption: yes/no
No
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
LDAP
LDAP config
| hasMemberOfFilterSupport | 1 |
| hasPagedResultSupport | |
| homeFolderNamingRule | |
| lastJpegPhotoLookup | 0 |
| ldapAgentName | CN=User,OU=Group,DC=domain,DC=net |
| ldapAgentPassword | * |
| ldapAttributesForGroupSearch | |
| ldapAttributesForUserSearch | |
| ldapBackupHost | nothing to see here |
| ldapBackupPort | nothing to see here |
| ldapBase | DC=domain,DC=net |
| ldapBaseGroups | DC=domain,DC=net |
| ldapBaseUsers | DC=domain,DC=net |
| ldapCacheTTL | 1200 |
| ldapConfigurationActive | 1 |
| ldapDefaultPPolicyDN | |
| ldapDynamicGroupMemberURL | |
| ldapEmailAttribute | mail |
| ldapExperiencedAdmin | 0 |
| ldapExpertUUIDGroupAttr | |
| ldapExpertUUIDUserAttr | sAMAccountName |
| ldapExpertUsernameAttr | sAMAccountName |
| ldapGidNumber | gidNumber |
| ldapGroupDisplayName | cn |
| ldapGroupFilter | (&(|(objectclass=group))(|(cn=somegroup)(cn=somegroup)(cn=somegroup))) |
| ldapGroupFilterGroups | somegroup;somegroup;somegroup |
| ldapGroupFilterMode | 0 |
| ldapGroupFilterObjectclass | group |
| ldapGroupMemberAssocAttr | member |
| ldapHost | some ip |
| ldapIgnoreNamingRules | |
| ldapLoginFilter | (&(&(|(objectclass=user))(|(|(memberof=CN=group,CN=Users,DC=domain,DC=net)(primaryGroupID=8715))))(|(samaccountname=%uid)(|(mailPrimaryAddress=%uid)(mail=%uid))(|(sAMAccountName=%uid)))) |
| ldapLoginFilterAttributes | sAMAccountName |
| ldapLoginFilterEmail | 1 |
| ldapLoginFilterMode | 0 |
| ldapLoginFilterUsername | 1 |
| ldapNestedGroups | 0 |
| ldapOverrideMainServer | |
| ldapPagingSize | 500 |
| ldapPort | 389 |
| ldapQuotaAttribute | |
| ldapQuotaDefault | |
| ldapTLS | 0 |
| ldapUserAvatarRule | default |
| ldapUserDisplayName | displayname |
| ldapUserDisplayName2 | |
| ldapUserFilter | (&(|(objectclass=user))(|(|(memberof=CN=group ,CN=Users,DC=domain,DC=net)(primaryGroupID=some ID)))) |
| ldapUserFilterGroups | Group |
| ldapUserFilterMode | 0 |
| ldapUserFilterObjectclass | user |
| ldapUuidGroupAttribute | auto |
| ldapUuidUserAttribute | auto |
| turnOffCertCheck | 0 |
| turnOnPasswordChange | 0 |
| useMemberOfToDetectMembership | 1 |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Browser:
Google Chrome
Version 69.0.3497.100
Operating system:
Windows 10
Version 1803
Build 17134.286
Nextcloud log
Fatal | webdav | Sabre\DAV\Exception:聽Could not rename part file to final file/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php聽- line 156:OCA\DAV\Connector\Sabre\File->put(null)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php聽- line 1096:OCA\DAV\Connector\Sabre\Directory->createFile("nix.png",聽null)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php聽- line 529:Sabre\DAV\Server->createFile("zwissTEX Me ... g",聽null,聽null)Sabre\DAV\CorePlugin->httpPut(Sabre\HTTPR ... "},聽Sabre\HTTPResponse {})/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php聽- line 105:call_user_func_array([ Sabre\DAV\ ... "],聽[ Sabre\HTTP ... }])/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php聽- line 479:Sabre\Event\EventEmitter->emit("method:PUT",聽[ Sabre\HTTP ... }])/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php聽- line 254:Sabre\DAV\Server->invokeMethod(Sabre\HTTPR ... "},聽Sabre\HTTPResponse {})/var/www/nextcloud/apps/dav/appinfo/v1/webdav.php聽- line 80:Sabre\DAV\Server->exec()/var/www/nextcloud/remote.php聽- line 163:require_once("/var/www/ne ... p")
-- | -- | --
Error | webdav | renaming part file to final file failed ($run: false, $renameOkay: false, $fileExists: false)
-- | -- | --
Error | PHP | Undefined variable: run at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#223
-- | -- | --
Warning | no app in context | Icewind\SMB\Exception\NotFoundException:聽Invalid request for /0005a_Managementsystem%20Mexico/nix.png (NotFoundException)/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php聽- line 61:Icewind\SMB\Exception\Exception::fromMap({ 1: "Icewin ... "},聽2,聽"/0005a_Mana ... g")/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php聽- line 73:Icewind\SMB\Native\NativeState->handleError("/0005a_Mana ... g")/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php聽- line 136:Icewind\SMB\Native\NativeState->testResult(false,聽"smb://192.1 ... g")/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php聽- line 166:Icewind\SMB\Native\NativeState->rename("smb://192.1 ... t",聽"smb://192.1 ... g")/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php聽- line 237:Icewind\SMB\Native\NativeShare->rename("/0005a_Mana ... t",聽"/0005a_Mana ... g")/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php聽- line 276:OCA\Files_External\Lib\Storage\SMB->rename("nix.png.ocT ... t",聽"nix.png")/var/www/nextcloud/lib/private/Files/Storage/Wrapper/PermissionsMask.php聽- line 88:OC\Files\Storage\Wrapper\Wrapper->rename("nix.png.ocT ... t",聽"nix.png")/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php聽- line 276:OC\Files\Storage\Wrapper\PermissionsMask->rename("nix.png.ocT ... t",聽"nix.png")/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php聽- line 299:OC\Files\Storage\Wrapper\Wrapper->rename("nix.png.ocT ... t",聽"nix.png")/var/www/nextcloud/apps/files_trashbin/lib/Storage.php聽- line 163:OC\Files\Storage\Wrapper\Availability->rename("nix.png.ocT ... t",聽"nix.png")/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php聽- line 570:OCA\Files_Trashbin\Storage->rename("nix.png.ocT ... t",聽"nix.png")/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php聽- line 220:OC\Files\Storage\Wrapper\Wrapper->moveFromStorage(OCA\Files_Tr ... l},聽"nix.png.ocT ... t",聽"nix.png")/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php聽- line 156:OCA\DAV\Connector\Sabre\File->put(null)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php聽- line 1096:OCA\DAV\Connector\Sabre\Directory->createFile("nix.png",聽null)/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php聽- line 529:Sabre\DAV\Server->createFile("zwissTEX Me ... g",聽null,聽null)Sabre\DAV\CorePlugin->httpPut(Sabre\HTTPR ... "},聽Sabre\HTTPResponse {})/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php聽- line 105:call_user_func_array([ Sabre\DAV\ ... "],聽[ Sabre\HTTP ... }])/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php聽- line 479:Sabre\Event\EventEmitter->emit("method:PUT",聽[ Sabre\HTTP ... }])/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php聽- line 254:Sabre\DAV\Server->invokeMethod(Sabre\HTTPR ... "},聽Sabre\HTTPResponse {})/var/www/nextcloud/apps/dav/appinfo/v1/webdav.php聽- line 80:Sabre\DAV\Server->exec()/var/www/nextcloud/remote.php聽- line 163:require_once("/var/www/ne ... p")
-- | -- | --
GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/9152 (Problem renaming folders), https://github.com/nextcloud/server/issues/9000 (Problem rewriting SMB files), https://github.com/nextcloud/server/issues/8942 (Uploading to shared public upload-only Folder fails: Could not rename part file to final file), https://github.com/nextcloud/server/issues/9091 ( server replied: Internal Server Error (Could not rename part file to final file)), and https://github.com/nextcloud/server/issues/490 (Rename file logging from "ownCloud" to "file").
Does no one has any idea what causes this error or how ti fix it ? I cant upload any file to the external storage. This is very important because there are over 200 users waiting for it. I searched through all the forums i could find and also the things the nextcloud bot suggested me. There is no fix that could have helped me. Could someone please look through this ? Thanks very much.
Does no one else have this problem ?
I really need your help .. just give me any point where i can start searching for the problem ..
We had a similiar problem with NetApp as backend for CIFS/SMB external storage. Seems the CIFS implementation on NetApp and Samba/smbclient negotiated SMB1 as protocol but tried to upload with data chunks > 64k which does not work in SMB1 resulting in a butched upload.
To fix this behaviour add the following to global section of /etc/samba/smb.conf (path may differ on your system) on your nextcloud server:
client min protocol = SMB2
client max protocol = SMB2
min protocol = SMB2
max protocol = SMB2
Pls let me know if this was of any help.
Source:
https://unix.stackexchange.com/questions/367202/setting-smb-2-0-as-default-for-mount-operations
Did not change anything.. i checked the whole smb.conf file there wasnt anything like that in there so i copied that in the file. I tried rebooting the whole machine but it did not affect the error at all ..
It may well be that this won't fix your problem. But just to make sure, you put those lines into the global section of smb.conf? It is prefixed by a line "[global]".
Otherwise those parameters wont do anything.

That's where i pastet them.
seems perfect... then sorry for not beeing helpfull in your case :(
no problem but thanks for tryin .. :/
still not working after 14.0.3 Update ....
Same here;
Tech&Me VM
14.0.3
Exact same issue.
Are you using Netapp with a CIFS share?
Are you using Netapp with a CIFS share?
I'm using an internally self-hosted Tech&Me VM, updated to 14.03 using the External Storage SMB/CIFS share configuration to a Windows 2012 Std (Not R2) share. Creating a file within Nextcloud works fine but uploads do not, this includes the sync clients on any platform.
I have done a workaround by mounting the windows share using fstab and using "Local" as storage type. This means the share is accessed using one set of windows credentials rather than the LDAP authentication (preferred) but this works very well - and much quicker!
Hi Guys,
Just to let you know of a workaround for this. If I create the share as a hidden share this works eg; \server1\Data$ and connect your external storage to that.
No idea why, but it works!
I had the same problem. It turned out to be a permission problem. User "www-data" could not write to the "data/media/files" folder.
I also got this problem when trying to upload files to a directory I had read access but not write access. Double check if the folder you are trying to upload to is owned by the Nextcloud user you are logged in and is writable.
Hi!
Don't want to create new topic, so will post in here:
Nextcloud 14.0.4
Centos 7, with updated kernel to work with SMB3
I have mounted Azure cifs share with such command:
sudo mount -t cifs //xxxxxxx.core.windows.net/folder /opt/data/folder -o vers=3.0,username=username,password=passwor,dir_mode=0777,file_mode=0777,sec=ntlmssp,uid=apache_user_id,gid=apache_grp_id
share mounts with no error and syncs. I can create files and folders and new files in those folders with no problems with Nextcloud. Also they nicely syncs to Azure. BUT I can't upload any file using Nextcloud or NC WebDav to that folder or subfolders.
All those files and folders are owned by apache : apache
In error log there is such error:
`
Fatal | webdav | Sabre\DAV\Exception:聽Could not rename part file to final file
Error | webdav | renaming part file to final file failed ($run: false, $renameOkay: false, $fileExists: false)
Error | PHP | Undefined variable: run at /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php#223
Error | PHP | rename(/opt/data/folder/imgpsh_fullsize.png.ocTransferId583196258.part,/opt/data/folder/imgpsh_fullsize.png): Resource temporarily unavailable at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#272
`
Any advice, please?!
I fixed this error by adding the line
writeable = yes
to the configuration of the corresponding Samba shares. Also make sure that the Samba user which is used by Nextcloud is in the write list of the share. If multiple users are in the write list, make sure they all have file system access to the physical folder or use the force user directive to specify a user which has file system access.
A complete Samba configuration might look like this:
[MyShare]
path = /path/to/my/share
write list = bob,nextcloud
valid users = bob,nextcloud
force user = bob
writeable = yes
In this example, nextcloud is the user utilized by Nextcloud whereas bob is the Linux user which owns the /path/to/my/share directory.
I get this error with filenames containing characters like ":", "/" or "?". All other files sync normally.
I get this error with filenames containing characters like ":", "/" or "?". All other files sync normally.
Reproductible every time?
cc @icewind1991
@skjnldsv Yes!
We had a similiar problem with NetApp as backend for CIFS/SMB external storage. Seems the CIFS implementation on NetApp and Samba/smbclient negotiated SMB1 as protocol but tried to upload with data chunks > 64k which does not work in SMB1 resulting in a butched upload.
To fix this behaviour add the following to global section of /etc/samba/smb.conf (path may differ on your system) on your nextcloud server:client min protocol = SMB2 client max protocol = SMB2 min protocol = SMB2 max protocol = SMB2Pls let me know if this was of any help.
Source:
https://unix.stackexchange.com/questions/367202/setting-smb-2-0-as-default-for-mount-operations
To anyone using Netapp:
1) change smb.conf according above instructions
2) Login to Netapp admin web GUI (ONTAP System Manager) Storage->Shares
and edit "Share" options you want to connect/mount as External Storage.
You will find a "Symbolic links" section. Change from 篓Symlinks and widelinks" to "Symlinks"
Alternatively you can issue the relative cmdline :
vserver cifs share modify -vserver _vserver_name_ -share-name _share_name_ -symlink-properties symlinks
Hope this helps.
Thanks @valeriop , you saved my day :)
We're also using Netapp. I thought it was a Samba issue until I found your post. After changing the symlinks option I was able to rename files on our Netapp share via GVFS (Nemo file manager).
Failing to rename files/dirs with smbclient/libsmbclient for protocols > SMB1 appears to be a samba bug, cf.:
https://bugzilla.samba.org/show_bug.cgi?id=13599
https://bugzilla.samba.org/show_bug.cgi?id=14169
There is also a Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=949394
In my case with nextcloud on Debian buster trying to connect to a samba server on Debian stretch I could work around the issue with
1) letting icewind use the wrapper for smbclient by removing libsmbclient-php (apt remove php-smbclient) and
2) patching apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php in line 84, replacing the smbclient command invokation
'%s %s%s -t %s %s %s %s',
with
'%s %s%s -t %s -m NT1 %s %s %s',
so that all SMB connections to the server have the maximum protocol version NT1. Of course, the server must support the NT1 dialect. To check if NT1 is supported, use:
smbclient -d 10 -m NT1 -U nextcloud_user //SERVER/SHARE
FYI, with Version 19.0.1 July 17 2020, issue was still occuring with SMB share during upload of file.. and not where creating subfolder.
Modifying /etc/samba/smb.conf with
client min protocol = SMB2
client max protocol = SMB2
min protocol = SMB2
max protocol = SMB2
was not working
but
client min protocol = NT1
client max protocol = NT1
min protocol = NT1
max protocol = NT1
is working. No need to patch any other file
client min protocol = NT1
client max protocol = NT1
min protocol = NT1
max protocol = NT1is working. No need to patch any other file
... if you are fine with other samba clients connecting through a very unsafe protocol of if you have no other clients.
Do we have a solution for SMB2 or SMB3 ? especially if NAS parameters cannot be changed or is not NetAPP...
Most helpful comment
To anyone using Netapp:
1) change smb.conf according above instructions
2) Login to Netapp admin web GUI (ONTAP System Manager) Storage->Shares
and edit "Share" options you want to connect/mount as External Storage.
You will find a "Symbolic links" section. Change from 篓Symlinks and widelinks" to "Symlinks"
Alternatively you can issue the relative cmdline :
vserver cifs share modify -vserver _vserver_name_ -share-name _share_name_ -symlink-properties symlinks
Hope this helps.