[SOLVED] .squashfs LXC containers images

mokaz

Member
Nov 30, 2021
85
18
13
Hi,

I'm given a .squashfs image which contains a root filesystem in squashfs format.
Shall I be able to "import" such image and run that as a container directly?
Or shall I rather mount the image from within an LXC?

Let me know,
Kind regards,
m.
 
hi,

where did you get the image? sometimes they provide more options ;)

though you should be able to extract and pack it into a .tar.xz or similar archive and then it should be usable as a template :)
 
Hi Oguz,

Thanks a lot for your kind help.

The given image is a closed source container appliance.
I'll try the extract + pack way.. I can mount the root filesystem, so shall be able to tweak it.

I'll let you know,
Cheers,
m.
 
I could convert the image, yet failing to boot on pve but I guess this has nothing to do with the conversion.

okay, can you post the output from pct start CTID --debug (replace CTID with yours)?
 
Dear Oguz,

thanks a lot for your support, debug start output below:

Code:
root@pve:~# pct start 100 --debug
sync_wait: 34 An error occurred in another process (expected sequence number 7)
__lxc_start: 2068 Failed to spawn container "100"
_script_argv:337 - Executing script "/usr/share/lxc/hooks/lxc-pve-prestart-hook" for container "100", config section "lxc"
DEBUG    seccomp - seccomp.c:parse_config_v2:656 - Host native arch is [3221225534]
INFO     seccomp - seccomp.c:parse_config_v2:807 - Processing "reject_force_umount  # comment this to allow umount -f;  not recommended"
INFO     seccomp - seccomp.c:do_resolve_add_rule:524 - Set seccomp rule to reject force umounts
INFO     seccomp - seccomp.c:do_resolve_add_rule:524 - Set seccomp rule to reject force umounts
INFO     seccomp - seccomp.c:do_resolve_add_rule:524 - Set seccomp rule to reject force umounts
INFO     seccomp - seccomp.c:parse_config_v2:807 - Processing "[all]"
INFO     seccomp - seccomp.c:parse_config_v2:807 - Processing "kexec_load errno 1"
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding native rule for syscall[246:kexec_load] action[327681:errno] arch[0]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[246:kexec_load] action[327681:errno] arch[1073741827]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[246:kexec_load] action[327681:errno] arch[1073741886]
INFO     seccomp - seccomp.c:parse_config_v2:807 - Processing "open_by_handle_at errno 1"
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding native rule for syscall[304:open_by_handle_at] action[327681:errno] arch[0]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[304:open_by_handle_at] action[327681:errno] arch[1073741827]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[304:open_by_handle_at] action[327681:errno] arch[1073741886]
INFO     seccomp - seccomp.c:parse_config_v2:807 - Processing "init_module errno 1"
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding native rule for syscall[175:init_module] action[327681:errno] arch[0]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[175:init_module] action[327681:errno] arch[1073741827]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[175:init_module] action[327681:errno] arch[1073741886]
INFO     seccomp - seccomp.c:parse_config_v2:807 - Processing "finit_module errno 1"
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding native rule for syscall[313:finit_module] action[327681:errno] arch[0]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[313:finit_module] action[327681:errno] arch[1073741827]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[313:finit_module] action[327681:errno] arch[1073741886]
INFO     seccomp - seccomp.c:parse_config_v2:807 - Processing "delete_module errno 1"
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding native rule for syscall[176:delete_module] action[327681:errno] arch[0]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[176:delete_module] action[327681:errno] arch[1073741827]
INFO     seccomp - seccomp.c:do_resolve_add_rule:564 - Adding compat rule for syscall[176:delete_module] action[327681:errno] arch[1073741886]
INFO     seccomp - seccomp.c:parse_config_v2:1017 - Merging compat seccomp contexts into main context
INFO     start - start.c:lxc_init:883 - Container "100" is initialized
INFO     cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1028 - The monitor process uses "lxc.monitor/100" as cgroup
DEBUG    storage - storage/storage.c:storage_query:231 - Detected rootfs type "dir"
INFO     cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1136 - The container process uses "lxc/100/ns" as inner and "lxc/100" as limit cgroup
INFO     start - start.c:lxc_spawn:1759 - Cloned CLONE_NEWNS
INFO     start - start.c:lxc_spawn:1759 - Cloned CLONE_NEWPID
INFO     start - start.c:lxc_spawn:1759 - Cloned CLONE_NEWUTS
INFO     start - start.c:lxc_spawn:1759 - Cloned CLONE_NEWIPC
INFO     start - start.c:lxc_spawn:1759 - Cloned CLONE_NEWNET
INFO     start - start.c:lxc_spawn:1759 - Cloned CLONE_NEWCGROUP
DEBUG    start - start.c:lxc_try_preserve_namespace:139 - Preserved mnt namespace via fd 18 and stashed path as mnt:/proc/716565/fd/18
DEBUG    start - start.c:lxc_try_preserve_namespace:139 - Preserved pid namespace via fd 19 and stashed path as pid:/proc/716565/fd/19
DEBUG    start - start.c:lxc_try_preserve_namespace:139 - Preserved uts namespace via fd 20 and stashed path as uts:/proc/716565/fd/20
DEBUG    start - start.c:lxc_try_preserve_namespace:139 - Preserved ipc namespace via fd 21 and stashed path as ipc:/proc/716565/fd/21
DEBUG    start - start.c:lxc_try_preserve_namespace:139 - Preserved net namespace via fd 22 and stashed path as net:/proc/716565/fd/22
DEBUG    start - start.c:lxc_try_preserve_namespace:139 - Preserved cgroup namespace via fd 23 and stashed path as cgroup:/proc/716565/fd/23
WARN     cgfsng - cgroups/cgfsng.c:cgfsng_setup_limits_legacy:2732 - Invalid argument - Ignoring legacy cgroup limits on pure cgroup2 system
INFO     cgfsng - cgroups/cgfsng.c:cgfsng_setup_limits:2828 - Limits for the unified cgroup hierarchy have been setup
INFO     conf - conf.c:run_script_argv:337 - Executing script "/usr/share/lxc/lxcnetaddbr" for container "100", config section "net"
DEBUG    network - network.c:netdev_configure_server_veth:851 - Instantiated veth tunnel "veth100i0 <--> vethY0ugV5"
INFO     conf - conf.c:run_script_argv:337 - Executing script "/usr/share/lxc/lxcnetaddbr" for container "100", config section "net"
DEBUG    network - network.c:netdev_configure_server_veth:851 - Instantiated veth tunnel "veth100i1 <--> vethFvGpdx"
DEBUG    conf - conf.c:lxc_mount_rootfs:1432 - Mounted rootfs "/var/lib/lxc/100/rootfs" onto "/usr/lib/x86_64-linux-gnu/lxc/rootfs" with options "(null)"
INFO     conf - conf.c:setup_utsname:875 - Set hostname to "cFOS1"
DEBUG    network - network.c:setup_hw_addr:3807 - Mac address "9E:52:EC:47:C4:E8" on "eth0" has been setup
DEBUG    network - network.c:lxc_network_setup_in_child_namespaces_common:3948 - Network device "eth0" has been setup
DEBUG    network - network.c:setup_hw_addr:3807 - Mac address "56:D7:E0:49:53:BC" on "eth1" has been setup
DEBUG    network - network.c:lxc_network_setup_in_child_namespaces_common:3948 - Network device "eth1" has been setup
INFO     network - network.c:lxc_setup_network_in_child_namespaces:4005 - Finished setting up network devices with caller assigned names
INFO     conf - conf.c:mount_autodev:1215 - Preparing "/dev"
INFO     conf - conf.c:mount_autodev:1276 - Prepared "/dev"
DEBUG    conf - conf.c:lxc_mount_auto_mounts:735 - Invalid argument - Tried to ensure procfs is unmounted
DEBUG    conf - conf.c:lxc_mount_auto_mounts:758 - Invalid argument - Tried to ensure sysfs is unmounted
DEBUG    conf - conf.c:mount_entry:2412 - Remounting "/sys/fs/fuse/connections" on "/usr/lib/x86_64-linux-gnu/lxc/rootfs/sys/fs/fuse/connections" to respect bind or remount options
DEBUG    conf - conf.c:mount_entry:2431 - Flags for "/sys/fs/fuse/connections" were 4110, required extra flags are 14
DEBUG    conf - conf.c:mount_entry:2475 - Mounted "/sys/fs/fuse/connections" on "/usr/lib/x86_64-linux-gnu/lxc/rootfs/sys/fs/fuse/connections" with filesystem type "none"
DEBUG    conf - conf.c:mount_entry:2412 - Remounting "/dev/fuse" on "/usr/lib/x86_64-linux-gnu/lxc/rootfs/dev/fuse" to respect bind or remount options
DEBUG    conf - conf.c:mount_entry:2431 - Flags for "/dev/fuse" were 4098, required extra flags are 2
DEBUG    conf - conf.c:mount_entry:2475 - Mounted "/dev/fuse" on "/usr/lib/x86_64-linux-gnu/lxc/rootfs/dev/fuse" with filesystem type "none"
DEBUG    conf - conf.c:mount_entry:2475 - Mounted "proc" on "/usr/lib/x86_64-linux-gnu/lxc/rootfs/dev/.lxc/proc" with filesystem type "proc"
DEBUG    conf - conf.c:mount_entry:2475 - Mounted "sys" on "/usr/lib/x86_64-linux-gnu/lxc/rootfs/dev/.lxc/sys" with filesystem type "sysfs"
DEBUG    cgfsng - cgroups/cgfsng.c:__cgroupfs_mount:1540 - Mounted cgroup filesystem cgroup2 onto 20((null))
INFO     conf - conf.c:run_script_argv:337 - Executing script "/usr/share/lxcfs/lxc.mount.hook" for container "100", config section "lxc"
INFO     conf - conf.c:run_script_argv:337 - Executing script "/usr/share/lxc/hooks/lxc-pve-autodev-hook" for container "100", config section "lxc"
INFO     conf - conf.c:lxc_fill_autodev:1313 - Populating "/dev"
DEBUG    conf - conf.c:lxc_fill_autodev:1322 - Created device node "full"
DEBUG    conf - conf.c:lxc_fill_autodev:1322 - Created device node "null"
DEBUG    conf - conf.c:lxc_fill_autodev:1322 - Created device node "random"
DEBUG    conf - conf.c:lxc_fill_autodev:1322 - Created device node "tty"
DEBUG    conf - conf.c:lxc_fill_autodev:1322 - Created device node "urandom"
DEBUG    conf - conf.c:lxc_fill_autodev:1322 - Created device node "zero"
INFO     conf - conf.c:lxc_fill_autodev:1401 - Populated "/dev"
INFO     conf - conf.c:lxc_transient_proc:3766 - Caller's PID is 1; /proc/self points to 1
DEBUG    conf - conf.c:lxc_setup_devpts_child:1747 - Attached detached devpts mount 21 to 19/pts
DEBUG    conf - conf.c:lxc_setup_devpts_child:1833 - Created "/dev/ptmx" file as bind mount target
DEBUG    conf - conf.c:lxc_setup_devpts_child:1840 - Bind mounted "/dev/pts/ptmx" to "/dev/ptmx"
DEBUG    conf - conf.c:lxc_allocate_ttys:1101 - Created tty with ptx fd 23 and pty fd 24 and index 1
DEBUG    conf - conf.c:lxc_allocate_ttys:1101 - Created tty with ptx fd 25 and pty fd 26 and index 2
INFO     conf - conf.c:lxc_allocate_ttys:1106 - Finished creating 2 tty devices
DEBUG    conf - conf.c:lxc_setup_ttys:1028 - Bind mounted "" onto "/dev/lxc/tty1"
DEBUG    conf - conf.c:lxc_setup_ttys:1028 - Bind mounted "" onto "/dev/lxc/tty2"
INFO     conf - conf.c:lxc_setup_ttys:1072 - Finished setting up 2 /dev/tty<N> device(s)
INFO     conf - conf.c:setup_personality:1913 - Set personality to "0lx0"
DEBUG    conf - conf.c:capabilities_deny:3196 - Dropped mac_admin (33) capability
DEBUG    conf - conf.c:capabilities_deny:3196 - Dropped mac_override (32) capability
DEBUG    conf - conf.c:capabilities_deny:3196 - Dropped sys_time (25) capability
DEBUG    conf - conf.c:capabilities_deny:3196 - Dropped sys_module (16) capability
DEBUG    conf - conf.c:capabilities_deny:3196 - Dropped sys_rawio (17) capability
DEBUG    conf - conf.c:capabilities_deny:3199 - Capabilities have been setup
NOTICE   conf - conf.c:lxc_setup:4459 - The container "100" is set up
INFO     apparmor - lsm/apparmor.c:apparmor_process_label_set_at:1186 - Set AppArmor label to "lxc-100_</var/lib/lxc>//&:lxc-100_<-var-lib-lxc>:"
INFO     apparmor - lsm/apparmor.c:apparmor_process_label_set:1231 - Changed AppArmor profile to lxc-100_</var/lib/lxc>//&:lxc-100_<-var-lib-lxc>:
DEBUG    terminal - terminal.c:lxc_terminal_peer_default:695 - No such device - The process does not have a controlling terminal
NOTICE   utils - utils.c:lxc_drop_groups:1347 - Dropped supplimentary groups
NOTICE   start - start.c:start:2154 - Exec'ing "/sbin/init"
ERROR    start - start.c:start:2157 - No such file or directory - Failed to exec "/sbin/init"
ERROR    sync - sync.c:sync_wait:34 - An error occurred in another process (expected sequence number 7)
INFO     network - network.c:lxc_delete_network_priv:3666 - Removed interface "veth100i0" from ""
INFO     network - network.c:lxc_delete_network_priv:3666 - Removed interface "veth100i1" from ""
DEBUG    network - network.c:lxc_delete_network:4159 - Deleted network devices
ERROR    start - start.c:__lxc_start:2068 - Failed to spawn container "100"
WARN     start - start.c:lxc_abort:1038 - No such process - Failed to send SIGKILL via pidfd 17 for process 716587
startup for container '100' failed

