Open mszywala opened 4 months ago
Any updates on this topic?
It seems that the Shutdown function is halting here, probably because LXD is not receiving the appropriate hook to finish the operation (neither the stop hook nor the stop namespace). Is is still to be determined what is the inconsistency on the hook.
Took a look at this and found this in /var/snap/lxd/common/lxd/logs/c1/lxc.log
after setting sudo snap set lxd daemon.debug=true; sudo systemctl reload snap.lxd.daemon
:
lxc c1 20240719091404.652 DEBUG conf - ../src/src/lxc/conf.c:run_buffer:311 - Script exec /snap/lxd/current/bin/lxd callhook /var/snap/lxd/common/lxd "default" "c1" stop produced output: /snap/lxd/current/bin/lxd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /snap/lxd/current/bin/lxd)
lxc c1 20240719091404.652 DEBUG conf - ../src/src/lxc/conf.c:run_buffer:311 - Script exec /snap/lxd/current/bin/lxd callhook /var/snap/lxd/common/lxd "default" "c1" stop produced output: /snap/lxd/current/bin/lxd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /snap/lxd/current/bin/lxd)
lxc c1 20240719091404.652 DEBUG conf - ../src/src/lxc/conf.c:run_buffer:311 - Script exec /snap/lxd/current/bin/lxd callhook /var/snap/lxd/common/lxd "default" "c1" stop produced output: /snap/lxd/current/bin/lxd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /snap/lxd/current/bin/lxd)
lxc c1 20240719091404.652 DEBUG conf - ../src/src/lxc/conf.c:run_buffer:311 - Script exec /snap/lxd/current/bin/lxd callhook /var/snap/lxd/common/lxd "default" "c1" stop produced output: /snap/lxd/current/bin/lxd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /snap/lxd/current/bin/lxd)
lxc c1 20240719091404.653 ERROR conf - ../src/src/lxc/conf.c:run_buffer:322 - Script exited with status 1
lxc c1 20240719091404.653 ERROR start - ../src/src/lxc/start.c:lxc_end:985 - Failed to run lxc.hook.post-stop for container "c1"
Looks like it could be to do with the core base change from 5.0 to 5.21 (core20 to core22).
@simondeziel @mihalicyn btw ive confirmed this is also an issue going from 5.0/stable to 5.0/edge so it'll need to be sorted before we put out 5.0.4 with core22.
Required information
Output of "lxc info"
Issue description
We're on the way to upgrading our servers from LXD 5.0.3 to LXD 5.21.1 LTS. I somehow experienced the issue that the stop and restart container operations were hanging after the refresh. I only encountered the issue for the first stop/restart after
snap refresh lxd --channel=5.21/stable
It seems not to make a difference if-f
is used to stop or restart the instance.After a while, the instance stops with the following error:
Additionally, we are using a routed nic for our container instances.
Because the instance is not stopping properly, there are remaining routes and the veth Device of the instance is in the state "LOWERLAYERDOWN" and the instance is refusing to start back up. When we manage to shut down an instance, it is necessary to take down the veth interface of the instance with
ip link set vethxxxx
down, and we also have to clean up the remaining routes on the hostsystemExpectation:
lxc stop
andlxc restart
is working properly after a refresh.Steps to reproduce
snap refresh lxd --channel=5.21/stable
lxc stop <containerName>
Information to attach
dmesg
) Nothing relevant herelxc info NAME --show-log
)Resources: Processes: 0 CPU usage: CPU usage (in seconds): 0
Log:
lxc u 20240415120709.358 WARN conf - ../src/src/lxc/conf.c:lxc_map_ids:3621 - newuidmap binary is missing lxc u 20240415120709.358 WARN conf - ../src/src/lxc/conf.c:lxc_map_ids:3627 - newgidmap binary is missing lxc u 20240415120709.359 WARN conf - ../src/src/lxc/conf.c:lxc_map_ids:3621 - newuidmap binary is missing lxc u 20240415120709.359 WARN conf - ../src/src/lxc/conf.c:lxc_map_ids:3627 - newgidmap binary is missing lxc u 20240415120831.600 ERROR conf - ../src/src/lxc/conf.c:run_buffer:322 - Script exited with status 1 lxc u 20240415120831.601 ERROR start - ../src/src/lxc/start.c:lxc_end:944 - Failed to run "lxc.hook.stop" hook lxc u 20240415120832.126 ERROR conf - ../src/src/lxc/conf.c:run_buffer:322 - Script exited with status 1 lxc u 20240415120832.126 ERROR start - ../src/src/lxc/start.c:lxc_end:985 - Failed to run lxc.hook.post-stop for container "u"
architecture: x86_64 config: image.architecture: amd64 image.description: ubuntu 22.04 LTS amd64 (release) (20240319) image.label: release image.os: ubuntu image.release: jammy image.serial: "20240319" image.type: squashfs image.version: "22.04" volatile.base_image: ca08f2f359079cdb7fb2d4efa882df5974304d7ae9bb13cbac4904a1347626be volatile.cloud-init.instance-id: fd955459-ecfc-4d00-932e-896aa690f8f5 volatile.idmap.base: "0" volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]' volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]' volatile.last_state.idmap: '[]' volatile.last_state.power: RUNNING volatile.uuid: 72c6dd51-b44c-42ef-ac72-4064385a644e volatile.uuid.generation: 72c6dd51-b44c-42ef-ac72-4064385a644e devices: root: path: / pool: default type: disk ephemeral: false profiles:
location: none metadata: context: ip: '@' method: GET protocol: unix url: /1.0 username: root level: debug message: Handling API request timestamp: "2024-04-15T12:08:28.290919569Z" type: logging
location: none metadata: context: ip: '@' method: GET protocol: unix url: /1.0/events username: root level: debug message: Handling API request timestamp: "2024-04-15T12:08:28.292459798Z" type: logging
location: none metadata: context: id: 7206ca2e-6647-493d-acb0-9f2b739ad80f local: /var/snap/lxd/common/lxd/unix.socket remote: '@' level: debug message: Event listener server handler started timestamp: "2024-04-15T12:08:28.292742589Z" type: logging
location: none metadata: context: ip: '@' method: PUT protocol: unix url: /1.0/instances/u/state username: root level: debug message: Handling API request timestamp: "2024-04-15T12:08:28.293482232Z" type: logging
location: none metadata: class: task created_at: "2024-04-15T12:08:28.29445839Z" description: Stopping instance err: "" id: f74b35a7-28f7-4da7-a3a2-945f79b9d29a location: none may_cancel: false metadata: null resources: instances:
location: none metadata: context: class: task description: Stopping instance operation: f74b35a7-28f7-4da7-a3a2-945f79b9d29a project: default level: debug message: New operation timestamp: "2024-04-15T12:08:28.296017929Z" type: logging
location: none metadata: class: task created_at: "2024-04-15T12:08:28.29445839Z" description: Stopping instance err: "" id: f74b35a7-28f7-4da7-a3a2-945f79b9d29a location: none may_cancel: false metadata: null resources: instances:
location: none metadata: context: class: task description: Stopping instance operation: f74b35a7-28f7-4da7-a3a2-945f79b9d29a project: default level: debug message: Started operation timestamp: "2024-04-15T12:08:28.29604927Z" type: logging
location: none metadata: context: ip: '@' method: GET protocol: unix url: /1.0/operations/f74b35a7-28f7-4da7-a3a2-945f79b9d29a username: root level: debug message: Handling API request timestamp: "2024-04-15T12:08:28.297029355Z" type: logging
location: none metadata: context: instance: u instanceType: container project: default timeout: 10m0s level: debug message: Shutdown started timestamp: "2024-04-15T12:08:28.305543127Z" type: logging
location: none metadata: context: action: shutdown created: 2024-04-15 09:15:51.927293086 +0000 UTC ephemeral: "false" instance: u instanceType: container project: default timeout: 10m0s used: 2024-04-15 12:07:09.356193457 +0000 UTC level: info message: Shutting down instance timestamp: "2024-04-15T12:08:28.305832124Z" type: logging
location: none metadata: context: action: stop instance: u project: default reusable: "true" level: debug message: Instance operation lock created timestamp: "2024-04-15T12:08:28.305813353Z" type: logging
location: none metadata: context: instance: u instanceType: container project: default level: debug message: Shutdown request sent to instance timestamp: "2024-04-15T12:08:28.306351356Z" type: logging
location: none metadata: context: ip: '@' method: GET protocol: unix url: /1.0 username: root level: debug message: Handling API request timestamp: "2024-04-15T12:10:38.268495437Z" type: logging
location: none metadata: context: ip: '@' method: GET protocol: unix url: /1.0/instances/u?recursion=1 username: root level: debug message: Handling API request timestamp: "2024-04-15T12:10:38.269666709Z" type: logging
location: none metadata: context: driver: dir instance: u pool: default project: default level: debug message: GetInstanceUsage started timestamp: "2024-04-15T12:10:38.275039775Z" type: logging
location: none metadata: context: driver: dir instance: u pool: default project: default level: debug message: GetInstanceUsage finished timestamp: "2024-04-15T12:10:38.275631324Z" type: logging
location: none metadata: context: ip: '@' method: GET protocol: unix url: /1.0/instances/u/logs/lxc.log username: root level: debug message: Handling API request timestamp: "2024-04-15T12:10:38.294387288Z" type: logging
location: none metadata: action: instance-log-retrieved requestor: address: '@' protocol: unix username: root source: /1.0/instances/u/backups/lxc.log project: default timestamp: "2024-04-15T12:10:38.295641303Z" type: lifecycle
location: none metadata: class: task created_at: "2024-04-15T12:08:28.29445839Z" description: Stopping instance err: 'Failed shutting down instance, status is "Running": context deadline exceeded' id: f74b35a7-28f7-4da7-a3a2-945f79b9d29a location: none may_cancel: false metadata: null resources: instances:
location: none metadata: context: instance: u instanceType: container project: default timeout: 10m0s level: debug message: Shutdown finished timestamp: "2024-04-15T12:18:28.307150063Z" type: logging
location: none metadata: context: class: task description: Stopping instance err: 'Failed shutting down instance, status is "Running": context deadline exceeded' operation: f74b35a7-28f7-4da7-a3a2-945f79b9d29a project: default level: debug message: Failure for operation timestamp: "2024-04-15T12:18:28.307227229Z" type: logging
location: none metadata: context: listener: 7206ca2e-6647-493d-acb0-9f2b739ad80f local: /var/snap/lxd/common/lxd/unix.socket remote: '@' level: debug message: Event listener server handler stopped timestamp: "2024-04-15T12:18:28.312781582Z" type: logging