Setting up hdparm (DMA, UDMA mode, multicount etc) modes with the initscript fails if configuring an empty CD/DVD drive. The problem stems from this check at the end of the /etc/init.d/hdparm: (Using the non-devfs since udev068 has gotten rid of devfs compatibility) # non-devfs compatible system for device in /dev/hd? do # check that the block device really exists # by opening it for reading if [ -b $device ] && ( : <$device ) 2>/dev/null then eval args=\${`basename $device`_args} do_hdparm fi done When addressing a DVD drive the test fails, and the do_hdparm is never executed. I can set the hdparm parameters manually just fine, but due to this test the setting up does not work during bootup. When accessing a CD/DVD drive without media in, "cat" produces this error # cat /dev/hdc cat: /dev/hdc: No medium found Suggested fix: Replace the test with something a bit more robust or remove it entirely.
Yes, I experience the same problem. udev-068 and hdparm-5.9
*** Bug 105018 has been marked as a duplicate of this bug. ***
This is still a problem, any fix anytime soon?
heaven forbid you suggest a fix rather than just complain someone else hasnt done it yet how does this work for people: - if [ -b $device ] && ( : <$device ) 2>/dev/null + errmsg=$(head -c 1 $device 2>&1) + if [[ -b $device ]] && [[ $? == 0 || ${errmsg} == *: No medium found ]]
I wasn't complaining, just wondering.. Your insulting reply wasn't very warranted anyways. For a fix, I have just been commenting out the check. If you really need me to generate a patch of commenting out a few lines, sure.. But there is probably a more elegant way to fix this. This bug has been lingering here for a month and nothing has been changed, just giving a "heads up".. Nice to see one of my first posts here was replied to like this...
(In reply to comment #4) > how does this work for people: > - if [ -b $device ] && ( : <$device ) 2>/dev/null > + errmsg=$(head -c 1 $device 2>&1) > + if [[ -b $device ]] && [[ $? == 0 || ${errmsg} == *: No medium found ]] Taking this approach, you should probably unset LANG/LC_* or whatever affects the output language, because otherwise on a german system this will fail because the message is 'Kein Medium gefunden'. (Not sure whether the language settings are active during execution of boot-scripts per default, but someone might have done so individually.)
This version works at least for me: - if [ -b $device ] && ( : <$device ) 2>/dev/null + errmsg=$(: <$device 2>&1) + if [[ -b $device ]] && [[ $? == 0 || $(errmsg) == "*: No medium found" ]] The language should not be a problem, at least for now, because also with LC_MESSAGES=de_DE `: <$device 2` gives the English error message. There's only one defective appearance. If there's no medium in the drive the line "errmsg=$(: <$device 2>&1)" prints the error message "/etc/init.d/hdparm: line 125: /dev/hdc: No medium found" on the screen. The hdparm settings are done for this drive anyhow.
Forgot to say that line 125 in the error message could also be 124 because I didn't delete the original line in my script but just commented it out. ;-)
Now I found the solution without having the error message printed on the screen: - if [ -b $device ] && ( : <$device ) 2>/dev/null + errmsg=$( : 2>/dev/null <$device ) + if [[ -b $device ]] && [[ $? == 0 || $(errmsg) == "*: No medium found" ]] This works as long as the dummy command : only gives English error messages regardless of the LC_MESSAGES value.
thanks Heiko and Stefan for actual testing / feedback ... should be fixed with hdparm-6.3 now
*** Bug 69284 has been marked as a duplicate of this bug. ***
latest fix causes annoying error messages and red question marks for me when it tries to run hdparm on nonexistant devices (/dev/hdd - /dev/hdh) while booting. this applied to the current init script works for me: - local errmsg=$( : 2>/dev/null <$device ) - if [[ -b $device ]] && [[ $? == 0 || $(errmsg) == "*: No medium found" ]] + local errmsg status + errmsg=$( : 2>&1 <$device ) + status=$? + if [[ -b $device ]] && [[ ${status} == 0 || ${errmsg:$((-25))} == "${device}: No medium found" ]] i noticed because i remerged hdparm (5.9) some days ago. maybe the test should be removed entirely as already suggested here and in another bugreport.
Created attachment 81767 [details, diff] patch linebreak issues in previous comment
> latest fix causes annoying error messages and red question marks for me when it > tries to run hdparm on nonexistant devices (/dev/hdd - /dev/hdh) while booting. file a new bug in the future > maybe the test should be removed entirely as already suggested here and in > another bugreport. no applied your fixes to current init.d script