LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-27-2018, 07:59 PM   #1
ag33k
Member
 
Registered: Mar 2013
Location: Portugal
Distribution: Slackware
Posts: 98

Rep: Reputation: Disabled
UEFI system, two hardrives with two different slackware installs in each one


Hello

I' am having a problem on my setup.
I have a laptop with an internal hard drive but now I connected a usb hard drive and I want to install slackware on it.
The internal hard drive already has slackware installed and works fine.
And my system is a UEFI system.

My internal hard drive has Windows and Slackware on it. I use elilo to boot slackware and refind to manage my Windows and Slackware boots.

I plugged in the usb hard drive and run a usb stick with Slackware install (the iso burned on the usb stick) on it.

After running setup and install and configure the machine, I drop to command prompt to create a initrd.gz. Using this guide as reference http://ftp.slackware.com/pub/slackwa...ADME_CRYPT.TXT

But I created initrd.gz with /usr/share/mkinitrd/mkinitrd_command_generator.sh

Then I rebooted the machine to my slackware on the internal hard drive.

In there I mounted the root of the second slackware installation /dev/sdc3 on mnt/tmp
And created a new /boot/efi/EFI/Folder like /boot/efi/EFI/Linux
Then copied elilo-x86_64.efi initrd.gz vmlinuz from the /mnt/tmp/boot/ to /boot/efi/EFI/Linux
Copied also the existing elilo.conf on /boot/efi/EFI/Slackware to /boot/efi/EFI/Linux
I changed the line on elilo.conf of the root of my slackware install on the internal hard drive to the root of the external hard drive.

Using http://www.rodsbooks.com/efi-bootloa...tallation.html
I did

Code:
# efibootmgr -c -d /dev/sda -p 2 -l \\EFI\\Linux\\elilo-x86_64.efi -L Linux
Typed # efibootmgr to check the new entry and than I booted and switched back to refind on my bios.
After booting to the slackware on my external hard drive the boot process hangs and is not a kernel panic.
If I hit enter I drop to command line but the boot process did not finished.

What I am missing to have two different slackware installs on this two hard drives, one internal and the other a external usb one?
 
Old 05-28-2018, 05:55 AM   #2
chrisVV
Member
 
Registered: Aug 2010
Posts: 548

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
You don't need to use elilo if you have refind installed. Refind will boot a kernel, provided that the linux EFI bootloader is compiled into it (as it is with Slackware). And refind, if configured correctly, should be able to find all such bootable kernel images for you. Or instead of getting it to search, you can include a specific entry for your external drive in refind.conf by reference to its volume ID (note that refind uses the PARTUUID not the UUID). The stock refind.conf which comes with refind has examples.
 
Old 05-28-2018, 07:58 AM   #3
AlleyTrotter
Member
 
Registered: Jun 2002
Location: Coal Township PA
Distribution: Slackware64-15.0
Posts: 778

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
If I understand what you want to do.
copy the kernel & initrd from the external disk to the ESP on your primary internal drive then add a stanza to elilo.conf on the ESP something like.
#
image=externalDisikvmlinuzCopiedToESP
label=externalDiskName
initrd=externalDisk-initrd.gzCopiedToESP
read-only
append="root=/dev/externalDiskRootPartition vga=normal ro"
#

should be able to select the second Slackware from the elilo boot
HTH
john

Last edited by AlleyTrotter; 05-31-2018 at 08:50 AM.
 
Old 05-30-2018, 10:19 PM   #4
slac-in-the-box
Member
 
Registered: Mar 2010
Location: oregon
Distribution: slackware64-15.0 / slarm64-current
Posts: 775
Blog Entries: 1

Rep: Reputation: 431Reputation: 431Reputation: 431Reputation: 431Reputation: 431
To use uefi on your external hd, hopefully you, when installing, formatted it with GPT (using gdisk or other gpt compatible disk utility) and created a partition for efi; if so, then setup should detect that efi partition and it will populate the /boot/efi/EFI/Slackware directory for you. (I assume you want the external drive to be portable and bootable on whatever pc you plug it into)...

Can you use the keyboard shortcut on most pcs to select from available boot devices, and just select which device you want to start from?

