File: note-missing-module-pkg-name.diff

package info (click to toggle)
qemu 1%3A10.2.0~rc1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 394,528 kB
  • sloc: ansic: 4,571,775; pascal: 114,931; python: 110,734; sh: 53,524; asm: 50,205; makefile: 26,349; perl: 17,092; cpp: 11,455; xml: 3,635; objc: 2,877; yacc: 2,505; php: 1,299; tcl: 1,296; lex: 1,110; sql: 71; sed: 35; awk: 8; javascript: 7
file content (98 lines) | stat: -rw-r--r-- 4,110 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Date: Sun, 22 Aug 2021 15:16:25 +0300
Updated: Wed, 03 Jan 2024 14:12:39 +0300
From: Michael Tokarev <mjt@tls.msk.ru>
Subject: Note missing module package name
Debian-Specific: yes
Forwarded: not-needed

Debian ships different modules in different packages.
By default qemu ignores the fact that it can not load
a module, pretending this module never existed.
Give a useful hint about the package where the module
in question resides.

This is a hack, but it makes qemu packaged in debian
more user-friendly.

diff --git a/audio/audio.c b/audio/audio.c
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1760,5 +1760,9 @@ static AudioBackend *audio_init(Audiodev *dev, Error **errp)
             done = audio_driver_init(s, driver, dev, errp);
         } else {
-            error_setg(errp, "Unknown audio driver `%s'", drvname);
+            error_setg(errp, "Unknown audio driver `%s'. Perhaps you want to install %s package?",
+                       drvname,
+                       !strcmp(drvname, "spice") ? "qemu-system-modules-spice" :
+                       !strcmp(drvname, "dbus") ? "qemu-system-modules-opengl" :
+                       "qemu-system-gui");
         }
         if (!done) {
diff --git a/block.c b/block.c
--- a/block.c
+++ b/block.c
@@ -454,4 +454,10 @@ static BlockDriver *bdrv_do_find_format(const char *format_name)
 }
 
+static void note_block_package_name(const char *b)
+{
+    error_report("Unable to load module %s. Perhaps you want to install qemu-block-extra or qemu-block-supplemental package?",
+                 b);
+}
+
 BlockDriver *bdrv_find_format(const char *format_name)
 {
@@ -477,4 +483,5 @@ BlockDriver *bdrv_find_format(const char *format_name)
                 error_report_err(local_err);
             }
+            else note_block_package_name(block_driver_modules[i].library_name);
             break;
         }
@@ -967,5 +974,8 @@ BlockDriver *bdrv_find_protocol(const char *filename,
                 return NULL;
             }
-            break;
+            else {
+                note_block_package_name(block_driver_modules[i].library_name);
+                return NULL;
+            }
         }
     }
diff --git a/system/vl.c b/system/vl.c
--- a/system/vl.c
+++ b/system/vl.c
@@ -1063,5 +1063,7 @@ static void select_vgahw(const MachineClass *machine_class, const char *p)
         if (ti->opt_name && strstart(p, ti->opt_name, &opts)) {
             if (!vga_interface_available(t)) {
-                error_report("%s not available", ti->name);
+                error_report("%s not available. Perhaps you want to install %s package?", ti->name,
+                        /* qxl is in spice, some are in opengl, the some are in common */
+                        !strcmp(ti->opt_name, "qxl") ? "qemu-system-modules-spice" : "qemu-system-modules-opengl");
                 exit(1);
             }
@@ -3589,5 +3591,10 @@ void qemu_init(int argc, char **argv)
 #ifdef CONFIG_SPICE
             case QEMU_OPTION_spice:
-                opts = qemu_opts_parse_noisily(qemu_find_opts("spice"), optarg, false);
+                olist = qemu_find_opts("spice");
+                if (!olist) {
+                    error_report("Perhaps you want to install qemu-system-modules-spice package?");
+                    exit(1);
+                }
+                opts = qemu_opts_parse_noisily(olist, optarg, false);
                 if (!opts) {
                     exit(1);
diff --git a/ui/console.c b/ui/console.c
--- a/ui/console.c
+++ b/ui/console.c
@@ -1557,6 +1557,8 @@ void qemu_display_early_init(DisplayOptions *opts)
     }
     if (dpys[opts->type] == NULL) {
-        error_report("Display '%s' is not available.",
-                     DisplayType_str(opts->type));
+        error_report("Display '%s' is not available. Perhaps you want to install %s package?",
+                     DisplayType_str(opts->type),
+                     (!strcmp(DisplayType_str(opts->type), "dbus") || !strcmp(DisplayType_str(opts->type), "egl-headless"))
+                      ? "qemu-system-modules-opengl" : "qemu-system-gui");
         exit(1);
     }