Skip to content

GHW_DISABLE_WARNINGS stop workingΒ #458

Closed

Description

@onyn

After upgrading ghw to v0.23.0 I noticed warnings in application output:

$ export GHW_DISABLE_WARNINGS=1
$ ./go_app
WARN:  Unable to read chassis_serial: open /sys/class/dmi/id/chassis_serial: permission denied
WARN:  Unable to read board_serial: open /sys/class/dmi/id/board_serial: permission denied

Warnings are expected, since I run app in linux under nonprivileged user. But GHW_DISABLE_WARNINGS should suppress them.

I think GHW_DISABLE_WARNINGS broke somewhere in #439, since downgrading to v0.21.3 fixes issue.

Activity

  1. jaypipes commented on Mar 31, 2026

    @jaypipes
    Owner

    @onyn thanks very much for your bug report. I'll look into this ASAP.

  2. self-assigned this
    on Mar 31, 2026
  3. onyn commented on Mar 31, 2026

    @onyn
    Author

    Found note in 600c188:

    Changing `GHW_LOG_LEVEL` to `error` has the same effect of setting
    `GHW_DISABLE_WARNINGS`:
    

    This also doesn't work. Warnings still here when GHW_LOG_LEVEL=error.

  4. jaypipes commented on Apr 1, 2026

    @jaypipes
    Owner

    @onyn I can't seem to replicate this issue on my machine:

    > go run cmd/ghwc/main.go baseboard
    WARN:  Unable to read board_serial: open /sys/class/dmi/id/board_serial: permission denied
    baseboard vendor=System76 version=thelio-mira-b4.1 product=Thelio Mira
    
    > GHW_DISABLE_WARNINGS=1 go run cmd/ghwc/main.go baseboard
    baseboard vendor=System76 version=thelio-mira-b4.1 product=Thelio Mira
    
    > GHW_LOG_LEVEL=debug go run cmd/ghwc/main.go baseboard
    DEBUG: reading from "/sys/class/dmi/id/board_asset_tag"
    DEBUG: reading from "/sys/class/dmi/id/board_serial"
    WARN:  Unable to read board_serial: open /sys/class/dmi/id/board_serial: permission denied
    DEBUG: reading from "/sys/class/dmi/id/board_vendor"
    DEBUG: reading from "/sys/class/dmi/id/board_version"
    DEBUG: reading from "/sys/class/dmi/id/board_name"
    baseboard vendor=System76 version=thelio-mira-b4.1 product=Thelio Mira
    
    > GHW_LOG_LEVEL=error go run cmd/ghwc/main.go baseboard
    baseboard vendor=System76 version=thelio-mira-b4.1 product=Thelio Mira
    

    Would you mind sharing the source code of your ./go_app binary so I can see if there's something about the way you're setting up ghw?

  5. onyn commented on Apr 2, 2026

    @onyn
    Author
    package main
    
    import (
    	"github.com/jaypipes/ghw"
    )
    
    func main() {
    	//ghw.ContextFromEnv()
    	ghw.Baseboard()
    }
    $ GHW_DISABLE_WARNINGS=1 go run main.go 
    WARN:  Unable to read board_serial: open /sys/class/dmi/id/board_serial: permission denied
    

    When I uncomment ghw.ContextFromEnv(), then GHW_DISABLE_WARNINGS works as intended.

  6. jaypipes commented on Apr 2, 2026

    @jaypipes
    Owner

    @onyn sorry about this. #460 should fix it.

  7. jaypipes commented on Apr 2, 2026

    @jaypipes
    Owner

    @onyn release v0.24.0 has been cut and contains the fix. please let me know if you experience any further issues and thanks again for your bug report!

  8. onyn commented on Apr 2, 2026

    @onyn
    Author

    Now it works. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions