LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Need help setting up bootloader (gpt table on bios motherboard) (https://www.linuxquestions.org/questions/slackware-14/need-help-setting-up-bootloader-gpt-table-on-bios-motherboard-4175525724/)

moisespedro 11-17-2014 09:30 PM

Need help setting up bootloader (gpt table on bios motherboard)
 
Hi, I have two hard disks on my PC. One is with a msdos table and Windows installed on it. I am trying to setup Slackware on The other HD with a gpt table. I did that before and ir was straightfoward: LILO installed fine. However I am not having luck now. LILO setup doesn't complete, it fails to detect Windows properly, it fails to install. I even tried grub but ir didn't work either. When I was trying to setup grub my partition scheme was the following:

/dev/sdb1 - first 2MiB for grub
/dev/sdb2 512 MiB swap
/dev/sdb3 25GiB for root (with btrfs)
/dev/sdb4 rest of the harddisk for /home

Currently I have nothing on that harddisk, looking forward to try it again tomorrow.

Followed this tutorial on my attemps.

ReaperX7 11-17-2014 09:56 PM

First off let's review your partition scheme:

Quote:

/dev/sdb1 - first 2MiB for grub
/dev/sdb2 512 MiB swap
/dev/sdb3 25GiB for root (with btrfs)
/dev/sdb4 rest of the harddisk for /home
You should have the /dev/sdb1 partition labeled as EF02. If it is, then you're spot on. However, /sdb1 should be the /boot partition, not the bios_grub boot partition.

The next question is, how much system RAM do you have, and are you going to be compiling stuff regularly? 512MB is rather small for swap. Unless you have more than 8GB of RAM, you should at least use 2GB at least, with no more than 8GB for swap if you'll be building a lot of software. There's no benefit to going past 8GB of swap though. If you're system has enough RAM, then you'll need less swap space, but generally the recommended average and minimum I've seen personally is 2GB.

Next, btrfs is risky to use still**, you will need a ext2/3/4 formatted /boot partition, however, to use btrfs as /(root). Personally, you could get away with using JFS with just as good a result, so you've been warned. There have been reports of btrfs causing a failure during the installation of Slackware. I have seen and witnessed it firsthand with the 14.1 install, so user beware. You should dedicate at least 50GB to /(root) for growth purposes, especially logs and the aspect of Copy-on-Write shadow copies taking up a deal of space.

/home is fine, but if you have multiple users, you should think about quotas.

Technically, you should have this:

Code:

/dev/sdb1 - 25MB - EXT2 - /boot partition
/dev/sdb2 - 2MB - EF02 grub partition
/dev/sdb3 - 2GB - swap space
/dev/sdb4 - 50GB - JFS/EXT4/XFS* - /(root) partition
/dev/sdb5 - remaining space - BtrFS - /home

*I personally would avoid using BtrFS as the root partition and use JFS, EXT4, or XFS instead and use BtrFS for /home due to the fact, BtrFS is a copy-on-write file system and BtrFS supports shadow copies for file recovery. On /(root) it can actually be very problematic due to the fact it keeps a few file versions in cache. Plus, due to the volatility of BtrFS, /home becomes more sacrificial if anything goes wrong, and you have a stable file system under root user.

**If anything wait until the next release of Slackware to use BtrFS. The current version in 14.1 is not classed as Stable.

Now let's move onto Grub.

You first should setup Grub as follows as root:

Code:

mkdir -pv /boot/grub
Grub will require it's own directory in /boot, so make sure you have ample space by allocating at least 25MB for /boot if you have a /boot partition, which you should have probably with btrfs.

Next, run this as root:

Code:

grub-mkconfig -o /boot/grub/grub.cfg
This should detect all available hard drives and give the proper boot setup. It should give you:

Code:

Slackware 14.1
Slackware 14.1 Advanced Options
Windows Recovery on /dev/sda

Normally the Windows Recovery listing is actually correct. Sometimes it will list as Windows Vista as well, but both are technically limitations of the os_prober package.

Then finalize it by running:

Code:

grub-install /dev/sdb
Note that if you have a separate hard drive, you probably should use the BIOS boot selection menu, especially if Windows is on /dev/sda and Linux is on /dev/sdb. Usually pressing [ESC] at the POST prompt brings up this menu.

From what I do know, LILO does have some problems at times with certain setups. I don't know the details, but I do know Grub does in fact work a lot better in some cases when LILO has issues.

moisespedro 11-17-2014 10:08 PM

OH, I forgot to mention: I do have a /boot partition

I basically copied the scheme from Gentoo Handbook. Also, I have only 4GB of RAM but my system rarely uses swap and when it needs it uses zram so, to be honest, I don't even think I need swap at all. Anyways, isn't a way to make LILO work worh this? ELILO? Does it have/need some special partition like Grub?

ReaperX7 11-17-2014 10:17 PM

I've done very little with eLILO honestly, but I do know Grub does work because I have a near identical setup:

My partition layout is:

/dev/sdb1 - ext2 - 25MB - /boot - also has noauto in fstab to keep it from being automatically mounted.
/dev/sdb2 - ef02 - 2MB - bios_boot
/dev/sdb3 - swap - 8GB - swap (I do a lot of building and only have 4GB RAM, so it helps)
/dev/sdb4 - jfs - 50GB - /(root)
/dev/sdb5 - zpool/zfs - 425GB - /home using zfs-on-linux.

I think, if I remembered correctly, LILO worked best with MBR partition schemes because it wrote to the MBR. eLILO, I don't know, but I do know it does support EFI partitioning.

moisespedro 11-18-2014 07:00 AM

It worked, my partition scheme is the following:
Code:

root@slack:~# parted -a optimal /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                           
Model: ATA WDC WD5000AAKS-0 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End    Size    File system    Name    Sinalizador
 1      1049kB  3146kB  2097kB                  grub    bios_grub
 2      3146kB  137MB  134MB  ext2            boot
 3      137MB  674MB  537MB  linux-swap(v1)  swap
 4      674MB  27,5GB  26,8GB  ext4            rootfs
 5      27,5GB  342GB  315GB  ext4            home

And I've installed it with:
Code:

# mkdir -pv /boot/grub
# grub-install --modules=part_gpt /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

Thanks Reaper and thanks ruario for this.

I just have a minor issue involving os-prober, sometimes it hangs and it puts all kernels (huge and generic) in the grub menu. So far so good. I liked LILO better but eventually I will get used to this.

ReaperX7 11-18-2014 07:49 PM

Check out documentation on how to setup an /etc/default/grub configuration file as well. You can use it to add graphics, themes, fonts, framebuffer modes, etc.

moisespedro 11-18-2014 07:57 PM

Well, I want LILO back. This thing has too many options, configurations, etc

Didier Spaier 11-18-2014 11:01 PM

Quote:

Originally Posted by moisespedro (Post 5271671)
Well, I want LILO back. This thing has too many options, configurations, etc

It never hurts to learn new things, IMHO.

Oh and don't try elilo, it can't make boot sectors, it provides EFI bootloader files instead, so it only targets EFI firmwares, not BIOS.

ReaperX7 11-18-2014 11:12 PM

Grub can be simple or complex. It's up to you. Personally, I just use it with the default settings, so no fuss.

And editing /boot/grub/grub.cfg isn't hard once you see they layout. It's basically a script of sorts. It looks intimidating, but honestly, it's easy, possibly less a headache than LILO.

I have used these in the past though for /etc/default/grub:

GRUB_TIMEOUT="10"
GRUB_TERMINAL_INPUT="console"
GRUB_TERMINAL_OUTPUT="gfxterm,console"
GRUB_CMDLINE_LINUX=""
GRUB_VIDEO_BACKEND="vbe"
GRUB_GFXMODE="1024x768"
GRUB_GFXPAYLOAD_LINUX="keep"

These gave me a nice bootup with the framebuffer console set similar to LILO's vga=792 mode, and 10 second timer for boot selections.

If you need more explanations, check this website:

https://www.gnu.org/software/grub/ma...iguration.html

One suggestion, edit your /boot/grub/grub.cfg file where the kernel is:

/boot/vmlinuz-#insert_name# to simply use the /boot/vmlinuz symlink so you never have to rerun Grub when you update your kernel before you install it to the boot sector. It saves a lot of time and headaches.

EYo 11-19-2014 04:34 AM

Finally I'm digging in and learning more about GRUB, it's kind of fun trying to make it do what I want. I made this crude edit so to see the kernel version on the menu, like "Slackware-14.1-3.10.17" Is there a more elegant way?

Code:

GRUB_DISTRIBUTOR=$( echo -n "`sed 's/Slackware /Slackware-/' /etc/slackware-version`-" && uname -r )
I have a corner case where EFI boot will hang my machine, trying to figure out how to have osdetect.cfg fail gracefully when no EFI partitions exist. Separate topic :)

