[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#826578: hw-detect: check-missing-firmware ignores symlinked firmware packages



Hi Martin,

Thanks for your report.

On Mon, Jun 06, 2016 at 05:16:36PM +0200, Martin von Wittich wrote:
>Package: hw-detect
>Severity: important
>Tags: d-i patch
>
>Dear Maintainer,
>
>we are distributing our system with a custom Debian installer that has
>been created with simple-cdd and contains non-free firmware packages.
>One of our customers has reported back to us that he encountered an
>error message during the installation that the following firmware file
>couldn't be found:
>
>rtl_nic/rtl8168e-3.fw
>
>I checked our installer source and determined that we do supply a
>firmware-realtek package that contains this firmware file:
>
>server /root/install-jessie-new/add/firmware # dpkg-deb -c firmware-realtek_0.43_all.deb | grep rtl8168e-3
>-rw-r--r-- root/root      3872 2014-06-16 01:51 ./lib/firmware/rtl_nic/rtl8168e-3.fw
>
>Then I booted the installer in a VM and looked in /cdrom/firmware. Most of the
>firmware packages there were files, but some were symlinks, including
>the firmware-realtek package:
>
>root@unassigned:/cdrom/firmware# find . -type l -exec ls -l {} \;
>lr-xr-xr-x 1 root root 62 May 19  2016 ./firmware-bnx2_0.43_all.deb -> ../pool/non-free/f/firmware-nonfree/firmware-bnx2_0.43_all.deb
>lr-xr-xr-x 1 root root 60 May 19  2016 ./firmware-linux-free_3.3_all.deb -> ../pool/main/f/firmware-free/firmware-linux-free_3.3_all.deb
>lr-xr-xr-x 1 root root 71 May 19  2016 ./firmware-linux-nonfree_0.43_all.deb -> ../pool/non-free/f/firmware-nonfree/firmware-linux-nonfree_0.43_all.deb
>lr-xr-xr-x 1 root root 65 May 19  2016 ./firmware-realtek_0.43_all.deb -> ../pool/non-free/f/firmware-nonfree/firmware-realtek_0.43_all.deb
>
>I believe that the Debian installer build process automatically replaces
>firmware files with symlinks to the pool if it determines those files to be
>identical. To ensure that this not a problem caused by simple-cdd, I booted the
>current Debian netinst that I downloaded here:
>
>http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-cd/debian-8.5.0-amd64-netinst.iso
>
>There was only a single file located in /cdrom/firmware, but it was also a
>symlink:
>
>/cdrom/firmware/firmware-linux-free-3.3_all.deb -> ../pool/main/f/firmware-free/firmware-linux-free-3.3_all.deb
>
>So apparently it's not caused by simple-cdd.
>
>I then figured out that the installer uses a script called
>check-missing-firmware to load firmware; apparently it determines
>missing firmware files and looks amongst others in /cdrom/firmware for
>firmware packages which might provide these files. Unfortunately, the
>code only accepts packages that are real files, not symlinks; notice the
>[ -f ... ] in line 238 in the function check_for_firmware:
>
>check_for_firmware() {
>  echo "$files" | sed -e 's/ /\n/g' >/tmp/grepfor
>  for filename in $@; do
>    if [ -f "$filename" ]; then
>      if check_deb_arch "$filename" && list_deb_firmware "$filename" | grep -qf /tmp/grepfor; then
>        log "installing firmware package $filename"
>        install_firmware_pkg "$filename" || true
>      fi
>    fi
>  done
>  rm -f /tmp/grepfor
>}

-f *should* work fine for symlinks too in shell:

tack:~$ ln -s foo bar
tack:~$ ls -al foo bar
lrwxrwxrwx 1 steve users  3 Jun  6 16:24 bar -> foo
-rw-r--r-- 1 steve users 13 Mar 22 20:39 foo
tack:~$ if [ -f bar ] ; then echo ok ; fi
ok

Can you confirm that this is your problem? Can you test that please?

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
"When C++ is your hammer, everything looks like a thumb." -- Steven M. Haflich


Reply to: