How to migrate my config file from LXC 2.X to 4.0.9

Hi All,
Please, could you give the good way to migrate my config file from LXC 2.X to 4.0.9.
Thanks & regards,
Kim

**My LXC 2.X config file **
lxc.network.type = veth
lxc.network.link = brBDD
lxc.network.veth.pair = vIDS_RULES_DB
lxc.network.hwaddr = 00:FF:AA:BB:03:06
lxc.network.ipv4.address = 10.0.3.6/24
lxc.network.ipv4.gateway = 10.0.3.254
lxc.network.flags = up
lxc.network.name = eth0

lxc.rootfs.path = /opt/BASES/BASE_DB.sqsh
lxc.mount.options = defaults,ro,nodev
lxc.rootfs = /mnt/ct_mount
lxc.hook.pre-mount = /sbin/base_bdd_hook.sh

lxc.mount.fstab = /opt/CTs/IDS_RULES_DB.CT/fstab

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

lxc.utsname = IDS_RULES_DB.CT
lxc.arch = amd64

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

base_bdd_hook.sh
mount -o loop,ro -t /opt/BASES/BASE_DB.sqsh ${LXC_ROOTFS_PATH}

Did you run lxc-update-config?

Hi,
Many thanks for your reply.
My config file is below after running lxc-update-config
And i got some errors, may be it’s due to lxc.rootfs.path ?

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

lxc.rootfs.path = /opt/BASES/JIZOM_DB.sqsh

lxc.rootfs.options = defaults,ro,nodev
lxc.rootfs.path = dir:/mnt/ct_mount

lxc.hook.pre-mount = /sbin/base_bdd_hook.sh

lxc.mount.fstab = /opt/CTs/JIZOM_DB.CT/fstab

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

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

Extract from log file

lxc-start JIZOM_DB.CT 20210607141213.408 INFO conf - conf.c:mount_autodev:1247 - Prepared “/dev”
lxc-start JIZOM_DB.CT 20210607141213.408 DEBUG conf - conf.c:lxc_mount_auto_mounts:730 - Invalid argument - Tried to ensure procfs is unmounted
lxc-start JIZOM_DB.CT 20210607141213.408 DEBUG conf - conf.c:lxc_mount_auto_mounts:745 - Invalid argument - Tried to ensure sysfs is unmounted
lxc-start JIZOM_DB.CT 20210607141213.412 ERROR utils - utils.c:safe_mount:1198 - No such file or directory - Failed to mount “/usr/local/lib/lxc/rootfs/var/IPCs/JIZOM_DB.CT” onto “/usr/local/lib/lxc/rootfs/var/JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210607141213.413 ERROR conf - conf.c:mount_entry:2116 - No such file or directory - Failed to mount “/usr/local/lib/lxc/rootfs/var/IPCs/JIZOM_DB.CT” on “/usr/local/lib/lxc/rootfs/var/JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210607141213.413 ERROR conf - conf.c:setup_mount_fstab:2483 - Failed to set up mount entries
lxc-start JIZOM_DB.CT 20210607141213.413 ERROR conf - conf.c:lxc_setup:3645 - Failed to setup mounts
lxc-start JIZOM_DB.CT 20210607141213.416 ERROR start - start.c:do_start:1265 - Failed to setup container “JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210607141213.423 ERROR sync - sync.c:sync_wait:36 - An error occurred in another process (expected sequence number 5)
lxc-start JIZOM_DB.CT 20210607141213.423 DEBUG network - network.c:lxc_delete_network:4180 - Deleted network devices
lxc-start JIZOM_DB.CT 20210607141213.423 ERROR start - start.c:__lxc_start:2073 - Failed to spawn container “JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210607141213.423 WARN start - start.c:lxc_abort:1022 - No such process - Failed to send SIGKILL to 2059
lxc-start JIZOM_DB.CT 20210607141213.444 INFO conf - conf.c:run_script_argv:333 - Executing script “/usr/share/lxcfs/lxc.reboot.hook” for container “JIZOM_DB.CT”, config section “lxc”
lxc-start JIZOM_DB.CT 20210607141213.957 ERROR lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start JIZOM_DB.CT 20210607141213.957 ERROR lxc_start - tools/lxc_start.c:main:314 - Additional information can be obtained by setting the --logfile and --logpriority options

lxc-start JIZOM_DB.CT 20210607141213.413 ERROR conf - conf.c:mount_entry:2116 - No such file or directory - Failed to mount “/usr/local/lib/lxc/rootfs/var/IPCs/JIZOM_DB.CT” on “/usr/local/lib/lxc/rootfs/var/JIZOM_DB.CT”

What’s in your lxc.mount.fstab?

my fstab

var/IPCs/JIZOM_DB.CT var/JIZOM_DB.CT none bind,rw,relative,noexec,nosuid,nodev 0 2
var/IPCs/LOG_DB.CT var/LOG_DB.CT none bind,rw,relative,noexec,nosuid,nodev 0 2

var/TMP_DB/TMP_JIZOM_DB.CT tmp none bind,rw,relative,noexec,nosuid,nodev 0 2
data/JIZOM_DB.CT/DATADIR var/lib/mysql none bind,rw,relative,noexec,nosuid,nodev 0 2
data/JIZOM_DB.CT/LOGERROR var/log/mysql none bind,rw,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/MAC opt/mac none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/SCRIPT opt/script none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/DB_CONF opt/db_conf none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/LAUNCHER opt/launcher none bind,ro,relative,nosuid,nodev 0 2
/opt/NEVERDIE_DB opt/neverdie none bind,ro,relative,nosuid,nodev 0 2
/opt/LIB_MODULE opt/lib none bind,ro,relative,nosuid,nodev 0 2
/opt/CONFIGURATION opt/sqlite none bind,ro,relative,nosuid,nodev 0 2

/opt/LOCALTIME mnt/LOCALTIME none bind,ro,relative,nosuid,nodev 0 2

The ones without leading slashes are the issues most likely.

If you don’t have a leading slash, it tells LXC to bind-mount from within the container’s rootfs instead of bind-mounting from the host.

I deleted the leading slash for testing … Now i got some errors below

lxc-start JIZOM_DB.CT 20210607144834.701 ERROR utils - utils.c:safe_mount:1198 - No such file or directory - Failed to mount “/usr/local/lib/lxc/rootfs//var/IPCs/JIZOM_DB.CT” onto “/usr/local/lib/lxc/rootfs/var/JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210607144834.702 ERROR conf - conf.c:mount_entry:2116 - No such file or directory - Failed to mount “/usr/local/lib/lxc/rootfs//var/IPCs/JIZOM_DB.CT” on “/usr/local/lib/lxc/rootfs/var/JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210607144834.702 ERROR conf - conf.c:setup_mount_fstab:2483 - Failed to set up mount entries
lxc-start JIZOM_DB.CT 20210607144834.703 ERROR conf - conf.c:lxc_setup:3645 - Failed to setup mounts
lxc-start JIZOM_DB.CT 20210607144834.703 ERROR start - start.c:do_start:1265 - Failed to setup container “JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210607144834.706 ERROR sync - sync.c:sync_wait:36 - An error occurred in another process (expected sequence number 5)
lxc-start JIZOM_DB.CT 20210607144834.706 DEBUG network - network.c:lxc_delete_network:4180 - Deleted network devices
lxc-start JIZOM_DB.CT 20210607144834.706 ERROR start - start.c:__lxc_start:2073 - Failed to spawn container “JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210607144834.706 WARN start - start.c:lxc_abort:1022 - No such process - Failed to send SIGKILL to 2325
lxc-start JIZOM_DB.CT 20210607144834.717 INFO conf - conf.c:run_script_argv:333 - Executing script “/usr/share/lxcfs/lxc.reboot.hook” for container “JIZOM_DB.CT”, config section “lxc”
lxc-start JIZOM_DB.CT 20210607144835.226 ERROR lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start JIZOM_DB.CT 20210607144835.226 ERROR lxc_start - tools/lxc_start.c:main:314 - Additional information can be obtained by setting the --logfile and --logpriority options

Other way around, they should all have leading slash.

Hi,
Many thanks. It works …
FYI, with the version 2.X, we didn’t add the leading slash on the dir column.
Kim

Yeah, that was a bug :slight_smile:

Hi,

My config was below working fine with LXC 2.0.7

lxc.rootfs.path = /opt/BASES/BASE_DB.sqsh
lxc.mount.options = defaults,ro,nodev
lxc.rootfs = /mnt/ct_mount
lxc.hook.pre-mount = /sbin/base_bdd_hook.sh
lxc.mount.fstab = /opt/CTs/IDS_RULES_DB.CT/fstab

Could you confirm that it should be as below for LXC 4.0.9 ?
It seems LXC didn’t read my fstab !!!

lxc.rootfs.path = /opt/BASES/JIZOM_DB.sqsh
lxc.rootfs.options = defaults,ro,nodev
lxc.rootfs.path = dir:/mnt/ct_mount
lxc.hook.pre-mount = /sbin/base_bdd_hook.sh
lxc.mount.fstab = /opt/CTs/JIZOM_DB.CT/fstab

Thanks

Hi,
Please see below extract from the log file
Many thanks.

lxc-start JIZOM_DB.CT 20210609152540.726 INFO conf - conf.c:mount_autodev:1187 - Preparing “/dev”
lxc-start JIZOM_DB.CT 20210609152540.730 DEBUG conf - conf.c:mount_autodev:1217 - Using mount options: size=500000,mode=755
lxc-start JIZOM_DB.CT 20210609152540.730 INFO conf - conf.c:mount_autodev:1247 - Prepared “/dev”
lxc-start JIZOM_DB.CT 20210609152540.731 DEBUG conf - conf.c:lxc_mount_auto_mounts:730 - Invalid argument - Tried to ensure procfs is unmounted
lxc-start JIZOM_DB.CT 20210609152540.731 DEBUG conf - conf.c:lxc_mount_auto_mounts:745 - Invalid argument - Tried to ensure sysfs is unmounted
lxc-start JIZOM_DB.CT 20210609152540.731 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/var/JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/var/LOG_DB.CT”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/tmp”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/var/lib/mysql”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/var/log/mysql”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/mac”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/script”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/db_conf”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/launcher”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/neverdie”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/lib”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/sqlite”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/mnt/LOCALTIME”

Hi All,

My config was below working fine with LXC 2.0.7

lxc.rootfs.path = /opt/BASES/BASE_DB.sqsh
lxc.mount.options = defaults,ro,nodev
lxc.rootfs = /mnt/ct_mount
lxc.hook.pre-mount = /sbin/base_bdd_hook.sh
lxc.mount.fstab = /opt/CTs/IDS_RULES_DB.CT/fstab

Could you confirm that it should be as below for LXC 4.0.9 ?
It seems LXC didn’t read my fstab !!!

lxc.rootfs.path = /opt/BASES/JIZOM_DB.sqsh
lxc.rootfs.options = defaults,ro,nodev
lxc.rootfs.path = dir:/mnt/ct_mount
lxc.hook.pre-mount = /sbin/base_bdd_hook.sh
lxc.mount.fstab = /opt/CTs/JIZOM_DB.CT/fstab

Thanks

Hi,
Please see below extract from the log file
Many thanks.

lxc-start JIZOM_DB.CT 20210609152540.726 INFO conf - conf.c:mount_autodev:1187 - Preparing “/dev”
lxc-start JIZOM_DB.CT 20210609152540.730 DEBUG conf - conf.c:mount_autodev:1217 - Using mount options: size=500000,mode=755
lxc-start JIZOM_DB.CT 20210609152540.730 INFO conf - conf.c:mount_autodev:1247 - Prepared “/dev”
lxc-start JIZOM_DB.CT 20210609152540.731 DEBUG conf - conf.c:lxc_mount_auto_mounts:730 - Invalid argument - Tried to ensure procfs is unmounted
lxc-start JIZOM_DB.CT 20210609152540.731 DEBUG conf - conf.c:lxc_mount_auto_mounts:745 - Invalid argument - Tried to ensure sysfs is unmounted
lxc-start JIZOM_DB.CT 20210609152540.731 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/var/JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/var/LOG_DB.CT”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/tmp”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/var/lib/mysql”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/var/log/mysql”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/mac”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/script”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/db_conf”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/launcher”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/neverdie”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/lib”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/opt/sqlite”
lxc-start JIZOM_DB.CT 20210609152540.735 WARN conf - conf.c:mount_entry_on_absolute_rootfs:2407 - Ignoring mount point “/mnt/LOCALTIME”

Hi,
My fstab is as below

/var/IPCs/JIZOM_DB.CT /var/JIZOM_DB.CT none bind,rw,relative,noexec,nosuid,nodev 0 2
/var/IPCs/LOG_DB.CT /var/LOG_DB.CT none bind,rw,relative,noexec,nosuid,nodev 0 2

