LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Not booting on X86: Can I sort myself with a live usb? (https://www.linuxquestions.org/questions/slackware-14/not-booting-on-x86-can-i-sort-myself-with-a-live-usb-4175679854/)

business_kid 08-03-2020 03:39 PM

Not booting on X86: Can I sort myself with a live usb?
 
I can't boot my X86_64 box.

What I think went wrong was that I changed the boot order in /boot/grub/grub.cfg, but forgot to run grub-install, or else something odd happened when I did. I never noticed it for a few days because I was suspending, until I rebooted.Previously, I had kernel1, kernel2, kernel3. I switched it to kernel3, kernel2, kernel1. On the menu now, only kernel2 shows, and that goes out to lunch if I try booting it.

My install dvd chose that moment to expire. Don't you just love it when that happens? I also have a slackware live-usb disk, (kernel-4.19.58?) which boots, but doesn't seem to have grub installed. So I have to mount /, then /boot, and chroot. I can mount proc in the chroot but grub-install throws up a long string of missing device errors and apparently does nothing useful.

I see two options: get grub going under chroot, or on my usb drive there's a slackware64 iso on file. If I could burn a dvd, I can sort myself out with that. Can that be done?

elcore 08-03-2020 04:03 PM

Assuming you've changed the order of drives, while device.map remained the same.
You can either fix this manually, or with the tools from the grub package. Probably not with both at the same time, because the tools overwrite manual edits.
If you're already familiar with the syntax, just edit grub.cfg and device.map to fit the drive map provided by bios. Note some connected USB storage may change this drive map, depending on bios configuration.

enorbet 08-03-2020 04:30 PM

Assuming your machine is new enough to support EFI boot, you could dispense with bootloader configs by calling up "Boot Order" and booting your Slackware media (either Install or Live should do) with the UEFI entry in Boot Order. Then run "efibootmgr" and if you like download and install "rEFInd" which behave a bit like GRUB by finding bootable kernels and adding them to it's menu.

business_kid 08-04-2020 04:14 AM

Thanks for the replies.

My machine supports EFI, but it's an M$ inspired BIOS in that area and supremely awkward. To get out of the UEFI 'jail' the BIOS has created, I specified 'Legacy boot, and formatted the disk with fdisk. So, no EFI is enabled.

I haven't changed the order of the drives. I use one ssd, and a usb backup drive. I can press F10 on reboot, and select either the dvd or a usb drive. There are 3 kernels on the same /boot drive (sda1) booting the same /root drive (sda3). I was meaning to install another system on sda6, and I probably wiil, one of these years…
The slackware Live usbs are more than a little complex, with several ISOs loop mounted. I'm hesitant to start firing packages in. I think I just need to install grub again, and all will be well. But 'grub-install /dev/sda in a chroot fails.

Could I install lilo in a chroot? It probably is on the HD. I could probably restore (in)sanity that way…
The other trick I can think of is burning a DVD. I have the iso, but the live usb only had cdrecord that I spotted. That means many grey hairs and a day wasted as I grapple with the very objectionable Mr. Schilling's rantings.

hazel 08-04-2020 04:41 AM

I think you can install any bootloader in chroot if you set up all the dynamic filesystems correctly, linking them to the versions on your host. The LFS book shows you how to do that.

As far as your UEFI is concerned, I don't think legacy boot is incompatible with booting something by hand. It only determines where the firmware normally looks for the bootloader on a given device.

business_kid 08-04-2020 06:54 AM

Thanks for all the help. I got out of it by reverting to the stone age:)

Lilo v1 is in the 'a/' directory - the one that everybody should install all of, they tell us.

I looked up how to get a lilo.conf written, and wrote one. That installed in a chroot. So I'm now booting on my own kernels on a primitive lilo, but will be back to grub in an hour or less.

For the record, the live usb doesn't have grub or lilo. I didn't check exhaustively for elilo. Lilo v1 is pre-uefi, but that suits, as so am I. As there's no boot loading programs on the live usb, I reckon it's a chroot. I did have proc available, but I didn't have sysfs, tmpfs, etc. It could probably be done, but I'll leave that to others.

EDIT: Install dvd being written as I post this!

hazel 08-04-2020 06:58 AM

