Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Fresh install Grub2 weirdness
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 354

PostPosted: Mon Sep 19, 2016 8:42 am    Post subject: Fresh install Grub2 weirdness Reply with quote

Hi... I hope this makes sense - I'm gonna try to keep it easy to follow:

Have a fresh install. Using Grub2 (for the 1st time). Booting generally seems to be fine.

During the install, I used genkernel to make the first kernel, although I always edit later to remove all the excess crud and tune things for my own needs.

Following the usual install instructions, I got a grub setup with a kernel AND an initramfs. I usually never use initramfs - don't quite understand it :) But my new system is using it, and booting fine.

NOW, I want to make kernel changes and install a modified kernel. After configging, I do

make
make modules_install
make install

The latter puts my new kernel in /boot - seems fine. Then, I do

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

This creates a new Grub config, however (this is the part that seems weird), it associates the OLD initramfs from the genkernel kernel with my new kernel. When I try to boot the new one, I get told that the root fs cannot be found. The root is specified as a UUID, and I check inside the grub.cfg, and can see that the UUID for the old kernel AND new kernel is the same. I google around, and find that you can replace these UUID with a good old /dev/sdaX. I try that. Still NO GO.

I wonder if the initramfs for the "wrong" kernel is screwing me up?

I'd like to get a simple step-by-step of how to install and run a modified kernel using Grub2. As you can see, I've got all the basics down. Is this supposed to be all there is to it? I am really determined to figure this out, rather than go back to Grub legacy. Gotta keep moving forward :)

Thanks for the help.


Last edited by Punchcutter on Mon Sep 19, 2016 9:07 am; edited 1 time in total
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Mon Sep 19, 2016 8:52 am    Post subject: Reply with quote

I tell you my approach with grub2 since years.

Install once grub2 with a binary distro, like linux mint, arch linux, ubuntu livecd with the binary distro.

=>> Reuse that grub2 without ever updating hte binary distro. <<==

That implies that I only install grub once and keep it as is. Grub refers to any grub / grub2 / grub beta installation. Therefore I keep the installation medium on the shelf, its sysrescue cd 4.6.0 for this notebook, as any newer livecd do not work with this grub installation. it seems grub is not compatible with newer installations here.

With every new created kernel i do the following

set symlink by hand to /usr/src/linux
create .config
set proper local version with datecode
make --jobs 8 && make --jobs 8 modules install
cp bzimage to /boot with a proper name for the kernel
create a new boot entry by hand for grub with an editor like nano. Basically swap out title, swap out kernel in use. Reuse initramfs from genkernel.

I never ever update the initramfs from genkernel or my grub(1/beta/2) since years on different boxes.

The initramfs here are just instructions to do the luks / lvm magic.

=>> You need to tweak your kernel probably, determine whats needed to boot your box. <<=

Thats essential so you can slim down your kernel to the needed modules and prevent future issues with kernel updates.

Personal opinion: I do not recommend to use these scripts of mass destruction to manipulate the grub.cfg. You may be able to tweak it but I think its much faster and easier to understand whats beeing done when you do it by hand with a text editor.

As said, change the number of which boot title is loaded, change the title / kernel version of the boot section in your grub.cfg.

Quote:
root fs cannot be found.


therefore the realroot or root boot option exists and I do use that.

Code:
cat /proc/cmdline
BOOT_IMAGE=/4.7.3-gentoo-16-09-2016 rootfstype=ext4 keymap=de init=/linuxrc ramdisk=8192 dolvm ro real_root=/dev/mapper/root crypt_root=/dev/mapper/vg_root_volume_SanDisk-lv_root_volume_SanDisk


as you can see i tell grub

rootfstype=ext4

my root is formated with ext4

real_root=/dev/mapper/root crypt_root=/dev/mapper/vg_root_volume_SanDisk-lv_root_volume_SanDisk dolvm

to use lvm, and where my root exists

plesae use the documetnation to update your kernel line. you probably only need for your installtion the real_root option

--

My opinion: those grub scripts are garbarge hardly ever worked, are intendted for binary distros like linux mint, when the developer really knows the boot kernel is that, its generic, the intiramfs is this, its generic. Not really for a self made setup

--

Some guys use other bootloaders because of the grub limitations or becuase its too complicated. There is no real need to use grub. Whatever works or suits you.

Grub is just a bunch of scripts which I adapted to my needs.

--

check your cat /proc/cmdline with your working kernel to see whats done, and also your working kernel .config and than adapt your bootloader with your needs
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Mon Sep 19, 2016 12:39 pm    Post subject: Reply with quote

edit the grub.cfg for booting the new kernel to eliminate the initrd line.
if using a GPT disk suggest using PARTUUID vice UUID. PARTUUID available by running blkid.
_________________
Defund the FCC.


Last edited by DONAHUE on Mon Sep 19, 2016 2:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Mon Sep 19, 2016 1:29 pm    Post subject: Reply with quote

depends what your box need. you may still need an initramfs

Quote:
When I try to boot the new one, I get told that the root fs cannot be found.


Sorry I have not seen it the first time i have read your post.

You need to figure out what your box needs for booting and adapt your kernel with or without initramfs accordingly.

Basically file-system support, controller support, ... built in or in the initramfs. (Generic answer)

with your lspci -kk output, kernel config others may be able to tell you waht you need for booting.

I assume you are aware of the gentoo wiki and gentoo handbook, they are a good starting point. i also assume you are aware that any forum wiki from another distro may aid you in your quest to complete the step, setting up your bootloader + kernel
Back to top
View user's profile Send private message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 354

PostPosted: Tue Sep 20, 2016 7:16 am    Post subject: Reply with quote

Thanks for the response. Roman_Gruber, esp thanks for the long, thoughtful notes... but unfortunately I need something more direct and practical to get me past this problem :lol: I would like to do what you are doing, having deeper understanding of exactly how booting works, down to the metal, but I'm not quite there yet, and I really need to get this box back to working status quickly.

Another fun fact: The box was in fact booting just fine, running X, and doing what I wanted it to do right after the install. Then, for some reason that I cannot fathom, X.org stopped working because the video driver module i915 suddenly could not be loaded (IIRC, I was told "invalid argument"). I am mystified as to how that could have happened. Anyway, that's when I started building my new kernel and trying to boot it.

As a stopgap, if someone can offer a clue how I can get modprobe i915 to work, at least I'd be able to run the box on the original genkernel-created kernel. Of course I will still need to get back soon to building a new kernel, but at least the immediate pain would be relieved. Here's another bit of evidence related to that: at the same time i915 started not loading, I also noticed that when I boot, the console does not go into (what I think is) frame buffer mode (i.e. where the text turns tiny), but stays super-big.

