Bug 709731 - dracut fails if /usr/bin/eject is symlink
Summary: dracut fails if /usr/bin/eject is symlink
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dracut
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-01 14:16 UTC by Dan Streetman
Modified: 2011-09-01 09:37 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-01 09:37:41 UTC
Type: ---


Attachments (Terms of Use)
patch to change /usr/sbin/eject reference to /usr/bin/eject (459 bytes, patch)
2011-06-01 14:29 UTC, Dan Streetman
no flags Details | Diff
proposed patch (557 bytes, patch)
2011-06-22 11:46 UTC, Harald Hoyer
no flags Details | Diff

Description Dan Streetman 2011-06-01 14:16:14 UTC
Description of problem:
If there is a symlink /usr/bin/eject, but not a /usr/sbin/eject, dracut fails.

Version-Release number of selected component (if applicable):
latest git.

How reproducible:
100%

Steps to Reproduce:
1. create a symlink /usr/bin/eject
2. make sure there is no /usr/sbin/eject
3. run dracut
  
Actual results:
Failure, e.g.:
...
I: Installing /bin/dd
I: Installing /sbin/losetup
I: Installing /lib64/libpcre.so.0.0.1
I: Installing /bin/grep
E: Failed to install /usr/sbin/eject

Expected results:
No failure

Additional info
This is due to what appears to be a typo in the modules.d/90dmsquash-live/module-setup.sh file.  It has the following code, which checks for /usr/bin/eject but then operates on /usr/sbin/eject; I assume that dracut_install should use /usr/bin/eject instead.

# eject might be a symlink to consolehelper
if [ -L /usr/bin/eject ]; then
    dracut_install /usr/sbin/eject
else
    inst eject
fi

Comment 1 Dan Streetman 2011-06-01 14:29:03 UTC
Created attachment 502285 [details]
patch to change /usr/sbin/eject reference to /usr/bin/eject

This patch changes dracut_install /usr/sbin/eject to dracut_install /usr/bin/eject.

Comment 2 Dan Streetman 2011-06-20 15:06:06 UTC
Harald, can you provide your thoughts on this bug?

Comment 3 bodhi.zazen 2011-06-20 21:05:32 UTC

-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 4 Harald Hoyer 2011-06-22 11:46:05 UTC
Created attachment 505979 [details]
proposed patch

can you test, if this works?

Comment 5 Dan Streetman 2011-06-22 17:24:22 UTC
(In reply to comment #4)
> Created attachment 505979 [details]
> proposed patch
> 
> can you test, if this works?

Yes, thanks, with the latest git code, that does work.  Note that I tested using the latest git using the local "-l" parameter.

With eject as a busybox symlink in /usr/bin:
lrwxrwxrwx 1 root root 18 Jun 22 09:09 /usr/bin/eject -> ../../sbin/busybox
the resulting initramfs contains that symlink under /usr/bin, and (for testing purposes only) if I move the symlink to /usr/sbin:
lrwxrwxrwx 1 root root 18 Jun 22 09:09 /usr/sbin/eject -> ../../sbin/busybox
the resulting initramfs contains the symlink under /usr/sbin.


With the eject rpm installed, which creates both a link in /usr/bin and installs the actual eject in /usr/sbin:
lrwxrwxrwx. 1 root root    13 Jun 22 09:14 /usr/bin/eject -> consolehelper
-rwxr-xr-x. 1 root root 32064 Jan 18 18:43 /usr/sbin/eject
the resulting initramfs contains only the real binary, /usr/sbin/eject.



Also, I'm using an older version of dracut, 004, and in that code version, while the patch does work with the busybox symlink, it does not work when the eject rpm is installed, in that case it installs the /usr/bin/eject symlink to the consolehelper binary, instead of the /usr/sbin/eject binary itself.  I think just for the 004 code version I will use the following patch; please let me know if you think I should adjust it.  Thanks.
--- dracut-004/modules.d/90dmsquash-live/install        2011-06-22 12:15:42.330318683 -0500
+++ b/modules.d/90dmsquash-live/install 2011-06-22 12:17:02.805016390 -0500
@@ -7,7 +7,7 @@ inst losetup
 inst grep
 
 # eject might be a symlink to consolehelper
-if [ -L /usr/bin/eject ]; then
+if [ -L /usr/bin/eject -a -e /usr/sbin/eject ]; then
     dracut_install /usr/sbin/eject
 else
     inst eject


Again, the above patch is only for my use with the 004 dracut code, your attached patch does work with the latest git code according to my tests.

Thanks!

Comment 6 Harald Hoyer 2011-06-23 07:15:13 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Created attachment 505979 [details]
> > proposed patch
> > 
> > can you test, if this works?
> 
> Yes, thanks, with the latest git code, that does work.  Note that I tested
> using the latest git using the local "-l" parameter.
> 
> With eject as a busybox symlink in /usr/bin:
> lrwxrwxrwx 1 root root 18 Jun 22 09:09 /usr/bin/eject -> ../../sbin/busybox
> the resulting initramfs contains that symlink under /usr/bin, and (for testing
> purposes only) if I move the symlink to /usr/sbin:
> lrwxrwxrwx 1 root root 18 Jun 22 09:09 /usr/sbin/eject -> ../../sbin/busybox
> the resulting initramfs contains the symlink under /usr/sbin.
> 
> 
> With the eject rpm installed, which creates both a link in /usr/bin and
> installs the actual eject in /usr/sbin:
> lrwxrwxrwx. 1 root root    13 Jun 22 09:14 /usr/bin/eject -> consolehelper
> -rwxr-xr-x. 1 root root 32064 Jan 18 18:43 /usr/sbin/eject
> the resulting initramfs contains only the real binary, /usr/sbin/eject.
> 
> 
> 
> Also, I'm using an older version of dracut, 004, and in that code version,
> while the patch does work with the busybox symlink, it does not work when the
> eject rpm is installed, in that case it installs the /usr/bin/eject symlink to
> the consolehelper binary, instead of the /usr/sbin/eject binary itself.  I
> think just for the 004 code version I will use the following patch; please let
> me know if you think I should adjust it.  Thanks.
> --- dracut-004/modules.d/90dmsquash-live/install        2011-06-22
> 12:15:42.330318683 -0500
> +++ b/modules.d/90dmsquash-live/install 2011-06-22 12:17:02.805016390 -0500
> @@ -7,7 +7,7 @@ inst losetup
>  inst grep
> 
>  # eject might be a symlink to consolehelper
> -if [ -L /usr/bin/eject ]; then
> +if [ -L /usr/bin/eject -a -e /usr/sbin/eject ]; then
>      dracut_install /usr/sbin/eject
>  else
>      inst eject
> 
> 
> Again, the above patch is only for my use with the 004 dracut code, your
> attached patch does work with the latest git code according to my tests.
> 
> Thanks!

Ok, will use your patch in 004 (RHEL-6) and my patch in upstream. Thank you!


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