The installer checks your boot mode by looking for /sys/firmware/efi/vars. If it finds that, it should install elilo on your EFI system partition by default. That's what it did for me anyway. Otherwise it installs lilo in the mbr.

business_kid 08-04-2020 09:00 AM

Well, I wrote the install dvd twice. The first one puked.

Then I wanted to restore grub.Here's my grub.cfg:
Code:

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
set root=(hd0,1)
insmod msdos

}menuentry "Slackware64-5.4.30-dec15 - Dec's Kernel" {
        linux  /vmlinuz-5.4.30-dec15 root=/dev/sda3 ro
}
menuentry "Slackware64-5.4.30-dec14 - Dec's Kernel" {
        linux  /vmlinuz-5.4.30-dec14 root=/dev/sda3 ro
}
menuentry "Slackware64-5.4.27 - Generic Kernel" {
        linux  /vmlinuz-generic-5.4.27 root=/dev/sda3 ro
        initrd /initrd.gz

I ran 'grub-install /dev/sda' to replace my stone age lilo config, and success was reported with no errors. I rebooted, and I got the fault condition - seeing Slackware64-5.4.30-dec14 entry only in the menu, and that not working.
Never mind, I thought, I'll boot on the dvd. But that went out to lunch halfway through the boot. So I'm back on my live usb --> chroot -->primitive lilo, referencing the same kernels on the same boot drive, except they're working with lilo. Now I am booting, but grub is doing nothing, except upsetting lilo. 'e2fsck -fvy' reports no issue with sda1, the common /boot partition. Is there some diagnostics built into grub to see why it's doing what appears to be nonsense? Should I be deleting stuff?

The only thing I did was swap the generic kernel above to the top - a copy & paste in nano, and Ctrl_K to delete the spare lines. I felt sure I ran grub-install. When grub puked, I presumed I must have forgotten to update the disk to the menu, but I did that, and it pukes. I have the same stuff in lilo.conf, and it seems to go fine:scratch:

Don't worry about the dvd. It's seven years old. The laser and the cdr were scrupulously cleaned, but I can do without it.

hazel 08-04-2020 10:13 AM

I think you have two unpaired braces in that grub menu.cfg file. The closing brace before the first entry doesn't correspond to anything. And there's no closing brace for the third entry.

elcore 08-04-2020 12:29 PM

Example of my MBR setup if you want to use as reference:

Code:

menuentry 'unknown-pc-linux-gnu' --class linux --class os {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        linux        /boot/vmlinuz root=/dev/sdb1 rootfstype=ext2 ro
}
menuentry 'unknown-pc-linux-gnu-64' --class linux --class os {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos2'
        linux        /boot/vmlinuz-64 root=/dev/sdb2 rootfstype=ext2 ro
}

device.map

Code:

(hd1) /dev/sda
(hd0) /dev/sdb
(hd2) /dev/sdc

Couple of notes:

There is part_msdos and msdospart (I think there is no 'msdos' module in 14.2 grub package) so your 'insmod msdos' seems suspicious.
In my example, a primary drive hd0 is mapped to sdb, in your case that would be sda.
I do also chainloading and remapping, but I removed this from example to make it simple.

business_kid 08-04-2020 02:29 PM

Quote:

Originally Posted by hazel (Post 6152602)
I think you have two unpaired braces in that grub menu.cfg file. The closing brace before the first entry doesn't correspond to anything. And there's no closing brace for the third entry.

Thanks, hazel & well spotted. This could have been it. I don't know, because I moved the entries since the initial problems.

@elcore: Thanks for the ideas. glad to hear the msdos module is gone. It's so weird to be talking about failed OSes of the last millenium. You sure have a lot of extra lines in your config.

I never had any device map, so in your honour one went in. Then i ran grub-install again, made sure my live usb key was inserted, and tried again. It booted up as normal. So I am not sure what broke it, or fixed it, but I imagine typos might have done it. Tired eyes…

thirdm 08-04-2020 09:42 PM

grub2 includes a utility named grub-script-check that can point out some kinds of errors in grub.cfg, in case you edit again sometime.

business_kid 08-05-2020 04:17 AM

Thanks. I already have edited again, I just didn't make an idiot of myself :rolleyes:


All times are GMT -5. The time now is 10:06 PM.