TransWikia.com

CIFS mount is returning errors when operating on remote files (file exists, interrupted system call)

Unix & Linux Asked on October 30, 2021

I need to replace a string in a file located in a CIFS mount (NTFS NAS). It is mounted with

sudo mount -t cifs -o rw,guest,vers=1.0 //192.168.1.1/hdd /hdd

I never faced this problem until a week ago, but I didn’t change any mount option


If I run sed -i 's/oldstring/newstring/' /hdd/file I get

sed: preserving permissions for ‘/hdd/sedgtQccm’: Not a directory
sed: cannot rename /hdd/sedgtQccm: File exists

If I run sed 's/oldstring/newstring/' /hdd/file > /hdd/file.tmp && mv /hdd/file.tmp /hdd/file I get

mv: cannot move '/hdd/file.tmp' to '/hdd/file': File exists

If I run sed 's/oldstring/newstring/' /hdd/file > /hdd/file.tmp && rsync /hdd/file.tmp /hdd/file I get

rsync: [receiver] rename "/hdd/file.tmp.GMn4i1" -> "file": File exists (17)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1287) [sender=3.2.2]

I get these errors if

  • both files are remote
  • file is remote and file.tmp is local

I don’t get them if

  • both files are local
  • file is local and file.tmp is remote

It’s also worth mentioning that if I download a large file I get

write /hdd/largefilefromweb: interrupted system call

And that if I play my music from there almost hourly I get

Encountered error while transfering /hdd/track.mp3: Read error: Interrupted system call

EDIT: A workaround to the sed, mv and rsync problem is rming the file before performing the second command:

sed 's/oldstring/newstring/' /hdd/file > /hdd/file.tmp && rm /hdd/file && mv /hdd/file.tmp /hdd/file
# instead of
sed 's/oldstring/newstring/' /hdd/file > /hdd/file.tmp && mv /hdd/file.tmp /hdd/file

One Answer

In regards to the "File exists" issue, as mentioned in this serverfault question, I believe this is a regression in recent kernels and downgrading to 5.7.7 avoids the issue for now.

Answered by nogoma on October 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP