topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
1.9k stars 123 forks source link

Topgrade should update hardware ID map files #602

Open metaminimalist opened 10 months ago

metaminimalist commented 10 months ago

Topgrade should also update hardware ID map files, if they are found on the system.

Most of these system packages have an update tool already, but updates are never scheduled, and if you need the tool, no one thinks of an update before using.

In most cases it is just a web request and replacing a map file.

But the task is probably platform specific and completely different on every operating system.

Example: PCI-IDs

The package pciutils has an update utility:

❯ dpkg -S $(which lspci)
pciutils: /usr/bin/lspci
❯ dpkg -L pciutils
/.
/usr
/usr/bin
/usr/bin/lspci
/usr/bin/setpci
/usr/sbin
/usr/sbin/update-pciids   <<== 
[…]
/usr/share/man/man8/update-pciids.8.gz
[…]

Updating is as easy as running the script as root:

# /usr/sbin/update-pciids
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  293k  100  293k    0     0   229k      0  0:00:01  0:00:01 --:--:--  229k
Done.

Example: smartmontools drive DB

The package smartmontools has an update utility:

❯ dpkg -S $(which smartctl)
smartmontools: /usr/sbin/smartctl
❯ dpkg -L smartmontools
[…]
/usr/sbin/update-smart-drivedb  <<==
[…]
/usr/share/man/man8/update-smart-drivedb.8.gz
[…]
/var/lib/smartmontools/drivedb

Updating is as easy as running the script as root:

# /usr/sbin/update-smart-drivedb
/var/lib/smartmontools/drivedb/drivedb.h 7.3/5319 updated to 7.3/5533

please help: discuss and collect which data shall be updated

Am I a lazy dog? Well, partly. And I am only on Linux, and I have no idea on how other platforms handle this. Plus I only know what did fail on me in the past, hence the list at the beginning of this issue. I am very sure that I forgot things.

MAC address data seems to be scattered over the Internet, in lots of formats. This seem both complete and up to date https://devtools360.com/en/macaddress/vendorMacs.xml but I do not know if it is the best source.

I also ask myself it the netbase files

/etc/ethertypes
/etc/protocols
/etc/rpc
/etc/services

belong into this issue or not. These are mapping files, and are very seldom being updated.

The next grief is that these update scripts in the various packages are run as root and seem like "serves the purpose" quick hacks. I don't want to think of all the damage that could be done with that.

If there are enough data sources to update, the better way would be to have a safe map file updating method which does atomic updates and call it on a set of (URL/file system path)-pairs.

SteveLauC commented 10 months ago

Well, I think Topgrade should have them, but I don't have any knowledge about these things (this is actually the first time I heard about them), would you like to submit a PR on the tools that you are aware of? If you are not familiar with Rust, you can tell me what should be done and I will write the code

metaminimalist commented 9 months ago

So… keepalive…this is definitively no easy task!

From an abstract top level view the topic is "update hardware enumeration data". It also overlaps with "update firmware in connected internal and external devices" which grows exponentially complex (just think of updating printer drivers and printer firmware)

I am still collecting data sources, for example https://wiki.gentoo.org/wiki/Hardware_detection , and found also other common such enumeration systems, like systemD's hwdb: https://github.com/systemd/systemd/tree/main/hwdb.d which seems to duplicate other DBs in the USB, PCI, Bluetooth department.

I entered myself two self appointments on sundays in december for that.

Realistically this will be my fun in calendar week 52, the end-of-year chaos has started already.

SteveLauC commented 9 months ago

Ok, I will stay tuned

metaminimalist commented 8 months ago

I still exist, it is still on my list, unfortunately I visit a family member in the hospital every other day.

SteveLauC commented 8 months ago

unfortunately I visit a family member in the hospital every other day.

I hope everything is ok

I still exist, it is still on my list

No worries about this, we are not in hurry, it is totally fine to do it when you have time.