2

I know that you could extract serial number from machine running dmidecode -t system, but how could I do that when running preseed installation of Debian? dmidecode command is not yet available, is it somehow possible to install/run it at the installation of the distro?

1

2 Answers 2

2

By way of example, here's how I assign the product serial number to the hostname:

# preseed.cfg
d-i preseed/early_command string \
  debconf-set netcfg/get_hostname "$(cat /sys/class/dmi/id/product_serial)"
d-i netcfg/get_hostname seen true

That's the relevant section of a preseed.cfg I use with my Ubuntu installers to get pertinent DMI things.

I did try to use dmidecode but...

  • anna/choose_modules string dmidecode-udeb (apparently) failed to install the "microdeb" early enough
  • preseed/early_command string anna-install dmidecode-udeb also failed to install it

pkgsel/include string dmidecode did install the package on the target, but only after the network configuration. I tried to use preseed/late_command string in-target to sed -i "s/dummyhostname/$(dmidecode -s system-serial-number)/g" files under /etc/ but I kept finding the hostname in more places.

1

Depends on your environment and precise needs:

  • If you boot the installer via Syslinux, you can use SYSAPPEND 0x80 to put it on the kernel command line.
  • Or you can preseed anna/choose_modules to dmidecode-udeb to make it available in the installer environment.
  • Or you can parse the serial number out of /sys/firmware/dmi/entries/1-0/raw (but that's binary).
  • Or you can preseed pkgsel/include to install it into your target system and use it from there.
1
  • Thanks Ferenc, the anna/choose_modules sounds like a plan, I will give it a try. Oct 9, 2017 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.