scp-action
scp-action copied to clipboard
drone-scp error: error copy file to dest: ***, error message: Process exited with status 142
See logs:
Run appleboy/scp-action@master
with:
source: .
target: /var/www/data
port: 22
timeout: 30s
command_timeout: 10m
use_insecure_cipher: false
rm: false
debug: false
strip_components: 0
overwrite: false
proxy_port: 22
proxy_timeout: 30s
proxy_use_insecure_cipher: false
env:
HOST: ***
USERNAME: ***
KEY: ***
/usr/bin/docker run --name e28490203383e4abf4401eb8983ad2d069cbb8_d83965 --label e28490 --workdir /github/workspace --rm -e HOST -e USERNAME -e KEY -e INPUT_SOURCE -e INPUT_TARGET -e INPUT_HOST -e INPUT_PORT -e INPUT_USERNAME -e INPUT_PASSWORD -e INPUT_TIMEOUT -e INPUT_COMMAND_TIMEOUT -e INPUT_KEY -e INPUT_KEY_PATH -e INPUT_PASSPHRASE -e INPUT_FINGERPRINT -e INPUT_USE_INSECURE_CIPHER -e INPUT_RM -e INPUT_DEBUG -e INPUT_STRIP_COMPONENTS -e INPUT_OVERWRITE -e INPUT_TAR_TMP_PATH -e INPUT_PROXY_HOST -e INPUT_PROXY_PORT -e INPUT_PROXY_USERNAME -e INPUT_PROXY_PASSWORD -e INPUT_PROXY_PASSPHRASE -e INPUT_PROXY_TIMEOUT -e INPUT_PROXY_KEY -e INPUT_PROXY_KEY_PATH -e INPUT_PROXY_FINGERPRINT -e INPUT_PROXY_USE_INSECURE_CIPHER -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/data/data":"/github/workspace" e28490:203383e4abf4401eb8983ad2d069cbb8
tar all files into /tmp/116532002/btkjHJuSID.tar
scp file to server.
drone-scp error: error copy file to dest: ***, error message: Process exited with status 142
2021/11/11 09:16:15 error copy file to dest: ***, error message: Process exited with status 142
This is config:
name: dashboard-backend
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deployment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Copy file via scp
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
KEY: ${{ secrets.SSHKEY }}
with:
source: "."
target: "/var/www/data"
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
script: |
whoami
cd /var/www/data
sh run_prod.sh
Can you please confirm that? I am not clear what is the issue?
HI, I have the same issue. It happens randomly some of the time. Did you find any workaround?
Even I am facing the same issue. It works fine on some of the repositories but failing on some of the repos. Is there any workaround to bypass this error?
also having the same, has someone a solution maybe?
The wrong username was the cause of error 142 for me
I can confirm that something seems to be borken with drone-scp
. I tested copying a file from my local machine using scp
and it worked without an issue:
▲ scp -i .github/ssh -P 2222 ./README.md [email protected]:var/www/htdocs/bla/md.bla
README.md 100% 35 0.1KB/s 00:00
However, the same command using drone-scp
fails for no obvious reasons:
▲ drone-scp --key-path .github/ssh --source ./README.md --host 10.10.10.10 --port 2222 --username github --target "var/www/htdocs/bla/md2.bla" --debug
tar all files into /tmp/4153233841/SjyPdcPsRK.tar
$ tar -cf /tmp/4153233841/SjyPdcPsRK.tar ./README.md
scp file to server.
drone-scp error: error copy file to dest: 10.10.10.10, error message: Process exited with status 1
2022/08/15 17:05:18 error copy file to dest: 10.10.10.10, error message: Process exited with status 1
On thing that I thought would fix this was the tar
command on the other end, that is a UNIX tar
, which I linked to gtar
(GNU tar
). I additionally set up a .kshrc
file for the github
user that contains alias tar=gtar
, just to make sure.
Judging from the output it doesn't look like the tar
on the other side seems to be the issue. If that was the case, the debug output should at least inform that drone-scp
is about to untar the file, judging by this code:
https://github.com/appleboy/drone-scp/blob/55cde9a13c845717500791c4fcbc0a7305fcb660/plugin.go#L349
To me it seems that the ssh
command fails.
Any news? @appleboy
Same issue, appeared last week.
I had a chance to deal with that error today, so guys, possible causes of the error:
- scp do not create a folder by itself, so be sure your target folder exist;
- the storage is full;
- user's insufficient permissions in target directory;
- your user does not have a home directory (most likely the action first scps the file into the user's home directory, and then performs a move);
the last one worked for me.
Hope this helps, good luck everyone! 🤟
I had a chance to deal with that error today, so guys, possible causes of the error:
- scp do not create a folder by itself, so be sure your target folder exist;
- the storage is full;
- user's insufficient permissions in target directory;
- your user does not have a home directory (most likely the action first scps the file into the user's home directory, and then performs a move);
the last one worked for me.
Hope this helps, good luck everyone! 🤟
All of the above aren't true in my case
i just fixed this by using ftp instead of scp... maybe this works for you, too? Here an example how i do this:
- name: copy files to server
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.HOST}}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: ./yourDir/
server-dir: /yourRemoteDir/
security: loose
protocol: ftps
- name: configure stuff
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSH_KEY }}
script: |
cd /home/github/ftp/upload/yourRemoteDir
tar -xf ./yourFile.tar
for this i create a ftp user with the name github and giv them only some rights to write within the ftp/upload directory and after that i connect via ssh to the server, extract the files and then do some stuff ^^
I fixed this by literally using an action with manual SCP commands. No idea what this action does to cause that bug.
I will take it.
Hi All,
Please try the master
version and report any bugs.
Not working yet on master @appleboy, I've tried with v0.1.4 too
Looks like the same errors with drone-scp
tar all files into /tmp/WXLivlleQw.tar.gz scp file to server. 20[23](https://github.com/matheusfischer0/myfit-server/actions/runs/4781385964/jobs/8499794844#step:8:24)/04/[24](https://github.com/matheusfischer0/myfit-server/actions/runs/4781385964/jobs/8499794844#step:8:25) 01:03:38 error copy file to dest: ***, error message: Process exited with status 1 drone-scp error: error copy file to dest: ***, error message: Process exited with status 1
@matheusfischer0 Please post your config.
Here @appleboy
- name: Copy to instance via SSH (EC2)
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
source: "., !node_modules"
target: "~/app/myfit-server"
Any news @appleboy ?
Any news @appleboy ?
I am thinking about how to replicate the environment. Just relying on this error message, I can't find the real point of the problem. @matheusfischer0
same problem
same problem I think the problem is /var/www does not exist on my machine or my user does not have root permission I just add a normal user or Could not chdir to home directory /home/my user name: No such file or directory
jobs:
deploy_to_server:
name: Deploying to Server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: copy file via ssh password
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: ./
target: /var/www/app
update with this it work for me what I do and fixed for me I add my user to the sudo er but did not success I try to add manually /var/www/app folder and test it not work ( think due to permission) so i go to some public places
sudo mkdir /home/my_user_name
sudo chown -R my_user_name:my_user_name /home/my_user_name
sudo chmod 700 /home/my_user_name
sudo usermod -d /home/my_user_name my_user_name
sudo mkdir /home/my_user_name sudo chown -R my_user_name:my_user_name /home/my_user_name sudo chmod 700 /home/my_user_name sudo usermod -d /home/my_user_name my_user_name
then I change the location where I send my file instead of /var/www/app to /home/my_user_name/app and before using scp i create the folder with connecting by ssh and send this command
make_dir_for_app:
name: Make a directory for the app
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
rm -r /home/my_user_name/app
mkdir -p /home/my_user_name/app
chmod 755 /home/my_user_name/app
cd /home/my_user_name/app
ls -la
update2 does not need this ssh and create a folder too if your permission is correct scp can create the folder my final config is
deploy_to_server:
name: Deploying to Server
# needs: [make_dir_for_app]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
with:
since_last_remote_commit: true
separator: ","
- name: copy file via ssh password
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: ./
target: /home/${{ secrets.USERNAME }}/app
@appleboy it's not a bug from your side and it's a server config problem
I encountered this issue where I was unable to copy files to a remote server via SCP. Initially, after confirming that permissions were not the problem, I sought to diagnose the issue further. I decided to use the df
command to inspect the disk space utilization, and it turned out that there was very little free disk space left.
Subsequently, I used the command find / -type f -size +100M -exec du -h {} \;
to identify which files were consuming a significant amount of space. I discovered several unnecessary files, which I promptly deleted. After performing this cleanup, I attempted the SCP copying operation again, and this time it succeeded.
2023/09/27 03:03:02 error copy file to dest: ******, error message: Process exited with status 1 drone-scp error: error copy file to dest: ******, error message: Process exited with status 1
The issue arose because my host disk was full. After I cleared some space on my hard disk, it worked normally.
2023/09/27 03:03:02 error copy file to dest: ******, error message: Process exited with status 1 drone-scp error: error copy file to dest: ******, error message: Process exited with status 1
The issue arose because my host disk was full. After I cleared some space on my hard disk, it worked normally.
Can you please tell me how you cleared the space?
2023/09/27 03:03:02 error copy file to dest: ******, error message: Process exited with status 1 drone-scp error: error copy file to dest: ******, error message: Process exited with status 1
The issue arose because my host disk was full. After I cleared some space on my hard disk, it worked normally.
Can you please tell me how you cleared the space?
You can look at my comments above