Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Refind does not see .old kernels
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
Caleb9
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2005
Posts: 79
Location: PL & DK

PostPosted: Tue Aug 16, 2016 7:31 pm    Post subject: [SOLVED] Refind does not see .old kernels Reply with quote

I have a dual boot Gentoo and Windows 10 with UEFI. I use Refind to boot but the problem is that it does not give me option to boot from the ".old" kernel. I'm experimenting a bit sometimes and it happens that I mess something up and Linux does not start at all afterwards. Having an option to boot from an old kernel is nicer than having to use rescue media, chroot and so on. Does anyone know what can be wrong?

Here are some details. I installed Refind 0.10.3 from Windows following instructions on refind website. The structure of /boot partition looks as follows:
Code:
# tree -L 3 /boot

Code:
boot/
├── BOOTSECT.BAK
├── config-4.4.6-gentoo
├── config-4.4.6-gentoo.old
├── EFI
│   ├── boot
│   │   └── bootx64.efi
│   ├── Microsoft
│   │   ├── Boot
│   │   └── Recovery
│   └── refind
│       ├── background.png
│       ├── drivers_x64
│       ├── icons
│       ├── README
│       ├── refind.conf
│       ├── refind.conf~
│       ├── refind.conf-sample
│       ├── refind_x64.efi
│       └── tools_x64
├── FSCK0000.REC
├── FSCK0001.REC
├── FSCK0002.REC
├── System.map-4.4.6-gentoo
├── System.map-4.4.6-gentoo.old
├── vmlinuz-4.4.6-gentoo
└── vmlinuz-4.4.6-gentoo.old

As you can see there are two kernel files, the current one and the ".old".
Here's output of efibootmgr:
Code:
# efibootmgr -v

Code:
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0020,0041,0043,001D,003C
Boot0000* Windows Boot Manager  HD(2,GPT,019d1dcf-9f2c-4a99-aded-82a0cedada20,0x97800,0x32000)/File(\EFI\REFIND\REFIND_X64.EFI)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...3................
Boot001D  Hard Drive    BBS(HD,,0x0)..GO..NO........o.S.a.m.s.u.n.g. .S.S.D. .8.5.0. .E.V.O. .2.5.0.G.B....................A...........................>..Gd-.;.A..MQ..L.2.S.P.1.S.N.G.A.8.1.0.2.6.7. .E. . . . ........BO..NO........o.S.T.3.1.0.0.0.5.2.8.A.S....................A...........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .V.9.A.P.0.M.M.L........BO
Boot0020* UEFI: Built-in EFI Shell      VenMedia(5023b95c-db26-429b-a648-bd47664c8012)..BO
Boot003C  Unknown Device        BBS(9,,0x0)..GO..NO........k.I.n.t.e.n.s.o. .U.S.B. .3...0. .D.e.v.i.c.e. .0....................A.......................>..Gd-.;.A..MQ..L.3.3.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.A.C........BO
Boot0041  Windows Boot Manager  HD(2,GPT,019d1dcf-9f2c-4a99-aded-82a0cedada20,0x97800,0x32000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)
Boot0043  UEFI: Intenso USB 3.0 Device 0        PciRoot(0x0)/Pci(0x14,0x0)/USB(5,0)/HD(1,MBR,0x4294967196,0x800,0x747051c1)..BO

Not sure if it can be relevant but the disk structure looks as follows:
Code:
# fdisk -l /dev/sda

Code:
Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: BFDB65D5-3A84-4770-9E65-4BBFBC81621E

Device         Start       End   Sectors   Size Type
/dev/sda1       6144    620543    614400   300M Windows recovery environment
/dev/sda2     620544    825343    204800   100M EFI System
/dev/sda3     825344   1087487    262144   128M Microsoft reserved
/dev/sda4    1087488 319653887 318566400 151,9G Microsoft basic data
/dev/sda5  319653888 320575487    921600   450M Windows recovery environment
/dev/sda6  320575488 454842702 134267215    64G Linux filesystem
/dev/sda7  454844416 488397134  33552719    16G Linux swap


refind.conf is the default (refind.conf-sample) with few modifications. I will attach it here, even though I don't see any option being set that could be relevant for this:
Code:
# egrep -v '^(# |#$|$)' refind.conf

Code:
timeout 20
#screensaver 300
#hideui singleuser
#hideui all
hideui badges
#icons_dir myicons
#icons_dir icons/snowy
#banner hostname.bmp
#banner mybanner.png
#banner icons/snowy/banner-snowy.png
banner background.png
banner_scale fillscreen
#small_icon_size 96
#big_icon_size 256
#selection_big   selection-big.bmp
#selection_small selection-small.bmp
#font myfont.png
#textonly
#textmode 2
#resolution 1024 768
#resolution 1440 900
#resolution 3
resolution 1024 768
#use_graphics_for osx,linux
#showtools shell, gdisk, memtest, mok_tool, apple_recovery, windows_recovery, about, reboot, exit, firmware, fwupdate
#windows_recovery_files LRS_ESP:/EFI/Microsoft/Boot/LrsBootmgr.efi
#scan_driver_dirs EFI/tools/drivers,drivers
#scanfor internal,external,optical,manual
#uefi_deep_legacy_scan
#scan_delay 5
#also_scan_dirs boot,ESP2:EFI/linux/kernels
#dont_scan_volumes "Recovery HD"
#dont_scan_dirs ESP:/EFI/boot,EFI/Dell,EFI/memtest86
#dont_scan_files shim.efi,MokManager.efi
#scan_all_linux_kernels false
#fold_linux_kernels false
#max_tags 0
#default_selection 1
#default_selection Microsoft
#default_selection "+,bzImage,vmlinuz"
#default_selection Maintenance 23:30 2:00
#default_selection "Maintenance,OS X" 1:00 2:30
#enable_and_lock_vmx false
#spoof_osx_version 10.9
#csr_values 10,77
#include manual.conf
menuentry Linux {
    icon EFI/refind/icons/os_linux.png
    volume 904404F8-B481-440C-A1E3-11A5A954E601
    loader bzImage-3.3.0-rc7
    initrd initrd-3.3.0.img
    options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837"
    disabled
}
menuentry Ubuntu {
    loader /EFI/ubuntu/grubx64.efi
    icon /EFI/refind/icons/os_linux.png
    disabled
}
menuentry "ELILO" {
    loader \EFI\elilo\elilo.efi
    disabled
}
menuentry "Windows 7" {
    loader \EFI\Microsoft\Boot\bootmgfw.efi
    disabled
}
menuentry "Windows via shell script" {
    icon \EFI\refind\icons\os_win.png
    loader \EFI\tools\shell.efi
    options "fs0:\EFI\tools\launch_windows.nsh"
    disabled
}
menuentry "My Mac OS X" {
    icon \EFI\refind\icons\os_mac.png
    volume "OS X boot"
    loader \System\Library\CoreServices\boot.efi
    disabled
}

Thanks in advance for any help :).


Last edited by Caleb9 on Sun Aug 21, 2016 11:21 am; edited 1 time in total
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Tue Aug 16, 2016 10:41 pm    Post subject: Reply with quote

press insert key with the gentoo icon selected , you should then see every kernel that has vmlinuz in its name including the .old 's
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Caleb9
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2005
Posts: 79
Location: PL & DK

PostPosted: Wed Aug 17, 2016 4:41 pm    Post subject: Reply with quote

DONAHUE wrote:
press insert key with the gentoo icon selected , you should then see every kernel that has vmlinuz in its name including the .old 's

