AIO PostgreSQL could not resize shared memory segment

I’m currently running Nextcloud AIO v4.6.2 and keep getting this error in my log. Is it normal?

“2023-03-27 22:51:18.684 EDT [3512] ERROR: could not resize shared memory segment “/PostgreSQL.1774270334” to 33554432 bytes: No space left on device”

A quick search on stackoverflow shows that this is likely caused by the 64MB default shared memory limit for docker containers. However, since the docker containers are controlled by the aio, the suggestion solutions in stackoverflow doesn’t apply.

I currently mitigated this problem by changing the docker default shared memory size following this stackoverflow post, i.e.

  1. Stop all containers and AIO
  2. Edit /etc/docker/daemon.json to {"default-shm-size" : "512M"}
  3. Reload docker deamon: systemctl restart docker
  4. Remove old databse container: docker container rm nextcloud-aio-database
  5. Restart AIO and containers
  6. Verify shared memory size: docker inspect nextcloud-aio-database | grep -i shm

Hi, may I ask how big your database is currently?

Hi @szaimen, the size of my /var/lib/docker/volumes/nextcloud_aio_database is 3.0GB

Thanks! It looks like the docs recommend 256MB: Notes on --shm-size for Postgres by wglambert · Pull Request #1331 · docker-library/docs · GitHub

Hi @szaimen, good to know that 256MB was the recommended size. Is it possible to make this value the default for AIO? Or is there a way user can customize specific containers in AIO, beside my current hack which modifies the global default?

Just on a related note, a good resource:

Yes, we’ll make it the default in a future update.

This is now improved with v4.8.0 Beta. Testing and feedback is welcome! See GitHub - nextcloud/all-in-one: Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.