DONAHUE, I tried removing the initrd line from my grub.cfg.....not by editing the file, but by doing a live-edit at boot time, by pressing "e". The result of that was a kernel panic and stack trace vomited all over my screen :( My disk is not GPT, it's MBR. I tried GPT originally when I began to install on this box, and I couldn't get it to boot at all, so I redid the whole thing with MBR.

Finally... I have indeed referred to the docs and wiki, but have not, strangely, been able to find any clear, direct documentation of "how to build and install a new kernel on an existing Gentoo system using Grub2." Often docs are lacking for things that Just Work, but in my experience Grub2 can hardly be described this way :?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Tue Sep 20, 2016 1:23 pm    Post subject: Reply with quote

I specialize in step by step.
What boot media are you using? If not system rescue cd or usb suggest switch to it. sysresccd can be booted to an xfce4 GUI that provides midori browser as well as terminal window allowing copy and paste
what is the make and model of the computer or the motherboard and cpu if a homebrew?
Boot the install media and mount the gentoo partitions then run:
Code:
lspci -k | wgetpaste -t
lshw | grep -i driver | wgetpaste -t
lsmod | wgetpaste -t
blkid | wgetpaste -t
wgetpaste -t /mnt/gentoo/proc/cpuinfo
wgetpaste -t | /mnt/gentoo/usr/src/linux/.config
wgetpaste -t /mnt/gentoo/boot/grub/grub.cfg
and post the url's returned
If more kernel panics occur, taking a photo, phone or digicam and posting on a free site can valuable.
In response to Finally: as you did, make and install the kernel and then run grub-mkconfig -o /boot/grub/grub.cfg is the politically correct procedure for updating the kernel and grub2. manual edit of an initial successful grub.cfg also can work. editing a successful grub.cfg to use a permanent kernel name and then symlinking the new kernel to the permanent kernel name in /boot also can work.
lilo and grub-static (legacy grub) are still available.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 354

PostPosted: Tue Sep 20, 2016 6:54 pm    Post subject: Reply with quote

Thanks DONAHUE... I will gratefully follow instructions a bit later and follow up. But quick question: Do I really need to boot from sysresccd? My box boots fine from genkernel kernel, it's just that Xorg doesn't work (bec module load fail), so I can't do anything too useful with it :) But if running those commands from having booted off the HDD will be ok, I'll do that.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Wed Sep 21, 2016 12:03 am    Post subject: Reply with quote

Sorry I had concluded you were now 'bootless" . Booting the installed gentoo will be better than going into chroot. Sysresccd does a good job of sussing out drivers/modules and does have all tools and a browser. Also sorry to be late answering, I lawn mowered my comcast connection, spliced it, comcast gave away my dhcp license since I wasn't using it and a struggle ensued ...
_________________
Defund the FCC.


Last edited by DONAHUE on Sat Sep 24, 2016 5:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 354

PostPosted: Wed Sep 21, 2016 7:50 am    Post subject: Reply with quote

Here are the pastes:

lspci -k
lshw | grep -i driver
lsmod
blkid
/proc/cpuinfo
Linux 4.1.15-gentoo-r1 .config
grub-mkconfig

Further help greatly appreciated. The machine is a Dell Vostro 260s.

[Moderator edit: changed bare unlabeled URLs to [url] tags labeled with their type. OP: please consider doing this as part of your post next time. -Hu]
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Wed Sep 21, 2016 4:45 pm    Post subject: Reply with quote

noting that the kernel version is gentoo-sources-4.1.15-r1 which is perhaps 1-1/2 years old:
Is it likely that you updated xorg more recently than building the genkernel that used to run X but lost that ability?
The configuration of my gentoo-sources-4.7.3 has some significant changes in Graphics Support for intel from 4.1.15-r1.
When I worked with proprietary drivers, xorg -- kernel -- driver compatibility used to be a problem. Portage checked compatibility and issued more or less helpful warnings. Perhaps there is a similar problem now with open source intel?
Thought 1: run
Code:
emerge -1uNDav --with-bdeps=y xorg-server xf86-video-intel xf86-input-evdev xf86-input-synaptics
Problems reported during compile could be helpful.
Thought 2: Are you averse to a newer kernel?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 354

PostPosted: Thu Sep 22, 2016 8:03 am    Post subject: Reply with quote

DONAHUE wrote:
noting that the kernel version is gentoo-sources-4.1.15-r1 which is perhaps 1-1/2 years old:
Is it likely that you updated xorg more recently than building the genkernel that used to run X but lost that ability?
D'oh! Yes, indeed, that's probably what happened. I guess. But since it's a question of a module loading, it's really about Intel drivers and kernel, not so much Xorg itself, no? So... I wonder what version of Intel drivers could have been installed during the original install? </rhetorical>

Quote:
The configuration of my gentoo-sources-4.7.3 has some significant changes in Graphics Support for intel from 4.1.15-r1.
Hmmm... I've never had any trouble in the past mixing and matching different Xorgs, Intel graphics drivers, and kernels (that I can remember), so this kind of incompatibility never even crossed my mind...

Quote:
Thought 1: run
Code:
emerge -1uNDav --with-bdeps=y xorg-server xf86-video-intel xf86-input-evdev xf86-input-synaptics
Problems reported during compile could be helpful.
Ran it, but only synaptics ebuild was updated. And gave no useful output. Did you mean to include -u? Anyway, your comments have helped me start to think about what else I can do to mess around this thing... so I tried downgrading xf86-video-intel to 2.21.15.... seems like a "safe-ish" and not too old version, and if it works, I'd be happy :) But... it didn't build. Says

Quote:
checking whether to include DRI1 support... no
configure: error: DRI1 requested but prerequisites not found
So I tried a build with USE="-dri", but this just failed on an obscure code syntax-type error! So now I feel stuck again... Does it make any sense to try downgrading Xorg to a lower version?

Quote:
Thought 2: Are you averse to a newer kernel?
Well... I guess not. It's usually my policy not to run bleeding-edge, and 4.1.15 seemed appropriately old. I'm still running 3.14.56 on my laptop, now the only working computer in the house :( But then... even if I wanted to try a different kernel, I run back into my other problem, of not being able to install a new kernel that can find its root partition at boot time! :(
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Thu Sep 22, 2016 2:02 pm    Post subject: Reply with quote

I f you would boot the genkernel that boots to the CLI and try to start X. then pastebin /var/log/Xorg0.log.
Does eselect kernel list show that you have linux-4.4.6-gentoo (The latest stable)) on board? Might be worthwhile to run genkernel all for 4.4.6, make a new grub.cfg, repeat the emerge of xorg and the drivers. then reboot to this new kernel. The new kernel will have a new /lib64/modules/4.4.6 to load from. In short:
Code:
 emerge =gentoo-sources-4.4.6 #if needed
eselect kernel set linux-4.4.6-gentoo
mount /dev/sda2 /boot # if needed -- substitute your value for sda2 if boot partion is other
genkernel all
emerge -1av --with-bdeps=y xorg-server xf86-video-intel xf86-input-evdev xf86-input-synaptics
reboot
grub-mkconfig -o /boot/grub/grub.cfg
Try X again.
Meanwhile I will put a BIOS only intel cpu integrated graphics machine back in service here and then follow the path you are on ending with a working manual kernel.

You are right about the uNDav; tells what hasn't updated but not how the set compiles.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Sat Sep 24, 2016 5:29 pm    Post subject: Reply with quote

I have emerged and run genkernel on gentoo-sources-4.1.15-r1 and gentoo-sources-4.4.6. Both booted. Only gentoo-sources-4.4.6 would run X, gentoo-sources-4.1.15-r1 failing to run X while complaining about DRI. The config files graphics support sections are different in how they handle i915. It appears the xorg-server/kernel developers did not maintain backward compatibility. Recommend you move on to an unmodified 'genkernel all' of gentoo-sources-4.4.6 for a bootable GUI capable system. grub2 should be able to handle a new version number without initrd ambiguity. Will work up a stripped down manual kernel .config for gentoo-sources-4.7.4 for you based on my own. The different version numbers should avoid grub2's initrd misbehavior.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Sat Sep 24, 2016 11:40 pm    Post subject: Reply with quote

https://paste.pound-python.org/show/WmHrGum9nu7m6wZMndlg/ holds a kernel-4.7.4 config based on the one I am using currently. If you wish to try it, suggest:
Code:
echo "=sys-kernel/gentoo-sources-4.74 ~amd64" >> /etc/portage/package.keywords
emerge =sys-kernel/gentoo-sources-4.7.4
eselect kernel set linux-4.7.4-gentoo
eselect kernel list # to check it
# the easy way to download the config
wget -O  /usr/src/linux/.config https://paste.pound-python.org/raw/WmHrGum9nu7m6wZMndlg/
ls  /usr/src/linux/.config #verify the download
# mount boot partition if not already mounted
cd /usr/src/linux;make oldconfig # take ownership
make menuconfig # look around
make && make modules_install && make install
emerge -1av xorg-server xf86-video-intel xf86-input-evdev
grub-mkconfig -o /boot/grub/grub.cfg
wgetpaste -t  /boot/grub/grub.cfg # we can all see it
nano /boot/grub/grub.cfg # if repairs needed
reboot # try 4.7.4

_________________
Defund the FCC.
Back to top
View user's profile Send private message
axl
Veteran
Veteran


Joined: 11 Oct 2002
Posts: 1144
Location: Romania

PostPosted: Sun Sep 25, 2016 1:46 am    Post subject: Reply with quote

u're right original poster.

u dont need initrd.

what you do need is a phone with a camera. that can take a picture of an actual error that someone could help with.
Back to top
View user's profile Send private message
Punchcutter
Guru
Guru


Joined: 11 Feb 2007
Posts: 354

PostPosted: Mon Sep 26, 2016 9:50 am    Post subject: Reply with quote

DONAHUE, thanks so much for all the work you put into this. I must admit, I tried to cut the solution short by taking the knowledge you provided about incompatibility, and just upgraded my kernel to 4.4.6, did the usual stuff needed to run it, remerged my Xorg, and tried it. But the result was another kernel panic :cry:

So I broke down, bec I've pretty much had it with this, and just followed your instructions step by step to go to 4.7.4, using the config you provided, and voila, I get a booting system that runs Xorg as well. Sigh. There was nothing unexpected in your instructions, though.... nothing that would make me go "oooh, that's why it works." Pretty much the same stuff I did for 4.4.6.

Here's my grub.cfg, if you're still interested: http://bpaste.net/show/4816f90cde37

So, I'm still mystified. I looked into the grub.cfg a bit... not TOO hard, bec I'm tired, but could not see what might make the 4.7.4 kernel bootable, while the 4.4.6 or 4.1.15 goes down in flames.

Anyway... running. Thanks again.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Mon Sep 26, 2016 1:44 pm    Post subject: Reply with quote

I did not see an error in the stuff you pastebined; thus the hard way solution. I still believe the X failure was caused by a loss of backward compatibility between barely older kernel and newer xorg-server and xf86-video-intel. The panics did not get investigated; we have bypassed them. If you are still interested: boot 4.4.6 to a panic post a picture as axl suggested and we can look.
The 4.7.4 is based on pappy's kernel seed 3.3.9 (Loved his work, so saved a copy when he sold the shop) updated via make oldconfig, then modified to suit my machine, then modified to suit your machine.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum