[systemd-devel] [PATCH v6] udev hwdb: Support shipping pre-compiled database in system images

Colin Guthrie gmane at colin.guthr.ie
Wed Nov 5 07:30:19 PST 2014


Hiya,

Martin Pitt wrote on 28/10/14 11:18:
> @@ -275,30 +281,43 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) {
>          hwdb->refcount = 1;
>          udev_list_init(udev, &hwdb->properties_list, true);
>  
> -        hwdb->f = fopen("/etc/udev/hwdb.bin", "re");
> +        /* find hwdb.bin in hwdb_bin_paths */
> +        NULSTR_FOREACH(hwdb_bin_path, hwdb_bin_paths) {
> +                hwdb->f = fopen(hwdb_bin_path, "re");
> +                if (hwdb->f)
> +                        break;
> +                else if (errno == ENOENT)
> +                        continue;
> +                else {
> +                        udev_dbg(udev, "error reading %s: %m", hwdb_bin_path);
> +                        udev_hwdb_unref(hwdb);
> +                        return NULL;
> +                }
> +        }
> +
>          if (!hwdb->f) {
> -                udev_dbg(udev, "error reading /etc/udev/hwdb.bin: %m");
> +                udev_err(udev, "hwdb.bin does not exist, please run udevadm hwdb --update");
>                  udev_hwdb_unref(hwdb);
>                  return NULL;
>          }
>  

Pretty sure it's a relatively minor issue, but since this patch, I see
the error message "hwdb.bin does not exist, please run udevadm hwdb
--update" twice on every boot despite me having a /etc/udev/hwdb.bin
file present and correct!

With a bit of digging, I looked into the issue and even after reverting
this patch, both error messages remained... at which point I realised it
was from udev in the initrd (dracut generated), not the installed version.

Rebuilding the initrd with the patch reverted udevd solved the problems
and the error message disappeared.

While it's a nice error message, I wonder if it should be reverted back
to being dbg again for the initrd use case or perhaps some other
mechanism could be used to suppress the error in that case?

AFAIUI, we do not need to ship the complied hwdb.bin in the initrd (it
would make it quite large) and thus is quite valid to not include it.

Anyone against the attached patch?

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-udev-hwdb-Change-error-message-regarding-missing-hwd.patch
Type: text/x-patch
Size: 1144 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141105/3a3f8974/attachment-0001.bin>


More information about the systemd-devel mailing list