cancel
Showing results for 
Search instead for 
Did you mean: 
OlegV
Sisense Team Member
Sisense Team Member

The error "cp: cannot create regular file '/usr/local/bin/kubectl': Text file busy" typically occurs when multiple upgrade processes are running simultaneously, causing a conflict when trying to update the kubectl binary.

 

 

 

[2024-10-30 12:33:34] Getting binaries kubectl (v1.30.3) and helm (v3.12.3)
[2024-10-30 12:33:34] Downloading them from the internet
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   138  100   138    0     0   1367      0 --:--:-- --:--:-- --:--:--  1380
100 49.0M  100 49.0M    0     0  3478k      0  0:00:14  0:00:14 --:--:-- 3525k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15.2M  100 15.2M    0     0  3730k      0  0:00:04  0:00:04 --:--:-- 3731k
linux-amd64/helm
cp: cannot create regular file '/usr/local/bin/kubectl': Text file busy
[2024-10-30 12:33:53] ** Error occurred during command sudo cp installer/05_post_infra/files/kubectl installer/05_post_infra/files/helm /usr/local/bin section **
[2024-10-30 12:33:53] ** Exiting Installation ... **

 

 

For example, in one case, the error occurred because multiple upgrades were happening on the same environment simultaneously (the same bastion for several cloud environments), which led to the Kubectl binary being in use by another upgrade process. The recommended solution is to check if any process is using Kubectl or Helm before proceeding with the upgrade.

Watching an upgrade with "kubectl ... -w" command can cause this issue also.

To prevent this error, it is advisable to:

  1. Ensure that no other upgrade or deployment processes are running in parallel.
  2. Use commands like lsof -t $(which kubectl) and lsof -t $(which helm) to check if these binaries are in use. If any command returns a PID, print out the process details using ps -ef | grep <pid number> and fail the pipeline if necessary.

By following these steps, you can avoid the "Text file busy" error and ensure a smooth upgrade process.

Rate this article:
Version history
Last update:
‎10-30-2024 01:36 PM
Updated by: