pierotofy / set-swap-space

GitHub Action to Increase Swap Space on GitHub Runners
47 stars 12 forks source link

swapoff: bad usage #3

Open xoiga123 opened 1 year ago

xoiga123 commented 1 year ago
Run pierotofy/set-swap-space@master
  with:
    swap-size-gb: 100
Run echo "Memory and swap:"
  echo "Memory and swap:"
  free -h
  echo
  swapon --show
  echo
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
Memory and swap:
               total        used        free      shared  buff/cache   available
Mem:            31Gi       642Mi        28Gi       7.0Mi       2.5Gi        30Gi
Swap:             0B          0B          0B

Run export SWAP_FILE=$(swapon --show=NAME | tail -n 1)
  export SWAP_FILE=$(swapon --show=NAME | tail -n 1)
  sudo swapoff $SWAP_FILE
  sudo rm $SWAP_FILE
  sudo fallocate -l 100G $SWAP_FILE
  sudo chmod 600 $SWAP_FILE
  sudo mkswap $SWAP_FILE
  sudo swapon $SWAP_FILE
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
swapoff: bad usage
Try 'swapoff --help' for more information.
Error: Process completed with exit code 16.

Only happens on a large runner (ubuntu-latest-8-cores), works fine on regular runners (ubuntu-latest).

xoiga123 commented 1 year ago

@pierotofy Sorry for pinging. Seems like the large runners doesn't have a swap file yet, similar to github codespaces. I can't figure out how to create a swapfile in /tmp like a commented suggested though.

nicoabie commented 1 year ago

this fails for buildjet-4vcpu-ubuntu-2204-arm too

tboerger commented 1 year ago

Since there haven't been any fix within this repository I have simply created my own version of an action, you can see it at https://github.com/actionhippie/swap-space

dkocich commented 9 months ago

this error message appeared to me today on ubuntu-latest after a few previous successful passes in my action...

shufps commented 3 weeks ago

Problem is that the action doesn't work on systems that don't have enabled swap when running the action.

export SWAP_FILE=$(swapon --show=NAME | tail -n 1)
sudo swapoff $SWAP_FILE
...

the SWAP_FILE is then empty and swapoff with empty variable doesn't work.