Container fails with the sync.c:__sync_wait:57 - An error occurred in another process (expected sequence number 7)


(Mugesh) #1

Error Logs:
lxc-start p2 20181023045654.161 ERROR lxc_utils - utils.c:safe_mount:1707 - No such file or directory - Failed to mount /dev/tty0 onto /usr/lib/lxc/rootfs/dev/tty0
lxc-start p2 20181023045654.164 ERROR lxc_utils - utils.c:safe_mount:1707 - No such file or directory - Failed to mount /dev/tty1 onto /usr/lib/lxc/rootfs/dev/tty1
lxc-start p2 20181023045654.253 ERROR lxc_start - start.c:start:1535 - No such file or directory - Failed to exec “/sbin/init”.
lxc-start p2 20181023045654.253 ERROR lxc_sync - sync.c:__sync_wait:57 - An error occurred in another process (expected sequence number 7)
lxc-start p2 20181023045654.254 ERROR lxc_start - start.c:__lxc_start:1459 - Failed to spawn container “p2”.
lxc-start p2 20181023045654.255 ERROR lxc_cgfs - cgroups/cgfs.c:cgroup_rmdir:209 - Device or resource busy - Failed to delete /sys/fs/cgroup/memory/lxc/p2
lxc-start p2 20181023045654.258 ERROR lxc_cgfs - cgroups/cgfs.c:cgroup_rmdir:209 - Device or resource busy - Failed to delete /sys/fs/cgroup/cpu,cpuacct/lxc/p2
lxc-start p2 20181023045654.261 ERROR lxc_cgfs - cgroups/cgfs.c:cgroup_rmdir:209 - Device or resource busy - Failed to delete /sys/fs/cgroup/cpuset/lxc/p2
lxc-start p2 20181023045654.263 ERROR lxc_cgfs - cgroups/cgfs.c:cgroup_rmdir:209 - Device or resource busy - Failed to delete /sys/fs/cgroup/devices/lxc/p2
lxc-start p2 20181023045654.265 ERROR lxc_cgfs - cgroups/cgfs.c:cgroup_rmdir:209 - Device or resource busy - Failed to delete /sys/fs/cgroup/systemd/system.slice/system-sshd.slice/sshd@1-192.168.1.40:22-192.168.1.51:64294.service/lxc/p2
lxc-start p2 20181023045654.267 ERROR lxc_start_ui - tools/lxc_start.c:main:371 - The container failed to start.
lxc-start p2 20181023045654.268 ERROR lxc_start_ui - tools/lxc_start.c:main:375 - Additional information can be obtained by setting the --logfile and --logpriority options.


Bad address - failed to exec /usr/sbin/init.lxc
(Stéphane Graber) #2
lxc-start p2 20181023045654.161 ERROR lxc_utils - utils.c:safe_mount:1707 - No such file or directory - Failed to mount /dev/tty0 onto /usr/lib/lxc/rootfs/dev/tty0
lxc-start p2 20181023045654.164 ERROR lxc_utils - utils.c:safe_mount:1707 - No such file or directory - Failed to mount /dev/tty1 onto /usr/lib/lxc/rootfs/dev/tty1
lxc-start p2 20181023045654.253 ERROR lxc_start - start.c:start:1535 - No such file or directory - Failed to exec “/sbin/init”.

Those are the problems, it looks like your container’s rootfs is missing a dev directory AND also a /sbin/init file.


(Mugesh) #3

Hello Stéphan,
My intention is to run the app container not the OS container and I have corrected the above error and struck with the another error

09.480 NOTICE lxc_utils - utils.c:lxc_switch_uid_gid:2079 - Switched to uid 0.
lxc 20181109044709.480 NOTICE lxc_execute - execute.c:execute_start:90 - exec’ing ‘/usr/bin/isoinit’
lxc 20181109044709.489 NOTICE lxc_execute - execute.c:execute_post_start:104 - ‘/usr/bin/isoinit’ started with pid ‘2160’
lxc 20181109044709.489 ERROR lxc_start - start.c:lxc_serve_state_socket_pair:441 - Broken pipe - Failed to send state to 6
lxc 20181109044709.489 ERROR lxc_start - start.c:lxc_set_state:462 - Failed to synchronize via anonymous pair of unix sockets
lxc 20181109044709.489 ERROR lxc_start - start.c:lxc_spawn:1386 - Failed to set state for container “p2” to “RUNNING”.
lxc 20181109044709.489 ERROR lxc_start - start.c:lxc_serve_state_socket_pair:441 - Broken pipe - Failed to send state to 6
lxc 20181109044709.489 ERROR lxc_start - start.c:lxc_set_state:462 - Failed to synchronize via anonymous pair of unix sockets
lxc 20181109044709.492 ERROR lxc_start - start.c:__lxc_start:1459 - Failed to spawn container “p2”.
lxc 20181109044709.492 ERROR lxc_start - start.c:lxc_serve_state_socket_pair:441 - Broken pipe - Failed to send state to 6
lxc 20181109044709.492 ERROR lxc_start - start.c:lxc_set_state:462 - Failed to synchronize via anonymous pair of unix sockets
lxc 20181109044709.521 ERROR lxc_start - start.c:lxc_serve_state_socket_pair:441 - Broken pipe - Failed to send state to 6
lxc 20181109044709.521 ERROR lxc_start - start.c:lxc_set_state:462 - Failed to synchronize via anonymous pair of unix sockets


(Mugesh) #4

I had deeper look but What I am missing is not know


(Mugesh) #5

@stgraber could you please kindly support me


(Stéphane Graber) #6

Looks like /usr/bin/isoinit failed pretty much immediately in this case, no idea why.


(Mugesh) #7

This binary is responsible to start the application container using api which is mentioned in your tutorial it seems for me there some issue with application container is there any possibility to check or get more info what went wrong?


#8

What tutorial are you referring to?
Did you create this rootfs or is it a stock container image?
If you created this rootfs, can you describe how you created it?


(Mugesh) #9

Hi,

I have followed the tutorial from the below link
https://stgraber.org/2014/02/05/lxc-1-0-scripting-with-the-api/

I have created the roofts container as mentioned in the below steps

1. I have created the folder structure like below 
	
		path : /var/lib/lxc/p2/

config 
rootfs/
    bin/
    dev/
    etc/
        passwd
        group
        service/
			app.service

    lib/
    mnt/
    usr/
		bin/	
		lib/
    bin/
    lib/
    tmp/
	
2. Copied the simple process (app.out) in usr/bin 
3. corresonding libraries is copied in usr/lib and lib.
4. in etc/service the service file is copied to start the app.out.

I have created the apprun process which will start the application container by using the below API 

lxcpath = "/var/lib/lxc"
lxcname = "p2"
lxcuser = "p2_user"

argv[0] = "/usr/bin/appinit";	
argv[1] = "-u";
argv[2] = lxcuser;            
  struct lxc_cont *pCont = lxc_container_new(lxcname, lxcpath);
    if (pCont == NULL)
    {
		printf("container faied \n");
        return -1;
    }


		if (pCont->start(pCont, 1, argv) == false)
            {
                printf("Failed starting container '%s'\n", lxcname);                    
                return -1;
            }
			
I have created the app.service file in native system which will call the apprun.out like below

[Service]
User=lxc_start
Group=lxc_start

Start / Stop the container

ExecStart=/usr/bin/apprun p2 p2_user

I have taken care the update of passwd and group files to add lxc_start and p2 as user and added p2 in lxc_start group.

The apprun runs in native system and appinit is running inside container which will read the servcie files from etc/service and starts the app.out. The apprun and appinit uses the unix socket to exchange data from container to native system by this way I can supervise the application process which runs inside container.