How to take over grub controlled by a different OS?

New to Debian (Or Linux in general)? Ask your questions here!

How to take over grub controlled by a different OS?

Postby johnywhy » 2018-09-07 08:54

hi all

How to install grub2 from a Debian-based distro, over an existing grub installation that was installed by a different OS? Pardon my ignorance.

I have a working grub2, installed from Mint. Works no problem. Includes auto-detected Windows 10, which has hibernation disabled to prevent issues. I manually added my Debian-based OS and Puppy linux to Mint's /etc/grub.d/40_custom file. Everything boots fine.

Mint and Windows are full-partition installs. Debian is a frugal install, inside a folder on the Win 10 partition.

Now i want Debian to take over the grub, so i can uninstall and completely remove Mint.

Having some issues with installing grub with Debian. At Debian CLI:
Code: Select all
# grub-install /dev/sda
Installing for i386-pc platform.
grub-install: error: failed to get canonical path of `aufs'.

Some articles advise me to do boot repair, but i doubt that's necessary, since i can boot just fine into all OS's. The existing boot isn't broken.
https://askubuntu.com/a/921970

Any suggestions? i have researched, but no luck.

thx
johnywhy
 
Posts: 21
Joined: 2011-11-24 00:17

Re: How to take over grub controlled by a different OS?

Postby p.H » 2018-09-07 12:17

It seems that your "frugal install" uses aufs (union mount). This is not supported by GRUB.
Can you post the contents of Mint's 40_custom file and the output of
Code: Select all
df -hT

from Debian ?
p.H
 
Posts: 631
Joined: 2017-09-17 07:12

Re: How to take over grub controlled by a different OS?

Postby johnywhy » 2018-09-07 16:41

hi p.H

Mint's /etc/grub.d/40_custom:

Code: Select all
#!/bin/sh
exec tail -n +3 $0

# DebianDog Stretch
menuentry "MyStretchNetinst1" {
    search -f /MyStretchNetinst1/live/vmlinuz1 --set=root
    linux /MyStretchNetinst1/live/vmlinuz1 from=/MyStretchNetinst1 noauto changes=EXIT:/MyStretchNetinst1/live/changes.dat
    initrd /MyStretchNetinst1/live/initrd1.xz}

# Porteus-32
     set p32fldr=/porteus32
     set p32iso=$p32fldr/Porteus-XFCE-v4.0-i586.iso
     set p32mods="extramod="
menuentry "Porteus 4.0-32 ISO"   {
     set boot_parms="volume=33 reboot=cold $p32mods$p32fldr/modules copy2ram changes=EXIT:$p32fldr/porteussave.dat"
     search -f $p32iso --set=root
     loopback loop $p32iso
     linux  (loop)/boot/syslinux/vmlinuz from=$p32iso $boot_parms
     initrd (loop)/boot/syslinux/initrd.xz
     }

# Puppy Linux
menuentry "xtahr" {
    set root='(hd0,1)'
    linux /puppyxtahr/vmlinuz pmedia=atahd psubdir=puppyxtahr
    initrd /puppyxtahr/initrd.gz
    }


Code: Select all
# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
tmpfs          tmpfs    1006M  2.0M 1004M   1% /mnt/live
devtmpfs       devtmpfs   10M     0   10M   0% /dev
/dev/sda1      fuseblk    39G   18G   21G  47% /mnt/live/mnt/sda1
tmpfs          tmpfs     1.2G  8.6M  1.2G   1% /mnt/live/memory/changes
aufs           aufs      1.2G  8.6M  1.2G   1% /
/dev/loop0     squashfs  162M  162M     0 100% /mnt/live/memory/images/01-filesystem.squashfs
/dev/loop1     squashfs  2.2M  2.2M     0 100% /mnt/live/memory/images/zz_xfce_config.squashfs
/dev/loop2     ext4      1.5G  588M  767M  44% /mnt/loop2
tmpfs          tmpfs     202M  660K  201M   1% /run
tmpfs          tmpfs     5.0M  4.0K  5.0M   1% /run/lock
tmpfs          tmpfs     403M   28M  375M   7% /run/shm
cgroup         tmpfs      12K     0   12K   0% /sys/fs/cgroup
tmpfs          tmpfs     202M     0  202M   0% /run/user/0


THX
johnywhy
 
Posts: 21
Joined: 2011-11-24 00:17

Re: How to take over grub controlled by a different OS?

Postby kedaha » 2018-09-07 21:16

Hi there,
As far as I know Debian "stretch" doesn't include aufs. Looks like a non-official version of Debian to me. What is DebianDog Stretch anyway?
Might it not be a topic for another forum?
In my opinion, you'd really do yourself a favour by choosing to use just one Linux distribution, for example Debian stable as recommended, rather than several.
Mate DE & OSSv4.
LaMp, WordPress; ispmail
Debian Stable

Words, as is well known, are the great foes of reality. Joseph Conrad.
Kedaha's Conjecture
User avatar
kedaha
 
Posts: 2869
Joined: 2008-05-24 12:26

Re: How to take over grub controlled by a different OS?

Postby p.H » 2018-09-07 21:40

It looks like this "frugal install" is a kind of live system with persistence rather than a real installation.
IMO, it is a bad idea to bind the main boot loader to this kind of setup. But if this is what you want...

I guess you could install GRUB in the NTFS partition /dev/sda1, which is mounted on /mnt/live/mnt/sda1 according to df, with this command :
Code: Select all
grub-install --boot-directory=/mnt/live/mnt/sda1 /dev/sda

If it succeeds, it will create a /grub directory at the root of the NTFS filesystem, visible as /mnt/live/mnt/sda1/grub. Then you have to put a proper config file grub.cfg in this directory. I doubt update-grub will work properly on this kind of setup.
p.H
 
Posts: 631
Joined: 2017-09-17 07:12

Re: How to take over grub controlled by a different OS?

Postby johnywhy » 2018-09-07 22:12

many thx for the recipe, p.H!

i won't try it yet, due to your caution.
i'll also check with the folks over at murga-linux.com/puppy. They have a lot of experience with frugals.

Question: would this arrangement be easier/safer with legacy-grub/grub4dos?

THX
johnywhy
 
Posts: 21
Joined: 2011-11-24 00:17

Re: How to take over grub controlled by a different OS?

Postby p.H » 2018-09-07 22:45

I doubt that grub-legacy can be installed - at least safely - on NTFS.
Why do you want to control grub from the frugal install ?
p.H
 
Posts: 631
Joined: 2017-09-17 07:12

Re: How to take over grub controlled by a different OS?

Postby johnywhy » 2018-09-08 03:43

Stretch DebianDog will be my main OS. i'm getting rid of Mint, which current controls grub.

It doesn't have to be installed abnormally. That is, i'd like a folder-based install, but it doesn't have to be this way.

THX
johnywhy
 
Posts: 21
Joined: 2011-11-24 00:17

Re: How to take over grub controlled by a different OS?

Postby debiman » 2018-09-08 08:11

distros with "dog" in their name are usually just puppies :D
in any case, that is not debian.
i don't mind personally, but it is something you need to specify in your opening post.
same in your other thread i guess?
User avatar
debiman
 
Posts: 3027
Joined: 2013-03-12 07:18

Re: How to take over grub controlled by a different OS?

Postby Prax » 2018-09-08 08:30

I like debiandog! there's nothing wrong with it.
Prax
 
Posts: 1
Joined: 2018-03-23 14:03

Re: How to take over grub controlled by a different OS?

Postby p.H » 2018-09-08 09:28

johnywhy wrote:Stretch DebianDog will be my main OS. (...)
It doesn't have to be installed abnormally. That is, i'd like a folder-based install, but it doesn't have to be this way.

It doesn't have to, but it is at the moment. Really, installing your main OS in an NTFS partition subdirectory does not look like a good idea to me.

johnywhy wrote:i'm getting rid of Mint, which current controls grub.

What do you mean by "getting rid" ? What is going to replace it on disk ?
Did you consider to install DebianDog "normally" instead of Mint ?
p.H
 
Posts: 631
Joined: 2017-09-17 07:12

Re: How to take over grub controlled by a different OS?

Postby johnywhy » 2018-09-08 14:53

Thx all, for helping me figure out my disk setup. Thx for helping me understand the aufs problem.

In my OP, I didn't say "it's Debian" . I said "Debian-based". Of the major Linux families, Debian, Arch, Fedora, Slack, and Gentoo, DebianDog is Debian-based. In your replies, I think you can just think of them as Debians.

By "remove Mint" I mean reformat its partition.

I'm doing myself a favor and comparing several distros. Your replies lead me to some conclusions:

- I should put all Linuxes in an ext4 partition, not in the Windows NTFS partition.

- I need to pick one OS as the long-term master OS for that partition (Mint wasn't it). For now, puppy xtahr (another Debian-based distro) is the only one I know is going to styay with me, so I'll make that the master.

Hopefully I can host multiple folder-based Linuxes in that partition for evaluation.

Ideally, every Linux in that partition would be able to manage that partition's grub, but sounds like not possible.

THX
johnywhy
 
Posts: 21
Joined: 2011-11-24 00:17

Re: How to take over grub controlled by a different OS?

Postby Dai_trying » 2018-09-08 15:22

I would create a seperate partition for each OS you want to install, and each time you install another Os I allow it to install it's own grub and then boot into the OS that you consider to be the "master" and re-install grub from there, this would allow you to simply re-install (and update) grub from whichever OS you want to be in control of it.

Below is the output of fdisk -l for this machine, as you will see there are several partitions and some are used for OS installation and others for data.

Code: Select all
Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1  *          2048  209717247  209715200   100G 83 Linux
/dev/sda2        209717248  968384511  758667264 361.8G 83 Linux
/dev/sda3        968384512  976773119    8388608     4G 82 Linux swap / Solaris
/dev/sda4        976773120 3907028991 2930255872   1.4T  5 Extended
/dev/sda5       1186492416 2235068415 1048576000   500G 83 Linux
/dev/sda6        976775168 1186490367  209715200   100G 83 Linux
/dev/sda7       2235070464 3283646463 1048576000   500G 83 Linux
/dev/sda8       3283648512 3488448511  204800000  97.7G 83 Linux
/dev/sda9       3488450560 3693250559  204800000  97.7G 83 Linux
/dev/sda10      3693252608 3907028991  213776384   102G 83 Linux


One thing to always remember is to make sure to have grub installed from the correct OS before removing another, and then run grub update after removing it to keep the grub options up to date. If you accidentally remove the OS that currently controls grub you can easily chroot into the desired OS and re-install grub using a live-cd, this happens sometimes with this sort of set-up.

Another thing to note is this is a BIOS machine and my UEFI setup is a little different as I keep each OS with it's own UEFI boot entry so they all have their own grub which means I can remove any of them without affecting the other distro's at all, I press F12 to get the boot menu at startup if I want to select anything other than the "master" OS. The partitioning is similar though with the exception of having Windows 10 installed (with it's extra partitions!) and a UEFI boot partition and obviously it does not need the extended partition.
Dai_trying
 
Posts: 557
Joined: 2016-01-07 12:25

Re: How to take over grub controlled by a different OS?

Postby johnywhy » 2018-09-08 22:44

thx for your outstanding answer, dai_trying.

Dai_trying wrote:I would create a seperate partition for each OS you want to install


i'll consider this approach. My goal is to make an OS for a resource-limited machine. Might be trickly, as my HD isn't very big, and i want to have flexibility. Your approach means i'm stuck with a fixed number of OS's, and if i have fewer OS's, then i'm wasting my limited space with unused partitions.

i can't tell if my machine is EFI, cuz windows says i'm booting with "legacy". If i go into BIOS, i don't even see EFI anyplace, i only see "Legacy USB Booting: enabled/disabled". If i disable it, then i lose keyboard control of Mint's grub menu. weird!

do you think the folder-based installs is risky, not possible with certain OS's, or you just don't like it?

THX
johnywhy
 
Posts: 21
Joined: 2011-11-24 00:17

Re: How to take over grub controlled by a different OS?

Postby GarryRicketson » 2018-09-09 01:24

In your replies, I think you can just think of them as Debians


No, there is only 1 Linux distro that is Debian. There are many Linux distros,
most of us do not think of them as Debians,... Debian is Debian. Linux Mint is a
different Linux disribution, (distro), all the other distros are like wise different distributions, all though some claim to be based on Debian, they are no longer Debian, they have been modified and changed so much, Debian.org does not support them, nor is responsible for the packages for them, this is why the other distros all have their own repositories.

if i have fewer OS's, then i'm wasting my limited space with unused partitions.

This is not realistic. You can all ways delete/remove any partitions you do not need, and use the space to increase the sizes of the partitions you do use.

do you think the folder-based installs is risky, not possible with certain OS's

I have never heard of "folder installs", and I have never heard of puppy xtahr, or Stretch DebianDog , this entire topic is not about debian, but it is about grub, and various linux distros.
For now, puppy xtahr (another Debian-based distro) is the only one I know is going to styay with me, so I'll make that the master.


How to install grub2 from a Debian-based distro, over an existing grub installation that was installed by a different OS? Pardon my ignorance.

Questions about properly installing Grub2 or Grub, to other distros, probably would get more accurate answers if the question is asked on a support site for that particular distro. Also it should be noted, grub is not the only boot loader available, lilo might be a better option.
For example, if you were using Debian, but you are not, obviously this would be the correct forum to ask about how to install grub to Debian.
When you install Debian, the installer installs Grub2, and updates it, assuming you did the install correctly, and everything went well, the grub version that Debian installs, will be what is booted and it will have a menu where you can select any of the bootable partitions, regardless as to what distro they are.
Some of what is said in the OP , confuses me :
Debian is a frugal install, inside a folder on the Win 10 partition.

Are you really using Debian or not ? please be honest, and I don't mean some distro based on Debian, I mean Debian. I do not know anything about windows 10, nor have any interest, but I don't think Debian can run from some folder on a Windows system. I know Debian, Linux, and Ms Windows are kind of merging and getting more and more similar, but I don't think it has gotten that far, Debian is a OS, not some program, that comes as a windows .exe file, and you put it in a folder, expecting it to run.
==============
- I need to pick one OS as the long-term master OS for that partition (Mint wasn't it). For now, puppy xtahr (another Debian-based distro) is the only one I know is going to styay with me, so I'll make that the master.

Hopefully I can host multiple folder-based Linuxes in that partition for evaluation.

Ok, and I am sorry to be so long winded, there just seems to be so many questions in my mind, and this topic seems to have a lot of various distros, etc,... any way, finally, this will wrap up what I have to say :
I only have 1 partition, and 1 OS, that is "master", if you want to call it that,..
I use the term "host",... the 1 OS is host, and controls all of the others, I do experiment with many, Linux (various), BSD's, Minix, even a old Windows XP, and also FreeDos. So called "multi boot", and various partitions, Grub, etc, is a ROYAL pain, and headache, and yes after all said and done, it is limited to 4 or 5, bootable partitions, I forget exactly on that. There are ways to have more, but it really gets complicated, and messy.
Anyway, it sounds to me like you should really look at using a VM system, I like QEMU, but there is also, VirtualBox, and many others, maybe that is what you mean by " folder-based Linuxes ", ? Are these just virtual images, in folders, ? In a way that is what I do as well, I have each OS I am testing and working with in a Directory, which contains the image, and everything needed to start the VM,... My ram is rather limited, so that does limit how many VM's I can have running at the same time, but it does not limit how many VM's I can have, in other words, if need be I can shutdown 1 vm ,say (Debian-2), and then start another, maybe the Minix 3,...etc,...
I have 3 running now, all at the same time,... you can't do that with a multi boot system, But you can with VM's.
============================
User avatar
GarryRicketson
 
Posts: 5168
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Next

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable