Page MenuHomePhabricator

DMI board/product serial can't be read
Closed, ResolvedPublicBUG

Description

The serial number of the board in use is not displayed when invoking show version

vyos@vyos:~$ show version
Version:          VyOS 1.2.1
Built by:         Sentrium S.L.
Built on:         Sun 14 Apr 2019 12:13 UTC
Build ID:         4ccd819a-db31-452e-b34b-a0b24af4e984

Architecture:     x86_64
Boot via:         installed image
System type:      bare metal

Hardware vendor:  PC Engines
Hardware model:   apu4
Hardware S/N:     Unknown
Hardware UUID:    Unknown

Copyright:        VyOS maintainers and contributors

Calling dmidecode unveils the proper serial number:

root@vyos:/home/vyos# dmidecode
# dmidecode 2.12
SMBIOS 2.7 present.
7 structures occupying 307 bytes.
Table at 0xDFFD7020.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
        Vendor: coreboot
        Version: v4.0.24
        Release Date: 02/04/2019
        ROM Size: 8192 kB
        Characteristics:
                PCI is supported
                PC Card (PCMCIA) is supported
                BIOS is upgradeable
                Selectable boot is supported
                ACPI is supported
                Targeted content distribution is supported
        BIOS Revision: 4.0
        Firmware Revision: 0.0

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: PC Engines
        Product Name: apu4
        Version: 1.0
        Serial Number: 13xxxxx
        UUID: Not Settable
        Wake-up Type: Reserved
        SKU Number: 4 GB
        Family: Not Specified

Handle 0x0002, DMI type 2, 8 bytes
Base Board Information
        Manufacturer: PC Engines
        Product Name: apu4
        Version: 1.0
        Serial Number: 13xxxxx

The problem is that the script gathering all the information /usr/libexec/vyos/op_mode/version.py required root priviledges to access certain files in /sys/class/dmi as indicated by the code itself:

# These two assume script is run as root, normal users can't access those files
version_data['hardware_serial'] = read_file('/sys/class/dmi/id/subsystem/id/product_serial')
version_data['hardware_uuid']   = read_file('/sys/class/dmi/id/subsystem/id/product_uuid')

Details

Difficulty level
Easy (less than an hour)
Version
1.2.1
Why the issue appeared?
Implementation mistake

Event Timeline

c-po claimed this task.Jun 15 2019, 11:53 PM
c-po created this task.
c-po renamed this task from APU4 board serial number not shown to DMI board/product serial can't be read.Jun 16 2019, 8:48 AM
c-po updated the task description. (Show Details)
c-po closed this task as Resolved.Jun 16 2019, 8:54 AM
c-po triaged this task as Low priority.
c-po moved this task from Needs Triage to Finished on the VyOS 1.2 Crux (VyOS 1.2.2) board.
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.
c-po changed Difficulty level from Normal (likely a few hours) to Easy (less than an hour).
c-po changed Why the issue appeared? from Will be filled on close to Implementation mistake.