Solved: Stopping cgconfig service: cgclear failed with Device or resource busy : Linux cgroup

While restarting cgconfig service, many of the times we used to encounter “Device or resourse busy error” and the service restart gets failed.

[root@nglinux ~]# service cgconfig restart
Stopping cgconfig service: cgclear failed with Device or resource busy
                                                           [  OK  ]
Starting cgconfig service: Error: cannot mount memory to /cgroup/memory: Device or resource busy
/sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed
Failed to parse /etc/cgconfig.conf or /etc/cgconfig.d      [FAILED]

To resolve this issue, we need to umount the partition which is not automatically umounted by the cgconfig script.

So lets try to umount the /cgroup/memory on which we have received the error message.

[root@nglinux ~]# umount /cgroup/memory
umount: /cgroup/memory: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

Oh !! It also failed. It seems some processes are currently using this path.

Lets check it out.

[root@nglinux ~]# fuser -cu /cgroup/memory
/cgroup/memory:       3271c(root)  4759c(root)  4762c(root)

Now kill the processes which are using this path.

[root@nglinux ~]# fuser -ck /cgroup/memory
/cgroup/memory:       3271c  4759c  4762c
Could not kill process 4762: No such process
[root@nglinux ~]# fuser -ck /cgroup/memory
[root@nglinux ~]# 

Now try to umount /cgroup/memory.

[root@nglinux ~]# umount /cgroup/memory

Finally Succeeded. So now we can restart the service and it will be successful.

[root@nglinux ~]# service cgconfig restart
Stopping cgconfig service:                                 [  OK  ]
Starting cgconfig service:                                 [  OK  ]
[root@nglinux ~]# 

Interesting troubleshooting !! Do share your experiences/comments below.

Leave a Reply

avatar
  Subscribe  
Notify of