113 | | <important> |
114 | | |
115 | | <para>When Udev is started by the LFS-Bootscripts, a replay of all kernel |
116 | | device events happens. These events tell Udev what devices exist. |
117 | | Sometimes the Udev bootscript doesn't wait long enough for |
118 | | <command>udevd</command> to process all of the replayed events and |
119 | | consequently the devices for those missed events are not created before the |
120 | | script exits. Since <command>udevd</command> is still running in the |
121 | | background, the devices will be created a few milliseconds later, but the |
122 | | next bootscript to run may require a device to exist before it has been |
123 | | created. To avoid such missed events, and to avoid hardcoding an overly |
124 | | long wait time, It is recommended that you run the following commands to |
125 | | aid the LFS development team in debugging these missed events and finding |
126 | | an acceptable solution more quickly.</para> |
127 | | |
128 | | <para>First, create a simple C file:</para> |
129 | | |
130 | | <screen><userinput>cat > bug.c << EOF |
131 | | <literal>/* Simple event recorder */ |
132 | | #define _GNU_SOURCE |
133 | | #include <sys/types.h> |
134 | | #include <sys/stat.h> |
135 | | #include <fcntl.h> |
136 | | #include <unistd.h> |
137 | | #include <stdlib.h> |
138 | | #include <argz.h> |
139 | | int main(int argc, char * argv[]) |
140 | | { |
141 | | char * envar; |
142 | | char * envz; |
143 | | size_t len; |
144 | | int bug; |
145 | | bug = open("/dev/bug", O_WRONLY | O_APPEND); |
146 | | if (bug == -1) |
147 | | return 0; |
148 | | |
149 | | /* Ignore everything USB-related to avoid spamming the list */ |
150 | | envar = getenv("PHYSDEVPATH"); |
151 | | if (envar && strstr(envar, "usb")) |
152 | | return 0; |
153 | | envar = getenv("DEVPATH"); |
154 | | if (envar && strstr(envar, "usb")) |
155 | | return 0; |
156 | | |
157 | | setenv("_SEPARATOR", "-------------------------------", 1); |
158 | | argz_create(environ, &envz, &len); |
159 | | argz_stringify(envz, len, '\n'); |
160 | | envz[len-1]='\n'; |
161 | | write(bug, envz, len); |
162 | | close(bug); |
163 | | free(envz); |
164 | | return 0; |
165 | | }</literal> |
166 | | EOF</userinput></screen> |
167 | | |
168 | | <para>Now compile it:</para> |
169 | | |
170 | | <screen><userinput>gcc -o /lib/udev/bug bug.c</userinput></screen> |
171 | | |
172 | | <para>When booting the new LFS system, if any events are missed, a warning |
173 | | message will appear and a <filename>/dev/bugreport</filename> file will be |
174 | | created. The warning message will tell you where to send feedback.</para> |
175 | | |
176 | | </important> |
177 | | |