dermotbradley / create-alpine-disk-image

Create cloud-init enabled Alpine disk images for physical machines (PCs & RPIs), VMs, and Cloud servers
GNU General Public License v2.0
93 stars 11 forks source link

The resulting Alpine image does not read cloud-init from "guestinfo" when running in ESXI #21

Closed tomastzn closed 1 year ago

tomastzn commented 2 years ago

The image does not read user data and meta data from "guestinfo" when booted up in ESXI (free ESXI, not sure if that makes any difference).

Even tried modifying the file lib/vm-functions to use VMware or VMwareGuestInfo as a data source but no luck. After running ds-identify command it seems to identify the platform but on subsequent boot (after cleanup) it still didn't pickup the data from guestinfo.

dermotbradley commented 2 years ago

Hi. Unfortunately I don't have any VMware hypervisors to test with.

The VMware DataSource in cloud-init was only added fairly recently and is now probably a better one to use than the OVF DS - I will change the code to use that.

You might find VMware's own docs (from before it was merged into upstream cloud-init) for the VMware DS useful: https://github.com/vmware-archive/cloud-init-vmware-guestinfo

All that I can suggest is that you re-run "create-alpine-disk-image" and add "--debug" to the options you provide - one of the things that will do is modify the /etc/cloud/cloud.cfg.d/05_logging.cfg file to enable debugging. With debugging enabled then the /var/log/cloud-init.log file will contain a lot more information which might help figure out what is happening.

tomastzn commented 2 years ago

Sorry for late reply, I will give this another test and report back.

tomastzn commented 2 years ago

Tried again on the same machine and now the process of creating image fails very quickly, only indication of something going wrong is the last two lines of log:

[2022-04-12 23:47:58]   Blkid output:
lsblk: unknown column: PARTTYPENAME,PARTLABEL

Just ends there, nothing after that point.

dermotbradley commented 2 years ago

lsblk: unknown column: PARTTYPENAME,PARTLABEL

ah, it is a typing mistake, there is a missing "," (comma) between "PARTTYPE" and "NAME". It just needs to be fixed here: https://github.com/dermotbradley/create-alpine-disk-image/blob/main/lib/disk-image-functions#L1590

dermotbradley commented 2 years ago

Correction - it is supposed to be PARTTYPENAME. It looks like whatever Linux distro you are running is a bit old, PARTTYPENAME was added to lsblk in Dec 2019: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=107e95594642b96cde430229095edcacb81dfa2f

For now you could just comment out that command in the script...

Just ends there, nothing after that point.

The script should have provided an error "An error occurred, cleaning up before aborting!" in the logfile and exited at that stage.

HugoFlorentino commented 2 years ago

At least on Ubuntu 20.04, there is no column called PARTTYPENAME and the script exits with this error:

[2022-06-16 00:52:48]   Blkid output:
lsblk: unknown column: PARTTYPENAME,PARTLABEL

According to lsblk:

Available output columns:
        NAME  device name
       KNAME  internal kernel device name
        PATH  path to the device node
     MAJ:MIN  major:minor device number
     FSAVAIL  filesystem size available
      FSSIZE  filesystem size
      FSTYPE  filesystem type
      FSUSED  filesystem size used
      FSUSE%  filesystem use percentage
  MOUNTPOINT  where the device is mounted
       LABEL  filesystem LABEL
        UUID  filesystem UUID
      PTUUID  partition table identifier (usually UUID)
      PTTYPE  partition table type
    PARTTYPE  partition type UUID
   PARTLABEL  partition LABEL
    PARTUUID  partition UUID
   PARTFLAGS  partition flags
          RA  read-ahead of the device
          RO  read-only device
          RM  removable device
     HOTPLUG  removable or hotplug device (usb, pcmcia, ...)
       MODEL  device identifier
      SERIAL  disk serial number
        SIZE  size of the device
       STATE  state of the device
       OWNER  user name
       GROUP  group name
        MODE  device node permissions
   ALIGNMENT  alignment offset
      MIN-IO  minimum I/O size
      OPT-IO  optimal I/O size
     PHY-SEC  physical sector size
     LOG-SEC  logical sector size
        ROTA  rotational device
       SCHED  I/O scheduler name
     RQ-SIZE  request queue size
        TYPE  device type
    DISC-ALN  discard alignment offset
   DISC-GRAN  discard granularity
    DISC-MAX  discard max bytes
   DISC-ZERO  discard zeroes data
       WSAME  write same max bytes
         WWN  unique storage identifier
        RAND  adds randomness
      PKNAME  internal parent kernel device name
        HCTL  Host:Channel:Target:Lun for SCSI
        TRAN  device transport type
  SUBSYSTEMS  de-duplicated chain of subsystems
         REV  device revision
      VENDOR  device vendor
       ZONED  zone model
dermotbradley commented 2 years ago

At least on Ubuntu 20.04, there is no column called PARTTYPENAME

Yes, as I indicated this column was added to util-linux source in Dec 2019. Ubuntu LTS is using util-linux 2.34 which predates this change.

It went into util-linux 2.35 (mentioned in the Release Notes but I checked the source).

Debian Stable (Bullseye) ships with util-linux 2.36. I guess I assumed that Ubuntu LTS would have the same or indeed more recent package version than Debian Stable...

HugoFlorentino commented 2 years ago

Perhaps it would be useful querying util-linux version before calling lsblk with custom output.

dermotbradley commented 2 years ago

I'll just drop that field - this is only debug output, it is not important for the script to run in general.

dermotbradley commented 2 years ago

At least on Ubuntu 20.04

Is there any particular reason you are using 20.04? I just checked and this is not the most recent LTS - 22.04 became LTS as of April 21 this year.

As this script is a personal project I'm certainly not going to be testing with very old releases of distros.

HugoFlorentino commented 2 years ago

Is there any particular reason you are using 20.04? I just checked and this is not the most recent LTS - 22.04 became LTS as of April 21 this year.

There is. My data center provider does not support a more recent release, at least officially.

dermotbradley commented 1 year ago

Closing old issue.