[Novalug] I NOW HAVE A WORKING INITRD IMAGE FILE

DonJr djr1952@hotpop.com
Tue Jan 15 03:03:15 EST 2008


On Mon, 2008-01-14 at 22:52 -0500, Jay Hart wrote:
> > The one place that mkinitrd uses 'mktemp' is:
> >
> >  work_dir=$(mktemp -qd $tmp_dir/${mkinit_name}.XXXXXX)
> >  if [ $? -ne 0 ]; then
> >         echo "$0: Can't create temp dir, exiting." >&2
> >         exit 1
> >   fi
> >
> 
> What the problem seemed to be was I would get something like
> 
> ${mkinit_name}.XXXXXX/mnt
> 
> which doesn't make sense, since this is not a valid defined variable or string
> within the mkinitrd script.  I looked it over to see if other calls were being
> made, but I'm no scripting expert.  Just ask Ken, if you don't believe me...
> 
> Jay

If your saying that "${mkinit_name}.XXXXXX" was that content of
"work_dir" and in the script someplace it is using it as
"${work_dir}/mnt", then yes that make perfectly good sense.

Why you ask is because the command:
   mktemp -qd $tmp_dir/${mkinit_name}.XXXXXX

Says to do the following:
  call "mktemp"

    -q  -  Fail silently if an error occurs. This is useful in script's
           that check the exit code.

     -d -  Make a directory instead of a file.

  The rest  "$tmp_dir/${mkinit_name}.XXXXXX" equates to a mask to use in
generating the temp name.
  In this case the MASK defaults to: /var/tmp/mkinitramfs.XXXXXX
  Where the 'X's will be replaced by random numbers or letters.
The resulting name would be something like the
following:  /var/tmp/mkinitramfs.Hl2rGp
    And a Directory by that NAME would be created with the above string
returned.

  And later in the script "work_dir" might be used like this:
       mkdir ${work_dir}/mnt
    # to create a directory in the above directory
  or
       cd $work_dir
    # to change the default directory to that directory.


All generally correct usage as far as it goes.

Funny thing I then happen to search for "tmp_mnt" in the script.
I found the following lines that referenced it:
  In the function cleanup()
    [ -d "$tmp_mnt" ] && rm -rf "$tmp_mnt"

AND
  In the function  mkinitrd_kernel()
   [ -d "$tmp_mnt" ] && cd "$tmp_mnt" # process setup files in the

No other place is the variable ever used or assigned a value.

Therefor the second line equates to:
   [ -d "" ] && cd ""

 Since "" isn't a valid directory name the next part is never ran.

Even more interesting is in some of the /lib/mkinitrd/scripts the
variable "tmp_mnt" is treated like it contains the valid name of a
directory, with no further testing.

So my first guess would be that the ERROR is in the failure to ever
assign "tmp_mnt" a value.

--  
 DonJr.


> >
> > And 'tmp_dir' where it creating the temporary directory defaults to:
> >    /var/tmp
> >
> > The syntax is correct,
> >
> > Are/Where you out of FREE SPACE where /var/tmp exists.
> >
> 
> /var/tmp is on the / partition, and I have 7.9G of free space.  Since mkinitrd
> worked using the older version, I'm going to guess that I had over the minimum
> amount of free space.
> 
> > I had a similar problem on one of my machines where:
> >   update-manager
> > would fail and abort, until I spotted my own configuration error that
> > was leaving a large block of disk space un-accessable.
> >
> > -- DonJr
> >
> > On Mon, 2008-01-14 at 21:18 -0500, Jay Hart wrote:
> >> Yes, if you were looking at the second link, it does mention a bug in the
> >> setup-luks.sh script.
> >>
> >> I saw this too, and I fixed that in my version, but it was not the cause of
> >> my
> >> problem.
> >>
> >> Did you see anything else?  I hit about 10 links on the first 3 pages
> >> returned, but couldn't find anything else.
> >>
> >> Not sure what the bug is, but it seems to have something to do with the
> >> mktemp
> >> command.
> >>
> >> Jay
> >>
> >> > On Mon, 2008-01-14 at 20:44 -0500, Jay Hart wrote:
> >> >> The moral of Ken's story:  When Jay tells Ken he thinks the script has a
> >> >> bug,
> >> >> Ken should listen to Jay.
> >> >>
> >> >> Wow, what a couple of days.
> >> >>
> >> >> Jay
> >> >>
> >> >> > The moral of the story: Jay breaks machines - don't let him touch your
> >> >> box.
> >> >> >
> >> >> > :)
> >> >> >
> >> >> > K
> >> >> >
> >> >
> >> > In my Googling to find a "browsable" copy of mkinitrd-2.1-36.i586.rpm ,
> >> > I saw a hint of a possible later version mentioned
> >> >  on <http://bugs.opensuse.org ... suse/updates/...>
> >> >
> >> >    Google for: OpenSuse mkinitrd 10.3
> >> >
> >> > --
> >> >  DonJr
> >> >
> >> >
> >>
> >>
> >> _______________________________________________
> >> Novalug mailing list
> >> Novalug@calypso.tux.org
> >> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug
> >>
> >
> >
> 
> 
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug
> 




More information about the Novalug mailing list