/var/TMP_DB/TMP_JIZOM_DB.CT /tmp none bind,rw,relative,noexec,nosuid,nodev 0 2
/data/JIZOM_DB.CT/DATADIR /var/lib/mysql none bind,rw,relative,noexec,nosuid,nodev 0 2
/data/JIZOM_DB.CT/LOGERROR /var/log/mysql none bind,rw,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/MAC /opt/mac none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/SCRIPT /opt/script none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/DB_CONF /opt/db_conf none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/LAUNCHER /opt/launcher none bind,ro,relative,nosuid,nodev 0 2
/opt/NEVERDIE_DB /opt/neverdie none bind,ro,relative,nosuid,nodev 0 2
/opt/LIB_MODULE /opt/lib none bind,ro,relative,nosuid,nodev 0 2
/opt/CONFIGURATION /opt/sqlite none bind,ro,relative,nosuid,nodev 0 2

/opt/LOCALTIME /mnt/LOCALTIME none bind,ro,relative,nosuid,nodev 0 2

Hi All,
Please, could you give me a reply ?
Thanks & regards,
Kim

Can you try with:

/var/IPCs/JIZOM_DB.CT var/JIZOM_DB.CT none bind,rw,relative,noexec,nosuid,nodev 0 2
/var/IPCs/LOG_DB.CT var/LOG_DB.CT none bind,rw,relative,noexec,nosuid,nodev 0 2
/var/TMP_DB/TMP_JIZOM_DB.CT tmp none bind,rw,relative,noexec,nosuid,nodev 0 2
/data/JIZOM_DB.CT/DATADIR var/lib/mysql none bind,rw,relative,noexec,nosuid,nodev 0 2
/data/JIZOM_DB.CT/LOGERROR var/log/mysql none bind,rw,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/MAC opt/mac none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/SCRIPT opt/script none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/CTs/JIZOM_DB.CT/DB_CONF opt/db_conf none bind,ro,relative,noexec,nosuid,nodev 0 2
/opt/LAUNCHER opt/launcher none bind,ro,relative,nosuid,nodev 0 2
/opt/NEVERDIE_DB opt/neverdie none bind,ro,relative,nosuid,nodev 0 2
/opt/LIB_MODULE opt/lib none bind,ro,relative,nosuid,nodev 0 2
/opt/CONFIGURATION opt/sqlite none bind,ro,relative,nosuid,nodev 0 2
/opt/LOCALTIME mnt/LOCALTIME none bind,ro,relative,nosuid,nodev 0 2

Hi,
I got the errors of 2 days ago.
Thanks & regards,

lxc-start JIZOM_DB.CT 20210610161513.283 ERROR utils - utils.c:safe_mount:1198 - No such file or directory - Failed to mount “/usr/local/lib/lxc/rootfs//var/IPCs/JIZOM_DB.CT” onto “/usr/local/lib/lxc/rootfs/var/JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR conf - conf.c:mount_entry:2116 - No such file or directory - Failed to mount “/usr/local/lib/lxc/rootfs//var/IPCs/JIZOM_DB.CT” on “/usr/local/lib/lxc/rootfs/var/JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR conf - conf.c:setup_mount_fstab:2483 - Failed to set up mount entries
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR conf - conf.c:lxc_setup:3645 - Failed to setup mounts
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR start - start.c:do_start:1265 - Failed to setup container “JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR sync - sync.c:sync_wait:36 - An error occurred in another process (expected sequence number 5)
lxc-start JIZOM_DB.CT 20210610161513.283 DEBUG network - network.c:lxc_delete_network:4180 - Deleted network devices
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR lxccontainer - lxccontainer.c:wait_on_daemonized_start:
869 - Received container state “ABORTING” instead of “RUNNING”
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR lxc_start - tools/lxc_start.c:main:311 - To get more details, run the container in foreground mode
lxc-start JIZOM_DB.CT 20210610161513.283 ERROR lxc_start - tools/lxc_start.c:main:314 - Additional information can be obtained by setting the --logfile and --logpriority options
lxc-start JIZOM_DB.CT 20210610161513.287 ERROR start - start.c:__lxc_start:2073 - Failed to spawn container “JIZOM_DB.CT”
lxc-start JIZOM_DB.CT 20210610161513.287 WARN start - start.c:lxc_abort:1022 - No such process - Failed to send SIGKILL to 19352

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

lxc.rootfs.options = defaults,ro,nodev
lxc.rootfs.path = dir:/mnt/ct_mount

lxc.hook.pre-mount = /sbin/base_bdd_hook.sh

lxc.mount.fstab = /opt/CTs/JIZOM_DB.CT/fstab

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

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

@brauner is there anything special about the fstab thing? I thought they were treated the same as lxc.mount.entry.