[LFS Trac] #1720: On 2.6.15.4/UDEV085, swapon sometimes fails

LFS Trac trac at linuxfromscratch.org
Sat Feb 25 04:29:41 PST 2006


#1720: On 2.6.15.4/UDEV085, swapon sometimes fails
-------------------------------------+--------------------------------------
 Reporter:  martyman99999 at yahoo.com  |        Owner:  matthew at linuxfromscratch.org
     Type:  defect                   |       Status:  assigned                    
 Priority:  normal                   |    Milestone:                              
Component:  Book                     |      Version:  SVN                         
 Severity:  normal                   |   Resolution:                              
 Keywords:                           |  
-------------------------------------+--------------------------------------
Comment (by alexander at linuxfromscratch.org):

 Let's make sure that the loop indeed works.

 1) Compile a simple uevent logger:

 {{{
 cat >bug.c <<"EOF"
 /* Simple event recorder */
 #define _GNU_SOURCE
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <argz.h>

 int main(int argc, char * argv[])
 {
         char * envz;
         size_t len;
         int bug;
         bug = open("/dev/bug", O_WRONLY | O_APPEND);
         if (bug == -1)
                 return 0;
         setenv("_SEPARATOR", "--------------------------------------", 1);
         argz_create(environ, &envz, &len);
         argz_stringify(envz, len, '\n');
         envz[len-1]='\n';
         write(bug, envz, len);
         close(bug);
         free(envz);
         return 0;
 }
 EOF
 gcc -o /lib/udev/bug bug.c
 }}}

 2) Add a logging rule to a separate file:

 {{{
 cat >/etc/udev/rules.d/90-bug.rules <<"EOF"
 ACTION=="add", RUN+="bug"
 EOF
 }}}

 3) Modify the udev initscript not as Matthew said in the previous comment,
 but in the following way (that still incorporates his wishes):

 At the end of walk_sysfs(), add:
 {{{
         # until we know how to do better, just wait for _all_ events to
 finish
         loop=300
         while test -d /dev/.udev/queue; do
             sleep 0.1
             test "$loop" -gt 0 || break
             loop=$(($loop - 1))
         done
         >/dev/bug
         test "$loop" -gt 0
         evaluate_retval
         sleep 5
         if test -s /dev/bug; then
             mv /dev/bug /dev/bugreport
             boot_mesg "Please paste the /dev/bugreport file to" ${WARNING}
             boot_mesg "http://wiki.linuxfromscratch.org/lfs/ticket/1720"
             boot_mesg "Otherwise, the next version of LFS may be
 unbootable on your system!"
             echo_failure
             sleep 10
         else
             rm -f /dev/bug
         fi
 }}}

-- 
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/1720>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.



More information about the lfs-book mailing list