canonical / canonical/cloud-init

fstab entry for disk without filesystem

Open
#4,342 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
3d 8h
Merged PRs (30d)
22

Description

# Bug report
It is possible to get into a situation where cloud-init creates an entry in `/etc/fstab` for a device that has no file system.

`cc_mounts` automatically creates an entry in fstab when a device with `ephemeral` or `ebs` in the name is found. While the `fstab` entry contains `nofail` this does not stop the `mount` command from complaining:

```
cloud-init.log:2021-11-17 16:09:30,601 - cc_mounts.py[DEBUG]: Changes to fstab: ['+ /dev/xvdb /mnt auto defaults,nofail,x-systemd.requires=cloud-init.service,comment=cloudconfig 0 2']
cloud-init.log:Stderr: mount: /mnt: wrong fs type, bad option, bad superblock on /dev/xvdb, missing codepage or helper program, or other error.
```

In effect we are training users to ignore errors, which I consider a bad thing.

We have various options to look at this and handle the topic but the direction is not obvious.

1.) Do away with the automagic setup of ephemeral devices
- This to a certain extend represents a loss of convenience and existing functionality. As such this is probably not the preferred path
2.) Only create an entry in fstab if `cc_disk_setup` is in the config and has a configuration for the automatically detected device
3.) Automagically create a default setup, 1 partition with a filesystem on the device

Other directions exist. There is no obvious answer and we probably need to form a consensus opinion about what the behavior should be.

## Steps to reproduce the problem

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

## cloud-init logs

Contributor guide

Open the contributing guide

Research direction

Start with the cc_mounts behavior that detects devices named ephemeral or ebs and writes entries to /etc/fstab, then compare it with the cc_disk_setup configuration described in the issue. Use the provided cloud-init log as the failure symptom. Done requires a maintainer-approved consensus on the desired behavior and a defined implementation direction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.