Drag and drop & copy/paste not working

Discussions related to using VirtualBox on Mac OS X hosts.
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Drag and drop & copy/paste not working

Post by sudokillall »

I installed Lubuntu 20.04 inside VB on my Mac Mojave Host OS. Its working beautifully. Except for the drag and drop (for files) and copy/paste functions.
When I first installed VB I added the extension pack and it said it installed successfully.
Any ideas?
Thanks
paulmc
Posts: 72
Joined: 28. Aug 2019, 18:43
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Mac OS X, Linux, Windows
Location: Earth (Guyana / USA / South Africa)
Contact:

Re: Drag and drop & copy/paste not working

Post by paulmc »

@sudokillall, my apologies if this is just re-stating the obvious, but did you remember to also install VirtualBox's latest Guest Additions (GAs) in your new Lubuntu guest VM? That would then actually "activate" the guest VM's related configuration {set up via: 'Settings' > 'General' pane > 'Advanced' sub-pane > 'Shared Clipboard' & "Drag'n'Drop" popup menus}.

It's not uncommon to forget to do so since, unlike the Extension Pack {a kind of host-side code library whose functionality becomes implicitly accessible to all guests}, the GAs are conceptually 'guest-side' and so need to be explicitly installed/updated "on demand" in each guest VM.

There's a recent thread discussing this possibility for two guests {Ubuntu 20.04 and Windows 10}, 'BiDirectional not working'. It includes some links to online guides that might be helpful, especially for the Lubuntu guest {recall that a Linux guest would typically need you to first install some prerequisite packages via the guest's command line before you can build/install the GAs in it}; if the linked guide for an Ubuntu guest doesn't quite match up with your Lubuntu guest, there should be many good specific guides available, or just post back here.
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Re: Drag and drop & copy/paste not working

Post by sudokillall »

I didn't get a notification for your reply here. Thank you so much that was a very generous reply.
I thought I did everything, including some terminal commands in the guest system. But I will read that thread and see if I missed anything. Thanks again
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Re: Drag and drop & copy/paste not working

Post by sudokillall »