Thanks but unfortunately that's not the case - I only see "Boot using normal options" entry, and it's the only one :(.
Back to top
View user's profile Send private message
vasettoo
Tux's lil' helper
Tux's lil' helper


Joined: 11 Nov 2012
Posts: 77

PostPosted: Wed Aug 17, 2016 5:25 pm    Post subject: Reply with quote

Quote:
Code:
#scan_all_linux_kernels false
#fold_linux_kernels false

These need to be changed or at least the first one to 'true'
As per refind instructions: http://www.rodsbooks.com/refind/configfile.html#adjusting
Back to top
View user's profile Send private message
Caleb9
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2005
Posts: 79
Location: PL & DK

PostPosted: Wed Aug 17, 2016 7:58 pm    Post subject: Reply with quote

vasettoo wrote:
Quote:
Code:
#scan_all_linux_kernels false
#fold_linux_kernels false

These need to be changed or at least the first one to 'true'
As per refind instructions: http://www.rodsbooks.com/refind/configfile.html#adjusting


Thanks. The comment in refind.conf says that the first setting is set to true by default
Code:
# Default is "true" -- to scan for kernels without ".efi" extensions.
#
#scan_all_linux_kernels false

However I tried to set it to true explicitly to no avail :/
Back to top
View user's profile Send private message
vasettoo
Tux's lil' helper
Tux's lil' helper


Joined: 11 Nov 2012
Posts: 77

PostPosted: Wed Aug 17, 2016 9:18 pm    Post subject: Reply with quote

I meant to uncomment the line and change into 'true'.
Back to top
View user's profile Send private message
Caleb9
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2005
Posts: 79
Location: PL & DK

PostPosted: Thu Aug 18, 2016 3:17 pm    Post subject: Reply with quote

vasettoo wrote:
I meant to uncomment the line and change into 'true'.

That's what I did but it didn't have any effect :(.
Back to top
View user's profile Send private message
vasettoo
Tux's lil' helper
Tux's lil' helper


Joined: 11 Nov 2012
Posts: 77

PostPosted: Thu Aug 18, 2016 5:26 pm    Post subject: Reply with quote

I'll suggest a different approach - wipe the refind installation in /boot and install it from linux as per the wiki:
https://wiki.gentoo.org/wiki/Refind
Good luck!
Back to top
View user's profile Send private message
Caleb9
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2005
Posts: 79
Location: PL & DK

PostPosted: Thu Aug 18, 2016 5:32 pm    Post subject: Reply with quote

vasettoo wrote:
I'll suggest a different approach - wipe the refind installation in /boot and install it from linux as per the wiki:
https://wiki.gentoo.org/wiki/Refind
Good luck!

Good idea, I'll try that and report back :).
Back to top
View user's profile Send private message
Caleb9
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2005
Posts: 79
Location: PL & DK

PostPosted: Sat Aug 20, 2016 2:40 pm    Post subject: Reply with quote

vasettoo wrote:
I'll suggest a different approach - wipe the refind installation in /boot and install it from linux as per the wiki:
https://wiki.gentoo.org/wiki/Refind
Good luck!


So I tried that and it's still the same. I tried copying both vmlinuz-*-gentoo{.old} files to /boot/EFI/gentoo so it looks like this now:
Code:
/boot/
├── BOOTSECT.BAK
├── config-4.4.6-gentoo
├── config-4.4.6-gentoo.old
├── EFI
│   ├── boot
│   │   └── bootx64.efi
│   ├── gentoo
│   │   ├── vmlinuz-4.4.6-gentoo.efi
│   │   └── vmlinuz-4.4.6-gentoo.old.efi
│   ├── Microsoft
│   │   ├── Boot
│   │   └── Recovery
│   └── refind
│       ├── banners
│       ├── drivers_x64
│       ├── fonts
│       ├── icons
│       ├── images
│       ├── refind.conf
│       ├── refind.conf~
│       ├── refind.conf-sample
│       ├── refind_x64.efi
│       └── tools_x64
├── FSCK0000.REC
├── FSCK0001.REC
├── FSCK0002.REC
├── System.map-4.4.6-gentoo
├── System.map-4.4.6-gentoo.old
├── vmlinuz-4.4.6-gentoo
└── vmlinuz-4.4.6-gentoo.old

The result in refind is 4 entries: Windows, Linux 4.4.6 (generic tux icon), Gentoo .old (Gentoo icon) and fallback boot. It is suspicious that it only sees the .old kernel from gentoo directory. Generally this is not a solution because I would have to manually update files in /boot/EFI/gentoo/ every time I build new kernel... :(
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sat Aug 20, 2016 4:50 pm    Post subject: Reply with quote

what you want and are not getting is a function of make install not of refind. Tedious detailed explanation follws:
Assume you use:
cd /usr/src/linux
make menuconfig (as desired)
make && make modules_install && make install
this populates /boot with entries (from ls /boot) config-4.4.6-gentoo System.map-4.4.6-gentoo vmlinuz-4.4.6-gentoo the first time the 4.4.6 version of the kernel is compiled. If that same version of the kernel is recompiled using the make install command; config-4.4.6-gentoo System.map-4.4.6-gentoo vmlinuz-4.4.6-gentoo will be renamed as config-4.4.6-gentoo.old System.map-4.4.6-gentoo.old vmlinuz-4.4.6-gentoo.old and new config-4.4.6-gentoo System.map-4.4.6-gentoo vmlinuz-4.4.6-gentoo files will be created. A third compile will cause the existing 4.4.6-gentoo.old files to be copied over by the existing 4.4.6-gentoo files after which new 4.4.6-gentoo files are generated. Only the newest and next to newest kernel of the 4.4.6-gentoo kernel will be preserved automatically.
You can intervene manually by changing the name of a working set of vmlinuz/config/system.map files by adding something like .wkg and preserve experiments by adding something else like .x1. example:
Code:
mv /boot/vmlinuz-4.4.6-gentoo vmlinuz-4.4.6-gentoo.wkg


The following entries should not be necessary, at least one should be found at the generic tux icon while they exist:
gentoo
│ │ ├── vmlinuz-4.4.6-gentoo.efi
│ │ └── vmlinuz-4.4.6-gentoo.old.efi

these entries are all you should need and reduce the maintenance required, they should be found at the gentoo icon, earlier remark about insert may apply:
boot
├── vmlinuz-4.4.6-gentoo
└── vmlinuz-4.4.6-gentoo.old

OOPSJust added
boot
|__efi
|_/gentoo
├── vmlinuz-4.7.0-gentoo.efi
└── vmlinuz-4.8.0-rc1.efi
to my ESP expecting to have a tux icon appear in addition to the existing gentoo icon instead got two gentoo icons.

However: My first gentoo icon identifies as being for the efi systems partition and lists only the kernel most recently copied to /boot/efi/EFI/gentoo and open with default options when Insert is pressed.
My second gentoo icon identifies as being for ROOT partition (my partition label) and lists vmlinuz-4.7.0-gentoo (most recent kernel copied to /boot) until Insert is pressed at which it lists vmlinuz-4.7.0-gentoo with default options, vmlinuz-4.7.0-gentoo with single user options, vmlinuz-4.8.0-rc1 with default options, and vmlinuz-4.8.0-rc1 with single user options.

HTH
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Caleb9
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2005
Posts: 79
Location: PL & DK

PostPosted: Sun Aug 21, 2016 11:20 am    Post subject: Reply with quote

Thanks for all the help guys. Turns out the problem was mounting /dev/sda2 in /boot while I should have it in /boot/efi as per Gentoo's Refind guide. After doing that, and executing 'make install' in /usr/src/linux two times (just to obtain .old kernel, I know I could copy it manually but whatever) Refind started picking up everything as it should (shows gentoo icon, pressing INS or F2 gives option to use .old kernel). So for completeness, now my fstab entry looks like this:
Code:
/dev/sda2               /boot/efi       vfat            defaults,noatime,discard        0 2

And the /boot directory structure is like this:
Code:
/boot/
├── config-4.4.6-gentoo
├── config-4.4.6-gentoo.old
├── efi
│   ├── BOOTSECT.BAK
│   ├── EFI
│   │   ├── boot
│   │   ├── Microsoft
│   │   └── refind
│   ├── FSCK0000.REC
│   ├── FSCK0001.REC
│   └── FSCK0002.REC
├── System.map-4.4.6-gentoo
├── System.map-4.4.6-gentoo.old
├── vmlinuz-4.4.6-gentoo
└── vmlinuz-4.4.6-gentoo.old

Of course that means that now my kernel files reside on the root partition instead of /dev/sda2, but that's fine. Solved :).
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sun Aug 21, 2016 1:29 pm    Post subject: Reply with quote

you might want to consider adding noauto to the options for /dev/sda2 in /etc/fstab
Code:
/dev/sda2 /boot/efi vfat defaults,noatime,discard,noauto 0 2

_________________
Defund the FCC.
Back to top
View user's profile Send private message
Caleb9
Tux's lil' helper
Tux's lil' helper


Joined: 22 Nov 2005
Posts: 79
Location: PL & DK

PostPosted: Sun Aug 21, 2016 3:49 pm    Post subject: Reply with quote

DONAHUE wrote:
you might want to consider adding noauto to the options for /dev/sda2 in /etc/fstab
Code:
/dev/sda2 /boot/efi vfat defaults,noatime,discard,noauto 0 2

True dat. No need to have it auto-mounted all the time.
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