I noticed you use readme for crypt setup: when I use LVM+crypt, on multiple devices, I have to use different physical volume names, and volume group names; and I'm not sure if necessary, but I also do this on the name given after "luksOpen", otherwise, the same name on multiple devices can confuse the mappings; I've been using the device's hostname for volume group, so my mappings end up like /dev/hostname1/root, or /dev/hostname2/root.
 
Old 07-04-2018, 06:31 AM   #5
ag33k
Member
 
Registered: Mar 2013
Location: Portugal
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
Hello
It took sometime to figure it out and several attempts.
I tried an efi partition on the internal HDD and elilo, efi partition on internal HDD and a custom refind.conf, efi partition on external HDD and grub. And finally efi partition on external hard drive and elilo.
The problem was always the same the boot process didn't finish and I notice the boot message

Code:
mount: can't find /mnt in /etc/fstab
ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahead.
       You can try to fix it. Type 'exit' when things are done.
Did some google search and end up on this thread on LQ

https://www.linuxquestions.org/quest...ab-4175606919/


It was a problem with initrd.gz that I solved this way

Code:
 mkinitrd -c -k 4.4.14 -f ext4 -r UUID=6b891380-abc7-4d5f-9068-7c159ef7109b -m usb-storage:xhci-hcd:xhci-pci:ohci-pci:ehci-pci:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:ext4:ehci-platform -u -w 30 -o /boot/initrd.gz

Reading all your replays and suggestions I end up with an encrypted slackware installation on the external hdd.
I still don't know if can't run on other machines but because I used UUID maybe it can.
For the encrypted installation my mkinitrd is this

Code:
mkinitrd -c -k 4.4.14 -f ext4 -r /dev/walletvg/root -m usb-storage:xhci-hcd:xhci-pci:ohci-pci:ehci-pci:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:ext4:ehci-platform -u -w 30 -C UUID=7c731aa7-3a4c-48ae-a186-3d0feb1c937b -o /boot/initrd.gz -L
This is UUID is from /dev/sdc3, the partition here I created the LVM.
I have in that disk three partitions: /EFI, /boot and a larger one for LVM.

I am still testing the installation but until now I don't have any problems with it.
 
Old 07-04-2018, 03:32 PM   #6
RadicalDreamer
Senior Member
 
Registered: Jul 2016
Location: USA
Distribution: Slackware64-Current
Posts: 1,815

Rep: Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981
*POOF*

Last edited by RadicalDreamer; 07-04-2018 at 09:04 PM.
 
Old 07-04-2018, 06:25 PM   #7
ag33k
Member
 
Registered: Mar 2013
Location: Portugal
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by RadicalDreamer View Post
First you need to install refind by executing the /usr/share/refind*/refind-install script. You don't have to do this again unless a new refind version comes out and you want to upgrade.

What I do is
1. create a usb boot disc of the latest kernel release.
2. mkinitrd -c -k 4.14.XX -m ext4 -r /dev/sda1 -u -o /boot/initrd.gz
3. eliloconfig
4. efibootmgr to find the number for refind
5. efibootmgr -o "refind's number."
6. Reboot
7. Reinstall NVIDIA
8. rkhunter --propupd

"/dev/sda1" is the location of root / partition.

Did you post on the right thread?
 
Old 07-04-2018, 09:00 PM   #8
RadicalDreamer
Senior Member
 
Registered: Jul 2016
Location: USA
Distribution: Slackware64-Current
Posts: 1,815

Rep: Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981Reputation: 981
Sorry. I triple boot with rEFInd and I saw it mentioned.

Last edited by RadicalDreamer; 07-04-2018 at 09:04 PM.
 
Old 07-04-2018, 11:36 PM   #9
ag33k
Member
 
Registered: Mar 2013
Location: Portugal
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
ok. no problem.

I am still having a issue.
Because this is a external hdd and like someone mentioned it's cool to move them around and connect to other machines. And the drives are encrypted so that is awesome.
But what about connect the external hdd to a machine without UEFI?
How I put a bootmanager like lilo or grub working and just for machines without UEFI?
I saw in a slackware live usb stick a partition called BIO ou BIOS. And I think that is related.
 
Old 07-05-2018, 06:05 AM   #10
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,431

Rep: Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471
Quote:
I saw in a slackware live usb stick a partition called BIO ou BIOS. And I think that is related.
Most likely the 1MB BIOS boot partition if you are using GPT on a Legacy system. Usually you would use Grub in the MBR of the drive to boot it from a non-EFI machine using GPT. I suppose with your EFI partition on the external, you might be able to install Grub code to the MBR of that drive and then in the BIOS on a Legacy machine, it should boot but you would obviously have to make your selection in the BIOS on other machines. Have no way to test this at present so...

If I'm reading your post correctly, you seem to be using LILO and refind, I haven't used LILO in years and never used refind so I'm not sure how that would work.
 
Old 07-05-2018, 08:54 AM   #11
ag33k
Member
 
Registered: Mar 2013
Location: Portugal
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
Most likely the 1MB BIOS boot partition if you are using GPT on a Legacy system. Usually you would use Grub in the MBR of the drive to boot it from a non-EFI machine using GPT. I suppose with your EFI partition on the external, you might be able to install Grub code to the MBR of that drive and then in the BIOS on a Legacy machine, it should boot but you would obviously have to make your selection in the BIOS on other machines. Have no way to test this at present so...

If I'm reading your post correctly, you seem to be using LILO and refind, I haven't used LILO in years and never used refind so I'm not sure how that would work.
I am using elilo and refind, right now. But I tried also refind and grub.
But to boot the external HDD I don't mind to use other solutions to get it to work on both legacy system and EFI.

This all came from the idea to have a full encrypted slackware installation on a usb external HDD.
But now that it's working on a EFI machine, I want to get it to work on both EFI and legacy systems.
 
Old 07-05-2018, 09:25 AM   #12
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,431

Rep: Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471
Quote:
But to boot the external HDD I don't mind to use other solutions to get it to work on both legacy system and EFI.
If you want the external drive with your Slackware to be able to boot on other machines which are Legacy (not EFI capable) then you need Grub in the MBR of that drive. If you are using GPT partitioning, you need a BIOS boot partition (usually 1MB).

If you also want it to boot EFI on EFI capable machines, you need the EFI partition which is apparently what you have now. In theory, I would expect this to work, an EFI partition which would be accessed from a computer which is EFI capable and EFI on in the BIOS. Having Grub (or other boot code) in the MBR of the drive and having only Legacy boot available in the BIOS of the machine should then boot in Legacy mode. Haven't tested this so...
 
Old 07-15-2018, 12:33 AM   #13
ag33k
Member
 
Registered: Mar 2013
Location: Portugal
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
Thank you all for your help. All the tips are quite useful to solve this.

I will leave this link for posteriority.


Quote:

As you request a clear illustration of how to do it, here it is. I assume you have your live Linux booted.

Partition the USB thumb drive

I recommend the command line tool gdisk. It produces very clean results. Alternatively, you can use gparted.

Create a new partiton table. Use GPT with a protective MBR.

Define these partitions:
(optional) A data partition
A Linux partition
A legacy BIOS boot partition (1MB is enough)
A EFI System partition (at least 32MB)

Example: On my 64GB thumb drive, the result looks like this:

Number Start (sector) End (sector) Size Code Name
1 2048 107632639 51.3 GiB 0700 DATA
2 107632640 124411903 8.0 GiB 8300 Linux filesystem
3 124411904 124413951 1024.0 KiB EF02 BIOS boot partition
4 124413952 124822453 199.5 MiB EF00 EFI System

Install Linux to the USB thumb drive using any method.

During the process, format the Linux partition with a filesystem of your choice, preferably ext4. Use this partition as root /.
Format the EFI System partition with FAT16.
The BIOS boot partition remains unformatted.

Install GRUB twice

In a final step, install GRUB for both boot methods, UEFI style booting and legacy BIOS booting.

grub-install --target=x86_64-efi --removable /dev/sdx

grub-install --target=i386-pc /dev/sdx

Where /dev/sdx is your USB thumb drive, obviously.
That --removable is important. Took me three hours to realize I need it on a removable USB thumb drive...

If you install GRUB to the thumb drive from the "outside" (not having booted the Linux from the USB thumb drive), you need to mount the Linux partition first. Maybe you mount it into /mnt. Then you mount the EFI System partition into the Linux partitions /mnt/boot/efi directory. Use --root=/mnt as parameter for grub-install. Only then grub-install finds all necessary directories.

Done.

For further reading:
We did not really define partitions in the MBR. So you may ask, why it does work on legacy BIOS machines. Keep in mind, we installed GRUB into the MBR. During the legacy BIOS boot process, the bootloader stored in the MBR is executed. This loads stage 1 of GRUB, which then proceeds to load stage 2 from the legacy BIOS boot partition. But at this time, GRUB does not actually know anything about partitions MBR or otherwise. For this reason, the information about the position of the BIOS boot partition has been embedded into GRUB stage 1. Consequently, if the BIOS boot partition is moved, you need to reinstall GRUB. After GRUB stage 2 is loaded, GRUB understands GPT and can continue with booting the Linux kernel.
source: https://superuser.com/questions/9613...ybrid-live-usb

It works.
 
1 members found this post helpful.
Old 07-15-2018, 04:51 AM   #14
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,431

Rep: Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471Reputation: 2471
Thanks for posting your solution. I'm sure it will be useful to others who find it. Out of curiosity, is the purpose of the 'optional' Data partition as the first partition so you can share with windowss (ntfs) or just coincidentally the first?
 
Old 07-15-2018, 06:29 AM   #15
ag33k
Member
 
Registered: Mar 2013
Location: Portugal
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
Thanks for posting your solution. I'm sure it will be useful to others who find it. Out of curiosity, is the purpose of the 'optional' Data partition as the first partition so you can share with windowss (ntfs) or just coincidentally the first?
Sorry for not giving more details about the solution.
That solution is not mine! I found it.

My setup was 4 partitions:

. A legacy BIOS boot partition (1MB) of type EF02 and not mounted
. A EFI System partition (100MB) of type EF00 mounted at /boot/efi/
. A Linux partition (100MB) of type 8300 mounted at /boot
. A Linux partition (rest of the hard drive) of type 8300

The 4th partition is setup up like described in section "Combining LUKS and LVM" from http://ftp.slackware.com/pub/slackwa...ADME_CRYPT.TXT

In there I have my swap and root. I don't created a LV just for /home.

After the install process I did

Code:
# chroot /mnt
In here I had to mount the efi partition of the usb external hard drive by hand, because slackware setup didn't detected it. In fact slackware setup detected only the EFI from the internal hard drive. I let that happen because after the install process, I just needed to edit /etc/fstab.

Code:
# umount /boot/efi
# mkfs.fat -F32 /dev/sdb2
# mount /dev/sdb2 /boot/efi
# mkdir /boot/efi/EFI
Edited my /etc/fstab to use UUID and created initrd.gz like this

Code:
# mkinitrd -c -k 4.4.14 -f ext4 -r /dev/walletvg/root -m usb-storage:xhci-hcd:xhci-pci:ohci-pci:ehci-pci:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:ext4:ehci-platform -u -w 30 -C UUID=7c731aa7-3a4c-48ae-a186-3d0feb1c937b -o /boot/initrd.gz -L -l pt
Installed grub like this on bios and EFI and also disabled os prober.

Code:
# export PATH=$PATH:/usr/sbin

# grub-install --target=i386-pc /dev/sdb
	
# grub-install --target=x86_64-efi --removable /dev/sdb
	
# chmod -x /etc/grub.d/30_os-prober

# grub-mkconfig -o /boot/grub/grub.cfg


In the link provided there is in fact a optional data partition. Maybe to exchange data with some Windows instalation.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Obscure Bugs in Current's Installer for UEFI Installs? laprjns Slackware - Installation 1 01-23-2018 05:04 PM
[SOLVED] elilo broken on Slackware 14.2 after Windows 10 update on dual boot UEFI system hyperhead Slackware 5 08-03-2016 01:45 PM
Slackware on a former UEFI system garpu Slackware - Installation 2 11-23-2012 10:59 PM
[SOLVED] Need advice installing slackware to a GPT/UEFI system arubin Slackware 38 10-21-2012 11:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:26 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