VS Code failed to save

I am running openhab2.4 SNAPSHOT on a raspberry pi and administer it from a windows 10 machine on the same network. I have VS Code installed and partially working. I am able to create items from things channels, however, I am not able to save the .items file. I am presented with an error window that says “Failed to save ‘switch.items’: Insufficient permissions. Select ‘Retry as Admin’ to retry as administrator.”

Does this have something to do with permissions of the .items file on the openhabian share or the items file on the raspberry pi? Can someone provide some insight as to what is wrong and how to correct it?

BTW, openHAB is Awesome

Thanks in advance.

Try to create a file using windows notepad in the items directory. See if it works! If it does not I suspect that you have an incorrect username in your windows drive mount.

I suspect this because the creation of items from things uses the rest api and saving the file relies on windows mapping the drive correctly.

FYI this post assumes you have the conf folders mounted as a drive letter in windows.

I was able to write a file to the items folder in the shared network drive I mapped as o:/ (drive letter O). I also checked the permissions for the folder and selected Full Control for Everyone. I also rebooted the pi and closed and reopened VS Code. Still no joy. I appreciate your help.

Update: I just looked at the permissions on the .items file and Everyone only has Read Access. I am not able to edit the permissions. I get an Access Denied window.

Run openhabian config and fix permissions. If you don’t use openhabian then you will most likely need to login to the pi and manually change permissions.

The last trick I have used in the past is rename the file in windows then open it and save a new copy.

Thank you @Thedannymullen. I am running openhabian and the fix permissions option did the trick.

1 Like

Can you Mark thread as solved. It’s the check mark on bottom of las t post.

I am a newbie learning the ropes with Openhab (and Linux :S). Came across the same issue with trying to save files through the visual studio extension.

I managed to fix this after reading through a bunch of posts and using the fix permissions option in the ophenhabian-config.

at the terminal type: sudo openhabian-config
(enter root password)
go to option 10 | Apply Improvements
go to option 14 | Fix permissions
then execute

Hope this helps someone.

3 Likes

Please how to do it in raspbian. Samba share user openhab or pi ?
I can’t save any files in openhab2 mapped drive in Windows.

Thanks @Thedannymullen & @puls3 for the details. After doing an update in openhabian-config my VS code started giving the same warning as the op. This cleared up my problem instantly.