I use Incus to run a Ubuntu container. I found that inside container, if I run systemctl start my-service where my service is “oneshot” type, the command doesn’t return. I have to press Ctrl +C to make it quit.
That script doesn’t seem to be suitable to run as a service - surely getpass.getuser() is interactive, waiting for a keyboard response? And therefore it hangs.
I’d say this question isn’t related to incus. For more advice, try on a python programming mailing list.
This is apparently specific to your system, so you will need to provide more details. What’s the incus version? Where did you install it from? What’s the OS and kernel version of the underlying host? What’s the OS type and version that you’re running inside the container?
Hi, the example above faces the same hanging issue, so it must be the problem with my system.
The Incus in my host (Ubuntu 25.04):
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 25.04
Release: 25.04
Codename: plucky
❯ uname -a
Linux MiniDesk 6.14.0-23-generic #23-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 23:02:20 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
❯ apt show incus
Package: incus
Version: 6.0.3-4
Built-Using: go-md2man-v2 (= 2.0.4-1), gobgp (= 3.33.0-1), golang-1.24 (= 1.24.0-2), golang-blackfriday-v2 (=>
Priority: optional
Section: universe/admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Go Packaging Team <team+pkg-go@tracker.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 20.5 kB
Depends: incus-agent (= 6.0.3-4), incus-base (= 6.0.3-4), qemu-system-x86 (>= 1:8.0), swtpm, virtiofsd
Suggests: gdisk
Homepage: https://linuxcontainers.org/incus/
Download-Size: 5,282 B
APT-Manual-Installed: yes
APT-Sources: http://mirrors.tino.org/ubuntu plucky/universe amd64 Packages
Description: Powerful system container and virtual machine manager - daemon
Incus is a next generation system container and virtual machine manager.
It offers a unified user experience around full Linux systems running
inside containers or virtual machines.
.
It's image based with pre-made images available for a wide number of
Linux distributions and is built around a very powerful, yet pretty
simple, REST API.
.
This metapackage will install everything needed to run containers and VMs.
The guest OS:
> uname -a
Linux ubuntu-in-incus 6.14.0-23-generic #23-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 23:02:20 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble
Otherwise, rebuilding the outer host with Ubuntu 24.04 would be a safe solution. Non-LTS versions of Ubuntu are likely to have breaking changes in them.