LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-02-2019, 02:34 PM   #1
Yotaphoner
Member
 
Registered: Jun 2017
Posts: 50

Rep: Reputation: Disabled
Grub error install on a USB


Hi! I am struggling since 3 days with this problem and I am exhausted of that s**t.

I want to install it on a pendrive where I have debian live, a couple of rescue disk, an ext2 partiton for the persistent of the Debian, and another partition as a storage. The first partition is the one with the Debian, and it boots properly. The system from where I am executing all the commands is an Ubuntu.

I tried many ways and I repartittioned the USB many times. Finally I found a guide that conviced me: https://www.pendrivelinux.com/instal...-ubuntu-linux/ .When I do the step 6 it returns me a strange error:
Quote:
Installing for i386-pc platform.
grub-install: error: cannot find a GRUB drive for /dev/sda1. Check your device.map
So I did a "sudo grub-mkdevicemap", but probably this does nothing because It will create the device.map on my hard disk and not in the USB.

This is the fdisk -l result:
Quote:
Disk /dev/sda: 28,9 GiB, 30992891904 bytes, 60532992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x13b62606

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 0 4186111 4186112 2G 0 Empty
/dev/sda2 1416 2247 832 416K ef EFI (FAT-12/16/32)
/dev/sda3 4186112 10477567 6291456 3G 83 Linux
/dev/sda4 10477568 60532991 50055424 23,9G 5 Extended
/dev/sda5 10479616 12220415 1740800 850M 83 Linux
/dev/sda6 12222464 13963263 1740800 850M 83 Linux
/dev/sda7 13965312 60532991 46567680 22,2G 83 Linux
For some reason, the partition containing the Debian-live image copied with dd appears as empty, but it runs perfectly.

Also I tried the guide on a Raspberry pi3, where I had another error, saying something about it can't find the canonical path to somewhere (sorry I don't remember now)

Ideas?
Thanks

Last edited by Yotaphoner; 01-02-2019 at 02:41 PM.
 
Old 01-02-2019, 03:19 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,508

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
The link you posted explains how to install Grub to a blank drive with Ubuntu. I don't see anything on the page indicating otherwise. YOu already have a Live Debian which boots and I expect that you get the error about not finding Grub because it is booting with syslinux not Grub. When you loop mount the Debian iso on the flash drive from Ubuntu, do you see a boot/grub directory with the appropriate files?

In any case, if you have the Live Debian on sda1, you don't want to try to install Grub there as that is a read-only filesystem. Doing what I think you are trying to do should be possible but I would think the best first step would be to install Grub.

Last edited by yancek; 01-02-2019 at 03:22 PM.
 
Old 01-02-2019, 04:04 PM   #3
Yotaphoner
Member
 
Registered: Jun 2017
Posts: 50

Original Poster
Rep: Reputation: Disabled
Maybe you are right about booting with syslinux because I can't find the grub folder on the boot folder. I just read something about it for the first time this afternoon.

I dont understand what you say about the no possibility to install grub on the partition with Debian because its read only. I mean... It becomes read only after "dd" an iso? Thats non sense. It is that the case?

And well, your last sentence says I should try to install grub, so I am confused because that is what I was trying to do and you said I cant do it where the partition is. So where I have to install it? And how?
 
Old 01-02-2019, 04:18 PM   #4
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
/dev/sda2 1416 2247 832 416K ef EFI (FAT-12/16/32)
I'm not sure how it works with isohybrid live CDs, but the Debian live would be isohybrid. To have it boot in both BIOS and UEFI, a GPT partition table is also created in some isohybrid methods according to syslinux isohybrid, as per GPT standards there should also be a Protective MBR, whether or not a protective MBR is included in Debian live ISO is unknown to me thus far but I've recently struggled to install Debian testing in UEFI mode in VMWare. In attempts to do so, I tried directly off the ISO and burning the ISO to a USB and could not do it. I could do Ubuntu, Mint and Fedora UEFI virtual machines.

But here's where I'm going...
After burning the Debian netinstall ISO to the USB a few times using different settings in Rufus and directly with dd, the 32GB USB was stuck at 350MB in size and I couldn't get the full 32GB size back through traditional re-partitioning re-formatting. I eventually used dd to zero out part of it with: dd if=/dev/zero of=/dev/sdb before I was able to get the full 32GB back. So I'm guessing there is a protective MBR associated with Debian isohybrid disks images.
 
Old 01-02-2019, 05:24 PM   #5
Yotaphoner
Member
 
Registered: Jun 2017
Posts: 50

Original Poster
Rep: Reputation: Disabled
Before going further I have 3 questions to clear:

1- Does grub and syslinux the same function?

2- What is a "protective MBR"?

3- This one It was asked before: when I "dd" an iso to a usb, the partition becomes read-only?
 
