dotnet-install.sh fail with a `Text file busy` error when dotnet process is running in background
See original GitHub issueSteps to reproduce
run dotnet-install.sh on linux while a background dotnet process is running (for example background compiler)
Expected behavior
dotnet-install.sh should succeed
Actual behavior
dotnet-install.sh will fail during the cp -R
phase with a Text file busy
error:
dotnet-install.sh -c master -i ~/dotnet/
dotnet-install: Downloading link: https://dotnetcli.azureedge.net/dotnet/Sdk/3.0.100-preview7-012601/dotnet-sdk-3.0.100-preview7-012601-linux-x64.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/3.0.100-preview7-012601/dotnet-sdk-3.0.100-preview7-012601-linux-x64.tar.gz
cp: cannot create regular file '/home/dmg/dotnet/dotnet': Text file busy
This is pretty common in Unix, and normally, to avoid this, most installers (such as dpkg, for example) will first remove the file (delete it) only then copy a new file instead of it.
I will submit a PR for this, I just wanted to report this separately and close via PR
Environment data
dotnet --info
output:
.NET Core SDK (reflecting any global.json): Version: 3.0.100-preview7-012601
Commit: 6fedcd8ebd
Runtime Environment:
OS Name: ubuntu
OS Version: 19.04 OS Platform: Linux
RID: ubuntu.19.04-x64
Base Path: /home/dmg/dotnet/sdk/3.0.100-preview7-012601/
Host (useful for support):
Version: 3.0.0-preview7-27824-03 Commit: e1d780539e
.NET Core SDKs installed: 2.1.700 [/home/dmg/dotnet/sdk]
3.0.100-preview6-012264 [/home/dmg/dotnet/sdk]
3.0.100-preview7-012601 [/home/dmg/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.10 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.11 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.10 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0-preview6.19307.2 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview7.19324.10 [/home/dmg/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.10 [/home/dmg/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.11 [/home/dmg/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview6-27804-01 [/home/dmg/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview7-27824-03 [/home/dmg/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Error the process cannot access the file because it is being ...
I got following error while running dotnet build command on my .NET Core project. C:\Program Files\dotnet\sdk\2.1.2\Microsoft.Common.
Read more >Troubleshoot .NET tool usage issues
When a .NET tool fails to run, most likely you ran into one of the following issues: The executable file for the tool...
Read more >epm_install_troubleshooting_11...
This guide provides troubleshooting tips for installing and configuring Oracle Enterprise. Performance Management System products.
Read more >PowerShell Team
for dotnet. Setting the environment variable DOTNET_ROOT to the install location, enables pythonnet a way find the assemblies and other support files to...
Read more >Net | PDF | Xml | Microsoft Visual Studio
If you receive an error message similar to Unable to locate package {dotnet-package} or Some packages could not be installed , run the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think the issue is with: https://github.com/dotnet/cli/blob/7a96d9cb1a40d80b9ec99181fdd0fbb9458a94b9/scripts/obtain/dotnet-install.sh#L615
When I run the script with bash -x it’s clear it’s performing something like:
This will fail if there is a
dotnet
process running…The proper way to handle this would be to change the command like from
cp -R ...
tocp -R --remove-destination
Would you be interested in a PR for this?
@damageboy yeah, I submitted dotnet/cli#11974 to fix this