cloud-init icon indicating copy to clipboard operation
cloud-init copied to clipboard

OpenBSD: disk-based DataSource detection is unreliable

Open igalic opened this issue 1 year ago • 1 comments

Bug report

in ds-identify, OpenBSD disk detection doesn't exist, which means it uses the Linux paths, which don't work. in the Python code, the disk-detection looks rather questionable:

https://github.com/canonical/cloud-init/blob/4f60ff099eb0a6f57595706f4d34cf713d3c02b1/cloudinit/util.py#L1444-L1458

none of the criteria are actually considered. We only return any found cd drives, whether those have anything mounted or not. But a source could just as well be mounted as disk.

Steps to reproduce the problem

  • mount a vfat formatted drive with user-data
  • set datasource_list to NoCloud or ConfigDrive, depending on your format
  • cloud-init clean -slr
  • does it work?

Environment details

  • Cloud-init version: main
  • Operating System Distribution: OpenBSD
  • Cloud provider, platform or installer type: source

igalic avatar Dec 19 '23 22:12 igalic

I had a look at that.

So it uses this sysctl command, which returns a very thin output:

# sysctl -n hw.disknames                                                                                                                                                                                                                                                                                               
cd0:,cd1:,sd0:34abf85fbe2151ba,fd0:

To know if there's something behind cd0, cd1, fd0, disklabel can be used:

disklabel cd0 
# /dev/rcd0c:
type: ATAPI
disk: cidata          
label:                 
duid: 0000000000000000
flags:
bytes/sector: 2048
sectors/track: 100
tracks/cylinder: 1
sectors/cylinder: 100
cylinders: 2
total sectors: 182
boundstart: 0
boundend: 182

16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  a:              182                0 ISO9660                    
  c:              182                0 ISO9660

hcartiaux avatar Apr 13 '24 12:04 hcartiaux