Bug 297209 - Grub2 integration does not work if grub2 uses submenus (as kubuntu does)
Summary: Grub2 integration does not work if grub2 uses submenus (as kubuntu does)
Status: RESOLVED FIXED
Alias: None
Product: kdm
Classification: Miscellaneous
Component: general (show other bugs)
Version: 3.5
Platform: PiSi Linux Linux
: NOR major
Target Milestone: ---
Assignee: Konstantinos Smanis
URL:
Keywords:
: 298541 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-03-31 18:52 UTC by Luiz Angelo De Luca
Modified: 2012-08-07 23:12 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.1


Attachments
GRUB2 menu file (4.27 KB, text/plain)
2012-04-10 15:23 UTC, Konstantinos Smanis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luiz Angelo De Luca 2012-03-31 18:52:07 UTC
Hello,

This problem happens since kubuntu11.10 and it is still present in 12.04beta2.

grub2 integration on reboot button does not consider the possibility of submenus. It just mergers the submenu items into the list. Ex:

In grub, i have:

item1
item2
item3
submenu (that have item4, item5)
item6
item7
item8

And in kdm, I got

item1
item2
item3
item4
item5
item6
item7
item8

If I select item6 in kdm, it will set grub to boot on the 6th position (default=5). However, for grub, the 6th position is item7.

Command line grub-reboot works flawlessly when I select the next boot using the item name.

Steps to reproduce:
1. Create a submenu in grub with 2 items
2. Add 3 items after the submenu
3.In kdm, select the first item after the submenu for reboot

Actual result:
4.the second item after the submenu is selected

Expected result:
4.the first item after the submenu is selected
Comment 1 Konstantinos Smanis 2012-04-10 11:00:06 UTC
I can confirm this bug. Submenus introduce multiple levels (tree structure) while at the moment kdm can only handle flat lists of entries (afaik). A proper fix would introduce a proper data structure to hold all the info. A quick and dirty fix is to use the "Submenu Title or Number>Submenu Menuentry Title or Number" format as explained here: http://ubuntuforums.org/showthread.php?p=10720316
Comment 2 Luiz Angelo De Luca 2012-04-10 14:33:19 UTC
To make it work "dirtly", just use the item name instead of the item number to select the next boot.
Comment 3 Konstantinos Smanis 2012-04-10 15:17:56 UTC
Unfortunately, no, it won't work. The "Submenu Title or Number>Submenu Menuentry Title or Number" format has to be used. grub-set-default and grub-reboot (the latter concerns us) will silently accept an item's name(=title) but it if this menuentry is within a submenu, it won't work. As a matter of fact I just tested it (GRUB2.00 Beta3 in Gentoo) and it didn't work. "Submenu Title or Number>Submenu Menuentry Title or Number" on the other hand worked as a charm.

grub-mkconfig handles it more gracely at least: if you try to set GRUB_DEFAULT to the title of a menuentry within a submenu you get the following warning:
Warning: Please don't use old title `Gentoo GNU/Linux, with Linux 3.3.1-gentoo' for GRUB_DEFAULT, use `Advanced options for Gentoo GNU/Linux>Gentoo GNU/Linux, with Linux 3.3.1-gentoo' (for versions before 2.00) or `gnulinux-advanced-b252c43e-44f6-4314-81aa-78474b513427>gnulinux-3.3.1-gentoo-advanced-b252c43e-44f6-4314-81aa-78474b513427' (for 2.00 or later)
Comment 4 Konstantinos Smanis 2012-04-10 15:23:34 UTC
Created attachment 70288 [details]
GRUB2 menu file

I uploaded my menu file as a reference. The bug can be reproduced if you try to reboot into Windows: instead of selecting Windows, it selects the last (dummy) entry.
Comment 5 Oswald Buddenhagen 2012-04-21 21:23:15 UTC
*** Bug 298541 has been marked as a duplicate of this bug. ***
Comment 6 Ilya Potapov 2012-04-22 11:24:28 UTC
I can confirm this bug on kubuntu-dev with kde 4.8.2
Comment 7 pfoo 2012-07-11 18:14:50 UTC
Still present on kde 4.8.4
Comment 8 Konstantinos Smanis 2012-07-11 20:19:03 UTC
I have a working patch for the 4.8.x branch (which will probably submit for review soon although the 4.8 series is not scheduled to receive another release). For the 4.9 and master branches see http://lists.kde.org/?l=kde-core-devel&m=134160279511422&w=2
Comment 9 Lamarque V. Souza 2012-07-17 17:40:35 UTC
Git commit 0e325a61a57ff85f15bd3f84e57b5800ef32de07 by Lamarque V. Souza.
Committed on 17/07/2012 at 19:35.
Pushed by lvsouza into branch 'KDE/4.9'.

Improve QML shutdown dialog: add submenu support, align reboot menu
entries to the left instead of center, add hover effect.

REVIEW: 105568
FIXED-IN: 4.9.0
(cherry picked from commit 7884098c74837db178a01c042cd187d37fd254b5)

M  +21   -3    ksmserver/themes/default/ContextMenu.qml
M  +44   -11   ksmserver/themes/default/MenuItem.qml
M  +64   -12   ksmserver/themes/default/main.qml

http://commits.kde.org/kde-workspace/0e325a61a57ff85f15bd3f84e57b5800ef32de07
Comment 10 Lamarque V. Souza 2012-07-17 17:40:39 UTC
Git commit 7884098c74837db178a01c042cd187d37fd254b5 by Lamarque V. Souza.
Committed on 17/07/2012 at 19:35.
Pushed by lvsouza into branch 'master'.

Improve QML shutdown dialog: add submenu support, align reboot menu
entries to the left instead of center, add hover effect.

REVIEW: 105568
FIXED-IN: 4.9.0

M  +21   -3    ksmserver/themes/default/ContextMenu.qml
M  +44   -11   ksmserver/themes/default/MenuItem.qml
M  +64   -12   ksmserver/themes/default/main.qml

http://commits.kde.org/kde-workspace/7884098c74837db178a01c042cd187d37fd254b5
Comment 11 Lamarque V. Souza 2012-07-17 20:44:58 UTC
Git commit 8d76169143a5d1e6f30ef069b3d133a05e80fe65 by Lamarque V. Souza.
Committed on 17/07/2012 at 22:43.
Pushed by lvsouza into branch 'KDE/4.9'.

Use submenus only with Grub2 or Burg.
(cherry picked from commit 965e46266ec3571740c6003e7c67f8f9dc21125c)

M  +3    -0    ksmserver/shutdowndlg.cpp
M  +28   -12   ksmserver/themes/default/main.qml

http://commits.kde.org/kde-workspace/8d76169143a5d1e6f30ef069b3d133a05e80fe65
Comment 12 Lamarque V. Souza 2012-07-17 20:44:59 UTC
Git commit 965e46266ec3571740c6003e7c67f8f9dc21125c by Lamarque V. Souza.
Committed on 17/07/2012 at 22:43.
Pushed by lvsouza into branch 'master'.

Use submenus only with Grub2 or Burg.

M  +3    -0    ksmserver/shutdowndlg.cpp
M  +28   -12   ksmserver/themes/default/main.qml

http://commits.kde.org/kde-workspace/965e46266ec3571740c6003e7c67f8f9dc21125c
Comment 13 Konstantinos Smanis 2012-08-07 18:11:49 UTC
Git commit b8e506743429fa28694b3565a231e48e52cfa6ef by Konstantinos Smanis.
Committed on 07/08/2012 at 20:01.
Pushed by ksmanis into branch 'KDE/4.8'.

Add support for GRUB2 submenus.

Properly parse the 'submenu' directive in GRUB's configuration file
and provide the user with an appropriate menu interface when choosing
which entry to reboot into.

Limitations: Internally we make use of the " >> " separator (hardcoded
in both kdm and ksmserver). An occurence of the separator in a menu
title (be it menuentry or submenu) will baffle our parser. Moreover,
we only support multi-line statements: one-liners, although supported
by GRUB, will fail to be parsed. Lastly, only up to 5 nesting levels
are supported. The above limits are more than enough for all but a
handful of cases.
REVIEW: 105563

M  +93   -44   kdm/backend/bootman.c
M  +0    -16   kdm/backend/ctrl.c
M  +4    -0    kdm/backend/dm.h
M  +40   -1    kdm/backend/util.c
M  +22   -12   ksmserver/shutdowndlg.cpp

http://commits.kde.org/kde-workspace/b8e506743429fa28694b3565a231e48e52cfa6ef
Comment 14 Konstantinos Smanis 2012-08-07 18:11:49 UTC
Git commit b8e506743429fa28694b3565a231e48e52cfa6ef by Konstantinos Smanis.
Committed on 07/08/2012 at 20:01.
Pushed by ksmanis into branch 'KDE/4.8'.

Add support for GRUB2 submenus.

Properly parse the 'submenu' directive in GRUB's configuration file
and provide the user with an appropriate menu interface when choosing
which entry to reboot into.

Limitations: Internally we make use of the " >> " separator (hardcoded
in both kdm and ksmserver). An occurence of the separator in a menu
title (be it menuentry or submenu) will baffle our parser. Moreover,
we only support multi-line statements: one-liners, although supported
by GRUB, will fail to be parsed. Lastly, only up to 5 nesting levels
are supported. The above limits are more than enough for all but a
handful of cases.
REVIEW: 105563

M  +93   -44   kdm/backend/bootman.c
M  +0    -16   kdm/backend/ctrl.c
M  +4    -0    kdm/backend/dm.h
M  +40   -1    kdm/backend/util.c
M  +22   -12   ksmserver/shutdowndlg.cpp

http://commits.kde.org/kde-workspace/b8e506743429fa28694b3565a231e48e52cfa6ef
Comment 15 Konstantinos Smanis 2012-08-07 23:05:27 UTC
Git commit 0af24b2dcd32fd74f1a7490088a37b1ef3387f6f by Konstantinos Smanis.
Committed on 08/08/2012 at 00:57.
Pushed by ksmanis into branch 'KDE/4.9'.

Add support for GRUB2 submenus.

Properly parse the 'submenu' directive in GRUB's configuration file
and provide the user with an appropriate menu interface when choosing
which entry to reboot into.

Limitations: Internally we make use of the " >> " separator (hardcoded
in both kdm and ksmserver). An occurence of the separator in a menu
title (be it menuentry or submenu) will baffle our parser. Moreover,
we only support multi-line statements: one-liners, although supported
by GRUB, will fail to be parsed. Lastly, only up to 5 nesting levels
are supported. The above limits are more than enough for all but a
handful of cases.

(forward ported from commit b8e506743429fa28694b3565a231e48e52cfa6ef)
FIXED-IN: 4.9.1
REVIEW: 105563

M  +93   -44   kdm/backend/bootman.c
M  +0    -16   kdm/backend/ctrl.c
M  +4    -0    kdm/backend/dm.h
M  +40   -1    kdm/backend/util.c

http://commits.kde.org/kde-workspace/0af24b2dcd32fd74f1a7490088a37b1ef3387f6f
Comment 16 Konstantinos Smanis 2012-08-07 23:12:16 UTC
Git commit c578e8804ee6505ea282fb046972bf88213157e4 by Konstantinos Smanis.
Committed on 08/08/2012 at 01:06.
Pushed by ksmanis into branch 'master'.

Add support for GRUB2 submenus.

Properly parse the 'submenu' directive in GRUB's configuration file
and provide the user with an appropriate menu interface when choosing
which entry to reboot into.

Limitations: Internally we make use of the " >> " separator (hardcoded
in both kdm and ksmserver). An occurence of the separator in a menu
title (be it menuentry or submenu) will baffle our parser. Moreover,
we only support multi-line statements: one-liners, although supported
by GRUB, will fail to be parsed. Lastly, only up to 5 nesting levels
are supported. The above limits are more than enough for all but a
handful of cases.

(forward ported from commit b8e506743429fa28694b3565a231e48e52cfa6ef)
FIXED-IN: 4.9.1
REVIEW: 105563

M  +93   -44   kdm/backend/bootman.c
M  +0    -16   kdm/backend/ctrl.c
M  +4    -0    kdm/backend/dm.h
M  +40   -1    kdm/backend/util.c

http://commits.kde.org/kde-workspace/c578e8804ee6505ea282fb046972bf88213157e4