Group: Hardware/RepairsRefurbishingAndMaintenance

From LibrePlanet
Jump to: navigation, search
(HDDs and SSDs: Add other programs to recover data)
(Move to free software directory. I didn't check the specific GFDL licenses declaration compatibility, but the only author of that page so I can move it and agree to the new GFDL declarations as well in the FSD.)
(Tag: Replaced)
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Introduction ==
+
This page has been moved to [https://directory.fsf.org/wiki/Collection:RepairsRefurbishingAndMaintenance the Collection:RepairsRefurbishingAndMaintenance page] on the free software directory because the free software directory already contain pages about collections of software for various purposes.
This page is meant to list free software applications or code that can be used to either:
 
* Repair devices
 
* Do regular device maintenance to keep the devices functional
 
* Repurpose devices
 
 
 
== Software for specific hardware ==
 
 
 
=== Batteries ===
 
 
 
==== Linux /sys/class/power_supply/*/ ====
 
 
 
X86 Laptops batteries often have a nonfree firmware somewhere and calibration data.
 
The computer embedded controller usually interfaces with that firmware.
 
And Linux has drivers to talk to the embedded controller to get data about the battery used by laptops.
 
 
 
We can usually get battery information through Linux standard interfaces:
 
$ grep . /sys/class/power_supply/BAT0/uevent
 
POWER_SUPPLY_NAME=BAT0
 
POWER_SUPPLY_TYPE=Battery
 
POWER_SUPPLY_STATUS=Discharging
 
POWER_SUPPLY_PRESENT=1
 
[...]
 
POWER_SUPPLY_POWER_NOW=15191000
 
POWER_SUPPLY_ENERGY_FULL_DESIGN=84240000
 
POWER_SUPPLY_ENERGY_FULL=32310000
 
POWER_SUPPLY_ENERGY_NOW=9690000
 
POWER_SUPPLY_CAPACITY=29
 
POWER_SUPPLY_CAPACITY_LEVEL=Normal
 
[...]
 
 
 
So not only we can see if charging works (here it's Discharging) but in a lot of cases, we can even understand how much the battery would last compared to the amount of time it lasted when manufactured.
 
 
 
Here we can simply calculate that by dividing  POWER_SUPPLY_ENERGY_FULL by POWER_SUPPLY_ENERGY_FULL_DESIGN:
 
$ python3
 
Python 3.9.9 (main, Jan  1 1970, 00:00:01)
 
[GCC 10.3.0] on linux
 
Type "help", "copyright", "credits" or "license" for more information.
 
>>> 100 * (32310000 / 84240000)
 
38.35470085470086
 
 
 
Note that this information is only accurate if the calibration data is correct. Batteries typically have I2C interfaces, so it's possible to talk to the battery firmware and it's probably possible to modify its calibration data too in some way.
 
 
 
So the battery I'm using will last 38% of the original battery. So if the battery lasted 5 hours after being manufactured, it will now last about 1 hours and 55 minutes.
 
 
 
In contrast with x86 laptops smartphones also have calibration data (typically in the battery gauge chip), but they often don't have any information on how much the battery would last compared to the original battery life.
 
 
 
A way to find out could be to develop a procedure that drains the battery as fast as possible (for instance using cpuburn to use the CPU as much as possible) and look how much different batteries last.
 
 
 
It might also be possible to caracterize the battery directly with hardware meant to discharge it and measure its voltage with multimeters and sigrok (a free software tool that can retrieve information from some multimeters).
 
 
 
=== Cooling ===
 
 
 
==== cpuburn ====
 
 
 
The cpuburn software tries to use a CPU core as much as possible so that can be used to test the cooling of a device, or the CPUs. If you have 8 cores, you need to run 8 instances of that software.
 
 
 
Implementations exists for multiple CPU for at least ARM and x86.
 
 
 
==== Linux ====
 
 
 
* Linux has an hwmon subsystem and it can be used to manually control fans
 
* Linux can also report various temperature sensors data through the hwmon subsystem
 
 
 
==== lm_sensors ====
 
 
 
lm_sensors can use data exported by Linux to print temperatures etc
 
 
 
=== Ethernet controllers ===
 
 
 
==== Ethtool and Linux drivers ====
 
Some ethernet controller have some (usually I2C) flash chip used to hold their configuration data.
 
 
 
Sometimes the content of this chip is corrupted, making the Ethernet controller useless (for instance because the driver refuses to load.
 
 
 
For some e1000 or e1000e compatible controllers, it's possible to patch Linux to make sure that the driver loads, and then use ethtool to reprogram the flash chip.
 
 
 
For that to work, the flash chip needs to be directly connected to the Ethernet controller. This is the case with computers like the Thinkpad X60.
 
 
 
==== Flashrom, bincfg, ich9gen and ifdtool ====
 
On some computers (like the Thinkpad X200), the Ethernet controller configuration data is not on a dedicated flash chip, but it's in a partition of the flash chip that also holds the BIOS.
 
 
 
For that, flashrom can be used to dump the flash chip content (that can usually be done on the laptop itself if it runs Libreboot or Coreboot).
 
 
 
Once this is done, ifdtool (which is available in Parabola in the libreboot-utils package) can extract the content of the Ethernet controller partition.
 
 
 
Its content can either be recreated with Libreboot's ich9gen, or with bincfg (part of libreboot-utils in Parabola).
 
 
 
The ich9gen tool is way easier to use as it only asks the MAC address on the command line:
 
ich9gen --macaddress XX:XX:XX:XX:XX:XX
 
the mac address is often found on a sticker on the bottom of the laptop. The ich9gen tool then produces a file that has the intel flash descriptor (the partition table of the flash chip) and the Ethernet controller partition. The later can be extracted with ifdtool again, for instance with
 
ifdtool -x ich9fdgbe_8m.bin
 
 
 
The bincfg tool can instead edit all the configuration of the Ethernet controller partition, but it requires users to download the datasheet (easily found online and/or on the Intel website) and to understand each field to modify. So it's way harder to use.
 
 
 
=== Flash chips ===
 
 
 
==== Flashrom ====
 
Flashrom can read and write various flash chips (With Parallel, SPI, FWH, LPC interfaces) so it can potentially be used to repair many devices. You also need a compatible flash programmer (that works with a compatible voltage level) to program flash chips conveniently.
 
 
 
On some computers it can also read/write the computer flash chip that holds the boot software (like the BIOS or UEFI). It can also read/write the flash chip of various cards (like GPUs, network cards, etc). In both cases it's not always able to read/write the full flash chip as sometimes the hardware configuration can prevent that (in case of laptops for instance), and other times the code is not stable enough to write the flash chip (for some GPUs and/or network cards).
 
 
 
Website: https://www.flashrom.org/
 
 
 
==== Linux + flashrom or mtd-utils ====
 
 
 
Linux can also read various flash chips. For instance you might be able to use a single board computer that runs GNU/Linux and connect a flash chip to it, modify the device tree to take it into account, and use the Linux driver along with mtd-utils or flashrom with the linux_mtd driver to read/write it.
 
 
 
Another option would be to only enable the SPI bus that has the flash chip in the device tree and use then use flashrom to read/write it through flashrom's linux_spi driver.
 
 
 
=== GPUs ===
 
==== Games ====
 
Various free software 3D games can be used to test GPUs.
 
 
 
Some games need a big quantity of RAM to run (Xonotic and supertuxkart probably require 2GiB of RAM or more for instance).
 
 
 
Many old computers cannot have that much RAM (due to chipset limitations). Even some modern computers have soldered RAM, so in that case RAM can't easily be increased either.
 
 
 
For cases like that, extreme Tux racer uses 3D acceleration and don't require a big quantity of RAM, so it could be used to test GPUs on such computers. It is available in several FSDG compliant distributions like Parabola and Guix.
 
 
 
==== Phoronix test suite ====
 
 
 
Phoronix test suite can also be used to test GPUs. Note that by default many tests are nonfree.
 
 
 
Both Guix and Parabola's phoronix-test-suite have free tests.
 
 
 
The Guix version is probably more advanced as Parabola's version is old and lack games (it's limited to compilation tests), at least until volunteers fix that in Parabola.
 
 
 
==== Flashrom and sgabios ====
 
 
 
Some broken GPUs can probably be repurposed with flashrom and [https://review.coreboot.org/plugins/gitiles/sgabios/ sgabios].
 
 
 
Sgabios can be used to redirect the output of the computer in the BIOS on a serial port. This could be useful to people with visual deficiencies or for people administrating servers.
 
 
 
Reprogramming the flash chip of modern GPUs might need to be done with flashrom and an external programmer (because flashrom doesn't have support for recent ATI or AMD GPUs).
 
 
 
=== HDDs and SSDs ===
 
 
 
==== ddrescue ====
 
 
 
GNU ddrescue can be used to rescue data from an SSD or hard disk that will soon break. It's obtimized for rescuing as much data as possible before the device break.
 
 
 
There are also associated graphical and command line tools to handle partial dumps, or to combine several dumps.
 
 
 
GNU ddrescue can also be used to rescue CD or DVDs that contain errors. In that case, the sector size might need to be changed to 2048 (ddrescue -b 2048 [...]). It is also a good idea to either combine several images made with different CD/DVD readers or to try to continue rescuing a given CD/DVD with different readers to capture as much data as possible.
 
 
 
==== ext4magic extundelete ====
 
 
 
In some cases ext4magic or extundelete are able to recover deleted files with their full paths. It doesn't always work though.
 
 
 
==== dmraid ====
 
Sometimes people use hard disk controller cards (also known as fake raid cards) to configure their hard disks as RAID.
 
 
 
These cards usually have a flash chip with a nonfree program inside that is then executed by the BIOS/UEFI. That software can then be used to configure the cards to combine several disks as a single raid device.
 
 
 
When users do that, the cards add additional data on the disks to combine them together. Usually that also requires additional drivers for the card in order for the OS to take that into account.
 
 
 
When the card break, users are usually unable to reconstruct the array.
 
 
 
Though the dmraid program has support for the format used by several fake RAID cards (like the Adaptec HostRAID ASR, Highpoint HPT37X, Highpoint HPT45X, etc).
 
 
 
So with dmraid we can recover data from these fake raid arrays.
 
 
 
==== Flashrom ====
 
 
 
Flashrom can also be used to dump and restore some HDDs and SSDs firmwares as the flash chips holding the firmwares are often easily accessible on the hard disk PCB.
 
 
 
==== Gnome disks ====
 
Gnome disks can test HDDs and SSDs to see if they are broken or not.
 
 
 
Gnome disks can also make images of what is on a given HDDs/SSD usb key, etc. It probably requires the HDDs/SSD usb key to work fine to do that. If the HDD/SSD is breaking, using ddrescue might be better.
 
 
 
Website: https://apps.gnome.org/en/app/org.gnome.DiskUtility/
 
 
 
==== NAND reader ====
 
 
 
There is hardware schematics and GPLv3(+?) software for a NAND reader that available here: https://spritesmods.com/?art=ftdinand
 
 
 
That might be useful to recover data from an SSD (SSDs use NAND).
 
 
 
There will probably be data used by the SSD firmware as well on the NAND, like checksums for the data being written, bad block information, or block usage information, etc.
 
 
 
So we would probbaly need to reverse engineer to recover the data.
 
 
 
==== photorec and testdisk ====
 
 
 
The testdisk program can recreate disk partitions that have been erased.
 
 
 
The photorec program can recover data from disks by looking for pattern on the raw disk data. For instance jpeg files have a jpeg header, so even if all the partition data and metadata is destroyed somehow, photorec can still recover some files. Though it cannot recover file names or paths.
 
 
 
==== smartmontools ====
 
Smartmontools can test HDDs and SSD to see if they are broken or not.
 
 
 
Website: http://smartmontools.sourceforge.net
 
 
 
=== Modems ===
 
 
 
==== simtrace and simtrace2 ====
 
Simtrace and Simtrace2 can trace the communication between a SIM card and a mode. Thanks to that it is possible to gain some information on what is going on, for instance:
 
* If the screen is broken we might see some acvitivy through that
 
* It might be useful to debug a SIM card reported as not found: if there is some traffic, the modem sees the SIM card
 
 
 
==== Osmocom GSM stack ====
 
 
 
It might be possible to use OpenBSC and so on to emulate a GSM network to see if a phone is working well, however the hardware to do that is probably expensive.
 
 
 
In addition it would require special cables between the phone and the GSM network to ensure that the GSM network doesn't emit ouside of the cable (to not require a (test) license).
 
 
 
==== network manager / modem manager / oFono etc ====
 
 
 
The various GNU/linux modem stacks can obviously be used to test some modems.
 
 
 
The test suites of these modem stacks or network test suites like [https://projects.osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Testsuites Titan_TTCN3_Testsuites] might be able to be repurposed to run automatic tests.
 
 
 
=== RAM ===
 
 
 
==== Memtest86+ ====
 
Memtest86+ is an application that can be launched in GRUB and that can test the RAM.
 
 
 
For that to work the computer needs to be able to boot up to GRUB so if the RAM module under test is very broken, you might have more luck with two RAM modules: one good and the one under test.
 
 
 
==== Libreboot or Coreboot on Libreboot supported devices ====
 
 
 
Libreboot supports laptops with DDR2 (I945) and DDR3 (GM45).
 
 
 
It also supports some desktop computers.
 
 
 
If one hook up a serial port (on compatible computers, through the dock) it is possible to get some diagnostics even if the RAM isn't working at all.
 
 
 
They also has a fork of Memtest86+ that works over an UART.
 
 
 
==== Coreboot on Libreboot supported devices ====
 
 
 
On some of these computers the RAM initialization isn't free software so it might not give much information on what is going wrong. Note that Coreboot contains nonfree software. That is why Libreboot was made in the first place. Libreboot contains script to produce deblobed versions of Coreboot. Some vendors selling RYF certified hardware have also released deblobbed Coreboot as part of their RYF certification.
 
 
 
==== Novena + u-boot ====
 
 
 
The novena laptop also has slots for RAM modules and in u-boot, the RAM intialization code for that laptop is free software. Though u-boot itself might need to be deblobbed as some of its versions contain nonfree software (like nonfree firmwares and/or binaries under nonfree licenses).
 
 
 
Parabola has already some packages for some computers using an I.MX6 system on a chip, so it might be possible to ask Parabola developers to add support for the novena if you accept to test the resulting package.
 
 
 
== Software for characterizing hardware ==
 
 
 
People dealing with refurbishing hardware often need to know what's inside the computer. There are many free software projects that can find hardware inside computers.
 
 
 
=== h-client ===
 
 
 
The h-client program can be useful to not only find what's in the computer, but it can even send information about what works and what doesn't (with 100% free software distributions) to h-node.
 
 
 
It can be installed in Guix, so it's even possible to make a special Guix image (to be installed on an USB key) or to make a Debian package (with guix) to install it on top of 100% free software distributions.
 
 
 
Note that h-node only accepts information if the computer is being tested on 100% free distributions (that includes all FSDG compliant distributions, obviously with no additional nonfree software, and Debian with only the main repository and no additional nonfree software)
 
 
 
=== lshw ===
 
 
 
The lshw program can not only list what hardware is in the computer it's running on, but it can also output that information in a wide variety of format, like for instance json or even in an sqlite database.
 
 
 
That makes it easy to reuse that data in a more global system that tracks what hardware there is in the organization that refurbish hardware.
 
 
 
=== Inventory software ===
 
There is several free software inventory programs (like OCS Inventory for instance). Some are pretty well adapted to large organizations.
 
 
 
Something to look for would be to understand the level of details needed and see if it fit well what organization that refurbish hardware need.
 
 
 
== Software for general purpose debug and repair tools ==
 
 
 
=== Sigrok ===
 
Sigrok can interface with a wide variety of hardware like:
 
* Digital analyzers
 
* Multimeters
 
* Osciloscopes
 
* Power supplies
 
* etc
 
 
 
So it can be super useful for debugging hardware issues.
 

Latest revision as of 10:29, 22 April 2023

This page has been moved to the Collection:RepairsRefurbishingAndMaintenance page on the free software directory because the free software directory already contain pages about collections of software for various purposes.