canonical / canonical/multipass

Using `systemctl is-active` on an inactive service via `multipass exec` results in infinite loop

Open
#3,771 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
9.2k
Forks
828
Avg merge
3d 1h
Merged PRs (30d)
44

Description

**Describe the bug**
I'm running `systemctl is-active` to check if a certain service is active on a multipass node, and if I run it through `multipass ssh`, it works fine and shows up as `inactive` once.

However, if I run it through `multipass exec -- /bin/bash -c "systemctl status "`, it loops, infinitely printing out `inactive`.

This does not occur if the service is actually active.

**To Reproduce**
How, and what happened?
1. `multipass launch --name test`
2. `multipass exec test -- /bin/bash -c "systemctl is-active fake-service"`
3. Infinite loop occurs

The same occurs if you use `systemctl status` on an inactive service.

**Expected behavior**
It should log out `inactive` once and stop outputting to the terminal.

**Additional info**
- OS: macOS 15.0
- `multipass version`: `1.14.1+mac`
- `multipass info`:
```
Name: test
State: Running
Snapshots: 0
IPv4: 192.168.73.9
Release: Ubuntu 24.04.1 LTS
Image hash: ac62c13d0cc8 (Ubuntu 24.04 LTS)
CPU(s): 1
Load: 0.00 0.03 0.00
Disk usage: 1.9GiB out of 4.8GiB
Memory usage: 217.8MiB out of 1.9GiB
Mounts: --
```
- `multipass get local.driver`: `qemu`

Contributor guide

Open the contributing guide

Research direction

Reproduce the loop with `multipass launch --name test` followed by `multipass exec test -- /bin/bash -c "systemctl is-active fake-service"`, then compare it with `multipass ssh` and an active service. Trace the `multipass exec` command path; done means an inactive service prints `inactive` once and exits, including for `systemctl status`.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.