Why Rsync is not available and can not be installed?

Hello,
I’m currently trying to rsync my project folders cloned into runner with my production server but I get the following error message within runner:

$ rsync -vrt -----source --- destination ------
/bin/bash: line 67: rsync: command not found

I neither can use rsync nor install it because

$ apt install rsync

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package rsync is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'rsync' has no installation candidate
ERROR: Job failed: exit code 1 

I see from other topics that people use rsync within runners without problems.
Why I can not?

I finally got it working after explicit update:

  • apt-get update -y
  • apt-get -y install rsync

May be this info will be usefull for someone else.

Hi -
I tried this but my script still executes apt-get install rsync with each run. Please help me understand what I am doing wrong.

I also posted a new question but no response. New Question Link

Here is the yml
before_script:

- …

  • ‘which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )’
  • mkdir -p ~/.ssh
  • eval $(ssh-agent -s)
  • ‘[[ -f /.dockerenv ]] && echo -e “Host *\n\tStrictHostKeyChecking no\n\n” > ~/.ssh/config’
  • export PATH=$PATH:/usr/bin
  • which rsync || ( apt-get update -y && apt-get install rsync -y )

Hi, PiyushRamuka.
I was using shared runner and I think it is normal behaviour. Each time runner served my task it maked fresh install of all software mentioned in my script so I never minded it.
I didn’t install runner to local machine so I can not advise.

For some reason I was assuming this was not normal hence was curious.
Thanks @olegbolden for your response.