mgmt icon indicating copy to clipboard operation
mgmt copied to clipboard

Port mgmt to OpenBSD

Open Superpat opened this issue 6 years ago • 12 comments

Versions:

  • mgmt version (eg: mgmt --version): git master

  • operating system/distribution (eg: uname -a): OpenBSD 6.6 GENERIC.MP#402 amd64

  • golang version (eg: go version): go version go1.13.3 openbsd/amd64

Description:

I'd like to create a port of mgmt for OpenBSD

Superpat avatar Nov 09 '19 00:11 Superpat

The main problem right now is that, as I understand it, mgmt currently requires go1.11.x, once it builds with the go compiler in OpenBSD-current I'll start trying to port it.

Superpat avatar Nov 09 '19 00:11 Superpat

@Superpat We have a 1.11 minimum for testing purposes, and in particular because we pull in etcd, but if you want to use an older version I wouldn't be surprised if it would still work. Or did you mean that you wanted to use a newer version?

purpleidea avatar Nov 09 '19 00:11 purpleidea

I meant using a newer version than 1.11. At the time being, the openbsd version of go is 1.13

Superpat avatar Nov 10 '19 03:11 Superpat

@Superpat Oh, port away. I'll be moving the default to 1.12 shortly, with the test adding in 1.13 as optional. I've only delayed it because I found a bug that seems to occur with much higher frequency on 1.12 (I plan to patch it ASAP) but it shouldn't block any porting.

HTH

purpleidea avatar Nov 10 '19 04:11 purpleidea

For reference: I've gotten to the point where almost all go deps are installed, I'm facing a few linking problems now, but havent had the time to check them out in depth.

Superpat avatar Nov 19 '19 23:11 Superpat

@Superpat Cool-- Feel free to ping here with progress or any questions.

purpleidea avatar Nov 19 '19 23:11 purpleidea

So during compilation:

$ GOTAGS='novirt nodocker' gmake build
Building: mgmt, os/arch: openbsd-amd64, version: 0.0.21-38-ge18adc7-dirty...
real	0m1.462s
user	0m0.780s
sys	0m0.910s
gmake: *** [Makefile:175: build/mgmt-openbsd-amd64] Error 2

I'm facing these two issues:

This I'm not sure yet how to fix yet

# github.com/purpleidea/mgmt/util/socketset
util/socketset/socketset.go:48:31: undefined: unix.AF_NETLINK
util/socketset/socketset.go:54:33: undefined: unix.SockaddrNetlink
util/socketset/socketset.go:107:9: undefined: unix.NLMSG_HDRLEN
util/socketset/socketset.go:116:51: undefined: syscall.NetlinkMessage
util/socketset/socketset.go:122:9: undefined: syscall.ParseNetlinkMessage

I have to get rid / replace this dependency.

# github.com/coreos/go-systemd/internal/dlopen
ld: error: unable to find library -ldl
cc: error: linker command failed with exit code 1 (use -v to see invocation)

Superpat avatar Nov 22 '19 00:11 Superpat

For socketset, you'll see here:

https://github.com/purpleidea/mgmt/search?q=util%2Fsocketset&unscoped_q=util%2Fsocketset

It's only used by the net resource (systemd) and cpu count.

You can provide alternates on BSD-- for the svc resource, you can just disable it with an os build tag. If you think there's a good BSD system manager, then please write a resource for that =D

For the cpu count, you can make an alternate that returns an error or a -1 or something. Ideally you'd actually implement this though =D

purpleidea avatar Nov 22 '19 03:11 purpleidea

@Superpat do you have a fork or clone somewhere with your diffs? I'm interested in seeing how close this gets for the Other BSD.

dch avatar Nov 22 '19 20:11 dch

@dhc done !

Superpat avatar Nov 22 '19 21:11 Superpat

I have some train hours this week while travelling before fosdem, maybe I can work on this a bit more.

@purpleidea After rebasing and installing new etcd deps, I'm getting the following errors:

` firefly$ GOTAGS='novirt nodocker' gmake build
Building: mgmt, os/arch: openbsd-amd64, version: 0.0.21-63-g9f4daa2-dirty... ../../../go.etcd.io/etcd/vendor/google.golang.org/grpc/balancer_conn_wrappers.go:28:2: use of internal package google.golang.org/grpc/internal/buffer not allowed ../../../go.etcd.io/etcd/vendor/google.golang.org/grpc/clientconn.go:49:2: use of internal package google.golang.org/grpc/internal/resolver/dns not allowed ../../../go.etcd.io/etcd/vendor/google.golang.org/grpc/clientconn.go:50:2: use of internal package google.golang.org/grpc/internal/resolver/passthrough not allowed

real 0m0.476s user 0m0.410s sys 0m0.300s gmake: *** [Makefile:175: build/mgmt-openbsd-amd64] Error 1 `

I'll spend some more time on this tomorrow morning.

Superpat avatar Jan 22 '20 07:01 Superpat

use of internal package google.golang.org/grpc/internal/resolver/passthrough

I don't know why, but make sure you have the submodules checked out at the correct versions:

git submodule init && git submodule update ... You should see a bunch of stuff if you run tree vendor/ in the mgmt root directory.

Or maybe those just don't work on *BSD ?

purpleidea avatar Jan 24 '20 08:01 purpleidea