Dual boot Linux and Windows for LinuxCNC use - Page 1
Forum section: electronics / general

author: Jester
author_rank: Frequent Contributor
timestamp: December 24, 2023, 06:49:20 pm
content: I have a new PC that will be dedicated to a milling machine for CNC that will be running LinuxCNC.The ac servo motors I will be using require Windows based tuning software to tune the various parameters to make them stable under the conditions they will operate in. This is a one time thing.In all likelihood once everything is configured I will rarely need the Windows OS ( but who knows)?I have never setup a dual boot machine. One option is to use a Windows based laptop for the tuning aspect, however I can envision the need for some sort of other Windows based utility to do something on that milling machine PC, so I want to explore making that PC dual boot with default operation Linux. I'm not clear on how this works when a using dual boot but I think it would be important that the Windows OS runs under Linux and not the other way around, latency time will be very important and I can't imagine having anything that requires low latency happening under Windows.I imagine there must be a lot of instructional videos or descriptions on how to dual boot if I do a google search, can anyone recommend a good set of instructions or video?Something else unclear to me is that (I think) that you can have Linux effectively run a Windows based program in some sort of Windows box (I'm guessing this is not the dual boot approach where I think that at startup you choose, and either on or the other system runs???). If this is possible it would likely be a much better option for my situation.Hot tips welcome.Thanks

author: themadhippy
author_rank: Super Contributor
timestamp: December 24, 2023, 07:01:00 pm
content: Quoteubuntu,and maybe other linux flavours, has an install alongside windows option during the initial instal,couldn't get much simpler.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 24, 2023, 07:08:42 pm
content: Do not make a dual-boot. For windows, make a virtual machine instead. A virtual machine can boot and run inside another OS, no need to reset/restart, no need to re-partition the disks, etc.Install Virtualbox in Linux, then open VirtualBox and create a new Virtual Machine (VM) inside which new VM you will install Windows. Then in the newly installed Windows install the motor-tuning software you need for the CNC.https://www.virtualbox.org/Installing this does not need any modification in Linux, and it does not repartition your diskc, and does not mes with the Linux boot. You can even run more than one Windows VM at once, if you want. For the end user, a VM can be regarded just like installing any normal Linux program.

author: Veteran68
author_rank: Frequent Contributor
timestamp: December 24, 2023, 07:09:23 pm
content: Dual booting is still a thing and isn't that hard to do, though less prevalent these days with the advent of VMs and WSL, which are much more convenient and don't require rebooting to switch OSes.What communications protocol does the servo tuning software use? If it's a standard serial/USB connection then a Windows VM on Linux should work fine, and you'd have Windows available for other utilities.OTOH if you were to prefer a primary Windows OS (it doesn't sound like you do), then you could likewise run a Linux VM and/or use WSL2 (preferable to WSL1) to run your Linux software. I don't know anything about LinuxCNC but a number of Linux GUI software can be run in WSL2 now.Here's a screenshot of me running Kali linux desktop from a WSL2 session on Windows 11. It uses a headless X server with a built-in VNC client to render the desktop. Notice in my Windows Terminal session I also have an Ubuntu WSL2 session running. These are using VM technology under the covers but are not setup like traditional VMs, and are seamless in Windows. I also have VMWare Workstation with several other Linux and Windows VMs but prefer WSL2 whenever I can use it.

author: Jester
author_rank: Frequent Contributor
timestamp: December 24, 2023, 07:22:38 pm
content: Quote from: RoGeorge on December 24, 2023, 07:08:42 pmRoGeorge,Thanks for your suggestion it sounds perfect.One last question, imagine I open this VM under Linux and run some sort of windows program and it generates some Gcode in an ASCII type file and I now want to use that ASCII file in Linux, will Linux be able to see, recognize and use that file or are the two file systems segregated and invisible to each other?

author: Veteran68
author_rank: Frequent Contributor
timestamp: December 24, 2023, 07:44:58 pm
content: Quote from: Jester on December 24, 2023, 07:22:38 pmYou can setup shared folders between the host and guest VMs to allow access to files between them.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 24, 2023, 07:51:33 pm
content: Yes, they can exchange files, either through shared folders, or by LAN, or simply by Drag&Drop from the Desktop of the Windows to the Desktop of the Linux. For the last option you'll have to install the VirtualBox Addition drivers, it will ask for it, and there are many videos online about setting VirtualBox.VirtualBox is free to use for noncommercial. If your setup is for profit, I don't know if there is a payment needed., you'll have to read the license or ask Oracle.The VM for Windows can be seen as a full running Windows install, it will boot up and shutdown and all without affecting the Linux host. The VM with Windows will run inside of its own Linux window, just like any other Linux program, same as a web browser runs in its own window inside Linux.Virtualisation allows you to have as many other desktops you want inside your Linux host, and you can start and stop the VMs when you like. You can even make a second Linux VM if you want to, for example to make risky Linux configurations without messing with the Linux host. For example you can have an Ubuntu host, and inside it create VMs for another 2 Ubuntu installs, a Fedora, a Windows XP, a Windows 10, and a FreeBSD.They can all run just as they were installed alone on the main hardware. Behind the scene, VirtualBox will virtualize the physical hardware, and it will share it (not always, only when another VM is started along with the host OS). It will work flowless unless you start really demanding programs, like a videogame or such, but for casual programs it will just work as if it were many different desktops at your disposal.

author: themadhippy
author_rank: Super Contributor
timestamp: December 24, 2023, 07:51:58 pm
content: Quoteyesit all depends how you set things up in virtual box,but having a folder or entire drive accessible to both is pretty simple,you can even if you wish copy and paste between the 2 systems

author: Veteran68
author_rank: Frequent Contributor
timestamp: December 24, 2023, 08:04:21 pm
content: Quote from: RoGeorge on December 24, 2023, 07:51:33 pmVirtualBox itself is free and legal for commercial use, butnotthe Extensions pack (which I'd consider a must-have).Oracle is a right bastard when it comes to this, too. At our company many of us used VirtualBox, and most naturally installed the Extensions. Oracle started hassling us as they track downloads from what they recognize as corporate IPs and demanding that we true up on licensing. They did the same with their Java JDK' post v8.203 after which they charged for commercial use. So we made concerted efforts to wipe VBox Extensions from all machines as well as migrated to OpenJDK for Java development. Didn't give in to their attempts at extortion. Every so often they come fishing for these, and I'll pull software discovery logs and tell them to pound sand.I doubt they'll come after a small business that has no other Oracle products that might tie them somehow to downloads and installs, but I just hate Oracle overall and wouldn't put it past them.

author: Infraviolet
author_rank: Super Contributor
timestamp: January 05, 2024, 09:42:30 pm
content: Doesn't this get a bit more complicated because LinuxCNC comes as a distro (OS) of its own? I'm not sure if a LinuxCNC as the host could run virtual box, within which a Windows OS could then live. Ubuntu, Mint or another common Linux distro could be installed as the main OS, a Windows VM would be fine under it, but I'm not sure how happy LinuxCNC would be inside a VM, isn't LinuxCNC meant to have some special realtime kernel with special access to hardware features?

author: Lindley
author_rank: Regular Contributor
timestamp: January 06, 2024, 03:34:09 pm
content: If you are using a Desktop pc and have a spare old drive , 60gb or larger, you could load Linux onto the second drive , so leaving your Windows system unaffected.Disconnect your windows drive and install Linux on the spare drive, once done, reconnect the widows drive and the system will create a Grub menu to choose which system to boot from.We run like that as our new mobo a NVMe drive , so use the old SATA C drive for linux.

author: abeyer
author_rank: Frequent Contributor
timestamp: January 07, 2024, 12:57:03 am
content: Quote from: Infraviolet on January 05, 2024, 09:42:30 pmIt's mostly just a customization layer on top of debian -- you just need to get a build of virtualbox for the correct debian version, either from Oracle, or from the debian fasttrack project.

author: J911
author_rank: Contributor
timestamp: January 20, 2024, 03:48:44 am
content: I have been doing this for years (dual boot xp and linux) and jf you haven't done it yet or if someone else wants to know just follow these steps. Its very easy. All distros are somewhat different but the idea is the same.Always install windows first as you normally wouldWhen installing win decide the parititioning. you can do anything, 50/50 or I usually do 30/30/40 , 40 for a 3rd partition called FILEZ which is always seen under both OS. Don't format the other 2 paritions, just leave it allocated.Once windows is installed reboot and start to install Linux as you normally would fom a USB or CDAt the disk choosing stage choose the empty parition you created as the location for linux, and if there is checkbox option to install alongside windows check that and it will automatically create a boot menu at startup... that's it, next step isn't needed if you have this option.If there isn't a "alongside windows" option, such as a in Puppy or another minimal OS, then contiune to install linux as you normally would on the unused partition and when you reboot windows will no longer boot, its there but it will boot into linux by default, you'll be able to see its there under disks in file manager. Now install something like grub4dos or grub under linux which will give you a boot screen with the option to go into Win or Linux. That's it, both will give you options after to pick a default and time outs, options, etc..I wouldn't bother with anything virutal if you want do serious work. its fun to run 1 program or do something basic like learning but this is as original as it gets and you can even choose a 3rd partition to share amongst the two OS's

author: 50ShadesOfDirt
author_rank: Regular Contributor
timestamp: January 20, 2024, 06:22:37 pm
content: Is your new computer a BIOS pc, or a UEFI pc? Worth looking at the manuals (PDF) for it ... warning, lots of info coming at you.In the old days (a few short years ago), our computers (desktop or laptop) would have a BIOS, and we'd most likely employ dual- or multi-boot strategies to get two OS's (windows & linux) on it, with varying degrees of success. Windows boot loaders, Linux grub boot loaders, etc.Nowadays, your "new" computer most likely has UEFI (it's no longer a BIOS), and may possibly have come with windows 10 or 11 already on it and running (installed as UEFI). If this is the case, and you want to dual- or multi-boot (which UEFI supports) then you'll want your version of Linux to install it's own UEFI stuff into that UEFI setup, and play nice. Most Linux OS's do this for you these days, you'll just need to read up on their UEFI support and installation methods.I dislike multi-booting, and run only a HostOS that knows how to use all the resources of the desktop/laptop, and then I put a virtualization package on it (vmware or virtualbox), and finally, I build any number of VM's to hold other OS's I might need or want to play with. When I use virtualization, all OS's are running at once (on any reasonable beefy PC); with multi-boot, it's always one or the other, and you might go crazy trying to get back and forth. One day, when you least expect it, something might go wrong with the multi-boot thing, and you'll be trying to sort all of that out again.As long as the OS will work in a VM and access devices thru virtualized device drivers, you could be good to go with virtualization. If the OS needs direct access to device drivers (and it doesn't have virtualized device drivers for a given virtualization package), a virtualization scheme may not be as good as a UEFI & multi-boot scheme.One place to look is the manuals for your new PC, and see if it is still BIOS, or it's UEFI (and whether or not it supports legacy mode). Another thing to do is to IMAGE that pc, using whatever tools work with whatever OS is on it now ... then you can test these things and get to a good state, or fall back if you can't get there.Hope this helps ...

author: YurkshireLad
author_rank: Frequent Contributor
timestamp: January 20, 2024, 06:25:47 pm
content: I bought a new windows laptop a while ago. I didn’t want to mess with partitions so I installed a second SSD and installed Linux on it. I changed the bios to set the Linux drive as the bootable disk. The Linux boot loader automatically finds the windows partition on boot up, so I can choose which to use at startup. Much easier than messing with partitions on windows and wondering if windows will screw anything up for me.