moisespedro 11-19-2014 05:22 AM

Quote:

Originally Posted by Didier Spaier (Post 5271725)
It never hurts to learn new things, IMHO.

I agree but in this case I am feeling lazy.

And thanks again Reaper :D I will take a look at it when I have more time.

bassmadrigal 11-19-2014 07:23 AM

Quote:

Originally Posted by EYo (Post 5271803)
Finally I'm digging in and learning more about GRUB, it's kind of fun trying to make it do what I want. I made this crude edit so to see the kernel version on the menu, like "Slackware-14.1-3.10.17" Is there a more elegant way?

Code:

GRUB_DISTRIBUTOR=$( echo -n "`sed 's/Slackware /Slackware-/' /etc/slackware-version`-" && uname -r )
I have a corner case where EFI boot will hang my machine, trying to figure out how to have osdetect.cfg fail gracefully when no EFI partitions exist. Separate topic :)

I'm not sure how well that will work since I don't use grub, but just as an FYI backticks are generally frowned on for running commands within a command. It should be $(command). Knowing this would've saved me some grief on stackexchange when I submitted a bash question a few years ago. You can have nested commands like you had above where backticks don't allow it. It isn't formally deprecated, but it is highly recommended to not use it, and is essentially, in any other sense of the word, deprecated. See more here. If you're already aware of this and chose to use backticks, carry on :) , but in case you weren't aware, I just wanted to throw the information out.

Code:

$( echo -n "$(sed 's/Slackware /Slackware-/' /etc/slackware-version)-" && uname -r )


All times are GMT -5. The time now is 09:43 PM.