Bug 124442 - Errormessage during startup of devlabel
Errormessage during startup of devlabel
Product: Fedora
Classification: Fedora
Component: devlabel (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Bill Nottingham
: 124696 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2004-05-26 12:39 EDT by Jochen Schmitt
Modified: 2014-03-16 22:45 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-09-08 15:47:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
typo corrected and path (713 bytes, patch)
2004-05-28 08:52 EDT, Harald Hoyer
no flags Details | Diff
A patch to clean 'tr' out of 'devlabel' (4.96 KB, patch)
2004-06-01 02:18 EDT, Michal Jaegermann
no flags Details | Diff
Devlabel 0.48.02 (40.00 KB, application/octet-stream)
2004-06-01 14:53 EDT, Gary Lerhaupt
no flags Details
Devlabel 0.48.03 (40.00 KB, application/octet-stream)
2004-06-01 16:27 EDT, Gary Lerhaupt
no flags Details
simplify devlabel a bit (12.91 KB, patch)
2004-06-08 04:26 EDT, Michal Jaegermann
no flags Details | Diff

  None (edit)
Description Jochen Schmitt 2004-05-26 12:39:23 EDT
After I have installed devlabel-0.48.01-2 I got the following error
meessages during the boot phase of my linux system:

/sbin/devlabel: line 880: /etc/sysconfig/devlabel.d/ignore_list: No
such file or directory
/sbin/devlabel: line 881: /etc/sysconfig/devlabel.d/proc_partitions:
No such file or directory

Best Regards:

Jochen Schmitt
Comment 1 Jochen Schmitt 2004-05-26 12:45:29 EDT
Additional Info:

After I have created the missed files with no content, no error
messages was displayed.

Best Regards:

Jochen Schmitt
Comment 2 Harald Hoyer 2004-05-28 08:52:12 EDT
these files should not be in /etc
use the attached patch (which also corrects a type) and add to the
touch $RPM_BUILD_ROOT/var/lib/devlabel/ignore_list
touch $RPM_BUILD_ROOT/var/lib/devlabel/proc_partitions

%dir /var/lib/devlabel
%verify(not md5 size mtime) %config(noreplace)
%verify(not md5 size mtime) %config(noreplace)
Comment 3 Harald Hoyer 2004-05-28 08:52:50 EDT
Created attachment 100657 [details]
typo corrected and path
Comment 4 Bill Nottingham 2004-05-28 12:15:23 EDT
*** Bug 124696 has been marked as a duplicate of this bug. ***
Comment 5 Bill Nottingham 2004-05-28 12:30:42 EDT
Added in -3, thanks!
Comment 6 Gary Lerhaupt 2004-05-28 12:49:39 EDT
Hmm, I had originally myself put ignore_list and proc_partition 
in /var/lib/devlabel.  Then we ran into problems in the Dell factory 
with this because in some scenarios /var wasn't on the / partition 
and there were many error messages as a result.  Have you considered 
this scenario?
Comment 7 Gary Lerhaupt 2004-05-28 12:51:10 EDT

The error messages were a result of devlabel getting started 
before /var was mounted.
Comment 8 Gary Lerhaupt 2004-05-28 14:35:36 EDT
I took a look at the "typo" patch:

-    if [ `grep -c "$1$" $IGNORE_LIST` -gt 0 ]; then
+    if [ `grep -c "$1" $IGNORE_LIST` -gt 0 ]; then

Was the extra '$' causing some sort of problem on your box that 
prompted you to make this change?  The reason I put it in there is in 
the event that /dev/sda has been added to your ignore_list, this 
keeps /dev/sdaa or /dev/sdab from also being ignored.  As you may 
know, the '$' tells it to match at the end of the string.

Also, I'd like clarification on the implications of going back and 
using /var/lib.

Reopening this bugzilla.  
Comment 9 Jon Lech Johansen 2004-05-29 16:49:37 EDT
devlabel uses tr, which is installed in /usr/bin. If /usr is on a
seperate partition this will result in errors since devlabel is
executed before /usr is mounted.
Comment 10 Michal Jaegermann 2004-06-01 02:18:54 EDT
Created attachment 100731 [details]
A patch to clean  'tr' out of  'devlabel'

Attached patch removes all instances of /usr/bin/tr from devlabel script
by replacing them with equivalent constructs which do not bother /usr/bin.
This patch also makes checks for root to run only if 'id' is available.
It is for devlabel-0.48.01-3.

Still devlabel has multiple calls to /usr/bin/logger and I do not know
now how to kill that.  The same problem - /usr/bin may be not mounted
yet when devlabel is invoked in a startup sequence.  Would replacing
'logger' with a function which just eats arguments if logger is not
available, and runs the later otherwise, be acceptable?

BTW, the whole script starts with '#!/bin/bash' so there is really no good
reason in using `...` constructs instead of much more readable, and nestable,
$(...); but I left things in the same style all over.
Comment 11 Harald Hoyer 2004-06-01 03:35:48 EDT
if you want 'grep -c "$1$" '  then you better quote the second '$'
Comment 12 Michal Jaegermann 2004-06-01 11:03:29 EDT
I missed the one from comment #11 although I do not see right
away a context where this would be harmful.  Seems to be safe
enough as a trailing "$" will be not expanded.  There could be
some other dragons be hidden in the script.  The main purpose
of a patch from comment #10 was to prevent flooding of my startup
sequence with a zillion of error messages. :-)  Obviously I still
see some leftover whining about 'logger'.

