Created attachment 219145 [details] svn diff output of the relevant changes Currently bhyvectl only can have only one type of message when it is unable to establish comms with VM. ---8<---- VM:free12.1 is not created. ---8<---- First time I encountered this lead me astray, as the access issue had to do with user permissions. Easy way to get more info is to report what system call gave as an error code. Including a patch as attachment which should address this issue. The libvmmapi change is there so that sysctlbyname() done within vm_destroy() would not override errno set by earlier syscall to open().
This looks fine.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6bb140e3ca895a148f32c93d50f93619bf735f73 commit 6bb140e3ca895a148f32c93d50f93619bf735f73 Author: Robert Wing <rew@FreeBSD.org> AuthorDate: 2021-03-07 06:19:30 +0000 Commit: Robert Wing <rew@FreeBSD.org> CommitDate: 2021-03-07 06:19:30 +0000 bhyvectl: print a better error message when vm_open() fails Use errno to print a more descriptive error message when vm_open() fails libvmm: preserve errno when vm_device_open() fails vm_destroy() squashes errno by making a dive into sysctlbyname() - we can safely skip vm_destroy() here since it's not doing any critical clean up at this point. Replace vm_destroy() with a free() call. PR: 250671 MFC after: 3 days Submitted by: marko@apache.org Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D29109 lib/libvmmapi/vmmapi.c | 2 +- usr.sbin/bhyvectl/bhyvectl.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3f65cb8fda02c4f643c476f04655de843e31e563 commit 3f65cb8fda02c4f643c476f04655de843e31e563 Author: Marko <marko@apache.org> AuthorDate: 2021-03-07 06:19:30 +0000 Commit: Robert Wing <rew@FreeBSD.org> CommitDate: 2021-07-02 03:17:12 +0000 bhyvectl: print a better error message when vm_open() fails libvmm: explicitly save and restore errno in vm_open() Use errno to print a more descriptive error message when vm_open() fails PR: 250671 Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D29109 (cherry picked from commit 6bb140e3ca895a148f32c93d50f93619bf735f73) (cherry picked from commit a7f81b488df2d4a5dcd785b4112e04ffb6ca0442) lib/libvmmapi/vmmapi.c | 5 ++++- usr.sbin/bhyvectl/bhyvectl.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-)
A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e63372af710790e6d583a0f1f7d0a3a6e55b5369 commit e63372af710790e6d583a0f1f7d0a3a6e55b5369 Author: Marko <marko@apache.org> AuthorDate: 2021-03-07 06:19:30 +0000 Commit: Robert Wing <rew@FreeBSD.org> CommitDate: 2021-07-02 03:18:54 +0000 bhyvectl: print a better error message when vm_open() fails libvmm: explicitly save and restore errno in vm_open() Use errno to print a more descriptive error message when vm_open() fails PR: 250671 Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D29109 (cherry picked from commit 6bb140e3ca895a148f32c93d50f93619bf735f73) (cherry picked from commit a7f81b488df2d4a5dcd785b4112e04ffb6ca0442) lib/libvmmapi/vmmapi.c | 5 ++++- usr.sbin/bhyvectl/bhyvectl.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-)