unable to add swap to codespace: swapon failed: operation not permitted #39481
Replies: 4 comments 2 replies
-
I'm encountering the same as you, but on the minimum size, 4GB, machine type. Just so you know you aren't alone! Perhaps Github is blocking swapfiles, since a lot of codespaces are free essentially. |
Beta Was this translation helpful? Give feedback.
-
I needed to add some swap to my codespace as well and stumbled upon this thread. The problem is |
Beta Was this translation helpful? Give feedback.
-
Please consider creating a swap file on $ findmnt /tmp
/tmp /dev/sda1[/containerTmp] ext4 rw,relatime Example entry script if [[ $(id -u) != 0 ]]; then
srcpath="$(realpath "$0")"
exec sudo bash "$srcpath" "$@"
fi
cat > /tmp/mkswap.sh << 'EOF'
dd if=/dev/zero bs=1M of=/tmp/swapfile count=2K
chmod 644 /tmp/swapfile
mkswap /tmp/swapfile
swapon /tmp/swapfile
EOF
bash /tmp/mkswap.sh & disown
exec "$@" |
Beta Was this translation helpful? Give feedback.
-
@memchr same.. not permitted. |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Bug
Body
I have a codespace with 64GB of RAM. Sometimes the ram is full and my development server is killed. One solution that I found was to use a swap file.
I tried to follow the instructions on how to set a swapfile. but it fails when I try to activate the swap file.
Beta Was this translation helpful? Give feedback.
All reactions