From: Stephen Powell on
On Tue, 16 Mar 2010 08:26:40 -0400 (EDT), Mitchell Laks wrote:
>
> I notice that others had problems with grub not updating the kernel
> from linux-image-2.6.32-trunk-686 to linux-image-2.6.32-3-amd64
> and I had this same problem.
>
> I suspect that this is because the heuristic that dpkg or apt or aptitude update
> is using
> finds that linux-image-2.6.32-trunk-686 is greater than linux-image-2.6.32-3-amd
> 64 alphabetically
> even though it is the older kernel
> and this is breaking all of your automatic grub updates done by debian packaging.
>
> that is the reason we are all suffering....

I don't think this has anything to do with the package management system.
My guess is that grub2 simply makes a list of all files in /boot which begin
with linux-image, sorts them in descending order by the ASCII collating
sequence, and the one which comes out on top is the default kernel.
The problem is the decision to use "trunk" in the original 2.6.32 kernel
image name. This sorts higher than any numeric value. I use lilo; so this
doesn't affect me; but doesn't grub2 have some option for remembering
the last kernel booted and making that the default? If you don't want to
remove/purge the old kernel, it seems to me that that would be the way to go.

--
.''`. Stephen Powell <zlinuxman(a)wowway.com>
: :' :
`. `'`
`-


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/1019441254.19474911268744599240.JavaMail.root(a)md01.wow.synacor.com
From: Wolodja Wentland on
On Tue, Mar 16, 2010 at 07:53 -0500, Ron Johnson wrote:
> On 2010-03-16 07:26, Mitchell Laks wrote:
> Interesting thought. Does the system boot if you manually edit the
> grub config file?

The system boots fine if you select the new (-3-) kernel manually, so I
would think that it would also boot fine if you edit grub's config file.

There seems to be a bug in some compare_version() function that is used
by in the update-grub process to determine which kernel is newer than
the other. It should special-case -trunk- as well, as it does for rc,
pre, test IIRC.

If someone could give me a pointer where I can find the source code for
that functionality, i'll try to come up with a patch and file a bug
against the applicable package.
--
.''`. Wolodja Wentland <wentland(a)cl.uni-heidelberg.de>
: :' :
`. `'` 4096R/CAF14EFC
`- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC
From: Wolodja Wentland on
On Tue, Mar 16, 2010 at 09:03 -0400, Stephen Powell wrote:
> On Tue, 16 Mar 2010 08:26:40 -0400 (EDT), Mitchell Laks wrote:
> >
> > I notice that others had problems with grub not updating the kernel
> > from linux-image-2.6.32-trunk-686 to linux-image-2.6.32-3-amd64
> > and I had this same problem.
> >
> > I suspect that this is because the heuristic that dpkg or apt or aptitude update
> > is using
> > finds that linux-image-2.6.32-trunk-686 is greater than linux-image-2.6.32-3-amd
> > 64 alphabetically
> > even though it is the older kernel
> > and this is breaking all of your automatic grub updates done by debian packaging.
> >
> > that is the reason we are all suffering....
>
> I don't think this has anything to do with the package management system.
> My guess is that grub2 simply makes a list of all files in /boot which begin
> with linux-image, sorts them in descending order by the ASCII collating
> sequence, and the one which comes out on top is the default kernel.
> The problem is the decision to use "trunk" in the original 2.6.32 kernel
> image name. This sorts higher than any numeric value. I use lilo; so this
> doesn't affect me; but doesn't grub2 have some option for remembering
> the last kernel booted and making that the default? If you don't want to
> remove/purge the old kernel, it seems to me that that would be the way to go.

Exactly. The relevant code is:

--- /etc/grub.d/10_linux -----------------------------------------------
...
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
...
------------------------------------------------------------------------

Which obviously does not special-case -trunk-, so it sorts based on
LC_COLLATE. Looks as if the -trunk- name was a particularly bad choice
and I'm not sure what is the best way to solve this problem.

The easiest way would be to enforce a strict naming scheme (maybe with
lintian) so the aforementioned code can stay as simple as it is today.
--
.''`. Wolodja Wentland <wentland(a)cl.uni-heidelberg.de>
: :' :
`. `'` 4096R/CAF14EFC
`- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC
From: Stephen Powell on
On Tue, 16 Mar 2010 09:28:18 -0400 (EDT), Wolodja Wentland wrote:
> On Tue, Mar 16, 2010 at 09:03 -0400, Stephen Powell wrote:
>>
>> My guess is that grub2 simply makes a list of all files in /boot which begin
>> with linux-image, sorts them in descending order by the ASCII collating
>> sequence, and the one which comes out on top is the default kernel.
>> The problem is the decision to use "trunk" in the original 2.6.32 kernel
>> image name. This sorts higher than any numeric value. I use lilo; so this
>> doesn't affect me; but doesn't grub2 have some option for remembering
>> the last kernel booted and making that the default? If you don't want to
>> remove/purge the old kernel, it seems to me that that would be the way to go.
>
> Exactly. The relevant code is:
>
> --- /etc/grub.d/10_linux -----------------------------------------------
> ...
> list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
> if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
> done`
> prepare_boot_cache=
> ...
> ------------------------------------------------------------------------
>
> Which obviously does not special-case -trunk-, so it sorts based on
> LC_COLLATE. Looks as if the -trunk- name was a particularly bad choice
> and I'm not sure what is the best way to solve this problem.
>
> The easiest way would be to enforce a strict naming scheme (maybe with
> lintian) so the aforementioned code can stay as simple as it is today.

