Bug 714295 - Anaconda invariably chooses the newest kernel during kickstart
Summary: Anaconda invariably chooses the newest kernel during kickstart
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: anaconda
Version: 6.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Anaconda Maintenance Team
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks: 756082
TreeView+ depends on / blocked
 
Reported: 2011-06-17 19:57 UTC by Michael MacDonald
Modified: 2013-04-16 21:04 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-17 21:30:09 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Michael MacDonald 2011-06-17 19:57:24 UTC
Description of problem: In EL5, it was possible to list a specific kernel to be installed by kickstart, like so:

%packages
kernel-2.6.18-238.9.1.el5

This would result in that specific kernel being installed, even if newer kernels were available.  As of EL6, this functionality is no longer present.  It seems that the newest kernel is always chosen, regardless of what is specified in the kickstart.

As an experiment, if I tacked on an arch to the kernel package entry like this:
%packages
kernel-2.6.32-131.2.1.el6.x86_64

Then I'd get an error like so:

Protected multilib versions     
        kernel-2.6.32-131.4.1.el6.x86_64 !=
        kernel-2.6.32-131.2.1.el6.x86_64

Version-Release number of selected component (if applicable): 13.21.117

How reproducible: Always

Steps to Reproduce:
1. Install EL6.x via kickstart (e.g. with Cobbler)
2. Specify a kernel package older than the latest available kernel
3. Tear out ones hair in frustration
  
Actual results: Latest kernel is always installed via kickstart.  Hair is lost.  Users are annoyed.

Expected results: Asked-for kernel version is installed.  I keep my full-ish head of hair.  Users get their work done.

Additional info: I understand that this use-case is uncommon, as most people want the latest errata kernel to be installed at kickstart time.  However, there is a valid use-case (testing) which requires specific kernels to be installed for certain versions of software.  I can imagine other related use-cases which may be a small percentage of usage, but are nonetheless important.

Comment 2 David Cantrell 2011-06-20 14:17:18 UTC
Please attach log files in /tmp generated by the installer:
http://fedoraproject.org/wiki/How_to_debug_installation_problems#Log_Files

Comment 4 Michael MacDonald 2012-01-16 19:58:57 UTC
The behavior is right there in the code:

In anaconda-13.21.149/yuminstall.py:1546, we have the following block:

        # do some sanity checks for kernel and bootloader
        if not anaconda.id.getUpgrade():
            # New installs only - upgrades will already have all this stuff.
            self.selectBestKernel(anaconda)
            map(self.selectPackage, anaconda.platform.packages)
            self.selectFSPackages(anaconda.id.storage)
            self.selectAnacondaNeeds()
        else:
            self.ayum.update()

Looking at selectBestKernel() (yuminstall.py:1480), we see this:

    def selectBestKernel(self, anaconda):
        """Find the best kernel package which is available and select it."""

        def getBestKernelByArch(pkgname, ayum):
            """Convenience func to find the best arch of a kernel by name"""
            try:
                pkgs = ayum.pkgSack.returnNewestByName(pkgname)
            except yum.Errors.PackageSackError:
                return None

            pkgs = self.ayum.bestPackagesFromList(pkgs)
            if len(pkgs) == 0:
                return None
            return pkgs[0]

        def selectKernel(pkgname):
            try:
                pkg = getBestKernelByArch(pkgname, self.ayum)
            except PackageSackError:
                log.debug("no %s package" % pkgname)
                return False

            if not pkg:
                return False

            log.info("selected %s package for kernel" % pkg.name)
            self.ayum.install(po=pkg)
            self.selectModulePackages(anaconda, pkg.name)

            if len(self.ayum.tsInfo.matchNaevr(name="gcc")) > 0:
                log.debug("selecting %s-devel" % pkg.name)
                self.selectPackage("%s-devel.%s" % (pkg.name, pkg.arch))

            return True

        foundkernel = False

        if not foundkernel and isys.isPaeAvailable():
            if selectKernel("kernel-PAE"):
                foundkernel = True

        if not foundkernel:
            selectKernel("kernel")

Reading the code, it's apparent that the newest package which provides "kernel" will always be chosen.  Supplying an older kernel in the %package list results in the "protected multilib" error described in the previous comment.  This makes sense, as anaconda doesn't want to install two different versions of the kernel.

Comment 5 Kevin Ying 2013-04-16 21:04:47 UTC
I'd like to revisit this bz as we would like to be able to specify specific kernel versions in 6.x kickstarts.  What can we provide you?  Do you need our anaconda-tb-* log?


Note You need to log in before you can comment on or make changes to this bug.