canonical / canonical/cloud-init

BUG - when installing any packages that depend on packagekit during bootcmd, process hangs on bootcmd, even if DEBIAN_FRONTEND is set to non-interactive

Open
#5,608 3 comments 0 reactions 0 assignees View on GitHub
bug incomplete
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# Bug report
When installing any packages that depend on packagekit during bootcmd, process hangs on bootcmd, even if DEBIAN_FRONTEND is set to noninteractive

## Steps to reproduce the problem
```yaml
#cloud-config
bootcmd:
- [ cloud-init-per, instance, removeResolveConf, rm, /etc/resolv.conf ]
- [ cloud-init-per, instance, relinkResolveConf, ln, -s, /run/systemd/resolve/resolv.conf, /etc/resolv.conf ]
- [ cloud-init-per, instance, aptUpdate, apt-get, update, -qyy ]
- [ cloud-init-per, instance, aptPurgeNeedRestart, apt-get, autoremove, -qyy, --purge, needrestart ]
- [ cloud-init-per, instance, aptInstallAptUtils, bash, -c ,"export DEBIAN_FRONTEND=noninteractive; apt-get install --no-install-recommends -qyy apt-utils dialog git ca-certificates cargo landscape-common libssl-dev pkg-config **software-properties-common**;" ]
```
Adding "echo \"FRONTEND=${DEBIAN_FRONTEND}\"" ends up printing noninteractive, so the environment variable is being exported correctly.

Example Hang
```bash
...
...
[ 55.371121] cloud-init[482]: Setting up cargo (1.75.0+dfsg0ubuntu1-0ubuntu7) ...
[ 55.407109] cloud-init[482]: Processing triggers for libc-bin (2.39-0ubuntu8.2) ...
[ 55.445129] cloud-init[482]: Processing triggers for dbus (1.14.10-4ubuntu4) ...
[ 55.479121] cloud-init[482]: Processing triggers for sgml-base (1.31) ...
[ 55.511148] cloud-init[482]: Setting up polkitd (124-2ubuntu1) ...
[ 55.543159] cloud-init[482]: Creating group 'polkitd' with GID 991.
[ 55.573162] cloud-init[482]: Creating user 'polkitd' (User for polkitd) with UID 991 and GID 991.
[ 55.614173] cloud-init[482]: invoke-rc.d: could not determine current runlevel
[ 55.752612] cloud-init[482]: Setting up packagekit (1.2.8-2build3) ...
[ 55.784170] cloud-init[482]: invoke-rc.d: could not determine current runlevel
### NOTHING BEYOND THIS POINT ###
```
## Environment details
- Cloud-init version: 24.1.3-0ubuntu3.3
- Operating System Distribution: Ubuntu 24.04
- Cloud provider, platform or installer type: AWS

## cloud-init logs
unable to capture logs since boot never finishes, but can be reproduced every time. The reason for including it in bootcmd, is otherwise the apt sources via ppas don't get ingested correctly. I also use the Ubuntu minimal images from AWS. It DOES NOT hang when software-properties-common is defined in the package list, but at that point, it's too late.
[24.04 minimal](https://aws.amazon.com/marketplace/pp/prodview-a2hsmwr6uilqq)
[22.04 minimal](https://aws.amazon.com/marketplace/pp/prodview-o5bowpuwmx3ng)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.