github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/exec/cli_linux.go (about)

     1  package exec
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/pyroscope-io/pyroscope/pkg/util/caps"
     7  )
     8  
     9  func performOSChecks(spyName string) error {
    10  	var err error
    11  	switch {
    12  	case disableLinuxChecks:
    13  	case spyName == "dotnetspy":
    14  	case spyName == "ebpfspy":
    15  		if !isRoot() {
    16  			err = errors.New("when using eBPF you're required to run the agent with sudo")
    17  		}
    18  	case !caps.HasSysPtraceCap():
    19  		err = errors.New("if you're running pyroscope in a Docker container, add --cap-add=sys_ptrace. " +
    20  			"See our Docker Guide for more information: https://pyroscope.io/docs/docker-guide")
    21  	}
    22  	return err
    23  }