mkfs fails on interactive input when no partition is used

Bug #1548772 reported by Graham Leggett
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
cloud-init (Ubuntu)
Fix Released

Bug Description

When an attempt is made to format a block device directly on a cloud platform like Azure as below, this attempt fails as follows:

  - label: data
    device: /dev/sdc
    filesystem: ext4

2016-02-23 11:01:50,344 -[WARNING]: Failed during filesystem operation
Failed to exec of '['/sbin/mkfs.ext4', '/dev/sdc', '-L', 'data']':
Unexpected error while running command.
Command: ['/sbin/mkfs.ext4', '/dev/sdc', '-L', 'data']
Exit code: 1
Reason: -
Stdout: '/dev/sdc is entire device, not just one partition!\nProceed anyway? (y,n) '
Stderr: 'mke2fs 1.42.9 (4-Feb-2014)\n'

It looks like the -F option needs to be added to mkfs.ext4 to force mkfs to be non-interactive.

Related branches

Revision history for this message
Scott Moser (smoser) wrote :

There is code in cloud-init to pass the '--force' flag on mkfs.ext4.
It will do that if it thinks it is calling mkfs on a 'disk' (rather than 'part') as would be output by:
  lsblk --pairs --output 'NAME,TYPE,FSTYPE,LABEL' /dev/sda

Can you tell me what version of OS (and version) you're running this on ? And what cloud-init?

Revision history for this message
Scott Moser (smoser) wrote :

fixed in revno 1196

Changed in cloud-init:
importance: Undecided → Medium
status: New → Fix Committed
Changed in cloud-init (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.7~bzr1200-0ubuntu1

cloud-init (0.7.7~bzr1200-0ubuntu1) xenial; urgency=medium

  * New upstream snapshot.
    - fix adding of users when no group is specified (LP: #1562918)
    - fix write_files with compressed content (LP: #1565638)
    - systemd: do not specify After of obsolete (LP: #1536964)
    - chef: fix chef installation from gems (LP: #1553345)
    - disk_setup: correctly send force to mkfs on block devices (LP: #1548772)
    - locale: list unsupported environment settings in warning (LP: #1558069)
    - fix NoCloud and other datasources if no datasource config (LP: #1514407)

 -- Scott Moser <email address hidden> Wed, 06 Apr 2016 13:07:27 -0400

Changed in cloud-init (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Scott Moser (smoser) wrote :

This is fixed in cloud-init 0.7.7

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.