Serial number exceeds length supported by System widget
-
Recently set a serial number on my third-party box to accommodate Nexus. The serial number is the 19 character alphanumeric serial number printed on the box. The serial number displays in the Nexus System Widget equivalent, but not in the PHP System Widget.

The PHP widget gets the serial number from
system_get_serial()in/etc/inc/system.inc, in particular from/bin/kenv -q smbios.system.serialat line 3451 for this box. Increasing the upper length limits to 19 on lines 3454 and 3464 causes the serial number to appear in the widget (26.07 version of system.inc). Not sure whether this might break other functions usingsystem_get_serial()?
Minor nit, but thought I'd mention it since the new Nexus serial number requirement may result in longer serial numbers than seen in the past.
3448 } else { 3449 foreach (array('system', 'planar', 'chassis') as $key) { 3450 unset($output); 3451 $_gb = exec("/bin/kenv -q smbios.{$key}.serial", 3452 $output); 3453 if (!empty($output[0]) && $output[0] != "0123456789" && 3454 preg_match('/^[\w\d]{10,16}$/', $output[0]) === 1) { 3455 $serial = $output[0]; 3456 break; 3457 } 3458 } 3459 } 3460 3461 $vm_guest = get_single_sysctl('kern.vm_guest'); 3462 3463 $serial = chop($serial); 3464 if (strlen($serial) >= 10 && strlen($serial) <= 18 && 3465 $vm_guest == 'none') { 3466 return $serial; 3467 } -
The PHP widget is only meant to show the serial for Netgate hardware.
-
@marcosm said in Serial number exceeds length supported by System widget:
The PHP widget is only meant to show the serial for Netgate hardware.
I didn't know the intended use, but seems like the serial number might be useful info on all platforms now that it's required for Nexus.
And it does currently display for non-Netgate hardware if the serial number is from 10-16 alphanumeric characters. I had no idea the widget was even capable of displaying a serial number until I saw this post showing the serial number on a Protectli box.
Privacy Policy · Cookie Policy