LXC 4.0.9 : lxc-start - failed to pin rootfs

Hi All,
I got an error (failed to pin rootfs) with the command lxc-start (lxc 4.0.9) using the squashfs file.
I’d like to migrate my configuration from LXC 2.X to LXC 4.0.
Has anyone ever had this error ?
Please, someone could help me.
Many thanks.
Kim

Extract of log file

lxc-start JIZOM_DB.CT 20210604093439.301 INFO lsm - lsm/lsm.c:lsm_init_static:40 - Initialized LSM s
ecurity driver nop
lxc-start JIZOM_DB.CT 20210604093439.301 INFO conf - conf.c:run_script_argv:333 - Executing script "
/sbin/pre-start.sh" for container “JIZOM_DB.CT”, config section “lxc”
lxc-start JIZOM_DB.CT 20210604093439.406 DEBUG terminal - terminal.c:lxc_terminal_peer_default:672 - Using terminal “/dev/tty” as proxy
lxc-start JIZOM_DB.CT 20210604093439.406 DEBUG terminal - terminal.c:lxc_terminal_winsz:61 - Set window size to 104 columns and 54 rows
lxc-start JIZOM_DB.CT 20210604093439.407 INFO start - start.c:lxc_init:855 - Container “JIZOM_DB.CT” is initialized
lxc-start JIZOM_DB.CT 20210604093439.407 INFO cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1070 -
The monitor process uses “lxc.monitor.JIZOM_DB.CT” as cgroup
lxc-start JIZOM_DB.CT 20210604093439.408 DEBUG storage - storage/storage.c:storage_query:233 - Detected rootfs type “dir”
lxc-start JIZOM_DB.CT 20210604093439.408 ERROR conf - conf.c:lxc_rootfs_init:581 - Read-only file system - Failed to pin rootfs
lxc-start JIZOM_DB.CT 20210604093439.408 ERROR start - start.c:__lxc_start:2045 - Failed to handle rootfs pinning for container “JIZOM_DB.CT”

My config file
lxc.net.0.type = veth
lxc.net.0.link = brBDD
lxc.net.0.veth.pair = vJIZOM_DB
lxc.net.0.hwaddr = 00:FF:AA:BB:03:06
lxc.net.0.ipv4.address = 10.0.3.6/24
lxc.net.0.ipv4.gateway = 10.0.3.254
lxc.net.0.flags = up
lxc.net.0.name = eth0

mount points

lxc.rootfs.path = /mnt/ct_mount
lxc.hook.pre-start = /sbin/pre-start.sh
lxc.mount.fstab = /opt/CTs/JIZOM_DB.CT/fstab

Common configuration

lxc.include = /usr/share/lxc/config/sesame.common.conf

Container specific configuration

lxc.uts.name = JIZOM_DB.CT
lxc.arch = amd64

drop capabilities

lxc.cap.drop =
lxc.cap.keep = setgid setuid dac_override sys_admin

cat /sbin/pre-start.sh
#!/bin/bash

echo “arguments: $*” > /tmp/pre-start.txt
echo "environment: " >> /tmp/pre-start.txt
env | grep LXC >> /tmp/pre-start.txt

mount -o loop,ro -t squashfs /opt/BASES/JIZOM_DB.sqsh ${LXC_ROOTFS_PATH}

ls /mnt/ct_mount
bin debootstrap etc lib lib64 mnt root sbin tmp var
boot dev home lib32 libx32 proc run sys usr

Ah yes, we fixed that in

commit e859a5ee2cdee5111185a6a629f891aa40b2ffd6
Author: Wei Mingzhi <weimingzhi@baidu.com>
Date:   Tue May 18 20:37:52 2021 +0800

    Skip rootfs pinning for read-only file system.

    Signed-off-by: Wei Mingzhi <weimingzhi@baidu.com>

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 7a248c268..4b427c08d 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -573,8 +573,12 @@ int lxc_rootfs_init(struct lxc_conf *conf, bool userns)
                         PROTECT_OPEN | O_CREAT,
                         PROTECT_LOOKUP_BENEATH,
                         S_IWUSR | S_IRUSR);
-       if (fd_pin < 0)
+       if (fd_pin < 0) {
+               if (errno == EROFS) {
+                       return log_trace_errno(0, EROFS, "Not pinning on read-only filesystem");
+               }
                return syserror("Failed to pin rootfs");
+       }

        TRACE("Pinned rootfs %d(.lxc_keep)", fd_pin);

So you either need to backport this or wait until we release 4.0.10.

Hi,
Many thanks for your response.
Best regards,
kim

Hi,
Do you know about the release date of LXC 4.0.10
Thanks & regards,
Kim

@stgraber any concrete plans yet?

As we’ve not had any requests from packagers directly, I’m currently aiming for early July.