Let me know,
Kind regards,
m.
 
here's the error:

Code:
ERROR    start - start.c:start:2157 - No such file or directory - Failed to exec "/sbin/init"

looks like the /sbin/init cannot be found in your rootfs archive.

you probably need to watch out for the directory structure inside the archive :) take a look at the file structure in there, it should be containing the standard linux folders at the top
 
Hi Oguz,

I'm such a rookie, I'm very sorry about this. I could boot it all fine, thanks to you !! I needed the rootfs/ as the root of the archive, that's it.
In the end I've done the export manually from a *nix host, like below and then imported the image within PVE and it boots all fine !

Code:
pyjaman@h1:~/source$ sudo mount IMAGE.squashfs /home/pyjaman/squash/ -t squashfs -o loop
pyjaman@h1:~/squash/rootfs$ tar -cf - ./ | xz -9ze -T0 > ../../source/IMAGE-export.tar.xz

Let's the fun begin =)
Thanks a lot, PROXMOX Rulezzzz!!

Cheers,
m.
 
  • Like
Reactions: oguz
Hi Oguz,

I'm such a rookie, I'm very sorry about this. I could boot it all fine, thanks to you !! I needed the rootfs/ as the root of the archive, that's it.
In the end I've done the export manually from a *nix host, like below and then imported the image within PVE and it boots all fine !

Code:
pyjaman@h1:~/source$ sudo mount IMAGE.squashfs /home/pyjaman/squash/ -t squashfs -o loop
pyjaman@h1:~/squash/rootfs$ tar -cf - ./ | xz -9ze -T0 > ../../source/IMAGE-export.tar.xz

Let's the fun begin =)
Thanks a lot, PROXMOX Rulezzzz!!

Cheers,
m.
glad to be of help!

please mark the thread as [SOLVED] :)