Unable to save file changes while using VS Code Remote Container due to "read-only file system" - vscode-remote

I'm experimenting with using dev-containers for development by trying to follow along with this simple example: https://github.com/microsoft/vscode-remote-try-python
The setup works fine and I am able to build and connect to the container, and run the app just fine. However, if I try to edit anything and save it, I get an error:
Failed to save 'app.py': Unable to write file 'vscode-remote://dev-container+2f55736572732f62726164656e2e6b696e6172642f706572736f6e616c2f7673636f64652d72656d6f74652d7472792d707974686f6e/workspaces/vscode-remote-try-python/app.py' (Unknown (FileSystemError): Error: EROFS: read-only file system, open '/workspaces/vscode-remote-try-python/app.py')
If I open a secondary window with the local folder open, I can save changes and those are reflected in the remote container window. But due to the file system being set to read-only, I can't edit anything from within the remote container. Any ideas on why I am stuck in read-only?
One potentially important note is that I am using using Colima (version 0.2.2) rather than Docker Desktop, thought I haven't found anything to indicate that this would be an issue.

I found the answer to my own problem. Turns out the issue was using Colima as a runtime. I came across the discussion around issue #102 on the Colima Github page. According to the developer, the default mount "Used to be read-only, but changed to writable in version 0.3.0.". I was using v0.2.2.
I updated colima to the most recent version (v0.4.4) and it fixed the issue for me.

Related

Codenameone: working on one projekt on two computers impossible

When using the Codenameone Starter Project and placing it on our internal Cloud Server the project is working properly only on the Computer where it was first opened. How can we change that?
This is due to us trying to grab a lock on the checksum file and its failing probably due to it being held by another IDE. Typically this file shouldn't be shared and shouldn't be in version control: https://github.com/codenameone/CodenameOne/blob/master/CodenameOneDesigner/src/com/codename1/designer/css/CN1CSSCLI.java#L828
The file is called .cn1_css_checksums.

'clarinet integrate' quickly fails and nothing is logged to console?

Following https://docs.hiro.so/smart-contracts/devnet I can't get the command clarinet integrate to work. I have installed Docker on my mac and am running version 0.28.0 of clarinet. Running command within 'my-react-app/clarinet' where all clarity related files live (contracts, settings, tests, and Clarinet.toml).
My guess is it could be an issue with Docker?
The issue was that I downloaded my Devnet.toml file from a repo that was configured incorrectly. The configuration I needed was:
[network]
name = "devnet"
I increased the CPU and Memory in Docker as well.
There is an issue when the command attempts to spin up the stacks explorer, but I was informed that there are several existing issues with the stacks explorer from clarinet integrate at the moment.
Depending on how the last devnet was terminated, you could have some containers running. This issue should be fixed in the next incoming release, meanwhile, you'd need to terminate this stale containers manually.
Apart from Ludo's suggestions, I'd also look into your Docker resources. The default CPU/memory allocation should allow you to get started with Clarinet, but just in case, you could alter it to see if that makes a difference. Here's my settings for your reference:
Alternatively, to tease things out, you could reuse one of the samples (eg: hirosystems/stacks-billboard) instead of running your project. See if the sample comes up as expected; if it does, there could be something missing in your project.

How to (semi-)automatically sync local files with remote devcontainer?

My Goal
I've been using devcontainers in combination with WSL2 for a little while now. But I keep running into issues and besides that I like off-loading resources of my laptop to a server. Moving the containers to a native Linux server would solve my issues.
My ideal situation would be to have a solution that works just like working locally on my Windows laptop (later probably moving to Macbook) but using the facilities of a Linux server (which has systemd and netns) and moving the workload there as well so my laptop doesn't sound like a vacuum cleaner.
My Journey
I'm trying to setup remote containers as described here: https://code.visualstudio.com/remote/advancedcontainers/develop-remote-host
Actually the containers are running fine, I'm using the second storage solution what means I add the following to my .devcontainer.json:
"workspaceMount": "source=/home/marvink/code,target=/workspaces,type=bind,consistency=cached"
And my workflow currently looks something like this:
Clone project locally (with .devcontainer already in the project)
Add workspaceMount above to devcontainer.json
Clone project on remote (e.g. to /home/marvink/code/new-project)
Open project locally
Build and reopen in container
Work on the files on the remote
My issue
This works but now I have files on my local drive that never get touched which isn't ideal but not a disaster, the bigger issue is when I want to update the devcontainer. I need to do that locally (in a seperate window), manually need to copy paste that to the remote if I want to commit it to git and off-course I sometimes forget this and try to edit it remotely which is causing a lot of frustration (and sometimes it seems like it does use the remote config, but that might have been a mistake?).
This is why I want to setup rsync both ways to sync changes to files and as a bonus I can edit files locally when I'm offline. In the link it's described how to do it manually but I want it automated so that I can't forget or make mistakes.
From Powershell I'm able to run an rsync command that syncs one-way and I can extend that to sync 2-way:
wsl rsync -rlptzv --progress --exclude=.git '$PWD' 'marvink#s-dev01:~/code/new-project'
This needs to be ran locally but I can't find a way to do that. I'd need to run a task locally for example, but that isn't possibly when working on a remote (https://github.com/microsoft/vscode-remote-release/issues/168).
The other way around doesn't seem like an option to me as I don't want to expose any ports on my laptop and firewalls would get in the way depending on where I am.
My question
My workflow still seems a bit convoluted so I'm open to suggestions on that end but any ideas on how to sync my workspace files?
You don't need a local version of your code (containing the .devcontainer folder) if you're storing that code on the remote server. You should be able to open an ssh target in VScode using the Remote - SSH extension, which is the recommended approach in the link you added. The extension Remote - Containers 'stacks' on top of the SSH extension, so once connected over SSH you then connect to the container using the .devcontainer.json configuration located on your remote server.
If you don't want to use the extension and use a bind mount + specify docker.host in your settings.json file, you can sync code using the approaches in that same article, through SSHFS, docker machine, or rsync.

My installed WPF app is crashing while trying to create a file

I have a problem with my WPF application (a simple clicker game). I've just made a deployment/created a setup project using Microsoft Visual Studio Installer Projects extension for Visual Studio. Everything seemed to work fine, setup works good (tested on other computer) and furthermore the installed application almost works correctly. The only exception is a button calling function which is creating a new txt (something like a draft of a "save" file) file in a folder where the application is installed. Clicking this button cause instant crash of the whole application. Nothing else happens, no error message, the app just turns off.
I assume that the problem lies in access rights to the folder/administrator rights.
I've added txt file with the same name in the application folder using "File System" window in setup project, deployed and installed again. Even when the file exists the problem happend again (probably because of access rights when trying to override file content).
It's may be important that everything worked while running app through VS, also using .exe works fine on any computer. The problem is only with application installed using setup.
I'm not sure where the problem is so it's hard to show some code, to be honest i'm not even sure if it's a problem with code, maybe it can be solved with setting some setup project properties?
I would like to store some data locally between two sessions, i've choosed txt file because it's light and simple even if it's not the most elegant way.
I expect that installed application will be able to create and override txt file in it's folder.
P.S. if you need any code, screenshots or information about my setup please let me know in comments section, I will provide what's necessary
At the moment you install your program you're having administrator-rights. So the folder where your application is, also was created with administrator-rigths.
If you want to store data to this folder, you'll have to run your application as administrator. (not the best idea)
Otherwise you can change your code to write your file at runtime to a different location where you don't need administrator-rights.
For example:
string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
will give you: "C:\Users\MyUserName\AppData\Local"
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
will give you: "C:\Users\MyUserName\AppData\Roaming"
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
will give you: "C:\Users\MyUserName\Documents"
And some error-handling around the saving of the file would be very nice and helpful ;)
Thank you everyone for solution and knowledge, the problem was as I assumed (access to the path denied).
I was using this code to create a path:
Directory.GetCurrentDirectory() + "\\SyntyhCitySave.txt";
Creating a file in a special directory instead of application folder works, that's the solution for my problem:
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\SyntyhCitySave.txt";
Tomtom answer marked as accepted.

An Error Occurred While Downloading A Required File

I'm not sure if this is the right forum or not, since I have no idea what's causing this problem. I have a WPF application that was compiled into a setup project. After building the setup project, there are two files: setup.exe and [Program Name].msi. I put both files in the same directory in an ASP.NET website, served via IIS 7.5. Everything was working fine for about a week, until I started getting the error:
"An error occured while downloading a
required file. You may retry
downloading the file or cancel setup."
This happens when I click on a link on my website for the setup.exe file. After seeing this error, there's a tab labeled "Details" which I can click to display the message:
"An error occurred trying to download
'[website url for the .msi file]'. See
the setup log file located at
'C:\Users[username]\AppData\Local\Temp[some
alphanumeric
sequence].tmp\install.log' for more
information."
I looked at this file, but it just restates that there was a problem downloading the .msi file. Can anyone offer me some suggestions? I'm really stumped on this, and have no idea where to go...
Many thanks for the help!
Andrew
EDIT: This appears to be a problem with the computer that I'm downloading the program to. I tried downloading and installing the program on a different computer, and everything worked fine. Apparently, I must have changed some setting on my computer to cause this, although I'm not sure what that is...
So you're trying to download these files directly? Could the server be preventing the download of the .msi file type? How is the download taking place? Is it user initiated?
I was experiencing the same issue this morning and I finally figured out that it caused by either one (or both) of the following settings in IIS:
Compression: I had compression enabled for both static and dynamic files
Output Caching: I had bit Enable cache and Enable Kernel Cache enabled
I cleared all of the above check boxes and after that the setup.exe downloaded the MSI without a problem!
You connection was interrupted just try the preview command you type and also check your connection

Resources