cloud-init cloud-config-mounts can add duplicate fstab entries

Bug #524562 reported by Scott Moser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Fix Released
Low
Scott Moser

Bug Description

Binary package hint: cloud-init

If you do:
  sudo rm /var/lib/cloud/config-mounts*
  sudo start cloud-config-mounts

You'll notice that /etc/fstab something like:
# cloud-config mounts
/dev/sda2 /mnt auto defaults 0 0
/dev/sda3 none swap sw 0 0
# cloud-config mounts
/dev/sda2 /mnt auto defaults 0 0
/dev/sda3 none swap sw 0 0

The second comment and entries are written even though they're already present.
It seems reasonable that to not write a new entry if an existing entry is present.

The fallout of this, is that if /etc/fstab is as shown above, a 'reboot' will never end up with 'filesystems' being emitted, and anything that depends on that will never run (quite a lot).

ProblemType: Bug
Architecture: i386
Date: Fri Feb 19 17:53:29 2010
DistroRelease: Ubuntu 10.04
Package: cloud-init 0.5.5-0ubuntu2
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: User Name 2.6.32-302.6-ec2
SourcePackage: cloud-init
Uname: Linux 2.6.32-302-ec2 i686

Related branches

Revision history for this message
Scott Moser (smoser) wrote :
Changed in cloud-init (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Might be nice to pipe the file through uniq -u, write to a tmpfile, and move it back to /etc/fstab to prune dupes.

Revision history for this message
Eric Hammond (esh) wrote :

I don't think that "uniq -u" does what is needed here.This might be closer to what you're looking for:

  perl -ni -e 'print if !$seen{$_}++' /etc/fstab

but that would also remove repeated comment lines which may be desired in some cases. Best to just not add duplicates in the first place.

Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
assignee: nobody → Scott Moser (smoser)
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.5.9-0ubuntu1

---------------
cloud-init (0.5.9-0ubuntu1) lucid; urgency=low

  * New upstream release.
  * rename apt list files. 'ubuntu-bug' now works without update (LP: #513060)
  * replace 'cloudconfig' entries in fstab rather than appending (LP: #524562)
  * fix to fstab writing on ebs-root instances
 -- Scott Moser <email address hidden> Mon, 08 Mar 2010 13:07:02 -0500

Changed in cloud-init (Ubuntu):
status: In Progress → Fix Released
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.