Old 01-02-2019, 05:27 PM   #6
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
Quote:
the partition containing the Debian-live image copied with dd appears as empty, but it runs perfectly.
your suppose to dd an iso to the whole usb not to a partition. the reason it debian probably works is you dd to the first partition, creating a readonly partition. thus causing errors when trying to install grub. I suggest to recreate a msdos partition table, reinstall ubuntu, then mount the Debian-live image, find the grub.cfg file in the mounted iso to see what to label the first partition and format to fat32. copy the contents of the debian-iso to the first partition. This should allow you to install grub to the mbr and also allow to boot the Debian-live on an uefi systems.

Last edited by colorpurple21859; 01-02-2019 at 09:44 PM.
 
Old 01-02-2019, 05:39 PM   #7
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by Yotaphoner View Post
2- What is a "protective MBR"?
There's a good explanation here.
 
Old 01-02-2019, 06:18 PM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,508

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
Quote:
I dont understand what you say about the no possibility to install grub on the partition with Debian because its read only. I mean... It becomes read only after "dd" an iso?
If you use dd to write an iso file to a flash drive, it will be read only. If you use unetbootin, rufus, pendrivelinus or any other similar software it will be read only. If you want to install Grub to the flash drive you will need to install it to a partition other than the one on which you have Debian. Since you don't seem to have an Grub files, that looks like a problem. You would also need to manually create the grub.cfg file if you want to boot some other 'rescue disk' on the usb. Might be simpler to do a full install of Debian or Ubuntu on the flash drive on a partition of 10GB. Not really clear what your end goal is.

Are you booting the Live Debian directly, setting the boot priority in the BIOS to boot the Debian usb OR are you booting it from an entry in the Ubuntu grub.cfg file?

Last edited by yancek; 01-02-2019 at 06:19 PM.
 
Old 01-02-2019, 08:59 PM   #9
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
the windows program rufus does something similar to what I described. If you select efi and bios for target, rufus will create a msdos partition table with a fat32 partition using the whole usb, install syslinux to mbr, then extract the contents of the iso onto the usb. This will allow you to boot on both efi and legacy systems and still read write to the usb. I more familiar with rufus then with unetbootin or pendrivelinus. Then you could use gparted to reduce the size of the debian-live partition, to create your other partitions for ubuntu and allow you to install grub to mbr.

Last edited by colorpurple21859; 01-02-2019 at 09:46 PM.
 
Old 01-03-2019, 04:59 PM   #10
Yotaphoner
Member
 
Registered: Jun 2017
Posts: 50

Original Poster
Rep: Reputation: Disabled
Ok I understand that thing of the read-only partition when you dd, thanks

Quote:
Originally Posted by colorpurple21859 View Post
I suggest to recreate a msdos partition table, reinstall ubuntu, then mount the Debian-live image, find the grub.cfg file in the mounted iso to see what to label the first partition and format to fat32. copy the contents of the debian-iso to the first partition. This should allow you to install grub to the mbr and also allow to boot the Debian-live on an uefi systems.
Why do I have to reinstall Ubuntu? Just to clear that, Ubuntu is installed on the SSD, not in the USB. There is no Ubuntu on the USB. And also why is this of recreating a msdos partition?

Quote:
Originally Posted by colorpurple21859 View Post
the windows program rufus does something similar to what I described. If you select efi and bios for target, rufus will create a msdos partition table with a fat32 partition using the whole usb, install syslinux to mbr, then extract the contents of the iso onto the usb.(...)
I read somewhere there isn't any automatic tool to configure syslinux and it has to be handmade. Is this true? Because I would love something that gives me less work. Also I don't understand if syslinux is a replacement of GRUB, so I don't need to install GRUB if I install syslinux. <---- Please answer this

Quote:
Originally Posted by yancek View Post
If you want to install Grub to the flash drive you will need to install it to a partition other than the one on which you have Debian. Since you don't seem to have an Grub files, that looks like a problem. You would also need to manually create the grub.cfg file if you want to boot some other 'rescue disk' on the usb
I thought it had to be installed on the same partition where the linux is. Correct me if I am wrong please. And for the grub.cfg the plan was to do that "wget pendrivelinux.com/downloads/grub.cfg" and at that point less figure out which is the next step.

Quote:
Originally Posted by yancek View Post
Might be simpler to do a full install of Debian or Ubuntu on the flash drive on a partition of 10GB. Not really clear what your end goal is
My goal is t create a pendrive which I can use as a live system and also as a rescue media, and I prefer the live Debian because my USB are 2.0 and using the live system it will be load at the RAM, and I think it will be faster

Quote:
Originally Posted by yancek View Post
Are you booting the Live Debian directly, setting the boot priority in the BIOS to boot the Debian usb OR are you booting it from an entry in the Ubuntu grub.cfg file?
I am booting the Live Debian directly

Last edited by Yotaphoner; 01-03-2019 at 05:01 PM.
 
Old 01-03-2019, 06:22 PM   #11
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
Quote:
Why do I have to reinstall Ubuntu? Just to clear that, Ubuntu is installed on the SSD, not in the USB
I was under the impression that ubuntu was installed on the usb.

Quote:
I read somewhere there isn't any automatic tool to configure syslinux and it has to be handmade. Is this true? Because I would love something that gives me less work. Also I don't understand if syslinux is a replacement of GRUB, so I don't need to install GRUB if I install syslinux. <---- Please answer this
You can use grub or syslinux to boot debian-live as long as you get config files set up correctly. For booting a usb on a legacy system need some sort of bootloader installed to mbr of usb. efi systems require a fat32 partition therefore a msdos partition scheme with a fat32 partitiion works for both legacy and efi system

Quote:
And also why is this of recreating a msdos partition?
Wasn't sure if the usb had a gpt or msdos scheme or if the dd of debian-live affected the partition table.

Quote:
I thought it had to be installed on the same partition where the linux is
I assume your talking about grub, and the answer is no. Grub boot files can be installed as a stand alone to any partition or drive independent of the linux os that grub is being installed from. Any changes that need to be made to the grub.cfg will have to be done manually. any grub-modules that need to be pre-loaded at boot time to acess alternate file systems will need to be added when grub-install is ran.

Last edited by colorpurple21859; 01-03-2019 at 06:28 PM.
 
Old 01-04-2019, 07:32 AM   #12
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,508

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
Quote:
I read somewhere there isn't any automatic tool to configure syslinux and it has to be handmade. Is this true? Because I would love something that gives me less work. Also I don't understand if syslinux is a replacement of GRUB, so I don't need to install GRUB if I install syslinux. <---- Please answer this
The automatic tool for Grub2 would be the grub-mkconfig software which updates Grub. Ubuntu and some other Linux systems use the 'stub' update-grub which run the grub-mkconfig software. This won't work on your Debian Live as everything will be lost on reboot. I'm not that familiar with syslinux and don't know if anything similar exists for it.

As pointed out above, you do not need to install Grub to the same partition on which you have your Linux OS. You would need to install Grub to a different partition (200MB should be large enough) with a Linux filesystem. In your case, you will need to manually create the grub.cfg file menuentries. Installing Grub is explained in detail at the link below under section 2.2.3 and 2.2.5.

https://help.ubuntu.com/community/Grub2/Installing

Last edited by yancek; 01-04-2019 at 08:05 AM.
 
Old 01-04-2019, 05:12 PM   #13
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
I once built me a kickbutt Debian live with full hardware support many years ago, but I didn't create an ISO, I created the image file. I made two partitions, the second only large enough for the image file and placed it in that partition. Then I formatted the rest of the USB NTFS. Windows (at the time anyways) only shows one partition on removable media, so the Debian was not visible when plugged in a Windows box.

Then I installed YUMI which would allow me to boot multiple ISOs, I had a Windows 7PE ISO, Windows XP PE ISO, PLOP ISO, SuperGrub2 ISO, BootitBM ISO, etc. Many ISOs in the appropriate Yumi folder on the large NTFS partition with tons of space left over in that partition for data files etc, basically I could still use the pendrive as a regular data drive, but it was bootable.

So when I booted it and was presented with the nice YUMI menu, I would select the PLOP ISO and boot it up, it would see all partitions on all drives, I would then select the Debian live image partition and boot it from PLOP.
 
Old 01-04-2019, 05:24 PM   #14
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
you can use the grub.cfg that is in \boot/grub on the iso.
to boot in efi mode extract the efi directory from the efi.img that is in /boot/efi on the iso and copy it to the / of the usb

Last edited by colorpurple21859; 01-04-2019 at 05:27 PM.
 
Old 01-04-2019, 06:57 PM   #15
Yotaphoner
Member
 
Registered: Jun 2017
Posts: 50

Original Poster
Rep: Reputation: Disabled
Today I tried the SuperGrub2 iso, installing it with rufus in a partition of 50MB on the pendrive. Then I mounted the iso of Debian life on my linux machine and with "rsync" copied it to its own partition of the pendrive, and now it is writtable. Also "dd" another benchmarking distro to another partition. And it works, but not in the best way. SuperGrub2 can acces to both distros installed but it takes some time to navigate through the menus and detect everything. SuperGrub also allows to boot ISO's, as Brain described, but I don't want navigate in a Grub menu. I want the classical and clean Grub menu. Also the user interface is ugly as hell.

One thing it surprised me is, even with the partition being able to write on it, changes aren't saved. So I will have to discover how to save changes. I read something about creating a ext2 partition where changes are saved, but now I don't have the guide. One problem at time.

Tomorrow night (European night) I will struggle again to create the USB with the grub working properly on there. And also tell to you now I don't have UEFI, just the old BIOS, but creating an hybrid boot it will be the best

Thanks for all your help. I am learning a lot, but the goal is not yet reached so... I will tell you tomorrow how it goes..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
GRUB GRUB GRUB.... all over the display while booting with USB. kapsikum Linux - General 5 01-08-2010 04:29 AM
GRUB GRUB GRUB..... error sachinh Red Hat 2 01-16-2007 09:02 PM
Booting my new ubuntu install = "GRUB GRUB GRUB GRUB GRUB" etc. dissolved soul Ubuntu 2 01-13-2007 12:55 PM
GRUB GRUB GRUB GRUB "Whats Going on?" Gaweph Linux - Newbie 6 03-26-2004 10:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration