Change Grub configuration on a Slackel USB installation

You have a problem with Slackel? Post here and we'll do what we can to help.
Post Reply
Papasot
Posts: 233
Joined: 13 May 2016 22:32
Location: Patras, Greece

Change Grub configuration on a Slackel USB installation

Post by Papasot »

I have a Slackel 64-bit installation on a USB drive which I use regularly when not at home. The installation was done so that it should work on a laptop with one disk drive, so Grub looks for Slackel USB installation at /dev/sdb. However, the laptop died and for now I should use the Slackel USB on my desktop. But desktop computer has two hard disks, so now Grub on Slackel USB should be reconfigured to boot filesystem from /dev/sdc, not /dev/sdb. I thought I knew how to do that but failed. This is what I did:
I boot from Slackel Live USB and attach the Slackel USB installation stick as well. Slackel Live assigns itself at /dev/sdc and Slackel USB installation is at /dev/sdd. Now I chroot the filesystem on Slackel USB installation (for that, I use the script djemos provided in the past). At the chrooted filesystem, the plan is to re-install Grub and then update-grub. However the first step fails:

Code: Select all

root@slackellive:/# grub-install /dev/sdd
Installing for i386-pc platform.
grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels.  This is not supported yet..
grub-install: error: embedding is not possible, but this is required for cross-disk install.
I am not sure what's going on here. The Slackel USB doesn't actually have "multiple partition labels". It is just a 32 Gb USB dedicated to Slackel, and doesn't have multiple partitions.
What am I doing wrong here?
djemos
Site Admin
Posts: 697
Joined: 15 Apr 2016 06:03

Re: Change Grub configuration on a Slackel USB installation

Post by djemos »

There is no need to install grub again. Since grub returned the error message i think did not change anything.
Also this "grub-install /dev/sdd" is wrong since your usb will be sdc on boot. Also if it is a 64bit real usb installation then why the message "Installing for i386-pc platform.
grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels."
How many partitions are in usb ? Well, read bellow.

Just boot with your desktop and plug in your usb it will be mounted in pcmanfm. If it is a 64bit installation there will be two partitions on usb.
Suppose it is mounted in /run/media/USER/
Then open a terminal and type geany /run/media/USER/boot/grub/grub.cfg to see if grub.cfg exists and is not destroyed. Then close geany and type.

Code: Select all

sed -i "s/sdb/sdc/g" /run/media/USER/boot/grub/grub.cfg
sed -i "s/hd1/hd2/g" /run/media/USER/boot/grub/grub.cfg
sed -i "s/ahci1/ahci2/g" /run/media/USER/boot/grub/grub.cfg
To check if changes done type geany /run/media/USER/boot/grub/grub.cfg
First disk is hd0 (ahci0), second disk is hd1 (ahci1) and third hd2 (ahci2) your usb.
But if you want to use this usb to boot in a desktop or laptop with one disk you have to run again the commands to replace sdc with sdb, hd1 with hd2, ahci2 with ahci1
(sed -i "s/sdc/sdb/g" /run/media/USER/boot/grub/grub.cfg
sed -i "s/hd2/hd1/g" /run/media/USER/boot/grub/grub.cfg
sed -i "s/ahci2/ahci1/g" /run/media/USER/boot/grub/grub.cfg)

Then boot with your usb.
Papasot
Posts: 233
Joined: 13 May 2016 22:32
Location: Patras, Greece

Re: Change Grub configuration on a Slackel USB installation

Post by Papasot »

djemos wrote:Also this "grub-install /dev/sdd" is wrong since your usb will be sdc on boot.
I thought so as well, but I had no way to tell the system I want the real usb installation at /dev/sdc and the live usb at /dev/sdd at boot.
djemos wrote:Also if it is a 64bit real usb installation then why the message "Installing for i386-pc platform.
grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels."
I noticed that "i386-pc" as well, and it's strange because no operating system in the hard disks and any usb I used is 32-bit. Everything is 64 bit.
djemos wrote:Just boot with your desktop and plug in your usb it will be mounted in pcmanfm. If it is a 64bit installation there will be two partitions on usb.
Real usb installation has 2 partitions: one for the system itself (28 Gb) and a linux swap (2 Gb - not sure this is needed nowadays).

Now, I tried to replace sdb with sdc in grub.cfg but... there is no sdb entry anywhere. Not even in older grub.cfg files found /boot/grub.
The problem is this usb was designed to work on a laptop with totally different hard disk setup. But this laptop does not exist anymore. What I am trying to do is to tell the real usb installation to reconfigure grub according to the new setup (that of the desktop). That is why I tried grub-install first.
Another problem is the desktop doesn't have Slackel installed on any hard disk (it has Salix, FreeBSD, and a Window$ 10 installation which I almost never use). So I cannot boot from a Slackel hard disk installation and try anything from there; this is why I booted from a Slackel-Live usb.

I can of course re-install Slackel on the usb from scratch, but there is a lot of stuff I will have to do after that, and this usb has it all already. What I want is the usb real installation to boot no matter what, pretty much like the Slackel-Live does. Live will boot anywhere, no matter if there is one or two hard disks. I don't care if I can boot operating systems on hard disks from grub installed on the usb. I just want the usb real installation to boot, even ignoring the operating systems on hard disks.
djemos
Site Admin
Posts: 697
Joined: 15 Apr 2016 06:03

Re: Change Grub configuration on a Slackel USB installation

Post by djemos »

It has to be something. sdd sdc? sd?
Is there any menuentry for 'Slackel on grub.cfg?

What is the grub.cfg file contents? Send it by email if it is big. Is there any initrd in /boot/ folder on usb?
Send also the previous grub.cfg old file which was working to boot the usb.
can of course re-install Slackel on the usb from scratch, but there is a lot of stuff I will have to do after that, and this usb has it all already. What I want is the usb real installation to boot no matter what, pretty much like the Slackel-Live does. Live will boot anywhere, no matter if there is one or two hard disks. I don't care if I can boot operating systems on hard disks from grub installed on the usb. I just want the usb real installation to boot, even ignoring the operating systems on hard disks.
Real installation is different than live usb.
With real installation can boot anywhere where there is one hard disk and usb will be the second disk (sdb). This is the common use.
To boot on a system having 2 hard disks need to do what i wrote above in previous message with sed.
Post Reply