If I would be writing something like that from scratch a quick glance
seem to suggest that I would likely do that in a single, per case,
invocation of awk with some rather thin shell "wrapper".  Most likely
would end up easier on eyes then the current variant.
Comment 13 Harald Hoyer 2004-06-01 11:26:29 EDT
/sbin/devlabel: line 167: [: /dev/loop0: integer expression expected
/sbin/devlabel: line 167: [: /dev/md0: integer expression expected
Comment 14 Gary Lerhaupt 2004-06-01 11:38:03 EDT
Are the linx 167 errors occuring with the tr patch or from the 
original devlabel?
Comment 15 Gary Lerhaupt 2004-06-01 14:53:17 EDT
Created attachment 100757 [details]
Devlabel 0.48.02
Comment 16 Gary Lerhaupt 2004-06-01 15:02:20 EDT
48.02 includes:

* removal of usage of tr from patch (note that one part of the patch 
just seemed to change my usage of grep and sed to fancy awk, but 
since seeing comment #13, i did not apply this as it did not have to 
do with tr removal)

* [ -n "`type -p logger`" ] before any calls to logger so that it 
shouldn't complain if /usr isn't mounted

* log dir is still /etc/sysconfig/devlabel.d/ and 
not /var/lib/devlabel since /var may not be mounted

* grep -c "$1" references left unchanged from my previous release 
(does this need to be changed?)

* Though I did include that part of tr removal patch, will someone 
please confirm that

line_arg=`echo "$1" | tr -d '\r'`



are equivalent?
Comment 17 Michal Jaegermann 2004-06-01 16:08:08 EDT
Comments to #16
> ... change my usage of grep and sed to fancy awk

"Fancy awk"??? This is as nearly elementary awk as it can be.
Indeed that part was not 'tr' removal but if you are using
grep to pipe something into awk then this is nearly as good
as "dead cat".  I could not restrain myself. :-)

A replacement of this construct:

line_arg=`echo "$1" | tr -d '\r'`

in my patch had a literal character '^M'.  That means that
it looked


where instead of ^M was a literal '\012'. If this got changed
in two lines then this is likely a bugzilla web interface doing.
I do not see anything else which would work here.  You can do  

    echo "$1" | sed 's/^M//'

but you need a literal character too.  Unfortunately sed does
not have an escape sequence for it so we may simply ask bash
to do the work.

Well, no.  I am lying.  You can do "fancy awk" here:

   line_arg=`echo "$1" | awk '{gsub(/\r/, ""); print}'`

If something mangled the substitution you qoute into two lines then
results are _not_ equivalent.  You have '\015' there instead
of intended '\012'.  So that awk may be more robust in face of
possible mangling by programs which "know better".
Comment 18 Michal Jaegermann 2004-06-01 16:20:51 EDT
BTW - if you are using awk only to pick up the third field then
something like that instead will do:

   grep ... | ( read a b c d ; echo $c ) | sed ....

Look, Ma!  No awk.
Comment 19 Gary Lerhaupt 2004-06-01 16:26:22 EDT
lol, I only call it fancy awk because `awk '{print $#}'` is the only 
thing I know how to do with it. I'm not opposed to awk in any 
respect, just ignorance combined with Comment #13 temper my 
acceptance of that code.

I'll be serving up 48.03 with the line_arg=`echo "$1" | awk '{gsub(/
\r/, ""); print}'` shortly.
Comment 20 Gary Lerhaupt 2004-06-01 16:27:50 EDT
Created attachment 100763 [details]
Devlabel 0.48.03

line_arg fixed
Comment 21 Harald Hoyer 2004-06-02 04:31:55 EDT
err, please correct the mime types of your attachements
Comment 22 Michal Jaegermann 2004-06-05 14:12:18 EDT
Referring to comment #17 I realized that there is a way to remove
all carriage returns using only bash and without putting in a literal
'\015'.  Like that:

    eval "$(echo -ne 'line_arg=${line_arg//'\\r'/}')"

This will not mess up other white-space in $line_arg.

If you want to have that instead of a call to awk that is a different
Comment 23 Gary Lerhaupt 2004-06-07 10:19:07 EDT
Like I said, I don't mind awk, I'm just not so fluent with it.  I'll 
keep what I have in 48.03.  

Bill, do you plan to move to this?  I don't think we ever settled the 
debate over /var/lib/devlabel vs. /etc/sysconfig/devlabel.d as per 
what is available during boot.  48.03 uses /etc.
Comment 24 Michal Jaegermann 2004-06-07 12:32:24 EDT
It is not a question of minding or not minding.  Simply it is a good
idea for programs used in a startup sequence to keep a number of
outside tools to a reasonable minimum and then, with a right set,
we would not have this bug listing.

It seems that all occurences of awk in devlabel, as it is used right
now, can be replaced by other simple means; so this looks like
a good opportunity.  This makes sense only if you will not leave
_any_ awk invocations. If you want to do that is another story
(if you prefer I can patch that easily enough if you plan to
apply results).

Another option would be to use consistently awk as it is supposed
to be used and dump other things instead.  For example, currently
any invocation of 'head' is really superfluous.
Comment 25 Gary Lerhaupt 2004-06-07 13:56:49 EDT
Agreed.  If you send me an anti-awk patch, I'll apply it.
Comment 26 Bill Nottingham 2004-06-07 13:59:45 EDT

In the grand scheme of things, devlabel configs really should be
migrated to be using udev. So, long term, /etc vs /var doesn't matter.

Short term, I think we can probably go with /etc.
Comment 27 Bill Nottingham 2004-06-07 14:01:25 EDT

In what cases would devlabel be called before /var is mounted?
Comment 28 Bill Nottingham 2004-06-07 14:03:01 EDT
0.48.03-1 built (using /var) in the meantime.
Comment 29 Gary Lerhaupt 2004-06-07 14:17:31 EDT
It was seen in our factory.  Generally, this is possible for any 
partition that isn't root, as devlabel should get called in 
rc.sysinit before others are mounted such that it is possible to 
mount them by devlabel symlink.

Agreed on the udev future statement.  At first it was nice to have 
your name attached to a piece of software.  Later on, it becomes a 
bit of a headache.  :) ... more time to spend on DKMS headaches 
Comment 30 Michal Jaegermann 2004-06-08 04:26:54 EDT
Created attachment 100957 [details]
simplify devlabel a bit