Superb, sorted!
This page was also useful - https://www.fosslinux.com/13484/how-to- ... ubuntu.htm
I had to do some head scratching to suss out how to make root account accessible, then to browse to correct folder where i mounted the GA image, then found the sh command to run it from terminal (i had tried from GUI and it looked like it ran, but obviously didn't). I also ran that kernel fix command on the above page.
All working nicely now, excellent!
Thanks very much Paul
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Re: Drag and drop & copy/paste not working

Post by sudokillall »

PS - I don't suppose there's a way to force my own key combinations in the Ubuntu Guest OS?
I have a Mac as host and I never use CTRL, always CMD (command) key, such as cmd-c to copy, cmd-p to paste, cmd-t new tab in browser etc. Is there any way to make this work in Ubuntu VM by any chance? I will live with it if not, but it would save a lot of time and mistakes!!!
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Drag and drop & copy/paste not working

Post by fth0 »

You can use a software like Karabiner Elements on your macOS host to achieve what you want.
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Re: Drag and drop & copy/paste not working

Post by sudokillall »

Thanks, but not sure that will create custom keyboard shortcuts in Ubuntu running inside my VM, will it? Everything I have read so far looks great, but only for MacOSX internally
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Drag and drop & copy/paste not working

Post by fth0 »

Karabiner Elements is quite a powerful tool with a steep learning curve. You can use the following conditions specification inside a complex modification to limit it to all VirtualBox VMs:

Code: Select all

          "conditions": [
            {
              "bundle_identifiers": [
                "^org\\.virtualbox\\.app\\.VirtualBoxVM$"
              ],
              "type": "frontmost_application_if"
            }
paulmc
Posts: 72
Joined: 28. Aug 2019, 18:43
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Mac OS X, Linux, Windows
Location: Earth (Guyana / USA / South Africa)
Contact:

Re: Drag and drop & copy/paste not working

Post by paulmc »

@sudokillall, I'm glad that you were able to get the GAs working in your Lubuntu guest. :-)

@fth0, thanks for alerting me to this Karabiner Elements utility! I saw that it's even available for older macOS versions too, such as v10.13 'High Sierra' which I'm still running at the moment. Looks very useful.
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Re: Drag and drop & copy/paste not working

Post by sudokillall »

Thanks for that. Unfortunately this looks way over my head, as are most things found on Github! They look mighty powerful, but they are usually well beyond me to implement with such a lack of knowledge of CLI
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Re: Drag and drop & copy/paste not working

Post by sudokillall »

@paulmc - hi again!

I have just migrated (manually) all my data and user account from one mac to another. I now can't run the VM any more. I get two errors. I assume it's caused by the fact that the machine I migrated from had only one user, hence it's UID would have been 501. And now that user is a second user (also admin) on the new machine, i.e. 502. I don't know what to do about this though. I did change permissions on the VM file to give this user read/write access, but that didn't help, still just gives the errors below. Any advice very much appreciated.

image links : https://i.ibb.co/KrpkpPD/Screenshot-202 ... -54-50.png

https://i.ibb.co/nngGQCy/Screenshot-202 ... -54-20.png
paulmc
Posts: 72
Joined: 28. Aug 2019, 18:43
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Mac OS X, Linux, Windows
Location: Earth (Guyana / USA / South Africa)
Contact:

Re: Drag and drop & copy/paste not working

Post by paulmc »

@sudokillall, hmmm, could you provide some more details, such as:
  • How did you do the manual migration {e.g., via Migration Assistant, or Finder copy from an attached drive, or …}?
  • Did the migration include just user data, or did it also include applications and/or system files?
  • What's the UID of the user account under which you're now running VirtualBox?
{BTW, hopefully also your new Mac still uses an Intel chip, otherwise all bets would be off. ;-)}

If you did migrate applications and/or system files too, then depending on whether/how permissions were preserved it could be that VirtualBox does indeed require reinstallation {e.g., some VirtualBox binaries may use the special setgid/setuid modes (the 's' bits at Unix level)}. So, you'd just try re-running the latest VirtualBox Mac installer.

Otherwise — or in addition — for user data, if the migrated items have UID 501, and you're now running under UID 502, then you'd probably need to make additional ownership/permissions adjustments. Recall that {on VirtualBox's behalf} your current user would likely need read/write access to not just, say, a '.vdi' file, but all of the enclosed items in a guest VM's folder. For instance, you could try doing a normal copy via the Finder of the entire guest VM folder over into your current account's folder hierarchy {providing your admin account credentials when prompted}, which should set all enclosed items' ownership to your current UID.

If problems persist, it might be necessary to further adjust the ownership/permissions of various migrated items. This could be quite dangerous though, so before any of that, you'd first provide the results of the following two 'ls' commands in a Terminal window {these would show the Unix permissions (with users & groups displayed as just numeric IDs), etc., on the guest VM folder itself, and then on all of its contents}:
  • ls -ATlOned <drag_in_your_guest_VM_folder_to_here>
  • ls -ATlOneR <drag_in_your_guest_VM_folder_to_here>
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Re: Drag and drop & copy/paste not working

Post by sudokillall »

Thanks very much Paul.

I will respond to your reply properly shortly, but just a quick additional comment:

When I open VB app, it prompts me to update extension pack. It did this earlier but I declined because it confused me. I just ran it again and agreed to install this time. Very weird... It says (something very similar to) "A newer version of the extension pack is available, would you like to install it?". I clicked yes, then it downloaded and I hit "install", but then it warns "A newer version is already installed, do you want to downgrade?"

It's a loop! I tried installing anyway in case it's got it wrong, but it failed!
https://ibb.co/dQxXzhf
sudokillall
Posts: 36
Joined: 13. Feb 2021, 07:01

Re: Drag and drop & copy/paste not working

Post by sudokillall »

Ok, here are my answers to those questions, really appreciate your generosity in helping here.

The migration was done from a carbon copy clone (I also have TimeMachine backup). It was done by hand moving apps, application support files etc. I created a second user on my iMac with identical username to the account on macbook I was migrating data from (selling the laptop, need cash!) I have done it before and fairly good at catching everything but I did wonder if the VM might not go smoothly. Having said that, for 99% of my apps I redownload them but I know you can just move them from backup drive Apps folder to internal drive same place, and they work. I dont like that approach, not sure why, but it does work usually. However maybe that's where I went wrong?! (I was being lazy, I remember the VB installation being a pretty painful task so I dodged it!

Whats the UID? - Well I only learned today that first user is always 501 and second 502, and so on. So, assuming that's correct, it was installed under user 501 on the macbook and now running in 502 (identical username) on this iMac. I don't know the command to check, sorry, but if that rule is correct then this must be the case.

yes it's intel :) - I won't use any mac which forces catalina or big sur, and frankly once time rolls on to then, I will be leaving mac and forced to learn Linux properly due to privacy issues and general ethos of Apple having gone down the toilet. But that's for another thread :)

Reinstall VB - I guess that sounds like the best plan of attack from here, but I will wait for your response just in case, yeah I am still dodging that :D

Re: "if the migrated items have UID 501, and you're now running under UID 502, then you'd probably need to make additional ownership/permissions adjustments..." - That paragraph makes sense, but that's exactly what I did, and I hoped the permissions would take care of themselves. But since then I have given my current user read/write access to the entire folder ("VirtualBox VM's" folder in user home directory). It didn't help.

Re your last paragraph and changing permissions of other items, I did do that, as best I could anyway. I found VB folder in a few places inside the library, app support, containers etc. I changed those folders to read/write access for current user and applied to all enclosed items. Still no joy :(

Thanks again for your help. Maybe time to fully wipe VB off the system (hopefully I can keep the VM so I don't have to build that again!) and the reinstall as this user.







Out put of those two ls commands shown here - https://ibb.co/jgZvLfH
paulmc
Posts: 72
Joined: 28. Aug 2019, 18:43
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Mac OS X, Linux, Windows
Location: Earth (Guyana / USA / South Africa)
Contact:

Re: Drag and drop & copy/paste not working

Post by paulmc »

@sudokillall, thanks for the additional details.

In the 'ls' listings for your guest VM folder & its contents, all the basic read/write permissions look okay (for UID 502). The extended ACLs for the '.vbox' and '.vdi' files {i.e., the two lines with ' 0: <UUID> allow read,write,…'} were a bit unexpected; they're probably for the admin group, since that's usually the group whose GeneratedUID (UUID) is ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000050 [1]; if so, then these two ACLs would seem rather redundant but okay. As long as your current UID is 502 {see below}, I think there shouldn't be any access issues with the copied guest VM folder & its contents.

It looks then as if there's a problem with the copied VirtualBox application and/or support files. E.g., I've confirmed on my Mac that some VirtualBox binaries {including '/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM'} do indeed have special permissions such as setuid with root ownership. There are likely also specific ownership and/or permissions requirements for the support files in the '/Library/Application Support/VirtualBox/' folder, and so on. I believe you'll have to "bite the bullet" and uninstall & reinstall VirtualBox. ;-)

BTW, there are various ways to know your account's UID:
  • One GUI method is: System Preferences > Users & Groups => Unlock if applicable => At the top of the left-side list, right-click on the current user, and choose the 'Advanced Options…' menu-item => In the resulting dialog, look (below the red Warning) for the 'User ID' entry. {Do heed the Warning and avoid making any accidental changes in this dialog (e.g., just hit Escape or click Cancel).}
  • One command-line method is: In a Terminal window, enter the Unix command 'id -u' {without the quotes}.

[1] You can verify that the UUID does denote the admin group, by running the command 'dscl . -read /Groups/admin' {without the quotes} and examining the 'GeneratedUID:' line in the output, or by just re-running that 'ls' command without the '-n' option — i.e.: 'ls -ATlOeR <your_guest_VM_folder>' should show (in the two ACL lines) 'group:admin' instead of the UUID.
Post Reply