Tutorial: better integration of VirtualBox (Windows) into MX Linux (guide in steps)
Posted: Thu Jan 21, 2021 8:37 am
What will be the benefit, when anybody has implemented these steps?
A) Opening for example a "Microsoft Word"-file (or any other Windows file-typ) in thunar with "double click":
-Without this tips: We must start VirtualBox. After we have to choose and start our VM. Then we have to wait until the VM is booted. This takes a while. Then we have to start "Windows Explorer" and search the Word-file, we want to open. Then we can double click it.
-When these tips are implemented: You just open thunar (in Linux). Search your file and double click it. Done.
Then automatically the right VM starts and the Word-file will be opened with "Microsoft Word". (Windows must not boot, because it was in save state. So this way Windows will be ready faster.) This not only works with word-files, but this works with any file for which a program is installed in the Windows VM.
-Also when you are surfing in the internet with Firefox and have a link to a word document (or any other file-typ that needs a program, that you have in your VM), then just click "open" in Firefox and it will automatically start in your VM with the matching windows program.
-Same, when you want to open for example a *.docx file attachment in Thunderbird.
-Simlinks can also be opened the same way.
B) Starting for example "Microsoft Word" (or any other Windows-Program):
-Without this tips: We must start VirtualBox. After we thave to choose and start our VM. Then we have to wait until the VM is booted. This takes a while. After, we have to look for the "Microsoft Word" starter in the VM and start it.
-Starting "Microsoft Word" when these tips are implemented: You will have a "Microsoft Word" starter in Linux. The starter can be on the desktop, in the menu or in the panel. The only thing you have to do, is to click on this starter. Done.
Then automatically the right VM starts and "Microsoft Word" starts. (Windows must not boot, because it was in save state. So this way Windows will be ready faster. Edit: But it also works, if you shut your PC down.)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"How to do"-guide in steps (for variant A) from above):
0. Pre-requisite: You have already a Windows VM with your prefered Windows programs. For this description I have used "Windows 7 32bit" and as windows programs "Office 2010". (I assume that it also works with other versions of windows. And with any windows-programs.)
Please note: This is an implementation for MX Linux 19.3 Xfce.
1. Steps you have to do with "windows user password":
Give your windows account a password (this is mandatory):
a. Start your windows VM
b. press WindowKey+R
c. type in: compmgmt.msc
d. open the Users folder in Local Users and Groups
e. Right-click your user account and choose Set Password.
f. Proceed to continue
g. Enter a new password, reenter it and click OK.
This is also needed:
h. press WindowKey+R
i. type in: gpedit.msc
j. Navigate to -> Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options
k. Change -> "Accounts: Limit local account use of blank passwords to console logon only" to "disabled".
This is needed so that you need not to type in manually your password, when you have shut down your VM instead of using the "save state" mode:
l. start your Windows-VM an log you in.
m. Press Win + R, enter netplwiz and press Enter. This opens the dialogue box for user accounts.
n. In the ‘User accounts’ dialogue box, select the user account that is to be logged in automatically.
o. Deactivate the option Users must enter user name and password and click on Apply.
p. Another dialogue box appears in which you must enter the user name and password of the account that is to be logged in automatically. Enter the password twice and confirm with OK.
q. Close all open dialogues with OK.
r. Shut down your VM.
2. VirtualBox: Set up "shared folders":
a. open VirtualBox Manager
b. right click on your Windows VM
c. choose "change" -> tab "shared folders"
d. add a new folder with path "/tmp" (this is necessary when you later click in Firefox on a "MS Word" link. So that this *.docx can be opened automatically in your Win-VM; Or when you have an attachment in Thunderbird, you want to open.)
e. check "Integrate automatically" and "only readable"
f. Embedding point "H:"
g. add a new folder with path "/home/MyUsername" (replace "MyUsername" with your Linux-account name). This is the place where all your files are, that you wont to be able to open directly with double clicking in thunar (See "A)" above). When your files, that you want to open in with windows programs, are all in a particular folder, then you can choose here this particular folder.)
h. check "Integrate automatically" and leave unchecked "only readable"
j. Embedding point "G:"
3. Start your VM
4. choose -> menu -> view -> "Full screen mode"
5. choose -> menu -> view -> Seamless mode
6. Change to "Oracle VM VirtualBox Manager"
7. Menu -> machine -> close -> "save state" (You must always close this VM this way. This is something like "hibernate" in Windows. It makes, that your VM will start faster.
8. Copy the attached file "Windows7VM.sh" into "/home/YourUserName/.bin/" (Replace YourUserName with your user name. If you do not have this folder, create it.)
In the file "Windows7VM.sh" you have to replace some lines:
Line 3: replace "Win7NeuFurOfficeVersuch" through the name of your VM. You find the name of your VM in the "Oracle VM VirtualBox Manager". It's the bold part of the name at the left side of the window.
Line 10: replace "/home/user/" through the path that you have set up in 2.g. (see above)
Line 31: replace "WindowsAccountName" through the "account name" of your windows in your VM. (Pardon, what name exactly? When you normally start windows, you have to log-in and your account name is shown. This is the name, you have to take here.)
Line 32: replace "MyPassword" through your windows password of your "windwos account" you have set up in 1.g. (see above)
Line 42: replace "Win7NeuFurOfficeVersuch" through the name of your VM. You find the name in "Oracle VM VirtualBox Manager". It's the the bold part of the name at the left side of the window.
Line 50: replace "Win7NeuFurOfficeVersuch" through the name of your VM. You find the name in "Oracle VM VirtualBox Manager". It's the the bold part of the name at the left side of the window.
Line 55: replace "Win7NeuFurOfficeVersuch" through the name of your VM. You find the name in "Oracle VM VirtualBox Manager". It's the the bold part of the name at the left side of the window. And replace "MyUsername" through your "Windows user name". And replace "MyPassword" through your "Windows password".
Edit: To bring it into work with MX-23 Xfce and VirtualBox 7.0.16 you have to change the following line:
--exe "%SystemRoot%\system32\cmd.exe"
through ...
--exe "C:\Windows\System32\cmd.exe"
9. Make the file "Windows7VM.sh" executable, if it is not already executable. (Right click on the file-> properties-> Tab "rights")
10. Copy the attached file "Windows7-VM.desktop" to the folder "/home/user/.local/share/applications/" (replace user to your Linux user-name)
In this "Windows7-VM.desktop" you have to replace
Line 3: "User" through your Linux user name.
Variant A) (see above) should now work.
How to use it?
-open thunar
-go to the file you want to open in your VM (This file must be in a folder, that is entered in VirtualBox as "shared folder". See above "point 2")
-make a right click on it -> "open with" -> "Open with another application"
-check "Use by default for files of this type"
-choose "windwos7 VM" from the list
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Additional steps for B)
(Please note: This "steps for B)" only work, when you also have implemented all steps above.)
Just download the attached "Microsoft starters" for Linux.
Copy them to the folder "/home/user/.local/share/applications/Windows_VM_Programs/" (Replace "user" through your "Linux user name")
Open each of this starters in Featherpad and replace in the line
"user" through your "Linux username".
Copy the attached file "VirtualBox-VM-Programs.directory" into the folder(replace user)
Copy the attached file "VirtualBox-VM-Programs.menu" into the folder(replace user)
-> Now you will have this starters in your Whisker menu (Category VirtualBox-VM-Programs)
(Thank you for your kind help @dolphin_oracle)
Just download in addition the attached icons to get Microsoft Symbols for your starters.
Copy them into the matching folders:
/home/user/.local/share/icons/hicolor/16x16/apps/
/home/user/.local/share/icons/hicolor/32x32/apps/
/home/user/.local/share/icons/hicolor/48x48/apps/
/home/user/.local/share/icons/hicolor/96x96/apps/
/home/user/.local/share/icons/hicolor/128x128/apps/
---------------------------------------------------------------
Main source for this guide: https://unix.stackexchange.com/question ... rough-virt
FAQ:
Question: What do I have to do, when I want to open for example an *.pdf file with the newest "Foxit Reader" with right click in thunar? (https://www.foxitsoftware.com/downloads/)
Answer: You have already implemented all you need for this. The only thing you need, is to link the file typ *.pdf with "windwos7 VM". See above section "How to use it?" .
Question: What do I have to do, when I want to start "Foxit Reader" with a starter. I have no starter for this?
Answer: Just open one of the attached "Microsoft starters" in Featherpad and you see how such a starter works. Then you can replace the lines
Question: How can I open an attachment in Thunderbird with a programme that is in the Windows VM?
Answer: You have already created the preconditions in step 2. d) above and with the existing section in "Windows7VM.sh" that looks like this:
Assumed you have an *.docx attachment in an E-Mail in thunderbird, you can make this additional steps:
1. Open Thunderbird
2. open menu -> edit -> settings -> general -> File & attachments
3. In the list go to the entry (Microsoft Word Document: application/vnd.openxmlformats-officedokument.wordprocessingml.document) and on the right side select "use other"
4. Go to "/home/YourUserName/.bin/" and open "Windows7VM.sh"
5. It's now selected in the column "Action"
6. When you click on it, you can see, that it is now in the list.
7. Select now in this list "always ask"
8. Close the settings tab
5. Go to your mail with the *.docx attachment
6. click or double click it
7. Check the option "open with"
8. select "other"
9. "Windows7VM.sh should be now in the list right of "open with"
10. select it, wait some seconds until the OK button is activ and then open it. Done.
-> Please not: It can be, that you do not have the fitting entry in "menu -> edit -> settings -> general -> File & attachments".
In this case the fist thing (step 0) you have to do, is to open (in this case) the *.docx document with any programme. For example LibreOffice or whatever programme is offered for you. This way thunderbird generates automatically a fitting entry in "menu -> edit -> settings -> general -> File & attachments". This means, after this step "0" you will have an additional entry in "menu -> edit -> settings -> general -> File & attachments" and you can continue with step 1 above.
Question: Should I "shut down" my Windos VM, when I am done?
Answer: No. First close all open windows programs in you VM. Then put the VM into the "save state". For example this way: Go to "Oracle VM VirtualBox Manager"; Menu -> machine -> close -> "save state" . You also can make a "key combination" for this:
-> Xfce settings -> keyboard -> tab "short keys for programs" -> add -> Command: (replace "Win7NeuFurOfficeVersuch" through the name of your VM.)
Edit: But yes, if you want, you can alternatively shut down the VM. It can be, that the start will need a bit longer with this method.
Question: When I set my VM into "save state" is my VM then still running in the background?
Answer: No. It's not "sleeping" or "standby" or "pause". It's more something like "hibernate" in Windows. I guess, it also saves the content of your RAM on the HD, so that the VM is able to start faster again.
.
A) Opening for example a "Microsoft Word"-file (or any other Windows file-typ) in thunar with "double click":
-Without this tips: We must start VirtualBox. After we have to choose and start our VM. Then we have to wait until the VM is booted. This takes a while. Then we have to start "Windows Explorer" and search the Word-file, we want to open. Then we can double click it.
-When these tips are implemented: You just open thunar (in Linux). Search your file and double click it. Done.
Then automatically the right VM starts and the Word-file will be opened with "Microsoft Word". (Windows must not boot, because it was in save state. So this way Windows will be ready faster.) This not only works with word-files, but this works with any file for which a program is installed in the Windows VM.
-Also when you are surfing in the internet with Firefox and have a link to a word document (or any other file-typ that needs a program, that you have in your VM), then just click "open" in Firefox and it will automatically start in your VM with the matching windows program.
-Same, when you want to open for example a *.docx file attachment in Thunderbird.
-Simlinks can also be opened the same way.
B) Starting for example "Microsoft Word" (or any other Windows-Program):
-Without this tips: We must start VirtualBox. After we thave to choose and start our VM. Then we have to wait until the VM is booted. This takes a while. After, we have to look for the "Microsoft Word" starter in the VM and start it.
-Starting "Microsoft Word" when these tips are implemented: You will have a "Microsoft Word" starter in Linux. The starter can be on the desktop, in the menu or in the panel. The only thing you have to do, is to click on this starter. Done.
Then automatically the right VM starts and "Microsoft Word" starts. (Windows must not boot, because it was in save state. So this way Windows will be ready faster. Edit: But it also works, if you shut your PC down.)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"How to do"-guide in steps (for variant A) from above):
0. Pre-requisite: You have already a Windows VM with your prefered Windows programs. For this description I have used "Windows 7 32bit" and as windows programs "Office 2010". (I assume that it also works with other versions of windows. And with any windows-programs.)
Please note: This is an implementation for MX Linux 19.3 Xfce.
1. Steps you have to do with "windows user password":
Give your windows account a password (this is mandatory):
a. Start your windows VM
b. press WindowKey+R
c. type in: compmgmt.msc
d. open the Users folder in Local Users and Groups
e. Right-click your user account and choose Set Password.
f. Proceed to continue
g. Enter a new password, reenter it and click OK.
This is also needed:
h. press WindowKey+R
i. type in: gpedit.msc
j. Navigate to -> Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options
k. Change -> "Accounts: Limit local account use of blank passwords to console logon only" to "disabled".
This is needed so that you need not to type in manually your password, when you have shut down your VM instead of using the "save state" mode:
l. start your Windows-VM an log you in.
m. Press Win + R, enter netplwiz and press Enter. This opens the dialogue box for user accounts.
n. In the ‘User accounts’ dialogue box, select the user account that is to be logged in automatically.
o. Deactivate the option Users must enter user name and password and click on Apply.
p. Another dialogue box appears in which you must enter the user name and password of the account that is to be logged in automatically. Enter the password twice and confirm with OK.
q. Close all open dialogues with OK.
r. Shut down your VM.
2. VirtualBox: Set up "shared folders":
a. open VirtualBox Manager
b. right click on your Windows VM
c. choose "change" -> tab "shared folders"
d. add a new folder with path "/tmp" (this is necessary when you later click in Firefox on a "MS Word" link. So that this *.docx can be opened automatically in your Win-VM; Or when you have an attachment in Thunderbird, you want to open.)
e. check "Integrate automatically" and "only readable"
f. Embedding point "H:"
g. add a new folder with path "/home/MyUsername" (replace "MyUsername" with your Linux-account name). This is the place where all your files are, that you wont to be able to open directly with double clicking in thunar (See "A)" above). When your files, that you want to open in with windows programs, are all in a particular folder, then you can choose here this particular folder.)
h. check "Integrate automatically" and leave unchecked "only readable"
j. Embedding point "G:"
3. Start your VM
4. choose -> menu -> view -> "Full screen mode"
5. choose -> menu -> view -> Seamless mode
6. Change to "Oracle VM VirtualBox Manager"
7. Menu -> machine -> close -> "save state" (You must always close this VM this way. This is something like "hibernate" in Windows. It makes, that your VM will start faster.
8. Copy the attached file "Windows7VM.sh" into "/home/YourUserName/.bin/" (Replace YourUserName with your user name. If you do not have this folder, create it.)
In the file "Windows7VM.sh" you have to replace some lines:
Line 3: replace "Win7NeuFurOfficeVersuch" through the name of your VM. You find the name of your VM in the "Oracle VM VirtualBox Manager". It's the bold part of the name at the left side of the window.
Line 10: replace "/home/user/" through the path that you have set up in 2.g. (see above)
Line 31: replace "WindowsAccountName" through the "account name" of your windows in your VM. (Pardon, what name exactly? When you normally start windows, you have to log-in and your account name is shown. This is the name, you have to take here.)
Line 32: replace "MyPassword" through your windows password of your "windwos account" you have set up in 1.g. (see above)
Line 42: replace "Win7NeuFurOfficeVersuch" through the name of your VM. You find the name in "Oracle VM VirtualBox Manager". It's the the bold part of the name at the left side of the window.
Line 50: replace "Win7NeuFurOfficeVersuch" through the name of your VM. You find the name in "Oracle VM VirtualBox Manager". It's the the bold part of the name at the left side of the window.
Line 55: replace "Win7NeuFurOfficeVersuch" through the name of your VM. You find the name in "Oracle VM VirtualBox Manager". It's the the bold part of the name at the left side of the window. And replace "MyUsername" through your "Windows user name". And replace "MyPassword" through your "Windows password".
Edit: To bring it into work with MX-23 Xfce and VirtualBox 7.0.16 you have to change the following line:
--exe "%SystemRoot%\system32\cmd.exe"
through ...
--exe "C:\Windows\System32\cmd.exe"
9. Make the file "Windows7VM.sh" executable, if it is not already executable. (Right click on the file-> properties-> Tab "rights")
10. Copy the attached file "Windows7-VM.desktop" to the folder "/home/user/.local/share/applications/" (replace user to your Linux user-name)
In this "Windows7-VM.desktop" you have to replace
Line 3: "User" through your Linux user name.
Variant A) (see above) should now work.
How to use it?
-open thunar
-go to the file you want to open in your VM (This file must be in a folder, that is entered in VirtualBox as "shared folder". See above "point 2")
-make a right click on it -> "open with" -> "Open with another application"
-check "Use by default for files of this type"
-choose "windwos7 VM" from the list
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Additional steps for B)
(Please note: This "steps for B)" only work, when you also have implemented all steps above.)
Just download the attached "Microsoft starters" for Linux.
Copy them to the folder "/home/user/.local/share/applications/Windows_VM_Programs/" (Replace "user" through your "Linux user name")
Open each of this starters in Featherpad and replace in the line
Code: Select all
Exec=/home/user/.bin/Windows7VM.sh "C:\\Program Files\\Microsoft Office\\Office14\\Winword.exe"
Copy the attached file "VirtualBox-VM-Programs.directory" into the folder
Code: Select all
/home/user/.local/share/desktop-directories/
Copy the attached file "VirtualBox-VM-Programs.menu" into the folder
Code: Select all
/home/user/.config/menus/applications-merged/
-> Now you will have this starters in your Whisker menu (Category VirtualBox-VM-Programs)
(Thank you for your kind help @dolphin_oracle)
Just download in addition the attached icons to get Microsoft Symbols for your starters.
Copy them into the matching folders:
/home/user/.local/share/icons/hicolor/16x16/apps/
/home/user/.local/share/icons/hicolor/32x32/apps/
/home/user/.local/share/icons/hicolor/48x48/apps/
/home/user/.local/share/icons/hicolor/96x96/apps/
/home/user/.local/share/icons/hicolor/128x128/apps/
---------------------------------------------------------------
Main source for this guide: https://unix.stackexchange.com/question ... rough-virt
FAQ:
Question: What do I have to do, when I want to open for example an *.pdf file with the newest "Foxit Reader" with right click in thunar? (https://www.foxitsoftware.com/downloads/)
Answer: You have already implemented all you need for this. The only thing you need, is to link the file typ *.pdf with "windwos7 VM". See above section "How to use it?" .
Question: What do I have to do, when I want to start "Foxit Reader" with a starter. I have no starter for this?
Answer: Just open one of the attached "Microsoft starters" in Featherpad and you see how such a starter works. Then you can replace the lines
Code: Select all
Name=Word VM
Exec=/home/user/.bin/Windows7VM.sh "C:\\Program Files\\Microsoft Office\\Office14\\Winword.exe"
Icon=0575_wordicon.0
Question: How can I open an attachment in Thunderbird with a programme that is in the Windows VM?
Answer: You have already created the preconditions in step 2. d) above and with the existing section in "Windows7VM.sh" that looks like this:
Code: Select all
# /temp/ is mounted as H:
original=$fixedFilePath
findWhat="/tmp/"
replaceWith="H:\\"
fixedFilePath="${original/$findWhat/$replaceWith}"
1. Open Thunderbird
2. open menu -> edit -> settings -> general -> File & attachments
3. In the list go to the entry (Microsoft Word Document: application/vnd.openxmlformats-officedokument.wordprocessingml.document) and on the right side select "use other"
4. Go to "/home/YourUserName/.bin/" and open "Windows7VM.sh"
5. It's now selected in the column "Action"
6. When you click on it, you can see, that it is now in the list.
7. Select now in this list "always ask"
8. Close the settings tab
5. Go to your mail with the *.docx attachment
6. click or double click it
7. Check the option "open with"
8. select "other"
9. "Windows7VM.sh should be now in the list right of "open with"
10. select it, wait some seconds until the OK button is activ and then open it. Done.
-> Please not: It can be, that you do not have the fitting entry in "menu -> edit -> settings -> general -> File & attachments".
In this case the fist thing (step 0) you have to do, is to open (in this case) the *.docx document with any programme. For example LibreOffice or whatever programme is offered for you. This way thunderbird generates automatically a fitting entry in "menu -> edit -> settings -> general -> File & attachments". This means, after this step "0" you will have an additional entry in "menu -> edit -> settings -> general -> File & attachments" and you can continue with step 1 above.
Question: Should I "shut down" my Windos VM, when I am done?
Answer: No. First close all open windows programs in you VM. Then put the VM into the "save state". For example this way: Go to "Oracle VM VirtualBox Manager"; Menu -> machine -> close -> "save state" . You also can make a "key combination" for this:
-> Xfce settings -> keyboard -> tab "short keys for programs" -> add -> Command:
Code: Select all
VBoxManage controlvm "Win7NeuFurOfficeVersuch" savestate
Edit: But yes, if you want, you can alternatively shut down the VM. It can be, that the start will need a bit longer with this method.
Question: When I set my VM into "save state" is my VM then still running in the background?
Answer: No. It's not "sleeping" or "standby" or "pause". It's more something like "hibernate" in Windows. I guess, it also saves the content of your RAM on the HD, so that the VM is able to start faster again.
.