canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.87k stars 857 forks source link

ds-identify doesn't properly detect ISO #3120

Closed ubuntu-server-builder closed 1 year ago

ubuntu-server-builder commented 1 year ago

This bug was originally filed in Launchpad as LP: #1749980

Launchpad details
affected_projects = []
assignee = smoser
assignee_name = Scott Moser
date_closed = 2018-02-22T22:33:47.683217+00:00
date_created = 2018-02-16T15:55:06.048701+00:00
date_fix_committed = 2018-02-22T03:00:37.494358+00:00
date_fix_released = 2018-02-22T22:33:47.683217+00:00
id = 1749980
importance = high
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1749980
milestone = 18.1
owner = sankaraditya
owner_name = Sankar Tanguturi
private = False
status = fix_released
submitter = sankaraditya
submitter_name = Sankar Tanguturi
tags = []
duplicates = []

Launchpad user Sankar Tanguturi(sankaraditya) wrote on 2018-02-16T15:55:06.048701+00:00

I have a proper ISO image mounted for my virtual machine but still 'ds-identify' doesn't properly detect OVF datasource in my virtual machine. On further investigation, found a minor issue with 'read_fs_info()' function in ds-identify.

################################################# In read_fs_info()

    out=$(blkid -c /dev/null -o export) || {         ret=$?         error "failed running [$ret]: blkid -c /dev/null -o export"         DI_FS_LABELS="$UNAVAILABLE:error"         DI_ISO9660_DEVS="$UNAVAILABLE:error"         return $ret     }     IFS="$CR"     set -- $out     IFS="$oifs"     for line in "$@" ""; do         case "${line}" in             DEVNAME=) dev=${line#DEVNAME=};;             LABEL=) label="${line#LABEL=}";                      labels="${labels}${line#LABEL=}${delim}";;             TYPE=*) ftype=${line#TYPE=};;             "") if [ "$ftype" = "iso9660" ]; then                     isodevs="${isodevs} ${dev}=$label"                 fi                 ftype=""; devname=""; label="";         esac     done

This function parses the output for blkid and then sets the 'isodevs' only when there is a proper blank line detected between the entry blocks. #################################################

Inside the virtual machine:

$ sudo blkid -c /dev/null -o export

DEVNAME=/dev/sr0 UUID=2009-04-20-15-30-24-00 LABEL=OVF\ Customization TYPE=iso9660

DEVNAME=/dev/sda1 UUID=2f09aea2-6411-444e-9d5b-32c0aa25c067 TYPE=ext4 PARTUUID=70ae1e13-01

It seems the blank line is not detected. Logging a bug to fix read_fs_info to properly parse the output of blkid.

Please let me know if any other information is required.

Thanks Sankar.

ubuntu-server-builder commented 1 year ago

Launchpad user Sankar Tanguturi(sankaraditya) wrote on 2018-02-16T16:41:28.171209+00:00

From the output of blkid in my virtual machine.

DEVNAME=/dev/sr0 UUID=2009-04-20-15-30-24-00 LABEL=OVF\ Customization TYPE=iso9660

TYPE is printed at the end. And after that, no other entries were printed for 'ISO'. In the output, if

  1. TYPE was displayed before UUID or
  2. PARTUUID (not present now) was displayed after TYPE

the ds-identify would have detected 'OVF'.

So, the main issue is 'ds-identify' doesn't detect OVF if 'TYPE=iso9660' is the last line printed for a block device in blkid.

ubuntu-server-builder commented 1 year ago

Launchpad user Sankar Tanguturi(sankaraditya) wrote on 2018-02-16T18:45:47.987469+00:00

Please ignore the first comment.

Had an offline discussion with Scott Moser. The blank line in the output of 'blkid' is not properly detected and this causes the issue.

ubuntu-server-builder commented 1 year ago

Launchpad user Scott Moser(smoser) wrote on 2018-02-22T22:33:48.578612+00:00

This bug is believed to be fixed in cloud-init in 18.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.