This patch to devlabel
 - replaces all invocations of awk and head with various other constructs
 - leaves /usr/bin/diff only in remove_entry() which checks that
   diff is already available before trying to execute
 - it fixes asignment to start_sector (there are no guarantees
   that in a partx output there will be a blank after '-') and
   considerably simplifies the whole thing in the process
 - removes instances of "dead cat"
 - does some other cleanups and checks

It applies to the script from devlabel-0.48.03

There are still problems.  After 'devlabel status' it prints for me:
Cannot open master raw device '/dev/rawctl' (No such device or address)
Comment 31 Stephen Tweedie 2004-09-07 06:05:43 EDT
Current rawhide still has this problem with /var on a separate
partition: loads of

grep: /var/lib/devlabel/ignore_list: No such file or directory
/sbin/devlabel: line 144: [: -gt: unary operator expected
/sbin/devlabel: line 192: /var/lib/devlabel/ignore_list: No such file
or directory

spouted during boot.  In response to

"In what cases would devlabel be called before /var is mounted?"

rc.sysinit does a

if [ -x /sbin/devlabel ]; then
        /sbin/devlabel restart
before even fscking, never mind mounting, local filesystems.
Comment 32 Gary Lerhaupt 2004-09-07 10:16:53 EDT
I realize /etc/sysconfig/devlabel.d might not be the most elegant 
place to put devlabel scripts, but it takes them out of /var and this 
is how it is currently handled in latest at linux.dell.com/devlabel.  
RH just needs to make the switch.
Comment 33 Bill Nottingham 2004-09-07 11:46:20 EDT
I'm still wondering whether, with udev, devlabel still needs to be
included in later releases.
Comment 34 Bill Nottingham 2004-09-07 11:47:06 EDT
Also, the latest at linux.dell.com/devlabel is 0.48.01, which is two
revs lower than things posted in this bug. :)
Comment 35 Gary Lerhaupt 2004-09-07 11:57:51 EDT
Per #33, Doesn't udev rely on outside applications to determine 
identifiers that it uses?  I'm no udev expert, but the partition_uuid 
program within devlabel has got to be useful for udev given that 
mount still does not make these externally available and has some 
uuid issues with JFS filesystems and does not read reiser uuids.  

Per #34, yes, I forgot.  I made a couple spins for this bugzilla to 
create 48.03 and haven't externally posted them yet.  Still, the 
48.03 I sent you uses /etc and not /var.  You must be patching it.  
Just yank those patches.
Comment 36 Bill Nottingham 2004-09-07 12:08:58 EDT
udev does support naming of partitions via UUID, although I have not
specifically looked as to the implementation thereof.
Comment 37 Gary Lerhaupt 2004-09-08 12:16:11 EDT
Bill, please just remove the devlabel-0.48.01-typo.patch which is 
being applied in Red Hat's RPM.  The patch has two parts.  The bottom 
part is what is changing the /etc to /var (coincidentally, I just was 
assigned an internal bug regarding this yesterday).  If you remove 
this patch, you can fix Stephen's issue.

The top part of the patch fixes a "typo" which isn't exactly right.  
See comment #8 and comment #11 above.  The second $ should be there.  
I'm not sure what Harold means by being sure quote the second $ since 
its surrounded by quotes.

Comment 38 Bill Nottingham 2004-09-08 15:47:12 EDT
Fixed in -4.

Note You need to log in before you can comment on or make changes to this bug.