Oops! I meant to say "starts with vmlinuz", not "starts with linux-image".
The package names start with linux-image. The kernel image file names
start with vmlinuz.

On a related note, when I build custom kernels with kernel-package, it
has been my practice to put "custom" in the kernel image name.
For example, a stock kernel might be "vmlinuz-2.6.32-3-686" and my
custom version might be "vmlinuz-2.6.32-custom3-686". With this naming
convention, anything starting with "custom" sorts higher than any
stock kernel, providing that the stock kernel uses a numeric value
for the upstream revision number. But "trunk" sorts higher than "custom"!

Again, is there no way to set a default in grub2? Is there no
way, for example, to make the last-booted kernel the default kernel?
It doesn't affect me, since I use lilo. Therefore, I won't bother
to research this myself. But surely there must be a way to set a default
kernel in grub2 other than the one which sorts highest in the collating
sequence. If not, then I have yet another reason to be glad that I
use lilo!

--
.''`. Stephen Powell <zlinuxman(a)wowway.com>
: :' :
`. `'`
`-


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/512649073.19501971268749756766.JavaMail.root(a)md01.wow.synacor.com
From: Wolodja Wentland on
On Tue, Mar 16, 2010 at 10:17 -0500, Mark Allums wrote:
> On 3/16/2010 8:28 AM, Wolodja Wentland wrote:
>
> >The easiest way would be to enforce a strict naming scheme (maybe with
> >lintian) so the aforementioned code can stay as simple as it is today.

> In the short run, an easy thing to do is remove -trunk- image and
> all corresponding packages, as it is an experimental-grade kernel
> that got promoted to Sid by mistake. If .32-3 is working, then
> -trunk- is not needed at all.

That surely is the easiest (and best IMHO) solution for users that run
into this problem, but I rather meant "What is the easiest and best way
to prevent things like this in the future".

I've just found #568160, which proposes the inclusion of -trunk into the
list of already special cased package name substrings in
debian/update_grub. I still don't get why the "trunk" part in the
package name was not ~trunk or -0, which would convey the meaning of
"Has not reached final -1 ABI".
--
.''`. Wolodja Wentland <wentland(a)cl.uni-heidelberg.de>
: :' :
`. `'` 4096R/CAF14EFC
`- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC