How do I install multiple Linux OSes on one machine?

Discussion in 'all things UNIX' started by kdcdq, Feb 15, 2018.

  1. kdcdq

    kdcdq Registered Member

    Joined:
    Apr 19, 2002
    Posts:
    815
    Location:
    A Non-Sh*thole State
    I've really gotten into testing and experimenting with various Linux distributions recently. I have Mint installed on one machine's hard drive and want to install other distributions on the same box, and be able to select the product to be brought up at boot.

    What product or products do you regular Linux users use to accomplish this?
     
  2. fblais

    fblais Registered Member

    Joined:
    Jul 31, 2008
    Posts:
    1,341
    Location:
    Québec, Canada
    Just make multiple partitions on your hard drive, for each distro.
    When you install a distro, it'll install GRUB, the boot manager.
    GRUB will update it's config file and detect the other distros and add them to the boot menu.
     
  3. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
  4. kdcdq

    kdcdq Registered Member

    Joined:
    Apr 19, 2002
    Posts:
    815
    Location:
    A Non-Sh*thole State
    Thanks fblais and Brian K for their input!
     
  5. chrome_sturmen

    chrome_sturmen Registered Member

    Joined:
    Apr 29, 2006
    Posts:
    875
    Location:
    Sverige

    If your computer's hardware can support it, you can try virtual machines
     
  6. Palancar

    Palancar Registered Member

    Joined:
    Oct 26, 2011
    Posts:
    2,402
    I have quite a few linux OS's on one machine. I prefer to go slightly off the beaten trail. Rather than piling into one loader (GRUB) I setup separate USB /boot media to independently mount my different systems. It allows me full control and privacy since no system has any chance to see or interact with any other system. Yep, for many its over the top, but for some "buffs" its just completely solid! Just mentioning this as an option, albeit not a starter application.

    Plus it sounds like you are experimenting with distro's that may be scrapped as you discover which to keep. With my method you simply re-do the partition and the single USB while the established OS's that you are going to keep remain untouched (including their loader). Makes going crazy low risk!
     
  7. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
    The more I use OS installed in UEFI mode the more I prefer OS installed in MBR mode. I like multi-booting in MBR mode with BootIt Bare Metal as the boot manager. Each OS only sees the partitions you want it to see. For example, say you had a dozen Windows OS and a few dozen Linux OS on HD0. All in Primary partitions. Take one Linux OS with grub installed in the partition boot sector, not in the MBR. It could only see its own partition and its Swap partition. The other partitions aren't just hidden, in effect they don't exist as they aren't in the MBR partition table for that particular boot. Similarly for the Windows OS. Each OS only sees the partitions that are relevant to that OS. The other partitions "don't exist". OS can be deleted or added without disturbing the other OS. OS can be booted from HD0, HD1, HD2 etc, up to HD15.
     
  8. Palancar

    Palancar Registered Member

    Joined:
    Oct 26, 2011
    Posts:
    2,402

    How are you arriving at MORE than 4 Primary partitions on an MBR aligned disk platter?

    Your scheme sounds interesting. Question(s): say you have all linux in play. sda3 is up and running in debian and now you need to pull files off of sda2 because the OS is broken. All my independent partitions are LVM on LUKS. Can you open the LUKS header of sda2 since it appears not to exist, if I understand you correctly? There are times I get aggressive with trying stuff and I occasionally need to open LUKS and go grab files before I blow away the "test partition". Make sense?
     
  9. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
    Palancar,

    Good question. In a MBR disk, LBA 0 has room for 4 primary partitions in the partition table. Installing BIBM lets you use LBA 1 to LBA 62 to store extra partition data so you can have over 200 primary partitions on the disk. The disk is then an EMBR disk. Extended MBR.

    Let's say your Debian boot item is set up to see Root and Swap only. But you decide you would like to get some files from Ubuntu and Win10. You would edit the Debian boot item so it sees Root, Swap, Ubuntu and Win10. Despite potentially having 200 primary partitions, you can only have 4 primary partitions in a Boot Item (for that disk) as these partitions are "moved" to LBA 0 for the boot. The LBA 0 partition table is different for each Boot Item. A different combination of 4 primary partitions which is your choice. You can also have different combinations of partitions on HD1, HD2, etc in the Boot Item.

    BIBM has a one month free trial. The learning curve is steep without assistance.
     
  10. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
    An example...

    My HD0 has 30 primary partitions
    My HD1 has 1 primary partition
    My HD2 has 5 primary partitions
    My HD3 has 2 primary partitions

    When I boot Win10 the Boot Item lets me see (my choice)

    2 partitions on HD0 (Win10 and Recovery)
    1 partition on HD1
    2 partitions on HD2
    1 partition on HD3

    Installing Linux OS with BIBM...

    http://www.terabyteunlimited.com/kb/article.php?id=281

    http://www.terabyteunlimited.com/kb/article.php?id=279

    http://www.terabyteunlimited.com/kb/article.php?id=278

    http://www.terabyteunlimited.com/kb/article.php?id=149

    http://www.terabyteunlimited.com/kb/article.php?id=601

    http://www.terabyteunlimited.com/kb/article.php?id=282

    http://www.terabyteunlimited.com/kb/article.php?id=280
     
    Last edited: Feb 17, 2018
  11. chrome_sturmen

    chrome_sturmen Registered Member

    Joined:
    Apr 29, 2006
    Posts:
    875
    Location:
    Sverige
    Brian, the original poster is interested in just checking out/testing some various distros, in his case, unless he is adept at partitioning, and taking into account that he did not mention a need for permanence at this time, wouldn't a vm be the better route for his purposes at this time?
     
  12. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
    chrome_sturmen,

    Yes, sure, a VM might be a good solution. The OP did "want to install other distributions on the same box" so I outlined my preferred method. This may or may not be of interest to the OP as I don't deny it is complex for a non BIBM user. But easy as pie for a BIBM user.
     
  13. zapjb

    zapjb Registered Member

    Joined:
    Nov 15, 2005
    Posts:
    5,557
    Location:
    USA still the best. But barely.
    As mentioned 'twas me I'd install multiples on a flashdrive. Decide which ones to keep & then install on a hard drive. Easy peasy here:
    https://www.pendrivelinux.com/
     
  14. Palancar

    Palancar Registered Member

    Joined:
    Oct 26, 2011
    Posts:
    2,402
    Great reading, and a definite thought provoker!
     
  15. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    10,225
  16. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
    Mrk,

    Nice tutorials. To satisfy my ignorance, say you removed all Linux OS and left the Win OS, how do you remove grub from the MBR?
     
  17. act8192

    act8192 Registered Member

    Joined:
    Nov 9, 2006
    Posts:
    1,789
    My experience with just Mint was to remove grub2 using easyBCD (it rewrites MBR), so you can boot to Windows. Also make sure Windows is set as default in msconfig.
    If you remove Linux first, it won't boot.
    Then you can remove Linux partitions either in gparted from Live Linux USB or from Windows diskmgnt.
    Problem with EasyBCD that I experienced was that it puts in just few basic things, not your entire previous contents. So it's a good idea to have some previous BCD stuff preserved to be able to copy sections back.

    I hope MRK will show an easier method. What I wrote is what I did twice and might not be the best way.
     
  18. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
    When you write a new MBR (boot code only) it will enable Windows to boot. But it will not remove the grub code from the next hundred sectors. Grub2 puts code in the first 101 sectors. LBA 0 to LBA 100. I was just interested in a method that will remove Grub2 code from those remaining 100 sectors.

    This applies to a MBR disk.
     
    Last edited: Feb 23, 2018
  19. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    10,225
    Here we go:

    https://www.dedoimedo.com/computers/linux-uninstall.html

    In a nutshell - if you remove one bootloader, you need to install a different bootloader.
    Linux does not auto-restore older bootloaders - usually because removal is a live cd procedure and the resident os is not running.

    My recommendation would be to backup the bootloader (with dd) before settng up an installation then manually restore it once you remove Linux.

    Mrk
     
  20. Palancar

    Palancar Registered Member

    Joined:
    Oct 26, 2011
    Posts:
    2,402
    That has saved my butt a number of times. I actually use Macrium Pro more now because I like having full power using their recovery environment in RAM.
     
  21. Palancar

    Palancar Registered Member

    Joined:
    Oct 26, 2011
    Posts:
    2,402
    OK, so now lets all start over again. LUKS2 (dmcrypt) was released just over a month ago. Man I have some reading to do. LOL!



    http://www.saout.de/pipermail/dm-crypt/2017-December/005771.html


    In-place conversion from LUKS1

    To allow easy testing and transition to the new LUKS2 format, there is a new
    convert command that allows in-place conversion from the LUKS1 format and,
    if there are no incompatible options, also conversion back from LUKS2
    to LUKS1 format.
     
  22. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
    Sounds very reasonable. But say you don't have a backup. You have Windows installed in MBR mode and several Linux OS. You can zero the 101 Grub2 sectors and boot Windows. How to clear the first 101 sectors with Grub2 code was my initial interest. I gather it can't be "uninstalled".

    Delete all Linux partitions including the partition boot sectors. Leave the Windows partitions
    Run Diskpart "clean". This zeroes the sectors in the first MiB of the drive. LBA 0 will be zeroed so your partition table is gone
    Write a Windows MBR
    Undelete the Windows partitions
    Set the relevant partition Active (Windows or the System Reserved Partition)
    Do a BCD Edit on the Active partition
    Windows now boots

    If the original disk was GPT...
    Delete all Linux partitions including the partition boot sectors. Leave the Windows partitions
    Diskpart "clean"
    Undelete the Windows partitions
    Create a GPT disk
    Edit the "Type" of the ESP and Recovery partitions
    Do a BCD Edit on the ESP
    Windows now boots
     
  23. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    10,225
    Yup, that will indeed work. The undelete Windows partitions is not necessary, though.
    Some maintenance distros can 'restore' Windows bootloaders, but it's effectively writing them over rather than uninstalling an existing one.
    Mrk
     
  24. kdcdq

    kdcdq Registered Member

    Joined:
    Apr 19, 2002
    Posts:
    815
    Location:
    A Non-Sh*thole State
    Many many thanks gentlemen for your time and valued, experienced input! This whole thread is VERY useful to me and many others as a result. :geek:
     
  25. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,179
    Location:
    NSW, Australia
    act8192,

    Unfortunately you can't do this with a GPT disk. The disk has a Protective MBR. After deleting the Linux partitions Windows doesn't boot. The computer boots to a grub command line.

    If you delete all files from the EFI\Ubuntu folder then Windows will boot. (or delete the EFI\Ubuntu folder)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.