Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SOLVED] Odd behaviour with 'vi' -- cannot edit files on my user share

Featured Replies

Today, I tried to edit a file on a user share. The file exists and has content. But, when I try to edit it with 'vi', vi always says "new file: line 1" and gives me an empty editor. If I ":w", the file is overwritten with whatever I've entered in vi and the original content is gone. So, vi apparently can access the file.

 

I thought maybe it was some weird permission issue. But, that's doubtful since all my directories are a+rwx and I'm logged in as root. If I copy the file to another location -- say /tmp -- I can edit the file.

 

I can't think of any reason why 'vi' should behave this way. Does anyone have a suggestion?

 

I'm running unRAID v5.0-rc12a.

I have the same symptoms here on rc13:

root@Tower:/mnt/user/data# ls -l joe.txt

-rw-rw-rw- 1 nobody users 15 2008-12-10 07:19 joe.txt

root@Tower:/mnt/user/data# cat joe.txt

this is a test

 

When I attempt to open it in "vi" by typing:

vi joe.txt

I get

~

~

~

~

~

joe.txt: new file: line 1

 

I'll turn on user-share debugging and see what it says.

 

Joe L.

 

In the log I see shfs_getattr tons of times for files NOT being accessed and NOT in the "data" user share along with a few lines apparently referencing vi/joe.txt.

This is just small set of the shfs_getattr lines logged surrounding those apparently from "vi":

Jun  7 18:52:22 Tower shfs/user: shfs_getattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_access size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_access size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_default size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_default size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_access size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_access size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_default size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_default size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_access size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_access size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_default size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_default size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_access size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_access size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_default size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_default size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_access size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_access size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra name: system.posix_acl_default size: 132
Jun  7 18:52:22 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra name system.posix_acl_default size 132 (61) No data available
Jun  7 18:52:22 Tower shfs/user: shfs_readdir: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra
Jun  7 18:52:22 Tower shfs/user: shfs_getattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra/Seasons For Love
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 28891 path: data/vi
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/vi (2) No such file or directory
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/joe.txt
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/DB_CONFIG
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/DB_CONFIG (2) No such file or directory
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/DB_CONFIG
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/DB_CONFIG (2) No such file or directory
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/__db.002
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/__db.002 (2) No such file or directory
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/__db.003
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/__db.003 (2) No such file or directory
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/DB_CONFIG
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/DB_CONFIG (2) No such file or directory
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/DB_CONFIG
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/DB_CONFIG (2) No such file or directory
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/__db.002
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/__db.002 (2) No such file or directory
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: pid: 9380 path: data/__db.003
Jun  7 18:52:23 Tower shfs/user: shfs_getattr: lookup: data/__db.003 (2) No such file or directory
Jun  7 18:52:24 Tower shfs/user: shfs_getattr: pid: 9367 path: Mp3/Music1
Jun  7 18:52:24 Tower shfs/user: shfs_getattr: pid: 9367 path: Mp3/Music1/encoded
Jun  7 18:52:24 Tower shfs/user: shfs_getattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra
Jun  7 18:52:24 Tower shfs/user: shfs_getattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra/Seasons For Love
Jun  7 18:52:24 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra/Seasons For Love name: system.posix_acl_access size: 132
Jun  7 18:52:24 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra/Seasons For Love name system.posix_acl_access size 132 (61) No data available
Jun  7 18:52:24 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra/Seasons For Love name: system.posix_acl_default size: 132
Jun  7 18:52:24 Tower shfs/user: shfs_getxattr: getxattr: /mnt/disk4/Mp3/Music1/encoded/London Symphony Orchestra/Seasons For Love name system.posix_acl_default size 132 (61) No data available
Jun  7 18:52:24 Tower shfs/user: shfs_getxattr: pid: 9367 path: Mp3/Music1/encoded/London Symphony Orchestra/Seasons For Love name: system.posix_acl_access size: 132

And on rc14, it does work.  (Yea!!!)

 

Was this also a side effect of your overloading of the extended attributes ?

 

Joe L.

I'll turn on user-share debugging

 

Joe L. how does one go about turning on this level of debugging?

I'll turn on user-share debugging

 

Joe L. how does one go about turning on this level of debugging?

This going to sound odd, but I don't know how on rc14.

 

On rc13 it involved putting a line in the config/extra.cfg file

shfsExtra=-logging 3

 

When Tom released rc14, he added a new field in the web-interface, and asked we delete the extra.cfg line, but that might have only been in respect to the NFS option that was also in the same file.

 

Therefore, on rc14, I really do not know.  (and have not experimented to find out)  I would start with creating

/boot/config/extra.cfg

and putting the one line in it as described above.

 

Joe L.

Thank you!

 

Tom, is this the recommended way for RC14 as well?

Perfect, that works  :)

Was this also a side effect of your overloading of the extended attributes ?

Yes, but I was overloading the st_ino field returned in a stat call, using the upper 32 bits to store a mask of disks the object is on.  I never liked this and thought it might lead to trouble, which it did  ::)  So now there is a "pseudo-extended attribute" called "user.LOCATION" which you can read for any file or directory in the user share file system that will return a list of disks the object is on along with an asterisk next to a disk number which indicates a duplicate.  For example:

 

getfattr -n user.LOCATION /mnt/user/<some dir>

or

getfattr -n user.LOCATION /mnt/user/../<some file>

 

This xattr is not actually stored in the file system - shfs just looks for a call to getxattr() where name is "user.LOCATION".  I don't know why I didn't think of this before  :o

 

Over time I might change this string a bit and/or add a binary version of it.

 

An enterprising person might write a script that identifies all duplicates using a command like this:

find /mnt/user -exec getfattr -n user.LOCATION {} \; | grep '*'

but it needs a little refinement  ;)

 

 

 

  • Author

Editing works just fine now. Thanks!

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.