From 3adaec1210d8df09d00ed5d97d0bab31f228ecc1 Mon Sep 17 00:00:00 2001 From: Tagada <36127788+Tagadda@users.noreply.github.com> Date: Mon, 25 Sep 2023 14:13:16 +0200 Subject: [PATCH] Don't swap when running on a LXC --- scripts/ynh_add_swap | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/ynh_add_swap b/scripts/ynh_add_swap index d7ec44b..133cdc9 100644 --- a/scripts/ynh_add_swap +++ b/scripts/ynh_add_swap @@ -19,6 +19,13 @@ ynh_add_swap () { SD_CARD_CAN_SWAP=${SD_CARD_CAN_SWAP:-0} + # Can't swap inside an LXD + if [ "$(systemd-detect-virt)" == "lxc" ] + then + ynh_print_warn --message="You are inside a LXC container, swap will not be added, but that can cause troubles for the app $app. Please make sure you have more than $size M available RAM." + return + fi + # Swap on SD card only if it's is specified if ynh_is_main_device_a_sd_card && [ "$SD_CARD_CAN_SWAP" == "0" ] then