Bug 261729 - emulators/virtualbox-ose: VBoxSharedClipboard.so required for non-X11 builds
Summary: emulators/virtualbox-ose: VBoxSharedClipboard.so required for non-X11 builds
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Virtualbox Team (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-02-05 04:49 UTC by Derek Schrock
Modified: 2022-07-21 09:04 UTC (History)
2 users (show)

See Also:
madpilot: maintainer-feedback+
madpilot: merge-quarterly+


Attachments
Always include VBoxSharedClipboard.so (944 bytes, patch)
2022-02-05 22:26 UTC, Derek Schrock
no flags Details | Diff
Always include VBoxSharedClipboard.so (with rev bump) (1.42 KB, patch)
2022-04-04 00:03 UTC, Derek Schrock
no flags Details | Diff
Always include VBoxSharedClipboard.so v3 rebased on main (62c09d7c530) (1.40 KB, patch)
2022-06-14 23:46 UTC, Derek Schrock
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Derek Schrock 2022-02-05 04:49:32 UTC
When built without X11 support VBoxSharedClipboard.so is not included.  However, when trying to edit a running VM in phpvirtualbox ClipboardMode setting will fail.

  ...
  00:00:37.304454 SQW03    API method name:            IMachine::COMSETTER(ClipboardMode)
  00:00:37.304474 SQW03    API return code:            0x80004005 (NS_ERROR_FAILURE)
  ...

You can simulate this by running 'VBoxManage controlvm <VM> clipboard mode disabled':

  $ VBoxManage controlvm <VMNAME> clipboard mode disabled        
  VBoxManage: error: Code NS_ERROR_FAILURE (0x80004005) - Operation failed (extended info not available)        
  VBoxManage: error: Context: "COMSETTER(ClipboardMode)(mode)" at line 543 of file VBoxManageControlVM.cpp

At some point vbox is trying to load VBoxSharedClipboard extension service.   Copying VBoxSharedClipboard.so from the FreeBSD repo package to /usr/local/lib/virtualbox/ and reload the VM the modify to the running VM applies without issue.  Is is also true when running the above with the package from FreeBSD pkg repo with the default options (this has X11 set). 

With that said should VBoxSharedClipboard.so from pkg-plist be unconditionally added?

  -%%X11%%lib/virtualbox/VBoxSharedClipboard.so
  +lib/virtualbox/VBoxSharedClipboard.so

There are ifdefs to not build code for clipboardboard support and make access to it VERR_NOT_IMPLEMENTED however it appears to still build even with Config.kmk and LocalConfig.kmk setting VBOX_WITH_SHARED_CLIPBOARD = 0.
Comment 1 Derek Schrock 2022-02-05 08:56:24 UTC
Found out that setting 'VBOX_WITH_SHARED_CLIPBOARD = 0' is incorrect.

'VBOX_WITH_SHARED_CLIPBOARD=' needs added to LocalConfig.kmk to set it as undefined.

With this:

  +post-patch-X11-off:
  +       @${ECHO_CMD} 'VBOX_WITH_SHARED_CLIPBOARD=' >> ${WRKSRC}/LocalConfig.kmk
  +

VBoxSharedClipboard.so is not built.
vboxmanage doesn't have any clipboard options as well.
It appears to be fully disabled now.

I'm wondering why when building with --enable-headless and --disable-qt why shared clipboard support is still built.  It seems that there are parts that still use it even though you don't have a GUI.  I'm still researching this.  But it's possible that it shouldn't be disabled and included to the base package?
Comment 2 Derek Schrock 2022-02-05 22:13:22 UTC
clipboard support is still enabled since vbox still provides access to the console via VRDP method.  So I believe the original issue is still in play: VBoxSharedClipboard.so should be included unconditionally.
Comment 3 Derek Schrock 2022-02-05 22:26:43 UTC
Created attachment 231572 [details]
Always include VBoxSharedClipboard.so

VBoxSharedClipboard.so is requires for headless/VRDP access as well.
Comment 4 Derek Schrock 2022-02-26 00:40:36 UTC
ping?
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2022-04-03 23:18:10 UTC
Thanks Derek, can you:

 - Confirm the build passes poudriere in both X11 ON and OFF cases
 - Bump the port PORTREVISION
Comment 6 Derek Schrock 2022-04-04 00:03:55 UTC
Created attachment 232921 [details]
Always include VBoxSharedClipboard.so (with rev bump)

Yes, with X11 on and X11 (including QT5, NLS) off.  File is included in both packages.  Tested with poudriere, 13amd64, interactive jail.

root@13amd64-testing-vbox:~ # pkg query '%Ok=%Ov' virtualbox-ose | fgrep X11 ; pkg info -l virtualbox-ose | fgrep VBoxSharedClipboard.so                               
X11=on
        /usr/local/lib/virtualbox/VBoxSharedClipboard.so

root@13amd64-testing-vbox:~ # pkg query '%Ok=%Ov' virtualbox-ose | fgrep X11 ; pkg info -l virtualbox-ose | fgrep VBoxSharedClipboard.so
X11=off
        /usr/local/lib/virtualbox/VBoxSharedClipboard.so

Bumped revision.
Comment 7 Derek Schrock 2022-06-14 23:46:47 UTC
Created attachment 234694 [details]
Always include VBoxSharedClipboard.so v3 rebased on main (62c09d7c530)

Rebased previous patch on main (62c09d7c530)
Comment 8 Guido Falsi freebsd_committer freebsd_triage 2022-07-20 07:09:02 UTC
THanks for the patch.

I'm testing the upgrade of  Virtualbox to the recently released new version.

I'll see if I can include this with the update.
Comment 9 commit-hook freebsd_committer freebsd_triage 2022-07-21 09:00:23 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5f02996b2b84deafaca8c5d6c3a2486695cb67ef

commit 5f02996b2b84deafaca8c5d6c3a2486695cb67ef
Author:     Derek Schrock <dereks@lifeofadishwasher.com>
AuthorDate: 2022-07-21 08:52:18 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-07-21 08:59:19 +0000

    emulators/virtualbox-ose: Add VBoxSharedClipboard.so to non X11 builds

    This library is built when X11 is disabled too, since the functionality
    can also be used by remote protocols.

    PR:             261729
    MFH:            2022Q3

 emulators/virtualbox-ose/Makefile  | 1 +
 emulators/virtualbox-ose/pkg-plist | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
Comment 10 Guido Falsi freebsd_committer freebsd_triage 2022-07-21 09:00:49 UTC
Patch committed. Thanks!
Comment 11 commit-hook freebsd_committer freebsd_triage 2022-07-21 09:04:26 UTC
A commit in branch 2022Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e82b9ce753e0a15cf5d703f8a90d132b95b7ac52

commit e82b9ce753e0a15cf5d703f8a90d132b95b7ac52
Author:     Derek Schrock <dereks@lifeofadishwasher.com>
AuthorDate: 2022-07-21 08:52:18 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-07-21 09:03:07 +0000

    emulators/virtualbox-ose: Add VBoxSharedClipboard.so to non X11 builds

    This library is built when X11 is disabled too, since the functionality
    can also be used by remote protocols.

    PR:             261729
    MFH:            2022Q3
    (cherry picked from commit 5f02996b2b84deafaca8c5d6c3a2486695cb67ef)

 emulators/virtualbox-ose/Makefile  | 1 +
 emulators/virtualbox-ose/pkg-plist | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)