Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a nice warning when running without root #64

Closed
johanneswuerbach opened this issue Jan 13, 2016 · 6 comments
Closed

Show a nice warning when running without root #64

johanneswuerbach opened this issue Jan 13, 2016 · 6 comments
Assignees

Comments

@johanneswuerbach
Copy link
Contributor

Currently users running docker-machine create -d xhyve test without root are receiving an ugly error message Error creating machine: Error in driver during machine creation: exit status 1

Instead this driver should print a nice warning and tell the users that root is required.

@zchee
Copy link
Member

zchee commented Jan 13, 2016

@johanneswuerbach Yes, I think so, too.

I tried os.Chown(os.Args[0], 0, 0) on PreCreateCheck(), but does not work.
Maybe caused by first run command user to has not root permission.

I think, the uid check insert to PreCreateCheck()

e.g. (example code. too dirty.)

// Print driver version, Check VirtualBox version
func (d *Driver) PreCreateCheck() error {
    .
    .
    .
    bin, err := os.Stat(os.Args[0])
    if err != nil {
        return err
    }
    if int(bin.Sys().(*syscall.Stat_t).Uid) == 501 {
        log.Infof("docker-machine-driver-xhyve need root owner. See https://github.com/zchee/docker-machine-driver-xhyve#install")
        os.Exit(1)
    }

    return nil
}

What do you think?

@johanneswuerbach
Copy link
Contributor Author

Yep, exactly like this 👍

@zchee
Copy link
Member

zchee commented Jan 13, 2016

@johanneswuerbach :)
If has been merged PR on homebrew, I will add this method.
and, Bump version v0.2.2 to later.

@zchee
Copy link
Member

zchee commented Jan 20, 2016

@johanneswuerbach I created a pull-request :)
#75

@zchee
Copy link
Member

zchee commented Jan 22, 2016

Merged 278eb5a.

If you find a bug, Could you tell me?
and, I will increase the more test for the future.

Close.

@zchee zchee closed this as completed Jan 22, 2016
@zchee zchee removed the in progress label Jan 22, 2016
@korsmakolnikov
Copy link

this is really annoying. I still have this issue on mac os 10.11.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants