Sorry for the long reply, but I’ll try to give you some additional information.
Theese are the semplified command line from host
incus exec mysql -- sh -c "apt update" > work fine
incus exec mysql --mode=interactive -- sh -c "apt update" > hangs
This is the script that I used for test the different behavior:
#!/bin/bash
BRed=$'\033[1;31m' # Red
BGreen=$'\033[1;32m' # Green
Color_Off=$'\033[0m' # Text Reset
TMSTMP=$(date +'%Y%m%d%H%M%S')
function update_container() {
#incus exec ${1} --mode=interactive -- sh -c "apt-get update 2>&1" | sed '/^$/d' | sed "s/^/$(date) - ${BGreen}${1}${Color_Off} /"
incus exec ${1} -- sh -c "apt update 2>&1" | sed '/^$/d' | sed "s/^/$(date) - ${BGreen}${1}${Color_Off} /"
}
echo $(date) "- ${BGreen}Start updating incus container...${Color_Off}"
update_container mysql
echo $(date) "- ${BGreen}Updating incus container ended.${Color_Off}"
and below the output of the script in the two cases
alex@alex-XPS-15-9570:~/scripts$ ./update-incus-container-test.sh
ven 15 ago 2025, 20:41:49, CEST - Start updating incus container...
ven 15 ago 2025, 20:41:49, CEST - mysql ^Cven 15 ago 2025, 20:45:58, CEST - Updating incus container ended.
alex@alex-XPS-15-9570:~/scripts$ ./update-incus-container-test.sh
ven 15 ago 2025, 20:46:45, CEST - Start updating incus container...
ven 15 ago 2025, 20:46:45, CEST - mysql WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
ven 15 ago 2025, 20:46:45, CEST - mysql Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
ven 15 ago 2025, 20:46:45, CEST - mysql Hit:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
ven 15 ago 2025, 20:46:45, CEST - mysql Hit:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
ven 15 ago 2025, 20:46:45, CEST - mysql Hit:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
ven 15 ago 2025, 20:46:45, CEST - mysql Reading package lists...
ven 15 ago 2025, 20:46:45, CEST - mysql Building dependency tree...
ven 15 ago 2025, 20:46:45, CEST - mysql Reading state information...
ven 15 ago 2025, 20:46:45, CEST - mysql 2 packages can be upgraded. Run 'apt list --upgradable' to see them.
ven 15 ago 2025, 20:46:48, CEST - Updating incus container ended.
In the case that hangs, in the incus-ui operations panel, there’s this notification:
command: ["sh","-c","apt-get update 2>&1"]environment: {"HOME":"/root","LANG":"C.UTF-8","PATH":"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin","TERM":"xterm-256color","TZ":"Europe/Rome","USER":"root"}fds: {"0":"4d43b437d5c026c093f00b7e6e2fc5e7e4ad7bdb4e3b46b09043abe5278c9e83","control":"c9534f03029b967ef9ceb08cf6e45d1fef7e9b8c91b49553759eec5cf8ad24af"}interactive: true
My incus configuration is the default and mysql container configuration is:
alex@alex-XPS-15-9570:~/scripts$ incus info mysql
Name: mysql
Description: mysql
Status: RUNNING
Type: container
Architettura: x86_64
PID: 6977
Created: 2023/12/17 16:24 CET
Last Used: 2025/08/15 20:33 CEST
Started: 2025/08/15 20:33 CEST
Resources:
Processes: 98
Utilizzo disco:
root: 8.44GiB
Utilizzo CPU:
Utilizzo CPU (in secondi): 42
Memory usage:
Memory (current): 639.86MiB
Network usage:
eth0:
Type: broadcast
State: UP
Host interface: vethd3405a29
MAC address: 00:16:3e:be:6a:29
MTU: 1500
Bytes ricevuti: 9.56MB
Byte inviati: 429.36kB
Packets received: 6566
Packets sent: 5334
IP addresses:
inet: 10.211.114.173/24 (global)
inet6: fe80::216:3eff:febe:6a29/64 (link)
lo:
Type: loopback
State: UP
MTU: 65536
Bytes ricevuti: 15.61kB
Byte inviati: 15.61kB
Packets received: 126
Packets sent: 126
IP addresses:
inet: 127.0.0.1/8 (local)
inet6: ::1/128 (local)
Snapshots:
±----------------------------------------±----------------------±----------------------±---------+
| Name | Taken at | Expires at | Stateful |
±----------------------------------------±----------------------±----------------------±---------+
| snap_2025-08-10_18:04:01 | 2025/08/10 18:04 CEST | 2025/08/17 18:04 CEST | NO |
±----------------------------------------±----------------------±----------------------±---------+
| snap_2025-08-13_17:27:29 | 2025/08/13 17:27 CEST | 2025/08/20 17:27 CEST | NO |
±----------------------------------------±----------------------±----------------------±---------+
| snap_2025-08-14_11:25:35 | 2025/08/14 11:25 CEST | 2025/08/21 11:25 CEST | NO |
±----------------------------------------±----------------------±----------------------±---------+