scrapli / scrapligo

scrapli, but in go!
MIT License
253 stars 36 forks source link

failed to open driver: read /dev/ptmx: input/output error #139

Closed zwiy closed 1 year ago

zwiy commented 1 year ago

Hi

I'm not sure if it's related to this: https://github.com/scrapli/scrapligo/pull/135

I wrote a small scrapligo application inside a vscode devcontainer mcr.microsoft.com/devcontainers/go:0-1.20-bullseye. It's running as it should.

But running it in an alpine, ubuntu or golang container doesn't work and ends up directly with this error message while opening the driver Driver.open():

read /dev/ptmx: input/output error

Maybe somebody has a hint for me? Thanks!

hellt commented 1 year ago

Maybe as a workaround you can use standard transport which doesn't use pty?

zwiy commented 1 year ago

Thanks for your fast response. Where can I set/change the transport mode?

Currently I have something like that:

p, err := platform.NewPlatform(
    platformDefinitionPath,
    hostname,
    options.WithAuthNoStrictKey(),
    options.WithAuthUsername(username),
    options.WithAuthPassword(password),
    options.WithAuthSecondary(enablePassword),
)
if err != nil {
    return nil, fmt.Errorf("failed to create platform: %w", err)
}

d, err := p.GetNetworkDriver()
if err != nil {
    return nil, fmt.Errorf("failed to fetch generic driver from the platform: %w", err)
}

...
hellt commented 1 year ago

https://github.com/srl-labs/containerlab/blob/56005c08358c3d4ca33b647e82f08511e5a68858/netconf/netconf.go#L25

zwiy commented 1 year ago

Nice 🚀 . Thanks for your help. It runs now also in an alpine image.