GNU/Linux >> Tutoriales Linux >  >> Cent OS

‘lxc_cgfs:dispositivo o recurso ocupado:no se pudo establecer memory.use_hierarchy en 1; continuando’ – error al iniciar el contenedor LXC

El problema

Al iniciar lxc da el siguiente error:

lxc-start 1491315722.354 ERROR lxc_cgfs - Device or resource busy - failed to set memory.use_hierarchy to 1; continuing
lxc-start 1491315722.354 ERROR lxc_cgfs - Device or resource busy - failed to set memory.use_hierarchy to 1; continuing
lxc-start 1497957841.930 ERROR lxc_cgfs - Device or resource busy - failed to set memory.use_hierarchy to 1; continuing
lxc-start 1497957841.937 ERROR lxc_cgfs - Device or resource busy - failed to set memory.use_hierarchy to 1; continuing

La solución

Teniendo en cuenta un escenario en el que obtenemos el error:dispositivo o recurso ocupado:no se pudo establecer memory.use_hierarchy en 1; continuando:

# lxc-start --name CentOS7
lxc-start: cgfs.c: handle_cgroup_settings: 2077 Device or resource busy - failed to set memory.use_hierarchy to 1; continuing
systemd 208 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Detected virtualization 'lxc'.
Welcome to CentOS Linux Server 7.1!
Failed to insert module 'autofs4'
Set hostname to [CentOS7].
[ OK ] Reached target Remote File Systems.
[ OK ] Created slice Root Slice.
[ OK ] Created slice User and Session Slice.
[ OK ] Created slice System Slice.
[ OK ] Reached target Slices.
[ OK ] Created slice system-getty.slice.

El parámetro /cgroup/memory/memory.use_hierarchy se establece en 0 causando el problema. Use el siguiente comando para verificar el valor actual del parámetro.

# cat /proc/mounts | grep -i mem
cgroup /cgroup/memory cgroup rw,relatime,memory 0 0

# ls /cgroup/memory/memory.use_hierarchy
/cgroup/memory/memory.use_hierarchy

# cat /cgroup/memory/memory.use_hierarchy
0

Si tratamos de establecer el valor en 1, sigue arrojando el mismo error:

# echo 1 > /cgroup/memory/memory.use_hierarchy
-bash: echo: write error: Device or resource busy

Para deshacerse del error:Dispositivo o recurso ocupado:no se pudo establecer memory.use_hierarchy en 1; Para continuar, debemos seguir los siguientes pasos:

  1. Detener el contenedor
  2. Detener el servicio cgconfig
  3. Iniciar el servicio cgconfig
  4. Establezca el parámetro /cgroup/memory/memory.use_hierarchy en 1
  5. Iniciar el contenedor
# lxc-stop --name CentOS7
# /etc/init.d/cgconfig stop
Stopping cgconfig service: [ OK ]
# cat /proc/mounts | grep -i mem
#
# /etc/init.d/cgconfig start
Starting cgconfig service: [ OK ]
# cat /cgroup/memory/memory.use_hierarchy
0
# echo 1 > /cgroup/memory/memory.use_hierarchy
# cat /cgroup/memory/memory.use_hierarchy
1
# lxc-start --name CentOS7
systemd 208 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Detected virtualization 'lxc'.

Welcome to CentOS Server 7.1!

Failed to insert module 'autofs4'
Set hostname to .
[ OK ] Reached target Remote File Systems.
[ OK ] Created slice Root Slice.


Cent OS
  1. "mlock falló:no se puede asignar memoria" error de comando lvcreate en CentOS/RHEL 7

  2. “Error en la autenticación previa al obtener las credenciales iniciales”:error de Kerberos

  3. “ADVERTENCIA:Error al conectarse a lvmetad. Recurrir al escaneo del dispositivo”:error al ejecutar comandos LVM

  4. Falló el enlace al puerto 22 en 0.0.0.0:la dirección ya está en uso:error al iniciar el servicio sshd CentOS/RHEL

  5. “error:Falló el enlace al puerto 2222 en 0.0.0.0:Permiso denegado” – error al iniciar el servicio sshd en CentOS/RHEL

Configurar Linux Container con LXC en CentOS 7/RHEL 7

Cómo configurar la alta disponibilidad para Resource Manager - Parte 6

¿Cómo reparar el error de error de rpmdb al procesar la actualización de cPanel?

El inicio de Control Suite da como resultado un error de aplicación que no se pudo inicializar

mdadm:no se puede abrir /dev/sda1:dispositivo o recurso ocupado

Cómo configurar una red externa para contenedores en contenedores de Linux (LXC)