Re: Skip kbd-chooser when running under Xen
Frans Pop <elendil@planet.nl> writes:
> On Thursday 08 May 2008, Ferenc Wagner wrote:
>
>> vmlinuz-2.6.18-6-xen-686 suite=etch DEBIAN_FRONTEND=text
> [...]
>> kbd-chooser[881]: ERROR **: Couldn't get a file descriptor referring to
>> the console
>> main-menu[670]: WARNING **: Configuring 'kbd-chooser' failed with error
>> code 1
>
> That seems to make fairly clear why kbd-chooser is failing...
Still not fully clear to me, but name it an already fixed Xen bug.
>> vmlinuz-2.6.25-1-xen-686 console=hvc0 suite=etch DEBIAN_FRONTEND=text:
>
> And apparently here kbd-chooser _can_ find a file descriptor for the
> console.
Yes, it looks like hvc0 is a much better console than the earlier
hacks. Which is not particularly surprising.
>>>> * Should we skip running it from a virtualized D-I? (I guess yes,
>>>> especially that it's so simple to achieve.)
>
> If I understand you correctly: no, we do not want to add a question for
> this.
Maybe not. What I'm talking about it the following prompt:
Select a keyboard layout
------------------------
Keymap to use:
1. American English [*] 22. Italian
2. Belarusian 23. Japanese
[...]
which doesn't appear during serial installation.
>> Yes, testing for functionality would be much better. Like skipping
>> kbd-chooser if there's no keyboard attached. Is serial installation
>> handled by checking the kernel command line?
>
> I suggest someone starts looking at the kbd-chooser code...
> For serial console the relevant parts are kbd-chooser.c from line 534 down.
Maybe you want to commit the following fix for a missing hyphen:
Index: packages/kbd-chooser/kbd-chooser.c
===================================================================
--- packages/kbd-chooser/kbd-chooser.c (revision 53339)
+++ packages/kbd-chooser/kbd-chooser.c (working copy)
@@ -552,7 +552,7 @@
}
/**
- * @brief set debian-installer/serial console as to whether we are using a serial console
+ * @brief set debian-installer/serial-console as to whether we are using a serial console
* @return 1 if present, 0 if absent, 2 if unknown.
*/
sercon_state
> Both UML and serial console are already being detected there. Seems to me
> that it should be possible to handle Xen in the same or a similar way.
Yes. Line 669 of kbd-chooser.c forces console-tools/archs to
no-keyboard, just like during UML installation. The latter is
especially similar to the Xen case, and bases the decision on
/proc/cpuinfo. This suggests that introducing an analogous function
which checks for Xen (in the line of [ -d /sys/bus/xen ]) and oring
that to the above condition would be enough.
> When testing based on hvc0 you should be aware that is also used by PowerPC
> systems.
This way we wouldn't test for hvc0 at all. Unfortunately, Xen's hvc
isn't a serial device, so that case can't catch it.
> Bottom line: please implement something that fits _within_ the existing
> structure of kbd-chooser. Don't add hacks.
What about somethink like this? (Apply before the above!) Totally
untested, POC only. :)
Index: packages/kbd-chooser/kbd-chooser.c
===================================================================
--- packages/kbd-chooser/kbd-chooser.c (revision 53339)
+++ packages/kbd-chooser/kbd-chooser.c (working copy)
@@ -552,6 +552,26 @@
}
/**
+ * @brief set debian-installer/xen-console as to whether we are using a Xen console
+ * @return 1 if present, 0 if absent, 2 if unknown.
+ */
+sercon_state
+check_if_xen_console (void)
+{
+ sercon_state present = SERIAL_UNKNOWN;
+ struct debconfclient *client = mydebconf_client ();
+
+ if (!access("/sys/bus/xen", F_OK))
+ present = SERIAL_PRESENT;
+ else
+ present = SERIAL_ABSENT;
+
+ debconf_set (client, "debian-installer/xen-console", present ? "true" : "false");
+ di_info ("Setting debian-installer/xen-console to %s", present ? "true" : "false");
+ return present;
+}
+
+/**
* @brief set debian-installer/serial console as to whether we are using a serial console
* @return 1 if present, 0 if absent, 2 if unknown.
*/
@@ -633,6 +653,7 @@
int choices = 0, first_entry_s = 1, first_entry_t = 1;
sercon_state sercon;
sercon_state umlcon;
+ sercon_state xencon;
struct debconfclient *client = mydebconf_client ();
/* k is returned by a method if it is preferred keyboard.
@@ -666,7 +687,8 @@
}
sercon = check_if_serial_console();
umlcon = check_if_uml_console();
- if (sercon == SERIAL_PRESENT || umlcon == SERIAL_PRESENT) {
+ xencon = check_if_xen_console();
+ if (sercon == SERIAL_PRESENT || umlcon == SERIAL_PRESENT || xencon == SERIAL_PRESENT) {
debconf_metaget(client, "kbd-chooser/no-keyboard", "Description");
arch_descr = strdup(client->value);
choices++;
@@ -687,7 +709,7 @@
debconf_subst (client, "console-tools/archs", "KBD-ARCHS-L10N", buf_t);
free(arch_descr);
// Set medium priority if current selection is no-keyboard or skip-config
- return ((sercon == SERIAL_PRESENT) || (umlcon == SERIAL_PRESENT) ||
+ return ((sercon == SERIAL_PRESENT) || (umlcon == SERIAL_PRESENT) || (xencon == SERIAL_PRESENT) ||
((preferred && preferred->present == TRUE) &&
(strcmp (curr_arch, "skip-config") != 0) &&
(strcmp (curr_arch, "no-keyboard") != 0))) ? "low" : "medium";
--
Cheers,
Feri.
Reply to: