canonical / canonical/cloud-init

debian/ubuntu: preinst errors from dpkg issues expecting /etc/fstab file

Open
#6,148 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# Bug report
When trying to install cloud-init deb package on a system which doesn't contain cloud-init, the following error message is printed:
```
root@dev-p:~# apt install cloud-init --assume-yes
Installing:
cloud-init

Installing dependencies:
cloud-init-base

Summary:
Upgrading: 0, Installing: 2, Removing: 0, Not Upgrading: 0
Download size: 619 kB
Space needed: 3193 kB / 5734 MB available
...
Get:1 http://archive.ubuntu.com/ubuntu plucky/main amd64 cloud-init-base all 25.1.1-0ubuntu2 [617 kB]
Get:2 http://archive.ubuntu.com/ubuntu plucky/main amd64 cloud-init all 25.1.1-0ubuntu2 [2098 B]
Fetched 619 kB in 1s (614 kB/s)
Preconfiguring packages ...
Selecting previously unselected package cloud-init-base.
(Reading database ... 38554 files and directories currently installed.)
Preparing to unpack .../cloud-init-base_25.1.1-0ubuntu2_all.deb ...
awk: fatal: cannot open file `/etc/fstab' for reading: No such file or directory <-------- HERE
Unpacking cloud-init-base (25.1.1-0ubuntu2) ...
....
```

In some environments, /etc/fstab may not exist (such as LXC containers), yet some functions in cloud-init-base.preinst make assumptions that such a file exists.

## Steps to reproduce the problem
```
lxc launch ubuntu-daily:plucky dev-p
lxc exec dev-p bash
apt remove cloud-init-base cloud-init --assume-yess
root@dev-p:~# apt install cloud-init --assume-yes | grep fstab

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

awk: fatal: cannot open file `/etc/fstab' for reading: No such file or directory

````

## Environment details
- Cloud-init version: 25.1
- Operating System Distribution: Ubuntu/Debian
- Cloud provider, platform or installer type:

## cloud-init logs
n/a

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.