OpenVZ swap space error during install

./discourse-setup
WARNING: Discourse requires at least 2GB of swap when running with 2GB of RAM
or less. This system does not appear to have sufficient swap space.

Without sufficient swap space, your site may not work properly, and future
upgrades of Discourse may not complete successfully.

Ctrl+C to exit or wait 5 seconds to have a 2GB swapfile created.
2097152+0 records in
2097152+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 7.2644 s, 296 MB/s
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=6e02cc8b-b5af-412b-9121-3fc09f0055a0
swapon: /swapfile: swapon failed: Operation not permitted
/swapfile       swap    swap    auto      0       0
sysctl: permission denied on key 'vm.swappiness'
vm.swappiness = 10
Failed to create swap, sorry!

help me !!

root@CTR386846:/var/discourse# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
root@CTR386846:/var/discourse#

what is the Ram capacity ?
and host

you will have to create inough swap space

1 Like

CPU: Intel XEON E5645/X5650

  • Core: CPU 2 Core
  • Cloud storage: 25GB
  • RAM: 2.5GB

What flavour of VPS is this? My guess is that you’re using a provider that gives you a container instead of a VM.

Can you please run: apt-get install virt-what and send the output of virt-what?

4 Likes

root@CTR386846:/var/discourse# sudo virt-what
openvz

Confirmed: openvz is a container-based virtualization system, not a full server. You won’t be able to add swap or change sysctls.

Using docker may also not work. If not, I suggest a container from a provider such as Digitalocean.

5 Likes

Thank ! if i don’t create swap
=> help me setup discourse ?

Can you run: free -g --si and show the output? free -m --si as well?

We may not be handling systems with 2.5GB correctly. If you do have 2.5GB, you can cheat by making the following change on line 108 of discourse-setup and rerunning the installer:

--- old/discourse-setup
+++ new/discourse-setup
@@ -108,7 +108,7 @@ check_disk_and_memory() {
   if [ "$os_type" == "Darwin" ]; then
     avail_mem=$(check_osx_memory)
   else
-    avail_mem=$(check_linux_memory)
+    avail_mem=3
   fi
 
   if [ "$avail_mem" -lt 1 ]; then
4 Likes

i change discourse-setup and update

root@CTR386846:~# cd /var/discourse
root@CTR386846:/var/discourse# ./discourse-setup
-bash: ./discourse-setup: Permission denied
root@CTR386846:/var/discourse#

chmod -R 777 /var/discourse

is ok => thanh so much

Configuration file at containers/app.yml updated successfully!

Updates successful. Rebuilding in 5 seconds.
Device “docker0” does not exist.
Cannot connect to the docker daemon - verify it is running and you have access

real 0m0.063s
user 0m0.037s
sys 0m0.018s
root@CTR386846:/var/discourse#

help me ??

Configuration file at containers/app.yml updated successfully!

Updates successful. Rebuilding in 5 seconds.
Device “docker0” does not exist.
Cannot connect to the docker daemon - verify it is running and you have access

real 0m0.038s
user 0m0.012s
sys 0m0.013s
root@CTR386846:/var/discourse# service docker restart
Job for docker.service failed because the control process exited with error code. See “systemctl status docker.service” and “journalctl -xe” for details.
root@CTR386846:/var/discourse#
root@CTR386846:/var/discourse#

This is a terrible idea. Next server, chmod the script to 755.

Your VPS does not support docker. I suggest a full VM from a different provider.

7 Likes