output
stringlengths
9
26.3k
input
stringlengths
26
29.8k
instruction
stringlengths
14
159
It doesn't seem so. $ unshare -r # ulimit -u 1000 # sh -c 'for i in $(seq 998); do sleep 1& done' >/dev/null sh: fork: retry: Resource temporarily unavailable sh: fork: retry: Resource temporarily unavailable ... (i.e. more than one error - so I guess my existing processes were already counted) sh: fork: retry: Resource temporarily unavailable -bash: fork: retry: Resource temporarily unavailableSimilarly: $ unshare -r # ulimit -u 1002 # sh -c 'for i in $(seq 100); do sleep 1& done' >/dev/null # sleep 2 # for i in $(seq 10); do unshare -r sh -c 'for i in $(seq 100); do sleep 1& done' >/dev/null; done sh: fork: retry: Resource temporarily unavailable sh: fork: retry: Resource temporarily unavailableRunning ulimit -u 1000 inside unshare -r does not affect my user outside of the user namespace. Ah - this is because ulimit -u always sets a limit inside the process. But when the limit is checked in fork(), we compare the RLIMIT_NPROC for that process, against the total number of processes of the "real" UID, i.e. from the point of view of the "root" namespace. So as far as I can see, this all works pretty nicely.Incidentally, I notice you can't use user namespaces to create processes with multiple different UIDs, if you are not privileged. $ unshare -r # id -u 0 # setpriv --ruid 1 sh setpriv: setresuid failed: Invalid argumentThe rules for this aspect are explained e.g. by Michael Kerrisk in Namespaces in operation, part 5: User namespaces.
Depending on configuration, unprivileged (non-root) processes can create a user namespace. RLIMIT_NPROC limits the number of processes per user. If I enter a user namespace, can I create processes with different UIDs, and hence exceed my real RLIMIT_NPROC?
Who would win, RLIMIT_NPROC or user namespaces?
This script below requires a lot of additional improvements, but I think it can serve as a basis. I started to write comments, but for now, not able to finish it. I will use edits to my answer to add new comments and fix bugs when I get more free time. In my environment it works fine. I called this script mytop and put it to /usr/local/bin so I have bash command tab completion on it. You can put mytop to your ~/bin directory (if ~/bin not in your $PATH, add it), or whatever place on your machine. Of course execute bit must be set, with chmod u+x mytop. #!/bin/bash # mytop -ver 1.0# script name (default is: 'mytop') s_name=$(basename $0)# version ver="1.0"# set default time between mytop iterations sec_delay=3 # set default mytop repetitions/iterations mt_rep=1000000# Help function explaining syntax, options, ... Help() { # Display Help echo echo "Show Totals of %CPU and &MEM using 'top' command." echo echo "Syntax:" echo " $s_name [-h|-V]" echo " $s_name [[-d <S>][-n <N>] <APP_NAME>"] echo echo "Options:" echo " -h Print this Help." echo " -d S Delay/wait S seconds between iterations (default: 3 seconds)." echo " -n N Run/iterate 'mytop' N times (default: 3 times)." echo " -V Print version." echo echo "Examples:" echo " mytop -V" echo " mytop -d1 -n5 chromium" echo echo 'Use CTRL+C for exit!' echo }# Handling options from command line arguments while getopts ":hn:d:V" option; do case $option in h) # display Help Help exit;; V) # print version echo "$s_name $ver" exit;; n) # set how many times 'mytop' will repeat/iterate mt_rep=$OPTARG;; d) # set delays in seconds sec_delay=$OPTARG;; \?) echo "$s_name: inapropriate: '$1'." echo "Usage:" echo " $s_name [-h|-V|-d<S> -n<N> <APP_NAME>]" exit;; esac done# If no arguments given just display Help function and exit if [[ $# -eq 0 ]]; then Help exit else # If last argument starts with '-' exit from app if [[ ${@:$#} =~ -+.* ]]; then echo ${s_name}: error: Last argument must be the name of the application that you want to track. >&2 exit 1 else app_name=${@:$#} fi fi# Set 'dashes' literally #t_dsh='-----------------------------------------------------------' # or set them with printf command t_dsh=$(printf '%0.s-' {1..59})# Not in use #if [[ -z $mt_rep ]] 2>/dev/null; then # r_endless=1 # mt_rep=1000 #else # r_endless=0 #fii=0 while [[ $i -lt $mt_rep ]]; do #if [[ "$r_endless" == "0" ]]; then ((i++)); fi ((i++)) # Handle pids of app you want to track by removing 'mytop' pids # get s_name (mytop) pids pgrep $s_name > /tmp/mt_pids # get app_name pids -all of them --not desired behaviour pgrep -f $app_name > /tmp/app_name_pids # get app_name without mytop pids --desired behaviour for e in $(cat /tmp/mt_pids); do sed -i "/$e/d" /tmp/app_name_pids; done if [[ ! -s "/tmp/app_name_pids" ]]; then echo "1000000" > /tmp/app_name_pids; fi # top -b -n1 -p; -b for output without ANSI formating; -n1 for just one iteration of 'top'; -p for feeding processes from 'pgrep' command # Use LC_NUMERIC if your 'top' command outputs 'commas' instead 'dots' - with LC_NUMERIC you will get 'dots' during this script LC_NUMERIC=en_US.UTF-8 top -b -n1 -p $(cat /tmp/app_name_pids | xargs | tr ' ' ,) > /tmp/pstemp wc_l=$(wc -l < /tmp/pstemp) cpu_use=$(tail -n +8 /tmp/pstemp | tr -s ' ' | sed 's/^ *//' | cut -d' ' -f9 | xargs | tr ' ' + | bc) if [[ "$cpu_use" == "0" ]]; then cpu_use="0.0" else if (( $(bc <<< "$cpu_use < 1") )); then cpu_use="0$cpu_use"; fi fi mem_use=$(tail -n +8 /tmp/pstemp | tr -s ' ' | sed 's/^ *//' | cut -d' ' -f10 | xargs | tr ' ' + | bc) if [[ "$mem_use" == "0" ]]; then mem_use="0.0" else if (( $(bc <<< "$mem_use < 1") )); then mem_use="0$mem_use"; fi fi echo -en "\033[2J\033[0;0f" # Use 'echo ...' above or 'tput ...' below (chose the one that works for you) #tput cup 0 0 && tput ed # Align Totals under %CPU and %MEM columns if (( $(bc <<< "$cpu_use < 1") )); then sed "${wc_l}a \\\n\nTotal (%CPU/%MEM): $(printf " %29s")$cpu_use $mem_use\n${t_dsh}" /tmp/pstemp elif (( $(bc <<< "$cpu_use < 100") )); then sed "${wc_l}a \\\n\nTotal (%CPU/%MEM): $(printf " %28s")$cpu_use $mem_use\n${t_dsh}" /tmp/pstemp else sed "${wc_l}a \\\n\nTotal (%CPU/%MEM): $(printf " %27s")$cpu_use $mem_use\n${t_dsh}" /tmp/pstemp fi if [[ $i -lt $mt_rep ]]; then sleep $sec_delay; fi done
What I need I want to monitor system resources (namely memory and cpu usage) by application - not just by process. Just as the Windows Task Manager is grouping resources by the "calling mother process", I like to see it like that as well. Nowadays, applications like firefox and vscode spawn many child processes and I want to get a quick and complete overview of their usage. The solution can be a GUI or TUI, a bash script or a big one-liner. I do not really care. For it to work, I imagine I could feed it with the pid of the mother process or the name of an executable as a means of filtering. Example Task Manager groupes/accumulates Chrome browser system resources What I TriedI tried htop, but it only shows me a tree where the calling process has its own memory listed - not the ones it called. I tried the gnome-system-monitor, but its the same. I tried a bit with ps and free but have not found the correct set of arguments / pipes to make them do what I want.It stumped me that I could not google a solution for that. Maybe there is a reason for it? Does anybody have an idea? I would very much appreciate it!
Get memory/cpu usage by application
Unmount any filesystems on the disk. (umount ...) Deactivate any LVM groups. (vgchange -an) Make sure nothing is using the disk for anything.You Could unplug the HDD here, but it is recommended to also do the last two stepsSpin the HDD down. (irrelevant for SSD's) (sudo hdparm -Y /dev/(whatever)) Tell the system, that we are unplugging the HDD, so it can prepare itself. (echo 1 | sudo tee /sys/block/(whatever)/device/delete)If you want to be extra cautious, do echo 1 | sudo tee /sys/block/(whatever)/device/delete first. That'll unregister the device from the kernel, so you know nothing's using it when you unplug it. When I do that with a drive in an eSATA enclosure, I can hear the drive's heads park themselves, so the kernel apparently tells the drive to prepare for power-down. If you're using an AHCI controller, it should cope with devices being unplugged. If you're using some other sort of SATA controller, the driver might be confused by hotplugging. In my experience, SATA hotplugging (with AHCI) works pretty well in Linux. I've unplugged an optical drive, plugged in a hard drive, scanned it for errors, made a filesystem and copied data to it, unmounted and unplugged it, plugged in a differerent DVD drive, and burned a disc, all with the machine up and running.
I sometimes need to plug a disk into a disk bay. At other times, I have the very weird setup of connecting a SSD using a SATA-eSATA cable on my laptop while pulling power from a desktop. How can I safely remove the SATA disk from the system? This Phoronix forum thread has some suggestions:justsumdood wrote:An(noymous)droid wrote: What then do you do on the software side before unplugging? Is it a simple "umount /dev/sd"[drive letter]? after unmounting the device, to "power off" (or sleep) the unit:hdparm -Y /dev/sdX(where X represents the device you wish to power off. for example: /dev/sdb) this will power the drive down allowing for it's removal w/o risk of voltage surge.Does this mean that the disk caches are properly flushed and powered off thereafter? Another suggestion from the same thread:chithanh wrote: All SATA and eSATA hardware is physically able to be hotplugged (ie. not damaged if you insert/pull the plug). How the chipset and driver handles this is another question. Some driver/chipset combinations do not properly handle hotplugging and need a warmplug command such as the following one: echo 0 - 0 > /sys/class/scsi_host/hostX/scanReplace X with the appropriate number for your SATA/eSATA port. I doubt whether is the correct way to do so, but I cannot find some proof against it either. So, what is the correct way to remove an attached disk from a system? Assume that I have already unmounted every partition on the disk and ran sync. Please point to some official documentation if possible, I could not find anything in the Linux documentation tree, nor the Linux ATA wiki.
How can I safely remove a SATA disk from a running system?
It seems like the term Horkage was introduced with this patch by Alan Cox. The term "hork" means(computing, slang) To foul up; to be occupied with difficulty, tangle, or unpleasantness; to be broken. I downloaded the program, but something is horked and it won't load.You can also see this in The Jargon File's Glossary under "horked"Broken. Confused. Trashed. Now common; seems to be post-1995. There is an entertaining web page of related definitions, few of which seem to be in live use but many of which would be in the recognition vocabulary of anyone familiar with the adjective.The horkage list is a list of blacklisted functionality because hardware manufacturers failed to implement it properly ("horked" the implementation).
There are a lot of constants in the Kernel named with HORKAGE,ATA_HORKAGE_ZERO_AFTER_TRIM ATA_HORKAGE_NODMA ATA_HORKAGE_ATAPI_MOD16_DMA ATA_HORKAGE_NO_DMA_LOG ATA_HORKAGE_NO_ID_DEV_LO ATA_HORKAGE_NO_LOG_DIR ATA_HORKAGE_WD_BROKEN_LPMHowever, these are not really documentedForce horkage according to libata.force and whine about it. For consistency with link selection, device number 15 selects the first device connected to the host link.What does "horkage" mean?
What is "horkage"?
Thanks to @frostschutz, I could measure the write performance in Linux without NCQ feature. The kernel boot parameter libata.force=noncq disabled NCQ completely. Regarding my Seagate 6TB write performance problem, there was no change in speed. Linux still reaches 180 MiB/s. But then I had another idea: The Linux driver does not use transfers of 32 MiB chunks. The kernel buffer is much smaller, especially if NCQ with 32 queues is enabled (32 queues * 32 MiB => 1 GiB AHCI buffer). So I tested my SATA controller with 256 KiB transfers and voilà, it's possible to reach 185 MiB/s. So I guess the Seagate ST6000AS0002 firmware is not capable of handling big ATA burst transfers. The ATA standard allows up to 65.536 logical blocks, which equals 32 MiB. SMR - Shingled Magnetic Recording Another possibility for the bad write performance could be the shingled magnetic recording technique, which is used by Seagate in these archive devices. Obviously, I triggered a rare effect with my FPGA implementation.
I implemented my own Serial-ATA Host-Bus-Adapter (HBA) in VHDL and programmed it onto a FPGA. A FPGA is chip which can be programmed with any digital circuit. It's also equipped with serial transceivers to generate high speed signals for SATA or PCIe. This SATA controller supports SATA 6 Gb/s line rates and uses ATA-8 DMA-IN/OUT commands to transfer data in up to 32 MiB chunks to and from the device. The design is proven to work at maximum speed (e.g. Samsung SSD 840 Pro -> over 550 MiB/s). After some tests with several SSD and HDD devices, I bought a new Seagate 6 TB Archive HDD (ST6000AS0002). This HDD reaches up to 190 MiB/s read performance, but only 30 to 40 MiB/s write performance! So I dug deeper and measured the transmitted frames (yes that's possible with a FPGA design). As far as I can tell, the Seagate HDD is ready to receive the first 32 MiB of a transfer in one piece. This transfer happens at maximum line speed of 580 MiB/s. After that, the HDD stalls the remaining bytes for over 800 ms! Then the HDD is ready to receive the next 32 MiB and stalls again for 800 ms. All in all an 1 GiB transfer needs over 30 seconds, which equals to circa 35 MiB/s. I assume that this HDD has a 32 MiB write cache, which is flushed in between the burst cycles. Data transfers with less than 32 MiB don't show this behavior. My controller uses DMA-IN and DMA-OUT command to transfer data. I'm not using the QUEUED-DMA-IN and QUEUED-DMA-OUT command, which are used by NCQ capable AHCI controllers. Inplementing AHCI and NCQ on a FPGA platform is very complex and not needed by my application layer. I would like to reproduce this scenario on my Linux PC, but the Linux AHCI driver has NCQ enabled by default. I need to disable NCQ, so I found this website describing how to disable NCQ, but it doesn't work. The Linux PC still reaches 190 MiB/s write performance. > dd if=/dev/zero of=/dev/sdb bs=32M count=32 1073741824 bytes (1.1 GB) copied, 5.46148 s, 197 MB/sI think there is a fault in the article from above: Reducing the NCQ queue depth to 1 does not disable NCQ. It just allows the OS the use only one queue. It can still use QUEUED-DMA-** commands for the transfer. I need to realy disable NCQ so the driver issues DMA-IN/OUT commands to the device. So here are my questions:How can I disable NCQ? If NCQ queue depth = 1, is Linux's AHCI driver using QUEUED-DMA-** or DMA-** commands? How can I check if NCQ is disable, because changing /sys/block/sdX/device/queue_depth is not reported in dmesg?
How to (really) disable NCQ in Linux
I wrote one-liner based on Tobi Hahn answer. For example, you want to know what device stands for ata3: ata=3; ls -l /sys/block/sd* | grep $(grep $ata /sys/class/scsi_host/host*/unique_id | awk -F'/' '{print $5}')It will produce something like this lrwxrwxrwx 1 root root 0 Jan 15 15:30 /sys/block/sde -> ../devices/pci0000:00/0000:00:1f.5/host2/target2:0:0/2:0:0:0/block/sde
I woke up this morning to a notification email with some rather disturbing system log entries. Dec 2 04:27:01 yeono kernel: [459438.816058] ata2.00: exception Emask 0x0 SAct 0xf SErr 0x0 action 0x6 frozen Dec 2 04:27:01 yeono kernel: [459438.816071] ata2.00: failed command: WRITE FPDMA QUEUED Dec 2 04:27:01 yeono kernel: [459438.816085] ata2.00: cmd 61/08:00:70:0d:ca/00:00:08:00:00/40 tag 0 ncq 4096 out Dec 2 04:27:01 yeono kernel: [459438.816088] res 40/00:00:00:4f:c2/00:00:00:00:00/40 Emask 0x4 (timeout) Dec 2 04:27:01 yeono kernel: [459438.816095] ata2.00: status: { DRDY } (the above five lines were repeated a few times at a short interval) Dec 2 04:27:01 yeono kernel: [459438.816181] ata2: hard resetting link Dec 2 04:27:02 yeono kernel: [459439.920055] ata2: SATA link down (SStatus 0 SControl 300) Dec 2 04:27:02 yeono kernel: [459439.932977] ata2: hard resetting link Dec 2 04:27:09 yeono kernel: [459446.100050] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300) Dec 2 04:27:09 yeono kernel: [459446.314509] ata2.00: configured for UDMA/133 Dec 2 04:27:09 yeono kernel: [459446.328037] ata2.00: device reported invalid CHS sector 0 ("reported invalid CHS sector 0" repeated a few times at a short interval)I make full nightly backups of my entire system to an external (USB-connected) drive, and the above happened right in the middle of that backup run. (The backup starts at 04:00 through cron, and tonight's logged completion just before 04:56.) The backup process itself claims to have completed without any errors. There are two internally connected SATA drives and two externally (USB) connected drives on my system; one of the external drives is currently dormant. I don't recall off the top of my head which physical SATA ports are used for which of the internal drives. When googling I found the AskUbuntu question Is this drive failure or something else? which indicates that a very similar error occured after 8-10 GB had been copied to a drive, but the actual failure mode was different as the drive switched to a read-only state. The only real similarity is that I did add on the order of 7-8 GB of data to my main storage last night, which would have been backed up around the time that the error occured. smartd is not reporting anything out of the ordinary on either of the internal drives. Unfortunately smartctl doesn't speak the language of the external backup drive's USB bridge, and simply complains about Unknown USB bridge [0x0bc2:0x3320 (0x100)]. Googling for that specific error was distinctly unhelpful. My main data storage as well as the backup is on ZFS and zpool status reports 0 errors and no known data errors. Nevertheless I have initiated a full scrub on both the internal and external drives. It is currently slated to complete in about six hours for the internal drive (main storage pool) and 13-14 hours for the backup drive. It seems that the next step should be to determine which drive was having trouble, and possibly replace it. The ata2.00 part probably tells me which drive was having problems, but how do I map that identifier to a physical drive?
Given a kernel ATA exception, how to determine which physical disk is affected? [duplicate]
Bad sectors are always an indication of a failing HDD, in fact the moment you see an I/O error such as this, you probably already lost/corrupted some data. Make a backup if you haven't one already, run a self test smartctl -t long /dev/disk and check SMART data smartctl -a /dev/disk. Get a replacement if you can. Bad sectors can't be repaired, only replaced by reserve sectors, which harms HDD performance, as they require additional seeks to the reserve sectors every time they are accessed. Marking such sectors as bad on the filesystem layer helps, as they won't ever be accessed then; however it's hard to determine which sectors were already reallocated by the disk, so chances are the filesystem won't know to avoid the affected region.
My Ubuntu 13.10 system has been performing very poorly over the last day or so. Looking at the kernel logs, it appears that the <1yr old 3TB SATA disk is having issues with a particular sector: Nov 4 20:54:04 mediaserver kernel: [10893.039180] ata4.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0 Nov 4 20:54:04 mediaserver kernel: [10893.039187] ata4.01: BMDMA stat 0x65 Nov 4 20:54:04 mediaserver kernel: [10893.039193] ata4.01: failed command: READ DMA EXT Nov 4 20:54:04 mediaserver kernel: [10893.039202] ata4.01: cmd 25/00:08:f8:3f:83/00:00:af:00:00/f0 tag 0 dma 4096 in Nov 4 20:54:04 mediaserver kernel: [10893.039202] res 51/40:00:f8:3f:83/40:00:af:00:00/10 Emask 0x9 (media error) Nov 4 20:54:04 mediaserver kernel: [10893.039207] ata4.01: status: { DRDY ERR } Nov 4 20:54:04 mediaserver kernel: [10893.039211] ata4.01: error: { UNC } Nov 4 20:54:04 mediaserver kernel: [10893.148527] ata4.00: configured for UDMA/133 Nov 4 20:54:04 mediaserver kernel: [10893.180322] ata4.01: configured for UDMA/133 Nov 4 20:54:04 mediaserver kernel: [10893.180345] sd 3:0:1:0: [sdc] Unhandled sense code Nov 4 20:54:04 mediaserver kernel: [10893.180349] sd 3:0:1:0: [sdc] Nov 4 20:54:04 mediaserver kernel: [10893.180353] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE Nov 4 20:54:04 mediaserver kernel: [10893.180356] sd 3:0:1:0: [sdc] Nov 4 20:54:04 mediaserver kernel: [10893.180359] Sense Key : Medium Error [current] [descriptor] Nov 4 20:54:04 mediaserver kernel: [10893.180371] Descriptor sense data with sense descriptors (in hex): Nov 4 20:54:04 mediaserver kernel: [10893.180373] 72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00 Nov 4 20:54:04 mediaserver kernel: [10893.180384] af 83 3f f8 Nov 4 20:54:04 mediaserver kernel: [10893.180389] sd 3:0:1:0: [sdc] Nov 4 20:54:04 mediaserver kernel: [10893.180393] Add. Sense: Unrecovered read error - auto reallocate failed Nov 4 20:54:04 mediaserver kernel: [10893.180396] sd 3:0:1:0: [sdc] CDB: Nov 4 20:54:04 mediaserver kernel: [10893.180398] Read(16): 88 00 00 00 00 00 af 83 3f f8 00 00 00 08 00 00 Nov 4 20:54:04 mediaserver kernel: [10893.180412] end_request: I/O error, dev sdc, sector 2944614392 Nov 4 20:54:04 mediaserver kernel: [10893.180431] ata4: EH completeThe kern.log file is around 33MB mostly full of the above error repeated and the sector doesn't appear to be any different in the repeated messages. I'm currently running the following command on the now unmounted disk to test and attempt to sort out any issues the disk might have. I'm around 12hrs in and expect it to take another 24/48 hours as the disk is so large: e2fsck -c -c -p -v /dev/sdc1My question is: Is this drive failing, or am I looking at a common issue here? I'm wondering if there is any point to me to repairing or ignoring bad sectors and whether I should replace the disk under warranty whilst it's still covered. My knowledge of the above command is somewhat lacking, so I'm sceptical as to whether it'll help or not. Quick update! e2fsck finally finished after 2 days with lots of 'multiply-claimed block(s) in inode'. Trying to mount the filesystem resulted in an error, forcing it to drop back to read-only: Nov 11 08:29:05 mediaserver kernel: [211822.287758] EXT4-fs (sdc1): warning: mounting fs with errors, running e2fsck is recommended Nov 11 08:29:05 mediaserver kernel: [211822.301699] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: errors=remount-roTrying to read the sector manually: sudo dd count=1 if=/dev/sdc of=/dev/null skip=2944614392 dd: reading ‘/dev/sdc’: Input/output error 0+0 records in 0+0 records out 0 bytes (0 B) copied, 5.73077 s, 0.0 kB/sTrying to write to it: sudo dd count=1 if=/dev/zero of=/dev/sdc seek=2944614392 dd: writing to ‘/dev/sdc’: Input/output error 1+0 records in 0+0 records out 0 bytes (0 B) copied, 2.87869 s, 0.0 kB/sOn both counts, the Reallocated_Sector_Ct remained 0. The drive does go into a sleep state quite often. I'm now thinking this could be a filesystem issue? I'm not 100%.
Does a bad sector indicate a failing disk?
Depending on your SATA driver and your distribution's configuration, they might show up as /dev/hda and /dev/hdb, or /dev/hda and /dev/sda, or /dev/sda and /dev/sdb. Distributions and drivers are moving towards having everything hard disk called sd?, but PATA drivers traditionally used hd? and a few SATA drivers also did. The device names are determined by the udev configuration. For example, on Ubuntu 10.04, the following lines from /lib/udev/rules.d/60-persistent-storage.rules make all ATA hard disks appear as /dev/sd* and all ATA CD drives appear as /dev/sr*: # ATA devices with their own "ata" kernel subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" # ATA devices using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode"
Assume that we have two disks, one master SATA and one master ATA. How will they show up in /dev?
Names for ATA and SATA disks in Linux
They show up as SCSI devices because the drivers speak SCSI to the next kernel layer (the generic disk driver). This isn't actually true of all SATA drivers on all kernel versions with all kernel compile-time configurations, but it's common. Even PATA devices can appear as SCSI at that level (again, that depends on the kernel version and kernel compile-time configuration, as well as whether the ide-scsi module is used). It doesn't really matter whether the driver speaks SCSI to the physical device. Often, it does. ATAPI, used for talking to PATA/SATA optical drives and other devices, is a SCSI-based protocol encapsulation. However, PATA/SATA disks don't use ATAPI. The libata set of drivers also includes a translator between the ATA command set and SCSI so that you can place PATA/SATA disks under the umbrella of the SCSI subsystem. The separate ide interface inside the kernel is more of a historical survivance. You'll notice that USB disks also appear as SCSI, for the same reason (and they speak SCSI too on the USB bus). The same goes for Firewire.
I have 3 SATA devices on my system. They show up under /proc/scsi/scsi, although these are not SCSI devices. Why do my SATA devices show up under the SCSI directory? $ cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: ATA Model: WDC WD2500AAJS-6 Rev: 01.0 Type: Direct-Access ANSI SCSI revision: 05 Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: TSSTcorp Model: CDDVDW TS-H653Z Rev: 4303 Type: CD-ROM ANSI SCSI revision: 05 Host: scsi4 Channel: 00 Id: 00 Lun: 00 Vendor: ATA Model: ST3320620AS Rev: 3.AA Type: Direct-Access ANSI SCSI revision: 05
Why do my SATA devices show up under /proc/scsi/scsi?
You can find the corresponding /dev/sdY device via traversing the /sys tree: $ find /sys/devices | grep '/ata[0-9]\+/.*/block/s[^/]\+$' \ | sed 's@^.\+/\(ata[0-9]\+\)/.\+/block/\(.\+\)$@\1 => /dev/\2@'With a more efficient /sys traversal (cf. lsata.sh): $ echo /sys/class/ata_port/ata*/../../host*/target*/*/block/s* | tr ' ' '\n' \ | awk -F/ '{printf("%s => /dev/%s\n", $5, $NF)}'Example output from a 2 disk system: ata1 => /dev/sda ata2 => /dev/sdbThen, for reliably identifying the actual hardware you need to map /dev/sdY to the serial number, e.g.: $ ls /dev/disk/by-id -l | grep 'ata.*sd[a-zA-Z]$'lssci The lssci utility can also be used to derive the mapping: $ lsscsi | sed 's@^\[\([^:]\+\).\+\(/dev/.\+\)$@\1,\2@' \ | awk -F, '{ printf("ata%d => %s\n", $1+1, $2) }'Note that the relevant lsscsi enumeration starts from 0 while the ata enumeration starts from 0. Syslog If nothing else works one can look at the syslog/journal to derive the mapping. The /dev/sdY devices are created in the same order as the ataX identifiers are enumerated in the kern.log while ignoring non-disk devices (ATAPI) and not-connected links. Thus, following command displays the mapping: $ grep '^May 28 2' /var/log/kern.log.0 | \ grep 'ata[0-9]\+.[0-9][0-9]: ATA-' | \ sed 's/^.*\] ata//' | \ sort -n | sed 's/:.*//' | \ awk ' { a="ata" $1; printf("%10s is /dev/sd%c\n", a, 96+NR); }' ata1.00 is /dev/sda ata3.00 is /dev/sdb ata5.00 is /dev/sdc ata7.00 is /dev/sdd ata8.00 is /dev/sde ata10.00 is /dev/sdf(Note that ata4 is not displayed because the above log messages are from another system.) I am using /var/log/kern.log.0 and not /var/log/kern.log because the boot messages are already rotated. I grep for May 28 2 because this was the last boot time and I want to ignore previous messages. To verify the mapping you can do some checks via looking at the output of: $ grep '^May 28 2' /var/log/kern.log.0 | \ grep 'ata[0-9]\+.[0-9][0-9]: ATA-' May 28 20:43:26 hn kernel: [ 1.260488] ata1.00: ATA-7: SAMSUNG SV0802N, max UDMA/100 May 28 20:43:26 hn kernel: [ 1.676400] ata5.00: ATA-5: ST380021A, 3.19, max UDMA/10 [..]And you can compare this output with hdparm output, e.g.: $ hdparm -i /dev/sda/dev/sda:Model=SAMSUNG SV0802N [..](using Kernel 2.6.32-31)
Consider following kern.log snippet: ata4.00: failed command: WRITE FPDMA QUEUED ata4.00: cmd 61/00:78:40:1e:6c/04:00:f0:00:00/40 tag 15 ncq 524288 out res 41/04:00:00:00:00/04:00:00:00:00/00 Emask 0x1 (device error) ata4.00: status: { DRDY ERR } ata4.00: error: { ABRT } ata4: hard resetting link ata4: nv: skipping hardreset on occupied port ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300) ata4.00: configured for UDMA/133 ata4: EH completeHow can I identify which hard drive the kernel actually means when it talks about ata4.00? How can I find the corresponding /dev/sdY device name?
How to map ataX.0 identifiers in kern.log error messages to actual /dev/sdY devices?
I have found the solution. The device was unclaimed because it was not known correctly by the kernel. Using a kernel 3.5, the device was listed as below: *-ide UNCLAIMED description: IDE interface product: ASM1061 SATA IDE Controller vendor: ASMedia Technology Inc. physical id: 0 bus info: pci@0000:07:00.0 version: 01 width: 32 bits clock: 33MHz capabilities: ide msi pm pciexpress cap_list configuration: latency=0 resources: ioport:7000(size=8) ioport:7400(size=4) ioport:7800(size=8) ioport:7c00(size=4) ioport:8000(size=16) memory:d6100000-d6100but it was still unclaimed. When searching for the device [1b21:0611] I found a post in the kernel mailing list talking about it. It tells that the kernel does not identify the device correctly as an ahci device and propose a patch to the kernel. --- a/drivers/ata/ahci.c 2012-05-20 23:56:54.000000000 +0200 +++ b/drivers/ata/ahci.c 2012-05-31 14:51:01.577045033 +0200 @@ -391,6 +391,9 @@ { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 *//* Asmedia */ + { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM106x */ + { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci }, /* ASM106x */ + { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1061 *//* Generic, PCI class code for AHCI */I applied the patch to the source of kernel 3.5 and recompiled and it is now working. For information, the patch is included in the kernel in the release 3.6 and above.
I have added in my computer a PCI Express controler card with 2 USB3 ports and 2 sata3 ports. (http://www.ldlc.be/fiche/PB00121886.html). The USB ports are working correctly but the HDD plugged in the sata port is not appearing in the devices. I ran lshw and here the result concerning the pci card: *-pci:1 description: PCI bridge product: PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch vendor: PLX Technology, Inc. physical id: 5 bus info: pci@0000:05:05.0 version: ba width: 32 bits clock: 33MHz capabilities: pci pm msi pciexpress normal_decode bus_master cap_list configuration: driver=pcieport resources: irq:46 ioport:7000(size=8192) memory:d6100000-d61fffff *-ide UNCLAIMED description: IDE interface physical id: 0 bus info: pci@0000:07:00.0 version: 01 width: 32 bits clock: 33MHz capabilities: ide msi pm pciexpress cap_list configuration: latency=0 resources: ioport:7000(size=8) ioport:7400(size=4) ioport:7800(size=8) ioport:7c00(size=4) ioport:8000(size=16) memory:d6100000-d61001ff`It seems that the Unclaimed IDE is the culprit and that it is unclaimed because the system found no driver for it. How can I find which driver I would need to make that ide part working? So far my google search for PEX 8604 return almost nothing concerning a linux driver. EDIT: additional info # lspci -nn 00:00.0 Memory controller [0580]: nVidia Corporation CK804 Memory Controller [10de:005e] (rev a3) 00:01.0 ISA bridge [0601]: nVidia Corporation CK804 ISA Bridge [10de:0050] (rev f3) 00:01.1 SMBus [0c05]: nVidia Corporation CK804 SMBus [10de:0052] (rev a2) 00:02.0 USB Controller [0c03]: nVidia Corporation CK804 USB Controller [10de:005a] (rev a2) 00:02.1 USB Controller [0c03]: nVidia Corporation CK804 USB Controller [10de:005b] (rev a3) 00:04.0 Multimedia audio controller [0401]: nVidia Corporation CK804 AC'97 Audio Controller [10de:0059] (rev a2) 00:06.0 IDE interface [0101]: nVidia Corporation CK804 IDE [10de:0053] (rev f2) 00:07.0 IDE interface [0101]: nVidia Corporation CK804 Serial ATA Controller [10de:0054] (rev f3) 00:08.0 IDE interface [0101]: nVidia Corporation CK804 Serial ATA Controller [10de:0055] (rev f3) 00:09.0 PCI bridge [0604]: nVidia Corporation CK804 PCI Bridge [10de:005c] (rev f2) 00:0a.0 Bridge [0680]: nVidia Corporation CK804 Ethernet Controller [10de:0057] (rev f3) 00:0b.0 PCI bridge [0604]: nVidia Corporation CK804 PCIE Bridge [10de:005d] (rev f3) 00:0c.0 PCI bridge [0604]: nVidia Corporation CK804 PCIE Bridge [10de:005d] (rev f3) 00:0d.0 PCI bridge [0604]: nVidia Corporation CK804 PCIE Bridge [10de:005d] (rev f3) 00:0e.0 PCI bridge [0604]: nVidia Corporation CK804 PCIE Bridge [10de:005d] (rev a3) 00:18.0 Host bridge [0600]: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration [1022:1100] 00:18.1 Host bridge [0600]: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map [1022:1101] 00:18.2 Host bridge [0600]: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller [1022:1102] 00:18.3 Host bridge [0600]: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control [1022:1103] 01:00.0 VGA compatible controller [0300]: nVidia Corporation G98 [GeForce 8400 GS] [10de:06e4] (rev a1) 04:00.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch [10b5:8604] (rev ba) 05:01.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch [10b5:8604] (rev ba) 05:05.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch [10b5:8604] (rev ba) 06:00.0 USB Controller [0c03]: Device [1b21:1040] 07:00.0 IDE interface [0101]: Device [1b21:0611] (rev 01) 08:06.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ [10ec:8139] (rev 10) 08:0b.0 FireWire (IEEE 1394) [0c00]: Texas Instruments TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link) [104c:8023] 08:0c.0 Ethernet controller [0200]: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller [11ab:4320] (rev 13)# lspci -v -s 5:5 05:05.0 PCI bridge: PLX Technology, Inc. PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0 Bus: primary=05, secondary=07, subordinate=07, sec-latency=0 I/O behind bridge: 00007000-00008fff Memory behind bridge: d6100000-d61fffff Capabilities: [40] Power Management version 3 Capabilities: [48] MSI: Enable+ Count=1/4 Maskable+ 64bit+ Capabilities: [68] Express Downstream Port (Slot+), MSI 00 Capabilities: [a4] Subsystem: PLX Technology, Inc. PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch Capabilities: [100] Device Serial Number [EDITED] Capabilities: [fb4] Advanced Error Reporting Capabilities: [148] Virtual Channel Capabilities: [520] Access Control Services Capabilities: [950] Vendor Specific Information: ID=0001 Rev=0 Len=010 <?> Kernel driver in use: pcieport Kernel modules: shpchp# lspci -v -s 7:0 07:00.0 IDE interface: Device 1b21:0611 (rev 01) (prog-if 85 [Master SecO PriO]) Subsystem: Device 1b21:1060 Flags: fast devsel, IRQ 18 I/O ports at 7000 [size=8] I/O ports at 7400 [size=4] I/O ports at 7800 [size=8] I/O ports at 7c00 [size=4] I/O ports at 8000 [size=16] Memory at d6100000 (32-bit, non-prefetchable) [size=512] Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit- Capabilities: [78] Power Management version 3 Capabilities: [80] Express Legacy Endpoint, MSI 00 Capabilities: [100] Virtual Channel
Unclaimed device in lshw
I don't see any points on doing so, you want a Volume Group that contains both SATA and SSD, that's possible. Just create multiple PVs, with pvcreate /dev/partition_name And create a volume group that use those PVs, with vgcreate And do the partition of that VG.
Is it possible to create LVM partitions for both SSD and SATA hard disks? I mean if there isn't any conflicts.
LVM with SSD and SATA hard disks
I think you can get what you want by cross referencing the output from lshw -c disk and this command, udevadm info -q all -n <device>. For example My /dev/sda device shows the following output for lshw: $ sudo lshw -c disk *-disk description: ATA Disk product: ST9500420AS vendor: Seagate physical id: 0 bus info: scsi@0:0.0.0 logical name: /dev/sda version: 0003 serial: 5XA1A2CZ size: 465GiB (500GB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 signature=ebc57757If I interrogate the same device using udevadm I can find out what it's DEVPATH is: $ sudo udevadm info -q all -n /dev/sda | grep DEVPATH E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sdaThis string has all the info you're looking for regarding this device. The PCI address, "0000:00:1f.2", along with the SCSI address, "0:0:0:0". The SCSI address is the data in the 6th position if you break this data up on the forward slashes ("/").
I have a PCI-attached SATA controller connected to a (variable) number of disks on a machine with a Linux 2.6.39 kernel. I am trying to find the physical location of the disk, knowing the PCI address of the controller. In this case, controller is at address 0000:01:00.0, and there are two disks, with SCSI addresses 6:0.0.0.0 and 8:0.0.0 (though these last two aren't necessarily fixed, this is just what they are right now). lshw -c storage shows the controller and the SCSI devices (system disk and controller trimmed): *-storage description: SATA controller product: Marvell Technology Group Ltd. vendor: Marvell Technology Group Ltd. physical id: 0 bus info: pci@0000:01:00.0 version: 10 width: 32 bits clock: 33MHz capabilities: storage pm msi pciexpress ahci_1.0 bus_master cap_list rom configuration: driver=ahci latency=0 resources: irq:51 ioport:e050(size=8) ioport:e040(size=4) ioport:e030(size=8) ioport:e020(size=4) ioport:e000(size=32) memory:f7b10000-f7b107ff memory:f7b00000-f7b0ffff *-scsi:1 physical id: 2 logical name: scsi6 capabilities: emulated *-scsi:2 physical id: 3 logical name: scsi8 capabilities: emulatedlshw -c disk shows the disks: *-disk description: ATA Disk product: TOSHIBA THNSNF25 vendor: Toshiba physical id: 0.0.0 bus info: scsi@6:0.0.0 logical name: /dev/sdb version: FSXA serial: 824S105DT15Y size: 238GiB (256GB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=79a679b1-3c04-4306-a498-9a959e2df371 sectorsize=4096 *-disk description: ATA Disk product: TOSHIBA THNSNF25 vendor: Toshiba physical id: 0.0.0 bus info: scsi@8:0.0.0 logical name: /dev/sdc version: FSXA serial: 824S1055T15Y size: 238GiB (256GB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=79a679b1-3c04-4306-a498-9a959e2df371 sectorsize=4096However, there does not seem to be a way to go from the PCI address to the SCSI address. I have also looked under the sysfs entries for the PCI and SCSI devices and no been able to find an entry which makes the connection. When the disks are plugged into different physical ports on the controller, the SCSI address doesn't necessarily change, so this cannot be used with an offset to correctly determine the location of the disk. Listing disks by ID also doesn't work - ls -lah /dev/disks/by-path shows that the entry for pci-0000:01:00.0-scsi-0:0:0:0 points to /dev/sdc (or in general, the last disk connected), and there are no other paths that start in pci-0000:01:00.0 that aren't just links to partitions of that drive. Are there any other ways to map the controller address into something that can be used to locate the disks?
Match PCI address of SATA controller and SCSI address of attached disks
To see the device description for the controller (assuming an internal (PCI) controller), which usually contains SATA for SATA controllers: lspci -d $(cat /sys/block/sda/device/../../../vendor):$(cat /sys/block/sda/device/../../../device)If you want to type less, just browsing the output of lspci is likely to give you the answer in a laptop (many desktop have both kinds of interfaces so you'd have to look up the drive you're interested in). If that doesn't give you the answer, to see what driver is providing sda (you can then look up whether that driver is for a PATA or SATA controller): readlink -f /sys/block/sda/device/../../../driver
I have an ATA hard disk in my laptop, running Fedora 11, kernel 2.6.30.10-105.2.23.fc11.i586. I am looking to upgrade the disk in here (would love to get an SSD) but I forgot if it's a serial ATA or an old parallel ATA interface. There's not much use upgrading to an SSD if it's PATA... How can I tell if the disk is connected via a PATA or an SATA interface?
How can I tell if my hard drive is PATA or SATA?
Ok I guessing this is a udev issue (most Linux distros use this by default), this is what creates the symlinks. You can fix this by add a new rule. I will give some info on this, but it is largely anchored in my own distro - Debian. First off, you need to find where your rules are. Debian has them in two locations - /lib/udev/rules.d and /etc/udev/rules.d. If this is the case for you should only add/change the ones under /etc as changing another location is more likely to lead to being overwritten by an update. Go to the rules directory and see if you can find the file(s) with the rules for creating the links under disk/by-id. The command grep -r disk/by-id/ is going to help here (though only run it in the rules directory to avoid searching other places). For me the file is /var/lib/rules.d/60-persistent-storage.rules. Here are the lines that are creating the``disk/by-id/usb-*` links for me: ENV{DEVTYPE}=="disk", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"ENV{DEVTYPE}=="partition", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"There are two possibilities here (apart from the one where your system doesn't use udev at all):You have no line similar to this and you need to create one. You do, but it just doesn't work for you disk.The lines might look like gibberish, but basically the first two (really one as the \ is just a way of splitting long line) are for links relating to the disk itself, the other two are for its partitions. Hopefully running this command should make things less confusing: udevadm info --name=/dev/sdb --query=propertyThis shows the names/values of all the properties of your device. Basically all the rule does is go through all the properties of each device and matches them against the first part of the line (eg the first looks for devices with DEVTYPE=disk, and non-empty ID_BUS and ID_SERIAL). The next part creates a symlink with its name containing ID_BUS and ID_SERIAL. Anyway, what this boils down to is if you have ID_BUS=usb, you can probably go ahead and add the above rule. If not, you probably need to add specific rules for your device. Something like: ENV{ID_SERIAL}=="SAMSUNG_HM321HX_C5733G82AB0BPW", \ SYMLINK+="disk/by-id/usb-$env{ID_SERIAL}"ENV{ID_SERIAL}=="SAMSUNG_HM321HX_C5733G82AB0BPW", \ SYMLINK+="disk/by-id/usb-$env{ID_SERIAL}-part%n"I have guessed your ID_SERIAL from the question, if its wrong go ahead and put in the right one. The rules are probably best in a file of their own, something like s2-samsung-usb.rules in the directory you found at the start. Update: the below probably isn't necessary, just unplug and the plug the device in again - How to reload udev rules without reboot? Once you are done, you can reload the rules with (unplug your device first): udevadm control --reload-rulesThen plug in your device again. If this doesn't work, you can always try rebooting (in fact this may be safer anyway).
I have a S2 SAMSUNG 320GB USB-HDD which I use in both Ubuntu 13.10 (Kernel 3.11.0-17-generic) and Fedora 17. It works fine; I can read/write from/to them. Although, I am experiencing an issue with a software that deals with pen drive and other USB devices. This program tries to list the available devices by running the following: ls -l /dev/disk/by-id/usb*and returns nothing. So, I ran in terminal: ls -l /dev/disk/by-id/* and got this: ata-hp_DVDRAM_GT30L_KZEA6810820 ata-SAMSUNG_HM321HX_C5733G82AB0BPW ata-WDC_WD3200BEKT-60V5T1_WD-WX81A50J4370 wwn-0x50000f00ab0b000b wwn-0x50014ee20495cc9fin /dev/disk/by-uuid, my UBS-HDD is: 19ED-1878 -> ../../sdb My external HD is, so, listed as "ata-SAMSUNG...." and can not be found as "usb*...". I googled a lot about that. Found that editing /etc/fstab or /boot/grub/grub.conf would help me (haven't found anything related to my USB dev in grub.conf nor fstab). Or something like ZFS, zpool.. and even a tool that deals (only?) with the UUID, tune2fs. So, is it possible to change /dev/disk/by-id/ata-SAMSUNG... to ../../by-id/usb-SAMSUNG...? And if so, how?
Is there a way to change a device id in /dev/disk/by-id?
This is a known error in Samsung SSDs: The drives do not properly implement queued trim commands. However, Ubuntu (and probably most other Linux distributions) now implement trim as a cronjob to improve performance, so this is not of any practical concern. For more details, see the kernel bug on this: https://bugzilla.kernel.org/show_bug.cgi?id=72341 The reason the error did not appear in older kernels is that these do not try to use the buggy function of the drive, they thus never see the error. Even newer kernels (4.0 and forward) know that the drives have this error, so the error will not be shown for the drive in the future.
While investigating the issue with my SATA3 SSD drive being recognized as SATA2 (for some reason had to change SATA ports to fix it) I noticed the following messages when I run: $ dmesg | grep ata3.00 [ 0.980592] ata3.00: ACPI cmd ef/10:06:00:00:00:00 (SET FEATURES) succeeded [ 0.980594] ata3.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out [ 0.980596] ata3.00: ACPI cmd b1/c1:00:00:00:00:00 (DEVICE CONFIGURATION OVERLAY) filtered out [ 0.980712] ata3.00: supports DRM functions and may not be fully accessible [ 0.980795] ata3.00: failed to get NCQ Send/Recv Log Emask 0x1 [ 0.980797] ata3.00: ATA-9: SAMSUNG MZ7PD128HAFV-000H7, XXXXXXX, max UDMA/133 [ 0.980798] ata3.00: 250069680 sectors, multi 1: LBA48 NCQ (depth 31/32), AA [ 0.981070] ata3.00: ACPI cmd ef/10:06:00:00:00:00 (SET FEATURES) succeeded [ 0.981072] ata3.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out [ 0.981073] ata3.00: ACPI cmd b1/c1:00:00:00:00:00 (DEVICE CONFIGURATION OVERLAY) filtered out [ 0.981174] ata3.00: supports DRM functions and may not be fully accessible [ 0.981225] ata3.00: failed to get NCQ Send/Recv Log Emask 0x1 [ 0.981227] ata3.00: configured for UDMA/133My architecture: $ uname 3.13.8-1-ARCHMy concern is the line where it says that system failed to get NCQ Send/Recv Log Emask 0x1 Is this something I need to be concerned with? My system is Asrock Extreme4 mb with SAMSUNG MZ7PD128HAFV-000H7 SSD SATA3 drive on Arch Linux OS. Update 1 I run SysLinux on my machine and below is the output of the same command (no failure messages): root@sysresccd /root % dmesg | grep ata3 [ 1.166153] ata3: SATA max UDMA/133 abar m2048@0xf0336000 port 0xf0336200 irq 42 [ 1.470696] ata3: SATA link up 6.0 Gbps (SStatus 133 SControl 300) [ 1.471504] ata3.00: ACPI cmd ef/10:06:00:00:00:00 (SET FEATURES) succeeded [ 1.471507] ata3.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out [ 1.471710] ata3.00: ACPI cmd b1/c1:00:00:00:00:00 (DEVICE CONFIGURATION OVERLAY) filtered out [ 1.472032] ata3.00: supports DRM functions and may not be fully accessible [ 1.472166] ata3.00: ATA-9: SAMSUNG MZ7PD128HAFV-000H7, SN, max UDMA/133 [ 1.472359] ata3.00: 250069680 sectors, multi 1: LBA48 NCQ (depth 31/32), AA [ 1.472760] ata3.00: ACPI cmd ef/10:06:00:00:00:00 (SET FEATURES) succeeded [ 1.472761] ata3.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out [ 1.472762] ata3.00: ACPI cmd b1/c1:00:00:00:00:00 (DEVICE CONFIGURATION OVERLAY) filtered out [ 1.472920] ata3.00: supports DRM functions and may not be fully accessible [ 1.472946] ata3.00: configured for UDMA/133I compared SATA power profiles on both OSes under /sys/class/scsi_host/host(0-7) and they set to max_performance. What else can I check on both OSes and configure Arch so that this failure message would go away? Update 2 Looks like this issue only appears in newer kernels... I tried with Ubuntu Live CD 12.04, 13.10, and 14.04: I was able to see this issue in 14.04 but not in other 2 versions. I then run diff for the kernel config files but I can't figure out the exact change that affects me... Ubuntu 13.10 kernel config file Ubuntu 14.04 kernel config file
Possible issues with SSD SATA3 drive
Looks like an issue I also had. Two issues, in fact.The error message looks like the one I'm getting here. It is probably hardware related but I can't tell what it implies. As for the window manager not starting, it could be the logs filling up the system partition, not allowing Gnome to write in /tmp. I had this problem with Mate, with an explicit error message.Obviously, the root cause is the ATA error stuff, but assuming you don't know what to do about it and it does not seem to affect the machine (apart from the logs growing and growing), you'd like to avoid that partition being filled. I asked about this here. I didn't find any satisfying answer. Putting /var/log in a dedicated partition (or virtual filesystem) is the only safe solution I know.
Today I boot my laptop (HP pavilion dv6) running debian 7, and the window manager won't start. I just get over and over again errors as: [###.######] ata6: COMRESET failed (errno=-32) [###.######] ata6: COMRESET failed (errno=-32) [###.######] ata6: COMRESET failed (errno=-32) [###.######] ata6: reset failed, giving up [###.######] ata6: exception Emask 0x10 SAct 0x0 SErr 0x4000000 action 0xe frozen t2 [###.######] ata6: irq_stat 0x00000040, connection status changed [###.######] ata6: SError: { DevExch }and the window manager never starts. I have not been able to find out what is connected to ata6. Here is when it gets weird -to me at least-: I rebooted on an ubuntu pendrive, and everything is ok. I scanned the harddrive and it seems to be ok. I logged in (it let's me log in the terminal but the window manager won't start) and did $ dmesg | grep -i sata | grep up [###.######] ata1: SATA link up 3.0 Gpbs (SStatus 123 SControl 300)So apparently there is nothing on ata6. I also followed the instructions here to find out what was on ata6 but nothing. Maybe is the CDROM which is failing? Also, to me it was weird that this started happening today. So if I do $ sudo grep 'Nov 7' /var/log/kern.log | grep 'ata'I get nothing. But if I do $ sudo grep 'Nov 3' /var/log/kern.log | grep 'ata'I get a long list of errors. So this errors have been going on for a while, but only today it started to stop the window manager to starting up... How do I stop this error from not allowing me to start GNOME?
ATA error: COMRESET failed (errno=-32)
With FreeBSD 9+ the camcontrol utility can be used to control if either a SATA or a SCSI drive is disconnected, or not, in such circumstances: camcontrol negotiate /dev/<dev> -D disable
While accessing a drive with high error rates (as, for example, here for opensuse) in FreeBSD, the system eventually disconnects the drive and it disappears from /dev. This makes it impossible to run ddrescue or testdrive in any reasonable fashion.
How to prevent FreeBSD from disconnecting a drive device?
From what I can see, the Marvel; 88se9230 is supported in newer kernels (since 2013 and kernel 3.2 at least). See this bug report and these messages to the linux-ide mailing list. Based on the above, it should be supported by most recent distributions.
I have just purchased a SuperMicro X10SBA, where i intend to use the onboard Marvell 88SE923 SATA controller for RAID1. Unfortunately SuperMicro has written that RAID is only compatible on Windows platform. How do i determine that it is possible to run in linux, and how do you choose the right distribution that could make it less painful to get up running?
Drivers for Marvell 88SE9230 SATA controller on Linux
Partial answer: The kernel layers are a bit complex, and I can't give you a complete picture. Today, nearly all storage devices use some kind of SCSI commands (which why they show up as /dev/sdX instead of /dev/hdX), though that can be transported over different mechanisms (ATA packets, or USB, or others). So you need at least:The SATA driver for your particular hardware (possibly several modules, e.g. libahci) The generic ATA layer (possibly several modules, including libata) The generic SCSI layer, at least for the kind of storage devices you use (definitely several modules, including scsi_mod).I think the kernel should be able to figure out the minimal dependencies itself in menuconfig: If you first disable everything, and then enable only the bottom driver (hardware specific) and the top driver (SCSI disk, CONFIG_BLK_DEV_SD, module sd_mod) you'll likely end up with a pretty minimal workable configuration.
I am looking for the basic kernel drivers to enable SATA support. I have a Braswell (Intel SoC) setup and I would like to reduce the number of kernel drivers to a minimum. Does SATA support need the ATA drivers ? What about the SCSI drivers ? Or Device Mapper Support (from the RAID menu) ? It seems there is more than 10 different generic drivers needed to support SATA besides the manufacturer's driver. I am using the linux kernel 4.4 and I could not find much information in the Documentation. It seems that the ATA, SATA and SCSI menuconfig options are scattered across multiple sections. I guess the most important one is the libata driver, but it is unclear for me if they need the ATA or SCSI drivers Device Drivers ---> Serial ATA and Parallel ATA drivers (libata) --->I searched the subject but didn't find a clear answer. I liked this answer about the historical perspective of ATA and SCSI and how they can talk to each other. Also, would there be any major difference when enabling SATA for another SoC, like an ARM SoC, beside the vendor specific driver ? An ideal answer would refer to the specific options in menuconfig ! Thanks !
SATA: what linux kernel drivers are needed for basic support?
To answer the first question: Yes But anyway, it should be easy to generate a backup entry in your boot manager (with the original initrd and working kernel), in case something goes wrong. To answer the second one - you can use $ lsmod Module Size Used by ...On your running systems to see, if ata_generic is loaded and if it is, which modules depend on it (look at the used by column.
I don't have any IDE drives and my only SATA hard drive is running in AHCI mode, but my initrd image loads the pata_atiixp module. Is it safe to disable this module? And what about the ata_generic one?
Do I need pata_atiixp or ata_generic kernel modules on a SATA only system?
So obviously the libata.force disable kernel parameter setting is applied too late in the process. The ATA driver first tries to reset the device before it disables it. What has worked for me is to disable resets as well as the device with this kernel parameter libata.force=9:disable,9:norst,10:disable,10:norst. I am still getting a few kernel log entries for these devices but they don't bother me as long as nothing shows on the console and the system boots immediately: Nov 08 01:19:39 host kernel: ata9: FORCE: link flag 0x6 forced -> 0x6 Nov 08 01:19:39 host kernel: ata9: SATA max UDMA/133 abar m8192@0xfbffe000 port 0xfbffe100 irq 17 Nov 08 01:19:39 host kernel: ata10: DUMMY Nov 08 01:19:39 host kernel: ata9: SATA link down (SStatus 0 SControl 300)
My ASUS M4A87TD EVO board has two on-board disk controllers, one of them is a JMicron JMB361 with one old IDE disk connected. When I boot Arch Linux, it shows in the system journal like this: Nov 02 12:53:50 host kernel: ahci 0000:04:00.0: JMB361 has only one port Nov 02 12:53:50 host kernel: ahci 0000:04:00.0: AHCI 0001.0000 32 slots 2 ports 3 Gbps 0x3 impl SATA mode Nov 02 12:53:50 host kernel: ahci 0000:04:00.0: flags: 64bit ncq pm led clo pmp pio slum part Nov 02 12:53:50 host kernel: ata9: SATA max UDMA/133 abar m8192@0xfbffe000 port 0xfbffe100 irq 17 Nov 02 12:53:50 host kernel: ata10: SATA max UDMA/133 abar m8192@0xfbffe000 port 0xfbffe180 irq 17 Nov 02 12:53:50 host kernel: ata9: SATA link down (SStatus 0 SControl 300) Nov 02 12:53:50 host kernel: ata10: softreset failed (1st FIS failed) Nov 02 12:53:50 host kernel: ata10: softreset failed (1st FIS failed) Nov 02 12:53:50 host kernel: ata10: softreset failed (1st FIS failed) Nov 02 12:53:50 host kernel: ata10: limiting SATA link speed to 1.5 Gbps Nov 02 12:53:50 host kernel: ata10: softreset failed (1st FIS failed) Nov 02 12:53:50 host kernel: ata10: reset failed, giving upI don't know where devices ata9 and ata10 come from. There is only one IDE disk connected to that controller and it is initialized properly. The BIOS does not show anything relating to ata9 or ata10 (and it shouldn't because there is nothing connected there) and I haven't found any way to disable them in the BIOS. I thought I had found a way to disable detection of these two devices here: How to tell Linux Kernel > 3.0 to completely ignore a failing disk? but it hasn't made any difference. This is how I am booting the kernel: Nov 02 12:53:50 host kernel: Linux version 3.17.2-1-ARCH (builduser@thomas) (gcc version 4.9.1 20140903 (prerelease) (GCC) ) #1 SMP PREEMPT Thu Oct 30 20:49:39 CET 2014 Nov 02 12:53:50 host kernel: Command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=2cfdc373-7023-48d7-a90d-43d030af277b rw libata.force=9:disable,10:disable quietThe system manages to boot ultimately but the failing softresets annoyingly delay the boot process by at least 90 seconds.
Boot delay due to non-existent SATA disk
Problem was in wrong BIOS configuration. Solution (for my motherboard Z170-D3H) is go to BIOS > Peripherals > SATA Configuration and here enable Hot Plug option for each SATA port. Then save settings and restart computer. Now everything works properly!
Can you help me understand, why my SATA hotplug doesn't work? When I plug sata disk, lsblk doesn't change. There is only my system disk /dev/sda. I have linux: $ uname -aLinux Z170-D3H 4.9.0-3-amd64 #1 SMP Debian 4.9.25-1 (2017-05-02) x86_64 GNU/LinuxKernel settings: $ cat /boot/config-4.9.0-3-amd64 | grep HOTPLUG CONFIG_MEMORY_HOTPLUG=y CONFIG_MEMORY_HOTPLUG_SPARSE=y # CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE is not set CONFIG_HOTPLUG_CPU=y # CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set # CONFIG_DEBUG_HOTPLUG_CPU0 is not set CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ACPI_HOTPLUG_CPU=y CONFIG_ACPI_HOTPLUG_MEMORY=y CONFIG_ACPI_HOTPLUG_IOAPIC=y CONFIG_HOTPLUG_PCI_PCIE=y CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_ACPI=y CONFIG_HOTPLUG_PCI_ACPI_IBM=m CONFIG_HOTPLUG_PCI_CPCI=y CONFIG_HOTPLUG_PCI_CPCI_ZT5550=m CONFIG_HOTPLUG_PCI_CPCI_GENERIC=m CONFIG_HOTPLUG_PCI_SHPC=m CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y CONFIG_XEN_BALLOON_MEMORY_HOTPLUG_LIMIT=512 # CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set$ cat /boot/config-4.9.0-3-amd64 | grep SATA CONFIG_SATA_ZPODD=y CONFIG_SATA_PMP=y CONFIG_SATA_AHCI=m # CONFIG_SATA_AHCI_PLATFORM is not set # CONFIG_SATA_INIC162X is not set CONFIG_SATA_ACARD_AHCI=m CONFIG_SATA_SIL24=m CONFIG_SATA_QSTOR=m CONFIG_SATA_SX4=m # SATA SFF controllers with BMDMA # CONFIG_SATA_DWC is not set CONFIG_SATA_MV=m CONFIG_SATA_NV=m CONFIG_SATA_PROMISE=m CONFIG_SATA_SIL=m CONFIG_SATA_SIS=m CONFIG_SATA_SVW=m CONFIG_SATA_ULI=m CONFIG_SATA_VIA=m CONFIG_SATA_VITESSE=m$ cat /boot/config-4.9.0-3-amd64 | grep AHCI CONFIG_SATA_AHCI=m # CONFIG_SATA_AHCI_PLATFORM is not set CONFIG_SATA_ACARD_AHCI=mSATA controller: $ lspci | grep SATA00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA controller [AHCI mode] (rev 31)
Sata hotplug doesn't work
The steps I took to fix it:updated BIOS In the BIOS, diabled the SATA IDE Combined Mode with this help reading the kernel documentation about kernel parameters, since every solution online was about adding parameters to that. I found out that my SSD actually only supports SATA speed 3.0Gbps with a good shell script for i in `grep -l Gbps /sys/class/ata_link/*/sata_spd`; do echo Link "${i%/*}" Speed `cat $i` cat "${i%/*}"/device/dev*/ata_device/dev*/id | perl -nE 's/([0-9a-f]{2})/print chr hex $1/gie' | echo " " Device `strings` | cut -f 1-3 doneIn the grub configuration, set the SATA port of the SSD drive to maximum speed 3.0 vi /etc/default/grubchanged the parameter in this line to allow only 3Gbps for SATA port 7 (my SSD) GRUB_CMDLINE_LINUX_DEFAULT="libata.force=7:3.0G quiet"update grub and reboot update-grub rebootThe solution to this has come a long long way for me. I basically approached the whole problem every other day from scratch. The problems I found on the way where:I checked my SMART stats every day and compared. The error count didn't increase even though the exceptions kept being thrown. My SSD was actually the one causing the kernel exceptions, this script helped me lots to understand which ATA device was actually which hard drive in the case My SSD and two other drives where on a completely wrong speed setting (UDMA)root@msa-nas1:~# sudo hdparm -I /dev/sd{a,b,c,d,e,f,g} | grep -i udma DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5 udma6 DMA: mdma0 mdma1 mdma2 udma0 *udma1 udma2 udma3 udma4 udma5 udma6 DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5 udma6The dmesg log showed some strange messages about 40-wire cables, even though those don't really exist anymore, I bought two different NEW cables, nothing helped.[ 1.193091] ata5.01: ATA-8: SanDisk SD6SF1M128G1022I, X231200, max UDMA/133 [ 1.193095] ata5.01: 250069680 sectors, multi 1: LBA48 NCQ (depth 0/32) [ 1.193743] ata5.00: limited to UDMA/33 due to 40-wire cable [ 1.193746] ata5.01: limited to UDMA/33 due to 40-wire cableGrub loaded a funny kernel for the last two drives: pata_atiixp. I was expecting the AHCI driver.[ 1.022724] scsi4 : pata_atiixp [ 1.022834] scsi5 : pata_atiixp [ 1.022887] ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xf100 irq 14 [ 1.022888] ata6: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0xf108 irq 15I checked the power consumption and compared if it exceeded the power unit, it did not. Not even close. I replaced the SSD with exactly the same model from another machine. Excactly the same model. Still the same errors. The SSD!! was in fact incredibly slow, so the hdparm about the UDMA output was actually correct. root@msa-nas1:~# hdparm -t -T /dev/sdf /dev/sdf: Timing cached reads: 2144 MB in 2.00 seconds = 1072.18 MB/sec Timing buffered disk reads: 8 MB in 3.60 seconds = 2.22 MB/secI tried reaching out to SandDisk, it was their hard drive giving me the exceptions, without any success. I could really not find anyone with the exact same problem, but many people with similar problems, in the end I tried a few of those suggested solutions and it turned out to be a mix of a few things. Now it all makes perfectly sense to me, afterwards everyone knows better I guess.
I have a new system with debian (omv) a SSD hard drive for the OS and a software RAID 6 for the data. I only saw now that I have very regular exceptions in my syslog. I'm worried now, what could cause those exceptions. Is it a software problem or is actually some hardware faulty? Can you actually read anything from those logs? There is more exceptions in the syslog, but here an excerpt: Jul 19 07:48:51 msa-nas1 kernel: [485174.166986] ata5.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 Jul 19 07:48:51 msa-nas1 kernel: [485174.168522] ata5.01: failed command: WRITE MULTIPLE EXT Jul 19 07:48:51 msa-nas1 kernel: [485174.170003] ata5.01: cmd 39/00:00:00:cc:89/00:04:08:00:00/f0 tag 0 pio 524288 out Jul 19 07:48:51 msa-nas1 kernel: [485174.170003] res 51/84:00:00:cd:89/84:03:08:00:00/f0 Emask 0x10 (ATA bus error) Jul 19 07:48:51 msa-nas1 kernel: [485174.172996] ata5.01: status: { DRDY ERR } Jul 19 07:48:51 msa-nas1 kernel: [485174.174500] ata5.01: error: { ICRC ABRT } Jul 19 07:48:51 msa-nas1 kernel: [485174.176003] ata5: soft resetting link Jul 19 07:48:51 msa-nas1 kernel: [485174.355492] ata5.00: configured for UDMA/33 Jul 19 07:48:51 msa-nas1 kernel: [485174.364550] ata5.01: configured for PIO0 Jul 19 07:48:51 msa-nas1 kernel: [485174.364574] ata5: EH complete Jul 19 07:48:57 msa-nas1 kernel: [485180.175794] ata5.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 Jul 19 07:48:57 msa-nas1 kernel: [485180.177436] ata5.01: failed command: WRITE MULTIPLE EXT Jul 19 07:48:57 msa-nas1 kernel: [485180.179037] ata5.01: cmd 39/00:00:00:34:8a/00:04:08:00:00/f0 tag 0 pio 524288 out Jul 19 07:48:57 msa-nas1 kernel: [485180.179037] res 51/84:00:00:37:8a/84:01:08:00:00/f0 Emask 0x10 (ATA bus error) Jul 19 07:48:57 msa-nas1 kernel: [485180.182279] ata5.01: status: { DRDY ERR } Jul 19 07:48:57 msa-nas1 kernel: [485180.183907] ata5.01: error: { ICRC ABRT } Jul 19 07:48:57 msa-nas1 kernel: [485180.185524] ata5: soft resetting link Jul 19 07:48:57 msa-nas1 kernel: [485180.380318] ata5.00: configured for UDMA/33 Jul 19 07:48:57 msa-nas1 kernel: [485180.389391] ata5.01: configured for PIO0 Jul 19 07:48:57 msa-nas1 kernel: [485180.389407] ata5: EH complete Jul 19 07:48:58 msa-nas1 kernel: [485180.939900] ata5.01: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 Jul 19 07:48:58 msa-nas1 kernel: [485180.941736] ata5.01: failed command: WRITE MULTIPLE EXT Jul 19 07:48:58 msa-nas1 kernel: [485180.943533] ata5.01: cmd 39/00:00:00:3c:8a/00:04:08:00:00/f0 tag 0 pio 524288 out Jul 19 07:48:58 msa-nas1 kernel: [485180.943533] res 51/84:00:00:3e:8a/84:02:08:00:00/f0 Emask 0x10 (ATA bus error) Jul 19 07:48:58 msa-nas1 kernel: [485180.947169] ata5.01: status: { DRDY ERR } Jul 19 07:48:58 msa-nas1 kernel: [485180.948998] ata5.01: error: { ICRC ABRT } Jul 19 07:48:58 msa-nas1 kernel: [485180.950814] ata5: soft resetting link Jul 19 07:48:58 msa-nas1 kernel: [485181.128420] ata5.00: configured for UDMA/33 Jul 19 07:48:58 msa-nas1 kernel: [485181.137482] ata5.01: configured for PIO0 Jul 19 07:48:58 msa-nas1 kernel: [485181.137505] ata5: EH completeThanks for any help with this. EDIT: Alright, I exchanged the cable of one of the drive where I thought it was ata5, now I realize there are two ata5 drives: lrwxrwxrwx 1 root root 0 Jul 27 19:26 sde -> ../devices/pci0000:00/0000:00:14.1/ata5/host4/target4:0:0/4:0:0:0/block/sde lrwxrwxrwx 1 root root 0 Jul 27 19:26 sdf -> ../devices/pci0000:00/0000:00:14.1/ata5/host4/target4:0:1/4:0:1:0/block/sdfThe second one is a SSD drive directly connected to the mainboard. Any idea what options I have? Did smartctl checks on both drives. Both without any errors. EDIT2: assuming it's not the SSD causing the trouble, I exchanged the other drive and SATA cable with parts that are working without errors in another system. I still get the errors. How can a driver problem be identified, could the mainboard be faulty? EDIT3: found something in the SMART log of the SSD drive: 212 SATA_PHY_Error 0x0032 100 100 --- Old_age Always - 426What does the SATA PHY Error stand for?
What causes the ata exceptions in my syslog and how to solve them
ata2.00: ATA-8: ST2000DM001-1CH164, CC24, max UDMA/133ATA-8 is the version (SATA II). ST2000DM001-1CH164 is the device model number. CC24 is the device firmware version. UDMA/133 would be the speed, if this were a PATA device instead of SATA. ata2.00: 3907029168 sectors, multi 16: LBA48 NCQ (depth 31/32), AASector count should be obvious. Multi is the number of sectors that can be read/written in a single request. LBA48 means its using 48-bit logical block addressing (as opposed to 28-bit LBA, or the ancient cylinder-head-sector method). NCQ means it supports native command queuing. For the depth, if the host supports a greater-or-equal depth compared to the device, you'll only see one number—the device depth. Here, it's host depth (31), device depth (32), in that order. AA means the device is using SATA II auto-activate mode.
When the kernel boots, it prints out lines like this for each SATA device: [ 0.919450] ata2.00: ATA-8: ST2000DM001-1CH164, CC24, max UDMA/133 [ 0.919487] ata2.00: 3907029168 sectors, multi 16: LBA48 NCQ (depth 31/32), AAWhat do those fields mean?
What do the fields in the libata device probe line in dmesg mean?
As I ended replied to the original OP, you can always force an unmount with a lazy unmount umount -l <filesystem|partition>Nevertheless the thing about lazy umount is that it ignores the pending buffers to be written to that drive. I would recommend a script a sudo for the user or a group of users that run the app, that only allows to run a script to umount the drive, and that can be invoked by the app. Or even a key on the console programmed to to call a script. (if a physical server)
After removing a bay mounted SATA connected drive the kernel will most of the time remove the mount. However, sometimes the mount remains even though the disk has been removed. Is there a way to avoid this?
Hot Removed SATA drive mount remains
The Debian Wiki has an excellent entry describing what I required. Following this I made my own rules under /etc/udev/rules.d/20-disk-bay.rules. I have only included the first two sata port mappings as an example: # There are different DEVPATHs for major kernel versions! # Example for SATA N: # # Kernel < 3 DEVPATH # *1f.2/hostN/targetN:0:0/N:0:0:0* # # Kernel > 3 DEVPATH # *1f.2/ata(N+1)/host*########## Map SATA 0 to /dev/sdb ############### Kernel < 3KERNEL=="sd?", SUBSYSTEM=="block", DEVPATH=="*1f.2/host0/target0:0:0/0:0:0:0*", NAME="sdb", RUN+="/usr/bin/logger My disk ATTR{partition}=$ATTR{partition}, DEVPATH=$devpath, ID_PATH=$ENV{ID_PATH}, ID_SERIAL=$ENV{ID_SERIAL}", GOTO="END_20_PERSISTENT_DISK"KERNEL=="sd?*", ATTR{partition}=="1", SUBSYSTEM=="block", DEVPATH=="*1f.2/host0/target0:0:0/0:0:0:0*", NAME="sdb%n", RUN+="/usr/bin/logger My partition parent=%p number=%n, ATTR{partition}=$ATTR{partition}"# Kernel > 3KERNEL=="sd?", SUBSYSTEM=="block", DEVPATH=="*1f.2/ata1/host*", NAME="sdb", RUN+="/usr/bin/logger My disk ATTR{partition}=$ATTR{partition}, DEVPATH=$devpath, ID_PATH=$ENV{ID_PATH}, ID_SERIAL=$ENV{ID_SERIAL}", GOTO="END_20_PERSISTENT_DISK"KERNEL=="sd?*", ATTR{partition}=="1", SUBSYSTEM=="block", DEVPATH=="*1f.2/ata1/host*", NAME="sdb%n", RUN+="/usr/bin/logger My partition parent=%p number=%n, ATTR{partition}=$ATTR{partition}"########## Map SATA 1 to /dev/sdc ############### Kernel < 3KERNEL=="sd?", SUBSYSTEM=="block", DEVPATH=="*1f.2/host1/target1:0:0/1:0:0:0*", NAME="sdc", RUN+="/usr/bin/logger My disk ATTR{partition}=$ATTR{partition}, DEVPATH=$devpath, ID_PATH=$ENV{ID_PATH}, ID_SERIAL=$ENV{ID_SERIAL}", GOTO="END_20_PERSISTENT_DISK"KERNEL=="sd?*", ENV{DEVTYPE}=="partition", SUBSYSTEM=="block", DEVPATH=="*1f.2/host1/target1:0:0/1:0:0:0*", NAME="sdc%n", RUN+="/usr/bin/logger My partition parent=%p number=%n, ATTR{partition}=$ATTR{partition}"# Kernel > 3KERNEL=="sd?", SUBSYSTEM=="block", DEVPATH=="*1f.2/ata2/host*", NAME="sdc", RUN+="/usr/bin/logger My disk ATTR{partition}=$ATTR{partition}, DEVPATH=$devpath, ID_PATH=$ENV{ID_PATH}, ID_SERIAL=$ENV{ID_SERIAL}", GOTO="END_20_PERSISTENT_DISK" KERNEL=="sd?*", ATTR{partition}=="1", SUBSYSTEM=="block", DEVPATH=="*1f.2/ata2/host*", NAME="sdc%n", RUN+="/usr/bin/logger My partition parent=%p number=%n, ATTR{partition}=$ATTR{partition}"LABEL="END_20_PERSISTENT_DISK"The rules above will always map any drive placed in SATA port 0, the first physical SATA port on my motherboard, as /dev/sdb and any drive placed in SATA 1 as /dev/sdc Consistent physical port mappings are critical in my use case, as I have 5 RAID-1 arrays where the disks can be arbitrarily swapped out of their physical hotswap bays. A non-technical user can swap out these disks at any time without having to deal with device IDs - the system is fully autonomous and will not construct the RAID arrays over the wrong disks in the hotswap bays. This is a very specific use case.
I have a system with 10 SATA ports, and another SATA as the boot disk. The 10 SATA ports make up 5 software RAID1 arrays. The RAID disks may be removed between boots, and swapped in with arbitrary blank disks at any time. I need to ensure that /dev/sda is always my first physical SATA port, and /dev/sdj is always the tenth, for the RAID1 arrays to properly operate. If, for example, the first disk in the first port fails, that should be marked as a missing disk and so the disk in the next port should be /dev/sdb. Currently, the next available disk is mounted as /dev/sda – completely destroying my arrays and my boot configuration. Imagine a horrible scenario where every other disk fails, so each RAID1 array has only one working disk in its pair. The numbering should be:/dev/sda /dev/sdc /dev/sde /dev/sdg /dev/sdiNOT:/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sdeI have seen udev rules for labelling specific disks by UUIDs, but since users will be hotswapping disks arbitrarily this is not convenient at all. By default Linux will label the next available disk with the next alphabetical character. There are many situations where a single broken disk will break multiple RAID 1 arrays.How can I map a device to a specific hardware interface? Is this even possible? Is it possible to have a "missing" device on boot, so subsequent devices do not get labelled incorrectly ?
How to map a SATA device name to a physical SATA interface for RAID systems
I found a workaround for mounting devices as a user. A static line in /etc/fstab permits to mount/umount without being root : /dev/sdc1 /mnt/sdc1 auto defaults,user,rw,utf8,noauto,umask=000 0 2If /dev/sdc1 device & /mnt/sdc1 directory both exist, running either mount /dev/sdc1 or mount /mnt/sdc1 will mount the device on the directory. Note that this workaround is valid for any GNU/Linux distribution. Adding the following to the /etc/nixos/configuration.nix will generate the above /etc/fstab-line for NixOS : fileSystems."/mnt/sdc1" = { device = "/dev/sdc1"; fsType = "auto"; options = [ "defaults" "user" "rw" "utf8" "noauto" "umask=000" ]; };
In for example Thunar I can just click on an external USB drive to mount it under /run/media/$USER/[something]. The fact that the mount point is created dynamically is a great side effect. But for any drives which are on the SATA bus I'm toldmount: only root can do thatorNot authorized to perform operation.How do I configure internal drives to work like USB drives in this respect?
How to mount internal drives as a normal user in NixOS?
fdisk is a userspace tool, if kernel fails to recognize the device fdisk can do nothing about it. After you connect the disk, check dmesg or journalctl, you should see something similar to kernel: scsi 3:0:0:0: Direct-Access ATA Samsung SSD 860 2B6Q PQ: 0 ANSI: 5 kernel: sd 3:0:0:0: Attached scsi generic sg0 type 0 kernel: ata4.00: Enabling discard_zeroes_data kernel: sd 3:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB) kernel: sd 3:0:0:0: [sda] Write Protect is off kernel: sd 3:0:0:0: [sda] Mode Sense: 00 3a 00 00 kernel: sd 3:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA kernel: sda: sda1 kernel: sd 3:0:0:0: [sda] Attached SCSI diskand also /dev/sdX node and sysfs directory /sys/block/sdX should be created. At this point UDev and tools that use it like lsblk should be able to recognize it as a disk and will try to work with it (check for partitions/filesystems etc.). If you see something like kernel: print_req_error: I/O error, dev sda, sector 0 kernel: Buffer I/O error on dev sda, logical block 0, async page readit's usually a good indication that something is wrong with the disk. It doesn't necessary means it is completely broken, it still can be problem with controller or cable and it doesn't mean the data from it cannot be restored. So if you don't have the device node (/dev/sdX) and you need to be sure data are "wiped" from it, I guess you'll need to physically destroy the disk to be 100 % sure (but I have no idea what is the correct government process for that). You can always try connecting the disk to a different system or using an USB enclosure as @schrodigerscatcuriosity suggested. This could at least eliminate some cable or motherboard SATA controller issues.
I've found countless threads started by others where they can't boot from a device because they are using the wrong SATA configuration. Let me assure you this is not my issue. I work in an IT dept for a company and I have SSDs that I need to wipe. I have created my own Ubuntu machine complete with dcfldd and hdparm (even though I physically break the HDDs). I have several USB to SATA readers connected to the computer to easily swap connected drives to be wiped. ALL of the SSDs we wipe were initially imaged in the SATA AHCI configuration. When I run fdisk -l in terminal I occasionally run into an SSD that does not get listed. I've disconnected the drives and tried them in a different SATA reader only to get the same result. The SATA pins on the SSD are not damaged or bent. I've tried using the command hdparm -I /dev/(drive) in an attempt to view information of the drive to see if it's locked/frozen/etc but the command fails. Internet searches yield no results for how to troubleshoot/fix the issue I have or force the connected drive to get wiped despite it not being recognized by the system.I humbly have the two following requests for any data gurus who may stumble upon this issue:I'd love to learn why some of the drives are not being recognized and are inaccessible. If it's likely due to a failed drive, is there something I can do to verify this? What are my alternatives for wiping these drives that aren't being recognized? I need to securely clear the company data. Being able to verify the data is destroyed is a plus.EDIT: I don't want to confuse anyone. I follow the US government's protocol and use the command for n in 'seq 7'; do dcfldd if=/dev/urandom of=/dev/destination bs=8b conv=notrunc; doneto make the data of the drives unrecoverable. Again, the issue is that /dev/sda is Ubuntu, and drives /dev/sdb - /dev/sdf are the SSDs I am wiping. At times any number of those drives are not listed so the command I use to wipe them does nothing to them. Using commands of this nature are not alternatives to the method I am currently using to wiping the drives. Also, connecting these drives directly to a SATA cable on the motherboard does not make them recognizable for any live-boot USB.
Why doesn't fdisk -l not show all connected drives?
Old system and new disks? If the system's power supply is also old, it might be having problems keeping the voltages stable - and when the hard disks experience brief power "brown-outs", they reset and report errors to the operating system. If you can, try borrowing a new PSU from somewhere and using it to run the system for a while. If replacing the PSU causes the errors to not happen any more, then the old PSU is starting to die.
I have a fairly old system board from 2010 and two newer hard drives (HGST 6-TB) running CentOS. I repeatedly get the following errors in the dmesg output for each hard drive (proceeded by a loud clicking sound). ata14: lost interrupt (Status 0x50) ata14.00: exception Emask 0x10 SAct 0x0 SErr 0x40d0002 action 0xe frozen ata14: SError: { RecovComm PHYRdyChg CommWake 10B8B DevExch } ata14.00: failed command: READ DMA EXT ata14.00: cmd 25/00:08:a8:d9:30/00:00:46:02:00/e0 tag 0 dma 4096 in ata14.00: status: { DRDY } ata14: hard resetting link ata14: SATA link up 3.0 Gbps (SStatus 123 SControl 300) ata14.00: configured for UDMA/133 ata14.00: device reported invalid CHS sector 0 ata14: EH completeWhat could this be?
Disk Error: failed command: READ DMA EXT
I was looking into something similar in the past - changing the order of the disks and the network cards for a monolithic kernel. The order how the drivers are loaded gets decided during compilation - by initcall_levels (from lower to higher, include/linux/init.h) and then by positions in the Makefiles. I do not think there is much room for playing with initcall_levels - there are too many dependencies. SATA level 4 in drivers/ata/libata-core.c at subsys_initcall(ata_init) MEGASAS level 6 in drivers/scsi/megaraid/megaraid_sas_base.cat module_init(megasas_init) Pointers in System.map: ffffffff829545cd t megasas_init ffffffff8295547c t ata_init ffffffff829e7688 t __initcall_megasas_init6 ffffffff829e8288 t __initcall_ata_init4Changing the order in the Makefile should be an option, for example in drivers/net/ethernet/intel/Makefile switching the lines for e1000 and e1000e will change the order for eth0 and eth1 (using net.ifnames=0) obj-$(CONFIG_E1000) += e1000/ obj-$(CONFIG_E1000E) += e1000e/So in drivers/Makefile moving ata before scsi obj-$(CONFIG_ATA) += ata/ obj-y += scsi/should change the order of the host controllers (SATAs first). Check by ls -l /sys/class/scsi_host/ lsscsiBut even when having SATA as host0 the disks at LSI controller were found first, I am not sure how the asynchronous SCSI probe works, but adding a little delay (e.g. 700 ms) somewhere at the beginning of megasas_init() in drivers/scsi/megaraid/megaraid_sas_base.c made the SATA disk to be /dev/sda static int __init megasas_init(void) { int rval; msleep(700); ...I hope it does not cause any issues in the kernel, it worked for me but be careful. Of course there are dependencies, not everything is possible. For example I know when I tried mptsas (drivers/message/fusion/) before scsi, it would compile, but the kernel immediately crashed at boot. Hope this helps.
I have onboard SATA controller, and also an additional RAID controller card: 00:17.0 SATA controller: Intel Corporation Device a282 ... 04:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS-3 3108 [Invader] (rev 02)When linux kernel boots, disks connected on the LSI raid controller are recognized/enumerated first (sda,sdb,...), and disk hanging on the SATA controller after that (sde). My kernel is monolithic, without loadable modules. Is it possible to tell the kernel, the disk on the SATA controller should be first (sda) ? What affects the order? Is this just an accident, that LSI raid is recognized first, or can this be changed?
change order of SATA and RAID controller when booting linux kernel
The default order in which sda, sdb, sdc are assigned is unpredictable. But it can be overridden through udev. You can control the name of the block device files by adding directives in /etc/udev/rules.d/local.rules (some (older?) systems may only support /etc/udev/rules.conf). Better, you can add directives to create symbolic links, and use those symbolic links in your fstab. You can match by driver, by serial number, or call external programs to read things like filesystem UUIDs. The official documentation is a bit dry; if you need to write udev rules, you may prefer to start with a tutorial. KERNEL=="sd*", DRIVERS="ahci", SYMLINK+="sata"If you're using LVM exclusively on a drive, it doesn't matter what the letter the block device for the disk uses: you'll just be using the volume names. (That's one of the major advantages of LVM.) If you look in /dev/disk/by-*, you'll see various ways of naming disks that are part of udev's default setup: /dev/disk/by-id (disk serial number and more), /dev/disk/by-label (filesystem or other label), /dev/disk/by-path (SCSI IDs and so on), /dev/disk/by-uuid (filesystem UUIDs and the like). These may be sufficient for your purposes. It's better to match filesystem labels or UUIDs than disk serial numbers, because those don't change if you crash a disk in a RAID array or restore from a byte-for-byte copy (or, for labels, make label restoration part of your recovery procedure). You can use filesystem UUIDs directly in /etc/fstab: use UUID=01234567-89ab-cdef-0123-456789abcdef in the first field, instead of a block device path.
I have an HP xw8200 workstation running linux with two small, fast SCSI drives hooked up to the onboard LSI SCSI controller. The drives get labeled /dev/sda & /dev/sdb in /dev, respectively. I have a large SATA disk that I want to add to the system to store data, but every time I connect it, it's /dev gets assigned sda & the two scsi drives are assigned sdb,c, which messes with the boot procedure. How can I get this SATA drive to use sdc? Or what's the quickest way to get this set up?
Devices get renamed when SATA disk attached
You're likely seeing a limitation of PATA: two drives share the same bus (channel), and only one can be actively using it at a time. Busy processing a command with the host waiting for the result counts as using it. I've seen some drives that immediately return after hdparm --security-erase and process the command "offline", others hdparm does not return until the command is done. I suspect the former drives would allow master & slave to to both be doing it at once. Note this did sort of improve over the many years PATA was in use; and mostly the improvements went to where it matters: read and write commands. And dd can do both drives even if they're ancient because its not one write command, it's many, many write commands. (On truly ancient drives, it's actually taking turns — write some sectors to one drive, write some sectors to the other; newer modes allow the drives to receive the write command, buffer it, and process it "off-line" freeing the bus, that way both drives can be writing at the same time). (BTW: This is also why when you had PATA drives in RAID arrays, both mirrors needed to be on different buses. Either the master or slave failing would often take out the bus.) If you have multiple PATA channels (or buses, or whatever you call them), each should be able to handle a drive doing a security erase, concurrently. I've successfully used USB PATA interfaces to invoke secure erase (and dd as well, I personally do both); and of course it's trivial and fairly cheap to add more USB devices. At least for the security erase, which doesn't take USB bandwidth. SATA, of course, is point-to-point, there isn't a shared bus with multiple drives. So this issue doesn't exist.
When issuing the ATA secure erase command via hdparm against multiple SATA (non-SSD) drives it occurs in parallel. However when the same command is issued against PATA drives, it occurs consecutively. For example the second PATA drive does not commence its process until the first process has completed. Is the ATA Secure Erase command limited by a single PATA channel? If yes, why would it be since its an internal routine of the drive controller? Can it be overcome with independent IDE channels? Note in issuing the dd command to wipe the drive, it occurs in parallel. PATA drives have historically been is use in aging and legacy devices that are now being decommissioned. The requirement is to securely wipe the drives as they contained sensitive data such as personally identifiable information.
Why does ATA Secure Erase occur concurrently rather than in parallel with PATA drives?
Your SATA controller gives error messages back for the read and write commands. The error is timeout, which says that the controller can't communicate with your hard disks, more exactly it doesn't get answer from them. The most likely cause of the problem is contact problem with your SATA cables. Check with other hard disk, other cable, plug the cable into different slots and so on.
Where is this error coming from?
Boot Error: Emask 0X0 SAct 0X0 SErr 0X0 action 0X6 frozen
Most SATA controllers on PC-style (i.e. amd64 or i386) hardware are PCI-e (or PCI for older machines) devices, so you need PCI support for the kernel to see the SATA controllers. This is no big deal because almost everything else on your motherboard (including built-in sound card and ethernet interfaces) will be PCI or PCI-e, so you're going to need PCI support compiled in anyway. Similarly, most USB controllers are PCI or PCI-e devices. And it's not at all uncommon for devices like DVB (TV) interfaces to be USB devices connected to a PCI or PCI-e bridge card, so they'll also show up as PCI devices with lspci. This is why lspci lists both your USB controllers and your SATA controllers. e.g. on my Asus Sabertooth 990FX motherboard: # lspci | grep -iE 'sata|usb' 00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] (rev 40) 00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller 00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller 00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller 00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller 00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller 00:16.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller 00:16.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller 03:00.0 USB controller: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller 04:00.0 USB controller: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller
I have a question regarding the support for SATA ssd drives in the Linux Kernel. I read on the internet that one should enable PCI support for proper usage of the sata drives. Could someone please explain why? For me PCI and SATA are two different things. Another collateral question is why (list pci) lspci lists both sata and usb devices?! Thanks.
SATA ssd drives
As a rule of thumb, always turn off fakeraid (RAID which is declared in the BIOS but actually performed by an OS driver). Fakeraid only exists for two reasons:because some OSes have no native RAID capabilities and need some external assistance; because it lets hardware manufacturers advertise a feature that they aren't really implementing.There is no advantage of fakeraid over Linux RAID, only downsides such as the reliance on a specific driver and hardware. With some motherboards (or more precisely with some RAID BIOSes), you can't turn off RAID modes if the drives contain a valid RAID signature. You need to wipe off this signature. Boot from a Linux CD and zero out the first few kilobytes and the last few kilobytes of the disk (or the whole disk, if you have time to spare). Note that this will remove all the data on the drive; if you want to save some data, you will probably need a more complex strategy involving temporarily removing the drives (or plugging them in the non-RAID SATA ports). Then reboot and go back into the BIOS, and you should see an extra option that lets you really turn off RAID.
I have an ASUS P5Q deluxe from an old gaming computer that I'm converting to a server. Unfortunately, while their silly onboard fake RAID thing(drive xpert) worked fine in Windows, the drives are not being detected at all when I attempt to install openSUSE to them. I've tried disabling it and setting it to "normal" but still no luck. The other SATA ports are detected without issue, but they're for my storage drives. Eventually I decided the better option might be a pcie SATA card, but I'm not positive it will solve my problem: Will I be able to install to drives attached through a PCIE card? If so is there a specific card anybody could recommend?
Installing to a PCIE sata card
I solved the problem. It turns out that the SATA gets lined up first in the drive list (sda, etc.) on that motherboard when it is used, and the MB is first when no adapter card is used. This was confusing, but once I realized it, I needed a solution to specify a specific drive, no matter what the drive was called in a given boot. So I had to specify the drive I wanted to boot off of which might be sda with no adapter and sde with the adapter. Using a UUID specification allowed a consistent reference to the disk that I wanted to boot off of. My original post is not exactly accurate as to what was happening, however others have had similar problems and emailed me on other sites, and indicated that the UUID specification worked for them. So I understand that the question is disjoint from the answer, but I have addressed this in the interest of helping others similarly situated.
I have a Syba SI-PEX-40064 SATA adapter I am trying to install on a Slackware box with a ASRock G41M-S3 motherboard. After boot, I can see the interface with lspci, but it doesn't seem to have been recognized according to syslog and messages. The Slackware version is 14.0 Any pointers on where I can get info to debug this?
I am trying to figure out why a Marvell 88C9215 SATA adapter wont work with Slackware
Looking in /media is a reasonable way to find hotplug block devices. You can also use lsblk to list the block devices and whether they are hotpluggable: $ lsblk -l -p -o name,rm,hotplug,mountpoint NAME RM HOTPLUG MOUNTPOINT /dev/sda 0 0 /dev/sda1 0 0 / /dev/sda2 0 0 [SWAP] /dev/sda3 0 0 /home /dev/sdc 0 1 /dev/sdc1 0 1 /dev/sdc2 0 1 /dev/sdc3 0 1 /media/wd3 /dev/sdc4 0 1 /dev/sdd 1 1 /dev/sdd1 1 1 /media/clipThis shows that /dev/sdc is probably an external device (HOTPLUG=1), and that a partition is mounted on /media/wd3. Also there's another device on /media/clip. The RM column means removable, which sometimes applies to sd card readers, though in this case it is actually just a usb flash key. You can also use findmnt to get from a directory name to the name of the device it is on: $ findmnt -n -o source -T /media/wd3/my/sub/dir /dev/sdc3
I need to list all mount points associates to external storage devices such as USB keyfobs and SATA external drives. The only way I found under Ubuntu, is to call 'mount' and grep for '/media'. But I wonder if there is a better, more universal way. All this from the command line interface (terminal/bash).
List of mount points of external storage devices such as USB keyfobs and SATA external drives, from the cli
Could be down to a bad USB cable or/and insufficient/missing external power source. Some USB ports are simply too underpowered to drive a HDD.
My SATA HD used as an external disk connected to a USB port is not working. When I try to format it using sudo mkfs.ext4 /dev/sdj1, I get: "Input/output error while writing out and closing file system". In dmesg, I see [ 3819.478357] usb 4-3: USB disconnect, device number 47 [ 3819.478535] xhci_hcd 0000:00:14.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state. [ 3819.498268] blk_update_request: I/O error, dev sdj, sector 487239680 op 0x1:(WRITE) flags 0x4000 phys_seg 256 prio class 0 [ 3819.498366] blk_update_request: I/O error, dev sdj, sector 487241728 op 0x1:(WRITE) flags 0x4000 phys_seg 256 prio class 0 [ 3819.498432] blk_update_request: I/O error, dev sdj, sector 2048 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0 [ 3819.498444] Buffer I/O error on dev sdj1, logical block 0, lost async page write [ 3819.498450] Buffer I/O error on dev sdj1, logical block 1, lost async page write [ 3819.498453] Buffer I/O error on dev sdj1, logical block 2, lost async page write [ 3819.498455] Buffer I/O error on dev sdj1, logical block 3, lost async page write [ 3819.498458] Buffer I/O error on dev sdj1, logical block 4, lost async page write [ 3819.498461] Buffer I/O error on dev sdj1, logical block 5, lost async page write [ 3819.498463] Buffer I/O error on dev sdj1, logical block 6, lost async page write [ 3819.498466] Buffer I/O error on dev sdj1, logical block 7, lost async page write [ 3819.498514] blk_update_request: I/O error, dev sdj, sector 487243776 op 0x1:(WRITE) flags 0x4000 phys_seg 256 prio class 0 [ 3819.500108] blk_update_request: I/O error, dev sdj, sector 2528 op 0x1:(WRITE) flags 0x4800 phys_seg 2048 prio class 0 [ 3819.500114] Buffer I/O error on dev sdj1, logical block 480, lost async page write [ 3819.500117] Buffer I/O error on dev sdj1, logical block 481, lost async page write [ 3819.500927] blk_update_request: I/O error, dev sdj, sector 487245824 op 0x1:(WRITE) flags 0x4000 phys_seg 256 prio class 0 [ 3819.502469] blk_update_request: I/O error, dev sdj, sector 4576 op 0x1:(WRITE) flags 0x4800 phys_seg 2048 prio class 0 [ 3819.503514] blk_update_request: I/O error, dev sdj, sector 487247872 op 0x1:(WRITE) flags 0x4000 phys_seg 256 prio class 0 [ 3819.505103] blk_update_request: I/O error, dev sdj, sector 6624 op 0x1:(WRITE) flags 0x4800 phys_seg 2048 prio class 0 [ 3819.505902] blk_update_request: I/O error, dev sdj, sector 487249920 op 0x1:(WRITE) flags 0x4000 phys_seg 256 prio class 0 [ 3819.742439] sd 9:0:0:0: [sdj] Synchronizing SCSI cache [ 3819.742459] sd 9:0:0:0: [sdj] Synchronize Cache(10) failed: Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK [ 3820.014442] usb 4-3: new SuperSpeed USB device number 48 using xhci_hcdI can I find out if the problem lies on the disk or in the SATA-to-USB adapter if I don't have other disks and adapters to test?
External HDD disconnects when formating. Disk or SATA-to-USB adapter problem?
Seems like your extra sata ports might not be bios enabled or supported by the kernel? Dunno your hardware. To test things, get something that does USB to SATA (such as en enclosure or temporary cable). Use this to verify that your drive works. If your drive works, then those sata ports don't work for you.
I have a TrueNAS Mini E (running FreeBSD 11.3-RELEASE-p14), which comes pre-configured with seven drives: 4 3.5" for main storage, two SSD caches, and a boot disk. The hardware has two more SATA ports on it, so I plugged in an 8th drive. But I can't get FreeBSD to recognize the drive. It doesn't show up in dmesg nor in camcontrol devlist. I've tried different SATA cables, rebooting, (although the main drives are hot-swappable), etc. I’m not sure if I need to tell FreeBSD to look for more attached drives, or what. # lspci 00:00.0 Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev 11) 00:04.0 Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers (rev 11) 00:05.0 Generic system peripheral [0807]: Intel Corporation Atom Processor C3000 Series Root Complex Event Collector (rev 11) 00:11.0 PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root Port #7 (rev 11) 00:12.0 System peripheral: Intel Corporation Atom Processor C3000 Series SMBus Contoller - Host (rev 11) 00:13.0 SATA controller: Intel Corporation Atom Processor C3000 Series SATA Controller 0 (rev 11) 00:14.0 SATA controller: Intel Corporation Atom Processor C3000 Series SATA Controller 1 (rev 11) 00:15.0 USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI Controller (rev 11) 00:16.0 PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN Root Port #0 (rev 11) 00:17.0 PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN Root Port #1 (rev 11) 00:18.0 Communication controller: Intel Corporation Atom Processor C3000 Series ME HECI 1 (rev 11) 00:1f.0 ISA bridge: Intel Corporation Atom Processor C3000 Series LPC or eSPI (rev 11) 00:1f.2 Memory controller: Intel Corporation Atom Processor C3000 Series Power Management Controller (rev 11) 00:1f.4 SMBus: Intel Corporation Atom Processor C3000 Series SMBus controller (rev 11) 00:1f.5 Serial bus controller [0c80]: Intel Corporation Atom Processor C3000 Series SPI Controller (rev 11) 01:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge (rev 04) 02:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 41) 03:00.0 Ethernet controller: Intel Corporation Ethernet Connection X553 1GbE (rev 11) 03:00.1 Ethernet controller: Intel Corporation Ethernet Connection X553 1GbE (rev 11) 05:00.0 Ethernet controller: Intel Corporation Ethernet Connection X553 1GbE (rev 11) 05:00.1 Ethernet controller: Intel Corporation Ethernet Connection X553 1GbE (rev 11)# camcontrol devlist <WDC WD40EFRX-68N32N0 82.00A82> at scbus0 target 0 lun 0 (pass0,ada0) <WDC WD40EFRX-68N32N0 82.00A82> at scbus1 target 0 lun 0 (pass1,ada1) <WDC WD40EFRX-68N32N0 82.00A82> at scbus2 target 0 lun 0 (pass2,ada2) <WDC WD40EFRX-68N32N0 82.00A82> at scbus3 target 0 lun 0 (pass3,ada3) <Micron 5200 MTFDDAK480TDC D1MU020> at scbus4 target 0 lun 0 (pass4,ada4) <Micron 5200 MTFDDAK480TDC D1MU020> at scbus5 target 0 lun 0 (pass5,ada5) <AHCI SGPIO Enclosure 2.00 0001> at scbus6 target 0 lun 0 (pass6,ses0) <16GB SATA Flash Drive SFDK004A> at scbus7 target 0 lun 0 (pass7,ada6) <AHCI SGPIO Enclosure 2.00 0001> at scbus8 target 0 lun 0 (pass8,ses1)# dmesg | grep SATA ahci0: <Intel Denverton AHCI SATA controller> port 0xe090-0xe097,0xe080-0xe083,0xe040-0xe05f mem 0xdfb36000-0xdfb37fff,0xdfb3d000-0xdfb3d0ff,0xdfb3c000-0xdfb3c7ff irq 20 at device 19.0 on pci0 ahci1: <Intel Denverton AHCI SATA controller> port 0xe070-0xe077,0xe060-0xe063,0xe020-0xe03f mem 0xdfb34000-0xdfb35fff,0xdfb3b000-0xdfb3b0ff,0xdfb3a000-0xdfb3a7ff irq 21 at device 20.0 on pci0 ses0: (none) in 'Slot 00', SATA Slot: scbus0 target 0 ses0: (none) in 'Slot 01', SATA Slot: scbus1 target 0 ses0: (none) in 'Slot 02', SATA Slot: scbus2 target 0 ses0: (none) in 'Slot 03', SATA Slot: scbus3 target 0 ses0: (none) in 'Slot 04', SATA Slot: scbus4 target 0 ses0: (none) in 'Slot 05', SATA Slot: scbus5 target 0 ada0: <WDC WD40EFRX-68N32N0 82.00A82> ACS-3 ATA SATA 3.x device ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ses1: (none) in 'Slot 05', SATA Slot: scbus7 target 0 ada1: <WDC WD40EFRX-68N32N0 82.00A82> ACS-3 ATA SATA 3.x device ada1: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada2: <WDC WD40EFRX-68N32N0 82.00A82> ACS-3 ATA SATA 3.x device ada2: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada3: <WDC WD40EFRX-68N32N0 82.00A82> ACS-3 ATA SATA 3.x device ada3: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada4: <Micron 5200 MTFDDAK480TDC D1MU020> ACS-3 ATA SATA 3.x device ada4: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada5: <Micron 5200 MTFDDAK480TDC D1MU020> ACS-3 ATA SATA 3.x device ada5: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada6: <16GB SATA Flash Drive SFDK004A> ACS-2 ATA SATA 3.x device ada6: 600.000MB/s transfers (SATA 3.x, UDMA5, PIO 512bytes)Any suggestions? Thanks!
Getting FreeBSD to recognize a 8th SATA drive?
with hdparm To find out about the host protected area, use hdparm's -N option, for example sudo hdparm -N /dev/sdayields this on my machine: /dev/sda: max sectors = 1953529856/1953529856, HPA is disabledWith --dco-identify we can find out about the device configuration overlay. sudo hdparm --dco-identify /dev/sdaExample output: /dev/sda: DCO Checksum verified. DCO Revision: 0x0002 The following features can be selectively disabled via DCO: Transfer modes: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 udma6 Real max sectors: 1953529856 ATA command/feature sets: SMART error_log security 48_bit WRITE_UNC_EXT SATA command/feature sets: interface_power_management SSPLet's focus on this line: Real max sectors: 1953529856Comparing this number with the "max sectors" line of hdparm -N, we can see that there is no sector hidden using DCO: 1953529856 - 1953529856 = 0
I'd like to know whether any sectors on my solid state drive are inaccessible due tothe host protected area (HPA) or the device configuration overlay (DCO)Is there a file in /proc/ I can read or any tool I can use to find out about HPA and DCO? I'm on Arch Linux 5.9.14.
Check for host protected area and device configuration overlay
Hard disk errors ata error messages are caused by hardware errors from the disk controller. Errors such as the following are caused by failure to read correctly from the hard disk: sd 4:0:0:0: [sda] Sense Key : Aborted Command [current] [descriptor] May 26 14:05:21 centos kernel: Descriptor sense data with sense descriptors (in hex): May 26 14:05:21 centos kernel: 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00 Since you already replaced the SATA cable, we can rule that out as a cause. The disk is failing and will need to be replaced. I’ve had such intermittent errors in the past only for the disk to eventually fail completely. I’d replace the hard disk and in the mean time, ensure that current data is securely backed up to avoid data loss. Filesystem check Since the problems are at the disk level rather than the filesystem, running fsck won’t resolve the underlying issues. However, it should still be worth doing – to get information on (and to help maintain) the integrity of your filesystem. You can enforce a file system check when starting by modifying the sixth field (fs_passno) in your /etc/fstab. Change the fs_passno from 0 to 1 for the root filesystem and to 2 for other filesystems (see man fstab for more details).
my Centos 6 server has been playing recently in that it seems to freeze up and lose network access. I've been getting a load of ata5 error messages in the log and after some digging have determined that the drive is sda, the root filesystem. Another post with similar issues suggested changing the SATA cable, which i've done but the errors still persist. I've also set fsck to run at each boot up (as it's the root filesystem) although i'm not sure it's running as there's nothing appearing on screen during boot to suggest it's running (should there be?). I basically set the maximum mount count to 1 with tune2fs. Sometimes the system works fine, but i went away for a couple of days over the weekend and it was dead on my return. A simple hard reset brought it back again, but obviously I need to get to the bottom of it. May 26 14:05:21 centos kernel: ata7: SATA link up 3.0 Gbps (SStatus 123 SControl 300) May 26 14:05:21 centos kernel: ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300) May 26 14:05:21 centos kernel: ata7.00: ATA-7: SAMSUNG HD103UJ, 1AA01113, max UDMA7 May 26 14:05:21 centos kernel: ata7.00: 1953525168 sectors, multi 16: LBA48 NCQ (depth 31/32) May 26 14:05:21 centos kernel: ata5.00: ATA-8: SanDisk SDSSDX120GG25, R211, max UDMA/133 May 26 14:05:21 centos kernel: ata5.00: 234441648 sectors, multi 16: LBA48 NCQ (depth 31/32) May 26 14:05:21 centos kernel: ata7.00: configured for UDMA/133 May 26 14:05:21 centos kernel: ata5.00: configured for UDMA/133 May 26 14:05:21 centos kernel: ata4: SATA link down (SStatus 0 SControl 300) May 26 14:05:21 centos kernel: scsi 4:0:0:0: Direct-Access ATA SanDisk SDSSDX12 R211 PQ: 0 ANSI: 5 May 26 14:05:21 centos kernel: ata6: SATA link up 3.0 Gbps (SStatus 123 SControl 300) May 26 14:05:21 centos kernel: ata6.00: ATA-8: ST31000524AS, JC4B, max UDMA/133 May 26 14:05:21 centos kernel: ata6.00: 1953525168 sectors, multi 16: LBA48 NCQ (depth 31/32) May 26 14:05:21 centos kernel: ata6.00: configured for UDMA/133 May 26 14:05:21 centos kernel: scsi 5:0:0:0: Direct-Access ATA ST31000524AS JC4B PQ: 0 ANSI: 5 May 26 14:05:21 centos kernel: scsi 6:0:0:0: Direct-Access ATA SAMSUNG HD103UJ 1AA0 PQ: 0 ANSI: 5 May 26 14:05:21 centos kernel: ata8: SATA link up 3.0 Gbps (SStatus 123 SControl 300) May 26 14:05:21 centos kernel: ata8.00: HPA detected: current 1953523055, native 1953525168 May 26 14:05:21 centos kernel: ata8.00: ATA-8: WDC WD10EARX-00N0YB0, 51.0AB51, max UDMA/133 May 26 14:05:21 centos kernel: ata8.00: 1953523055 sectors, multi 16: LBA48 NCQ (depth 31/32) May 26 14:05:21 centos kernel: ata8.00: configured for UDMA/133 May 26 14:05:21 centos kernel: scsi 7:0:0:0: Direct-Access ATA WDC WD10EARX-00N 51.0 PQ: 0 ANSI: 5 May 26 14:05:21 centos kernel: ACPI: PCI Interrupt Link [AXV8] enabled at IRQ 16 May 26 14:05:21 centos kernel: ahci 0000:04:00.0: PCI INT A -> Link[AXV8] -> GSI 16 (level, low) -> IRQ 16 May 26 14:05:21 centos kernel: ahci 0000:04:00.0: AHCI 0001.0000 32 slots 2 ports 3 Gbps 0x3 impl SATA mode May 26 14:05:21 centos kernel: ahci 0000:04:00.0: flags: 64bit ncq led clo pmp pio May 26 14:05:21 centos kernel: scsi8 : ahci May 26 14:05:21 centos kernel: scsi9 : ahci May 26 14:05:21 centos kernel: ata9: SATA max UDMA/133 abar m8192@0xdfcfe000 port 0xdfcfe100 irq 16 May 26 14:05:21 centos kernel: ata10: SATA max UDMA/133 abar m8192@0xdfcfe000 port 0xdfcfe180 irq 16 May 26 14:05:21 centos kernel: ata9: SATA link down (SStatus 0 SControl 300) May 26 14:05:21 centos kernel: ata10: SATA link down (SStatus 0 SControl 300) May 26 14:05:21 centos kernel: pata_jmicron 0000:04:00.1: PCI INT B -> Link[AXV5] -> GSI 16 (level, low) -> IRQ 16 May 26 14:05:21 centos kernel: scsi10 : pata_jmicron May 26 14:05:21 centos kernel: scsi11 : pata_jmicron May 26 14:05:21 centos kernel: ata11: PATA max UDMA/100 cmd 0x8c00 ctl 0x8800 bmdma 0x7c00 irq 16 May 26 14:05:21 centos kernel: ata12: PATA max UDMA/100 cmd 0x8400 ctl 0x8000 bmdma 0x7c08 irq 16 May 26 14:05:21 centos kernel: ACPI: PCI Interrupt Link [APC4] enabled at IRQ 19 May 26 14:05:21 centos kernel: firewire_ohci 0000:03:07.0: PCI INT A -> Link[APC4] -> GSI 19 (level, low) -> IRQ 19 May 26 14:05:21 centos kernel: firewire_ohci: Added fw-ohci device 0000:03:07.0, OHCI version 1.10 May 26 14:05:21 centos kernel: STARTING CRC_T10DIF May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] 234441648 512-byte logical blocks: (120 GB/111 GiB) May 26 14:05:21 centos kernel: sd 5:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Write Protect is off May 26 14:05:21 centos kernel: sd 5:0:0:0: [sdb] Write Protect is off May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA May 26 14:05:21 centos kernel: sd 6:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) May 26 14:05:21 centos kernel: sd 5:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA May 26 14:05:21 centos kernel: sd 6:0:0:0: [sdc] Write Protect is off May 26 14:05:21 centos kernel: sd 6:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA May 26 14:05:21 centos kernel: sdb: May 26 14:05:21 centos kernel: sdc: May 26 14:05:21 centos kernel: sda: May 26 14:05:21 centos kernel: sd 7:0:0:0: [sdd] 1953523055 512-byte logical blocks: (1.00 TB/931 GiB) May 26 14:05:21 centos kernel: sd 7:0:0:0: [sdd] 4096-byte physical blocks May 26 14:05:21 centos kernel: sd 7:0:0:0: [sdd] Write Protect is off May 26 14:05:21 centos kernel: sd 7:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA May 26 14:05:21 centos kernel: sdd: sda1 sda2 May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Attached SCSI disk May 26 14:05:21 centos kernel: sdc1 May 26 14:05:21 centos kernel: sd 6:0:0:0: [sdc] Attached SCSI disk May 26 14:05:21 centos kernel: sdd1 May 26 14:05:21 centos kernel: sd 7:0:0:0: [sdd] Attached SCSI disk May 26 14:05:21 centos kernel: sdb1 May 26 14:05:21 centos kernel: sd 5:0:0:0: [sdb] Attached SCSI disk May 26 14:05:21 centos kernel: dracut: Scanning devices sda2 for LVM logical volumes vg_centos/lv_swap vg_centos/lv_root May 26 14:05:21 centos kernel: dracut: inactive '/dev/vg_centos/lv_root' [50.00 GiB] inherit May 26 14:05:21 centos kernel: dracut: inactive '/dev/vg_centos/lv_home' [57.48 GiB] inherit May 26 14:05:21 centos kernel: dracut: inactive '/dev/vg_centos/lv_swap' [3.81 GiB] inherit May 26 14:05:21 centos kernel: EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: May 26 14:05:21 centos kernel: dracut: Mounted root filesystem /dev/mapper/vg_centos-lv_root May 26 14:05:21 centos kernel: SELinux: Disabled at runtime. May 26 14:05:21 centos kernel: firewire_core: created device fw0: GUID 56a213d400044b18, S400 May 26 14:05:21 centos kernel: type=1404 audit(1432645472.858:2): selinux=0 auid=4294967295 ses=4294967295 May 26 14:05:21 centos kernel: dracut: May 26 14:05:21 centos kernel: dracut: Switching root May 26 14:05:21 centos kernel: ata5: EH in SWNCQ mode,QC:qc_active 0x60000007 sactive 0x60000007 May 26 14:05:21 centos kernel: ata5: SWNCQ:qc_active 0x60000001 defer_bits 0x6 last_issue_tag 0x0 May 26 14:05:21 centos kernel: dhfis 0x60000001 dmafis 0x60000001 sdbfis 0x0 May 26 14:05:21 centos kernel: ata5: ATA_REG 0x40 ERR_REG 0x0 May 26 14:05:21 centos kernel: ata5: tag : dhfis dmafis sdbfis sacitve May 26 14:05:21 centos kernel: ata5: tag 0x0: 1 1 0 1 May 26 14:05:21 centos kernel: ata5: tag 0x1d: 1 1 0 1 May 26 14:05:21 centos kernel: ata5: tag 0x1e: 1 1 0 1 May 26 14:05:21 centos kernel: ata5.00: exception Emask 0x0 SAct 0x60000007 SErr 0x0 action 0x6 frozen May 26 14:05:21 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:05:21 centos kernel: ata5.00: cmd 60/90:00:c8:91:59/00:00:05:00:00/40 tag 0 ncq 73728 in May 26 14:05:21 centos kernel: res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) May 26 14:05:21 centos kernel: ata5.00: status: { DRDY } May 26 14:05:21 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:05:21 centos kernel: ata5.00: cmd 60/08:08:08:b5:0f/00:00:04:00:00/40 tag 1 ncq 4096 in May 26 14:05:21 centos kernel: res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) May 26 14:05:21 centos kernel: ata5.00: status: { DRDY } May 26 14:05:21 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:05:21 centos kernel: ata5.00: cmd 60/78:10:90:b5:0f/00:00:04:00:00/40 tag 2 ncq 61440 in May 26 14:05:21 centos kernel: res 40/00:01:00:00:00/00:00:00:00:00/e0 Emask 0x4 (timeout) May 26 14:05:21 centos kernel: ata5.00: status: { DRDY } May 26 14:05:21 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:05:21 centos kernel: ata5.00: cmd 60/08:e8:00:b5:0f/00:00:04:00:00/40 tag 29 ncq 4096 in May 26 14:05:21 centos kernel: res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) May 26 14:05:21 centos kernel: ata5.00: status: { DRDY } May 26 14:05:21 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:05:21 centos kernel: ata5.00: cmd 60/80:f0:10:b5:0f/00:00:04:00:00/40 tag 30 ncq 65536 in May 26 14:05:21 centos kernel: res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) May 26 14:05:21 centos kernel: ata5.00: status: { DRDY } May 26 14:05:21 centos kernel: ata5: hard resetting link May 26 14:05:21 centos kernel: ata5: nv: skipping hardreset on occupied port May 26 14:05:21 centos kernel: ata5: link is slow to respond, please be patient (ready=0) May 26 14:05:21 centos kernel: ata5: SRST failed (errno=-16) May 26 14:05:21 centos kernel: ata5: hard resetting link May 26 14:05:21 centos kernel: ata5: nv: skipping hardreset on occupied port May 26 14:05:21 centos kernel: ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300) May 26 14:05:21 centos kernel: ata5.00: configured for UDMA/133 May 26 14:05:21 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:05:21 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:05:21 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:05:21 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:05:21 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Sense Key : Aborted Command [current] [descriptor] May 26 14:05:21 centos kernel: Descriptor sense data with sense descriptors (in hex): May 26 14:05:21 centos kernel: 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00 May 26 14:05:21 centos kernel: 00 00 00 00 May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Add. Sense: No additional sense information May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] CDB: Read(10): 28 00 04 0f b5 90 00 00 78 00 May 26 14:05:21 centos kernel: end_request: I/O error, dev sda, sector 68138384 May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Sense Key : Aborted Command [current] [descriptor] May 26 14:05:21 centos kernel: Descriptor sense data with sense descriptors (in hex): May 26 14:05:21 centos kernel: 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00 May 26 14:05:21 centos kernel: 00 00 00 00 May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Add. Sense: No additional sense information May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] CDB: Read(10): 28 00 04 0f b5 00 00 00 08 00 May 26 14:05:21 centos kernel: end_request: I/O error, dev sda, sector 68138240 May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Sense Key : Aborted Command [current] [descriptor] May 26 14:05:21 centos kernel: Descriptor sense data with sense descriptors (in hex): May 26 14:05:21 centos kernel: 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00 May 26 14:05:21 centos kernel: 00 00 00 00 May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] Add. Sense: No additional sense information May 26 14:05:21 centos kernel: sd 4:0:0:0: [sda] CDB: Read(10): 28 00 04 0f b5 10 00 00 80 00 May 26 14:05:21 centos kernel: end_request: I/O error, dev sda, sector 68138256 May 26 14:05:21 centos kernel: ata5: EH complete May 26 14:05:21 centos kernel: udev: starting version 147 May 26 14:05:21 centos kernel: ACPI: PCI Interrupt Link [AAZA] enabled at IRQ 23 May 26 14:05:21 centos kernel: snd_hda_intel 0000:00:0f.1: PCI INT B -> Link[AAZA] -> GSI 23 (level, low) -> IRQ 23 May 26 14:05:21 centos kernel: hda_intel: Disabling MSI May 26 14:05:21 centos kernel: input: HDA NVidia Front Headphone as /devices/pci0000:00/0000:00:0f.1/sound/card0/input6 May 26 14:05:21 centos kernel: input: HDA NVidia Line Out Side as /devices/pci0000:00/0000:00:0f.1/sound/card0/input7 May 26 14:05:21 centos kernel: input: HDA NVidia Line Out CLFE as /devices/pci0000:00/0000:00:0f.1/sound/card0/input8 May 26 14:05:21 centos kernel: input: HDA NVidia Line Out Surround as /devices/pci0000:00/0000:00:0f.1/sound/card0/input9 May 26 14:05:21 centos kernel: input: HDA NVidia Line Out Front as /devices/pci0000:00/0000:00:0f.1/sound/card0/input10 May 26 14:05:21 centos kernel: input: HDA NVidia Line as /devices/pci0000:00/0000:00:0f.1/sound/card0/input11 May 26 14:05:21 centos kernel: input: HDA NVidia Rear Mic as /devices/pci0000:00/0000:00:0f.1/sound/card0/input12 May 26 14:05:21 centos kernel: input: HDA NVidia Front Mic as /devices/pci0000:00/0000:00:0f.1/sound/card0/input13 May 26 14:05:21 centos kernel: snd_hda_intel 0000:01:00.1: PCI INT B -> Link[AXV6] -> GSI 16 (level, low) -> IRQ 16 May 26 14:05:21 centos kernel: hda-intel 0000:01:00.1: Handle VGA-switcheroo audio client May 26 14:05:21 centos kernel: input: HD-Audio Generic HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:02.0/0000:01:00.1/sound/card1/input14 May 26 14:05:21 centos kernel: i2c i2c-0: nForce2 SMBus adapter at 0xf400 May 26 14:05:21 centos kernel: i2c i2c-1: nForce2 SMBus adapter at 0xf000 May 26 14:05:21 centos kernel: sd 4:0:0:0: Attached scsi generic sg0 type 0 May 26 14:05:21 centos kernel: sd 5:0:0:0: Attached scsi generic sg1 type 0 May 26 14:05:21 centos kernel: sd 6:0:0:0: Attached scsi generic sg2 type 0 May 26 14:05:21 centos kernel: sd 7:0:0:0: Attached scsi generic sg3 type 0 May 26 14:05:21 centos kernel: forcedeth: Reverse Engineered nForce ethernet driver. Version 0.64. May 26 14:05:21 centos kernel: ACPI: PCI Interrupt Link [AMAC] enabled at IRQ 22 May 26 14:05:21 centos kernel: forcedeth 0000:00:11.0: PCI INT A -> Link[AMAC] -> GSI 22 (level, low) -> IRQ 22 May 26 14:05:21 centos kernel: md: bind<sdb1> May 26 14:05:21 centos kernel: forcedeth 0000:00:11.0: ifname eth0, PHY OUI 0x50ef @ 0, addr 00:04:4b:16:84:be May 26 14:05:21 centos kernel: forcedeth 0000:00:11.0: highdma csum vlan pwrctl mgmt gbit lnktim msi desc-v3 May 26 14:05:21 centos kernel: ACPI: PCI Interrupt Link [AMA1] enabled at IRQ 23 May 26 14:05:21 centos kernel: forcedeth 0000:00:12.0: PCI INT A -> Link[AMA1] -> GSI 23 (level, low) -> IRQ 23 May 26 14:05:21 centos kernel: forcedeth 0000:00:12.0: ifname eth1, PHY OUI 0x50ef @ 1, addr 00:04:4b:16:84:bf May 26 14:05:21 centos kernel: forcedeth 0000:00:12.0: highdma csum vlan pwrctl mgmt gbit lnktim msi desc-v3 May 26 14:05:21 centos kernel: md: bind<sdc1> May 26 14:05:21 centos kernel: microcode: CPU0 sig=0x10677, pf=0x10, revision=0x703 May 26 14:05:21 centos kernel: platform microcode: firmware: requesting intel-ucode/06-17-07 May 26 14:05:21 centos kernel: microcode: CPU1 sig=0x10677, pf=0x10, revision=0x703 May 26 14:05:21 centos kernel: platform microcode: firmware: requesting intel-ucode/06-17-07 May 26 14:05:21 centos kernel: microcode: CPU2 sig=0x10677, pf=0x10, revision=0x703 May 26 14:05:21 centos kernel: platform microcode: firmware: requesting intel-ucode/06-17-07 May 26 14:05:21 centos kernel: md: raid1 personality registered for level 1 May 26 14:05:21 centos kernel: bio: create slab <bio-1> at 1 May 26 14:05:21 centos kernel: md/raid1:md127: active with 2 out of 2 mirrors May 26 14:05:21 centos kernel: created bitmap (8 pages) for device md127 May 26 14:05:21 centos kernel: md127: bitmap initialized from disk: read 1 pages, set 0 of 14903 bits May 26 14:05:21 centos kernel: microcode: CPU3 sig=0x10677, pf=0x10, revision=0x703 May 26 14:05:21 centos kernel: platform microcode: firmware: requesting intel-ucode/06-17-07 May 26 14:05:21 centos kernel: Microcode Update Driver: v2.00 <[emailprotected]>, Peter Oruba May 26 14:05:21 centos kernel: md127: detected capacity change from 0 to 1000068022272 May 26 14:05:21 centos kernel: md127: unknown partition table May 26 14:05:21 centos kernel: microcode: CPU0 updated to revision 0x70a, date = 2010-09-29 May 26 14:05:21 centos kernel: microcode: CPU1 updated to revision 0x70a, date = 2010-09-29 May 26 14:05:21 centos kernel: microcode: CPU2 updated to revision 0x70a, date = 2010-09-29 May 26 14:05:21 centos kernel: microcode: CPU3 updated to revision 0x70a, date = 2010-09-29 May 26 14:05:21 centos kernel: EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: May 26 14:05:21 centos kernel: EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: May 26 14:05:21 centos kernel: EXT4-fs (sdd1): warning: maximal mount count reached, running e2fsck is recommended May 26 14:05:21 centos kernel: EXT4-fs (sdd1): mounted filesystem with ordered data mode. Opts: May 26 14:05:21 centos kernel: EXT4-fs (md127): mounted filesystem with ordered data mode. Opts: May 26 14:05:21 centos kernel: Adding 3997692k swap on /dev/mapper/vg_centos-lv_swap. Priority:-1 extents:1 across:3997692k SSD May 26 14:05:21 centos kernel: NET: Registered protocol family 10 May 26 14:05:21 centos kernel: lo: Disabled Privacy Extensions May 26 14:05:21 centos kernel: ip6_tables: (C) 2000-2006 Netfilter Core Team May 26 14:05:21 centos kernel: nf_conntrack version 0.5.0 (16384 buckets, 65536 max) May 26 14:05:21 centos kernel: ip_tables: (C) 2000-2006 Netfilter Core Team May 26 14:05:21 centos kernel: Bridge firewalling registered May 26 14:05:21 centos kernel: device eth0 entered promiscuous mode May 26 14:05:21 centos kernel: eth1: no link during initialization. May 26 14:05:21 centos kernel: ADDRCONF(NETDEV_UP): eth1: link is not ready May 26 14:05:21 centos kernel: device eth1 entered promiscuous mode May 26 14:05:21 centos kernel: br0: port 1(eth0) entering forwarding state May 26 14:05:21 centos kernel: eth1: link up. May 26 14:05:21 centos kernel: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready May 26 14:05:21 centos kernel: br0: port 2(eth1) entering forwarding state May 26 14:05:21 centos kernel: type=1305 audit(1432645521.660:3): audit_pid=1315 old=0 auid=4294967295 ses=4294967295 res=1 May 26 14:05:21 centos kernel: p4-clockmod: Warning: EST-capable CPU detected. The acpi-cpufreq module offers voltage scaling in addition to frequency scaling. You should use that instead of p4-clockmod, if possible. May 26 14:05:22 centos rpc.statd[1411]: Version 1.2.3 starting May 26 14:05:22 centos sm-notify[1412]: Version 1.2.3 starting May 26 14:05:22 centos kdump: kexec: loaded kdump kernel May 26 14:05:22 centos kdump: started up May 26 14:05:22 centos acpid: starting up May 26 14:05:22 centos acpid: 1 rule loaded May 26 14:05:22 centos acpid: waiting for events: event logging is off May 26 14:05:22 centos acpid: client connected from 1640[68:68] May 26 14:05:22 centos acpid: 1 client rule loaded May 26 14:05:22 centos kernel: w83627ehf: Found W83627DHG chip at 0x290 May 26 14:05:23 centos automount[1676]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master May 26 14:05:25 centos abrtd: Init complete, entering main loop May 26 14:05:25 centos pptpd[2015]: MGR: connections limit (100) reached, extra IP addresses ignored May 26 14:05:25 centos pptpd[2016]: MGR: Manager process started May 26 14:05:25 centos pptpd[2016]: MGR: Maximum of 100 connections available May 26 14:05:25 centos smbd[2043]: [2015/05/26 14:05:25.786741, 0] param/loadparm.c:7969(lp_do_parameter) May 26 14:05:25 centos smbd[2043]: Ignoring unknown parameter "symlinks" May 26 14:05:34 centos kernel: br0: port 1(eth0) entering forwarding state May 26 14:05:35 centos kernel: br0: port 2(eth1) entering forwarding state May 26 14:06:02 centos kernel: ata5: EH in SWNCQ mode,QC:qc_active 0xF sactive 0xF May 26 14:06:02 centos kernel: ata5: SWNCQ:qc_active 0x7 defer_bits 0x8 last_issue_tag 0x2 May 26 14:06:02 centos kernel: dhfis 0x7 dmafis 0x7 sdbfis 0x0 May 26 14:06:02 centos kernel: ata5: ATA_REG 0x40 ERR_REG 0x0 May 26 14:06:02 centos kernel: ata5: tag : dhfis dmafis sdbfis sacitve May 26 14:06:02 centos kernel: ata5: tag 0x0: 1 1 0 1 May 26 14:06:02 centos kernel: ata5: tag 0x1: 1 1 0 1 May 26 14:06:02 centos kernel: ata5: tag 0x2: 1 1 0 1 May 26 14:06:02 centos kernel: ata5.00: exception Emask 0x0 SAct 0xf SErr 0x0 action 0x6 frozen May 26 14:06:02 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:06:02 centos kernel: ata5.00: cmd 60/08:00:f8:bf:20/00:00:00:00:00/40 tag 0 ncq 4096 in May 26 14:06:02 centos kernel: res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) May 26 14:06:02 centos kernel: ata5.00: status: { DRDY } May 26 14:06:02 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:06:02 centos kernel: ata5.00: cmd 60/48:08:68:c0:20/00:00:00:00:00/40 tag 1 ncq 36864 in May 26 14:06:02 centos kernel: res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) May 26 14:06:02 centos kernel: ata5.00: status: { DRDY } May 26 14:06:02 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:06:02 centos kernel: ata5.00: cmd 60/20:10:d8:c0:20/01:00:00:00:00/40 tag 2 ncq 147456 in May 26 14:06:02 centos kernel: res 40/00:01:00:00:00/00:00:00:00:00/e0 Emask 0x4 (timeout) May 26 14:06:02 centos kernel: ata5.00: status: { DRDY } May 26 14:06:02 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:06:02 centos kernel: ata5.00: cmd 60/08:18:78:cf:d0/00:00:03:00:00/40 tag 3 ncq 4096 in May 26 14:06:02 centos kernel: res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) May 26 14:06:02 centos kernel: ata5.00: status: { DRDY } May 26 14:06:02 centos kernel: ata5: hard resetting link May 26 14:06:02 centos kernel: ata5: nv: skipping hardreset on occupied port May 26 14:06:08 centos kernel: ata5: link is slow to respond, please be patient (ready=0) May 26 14:06:12 centos kernel: ata5: SRST failed (errno=-16) May 26 14:06:12 centos kernel: ata5: hard resetting link May 26 14:06:12 centos kernel: ata5: nv: skipping hardreset on occupied port May 26 14:06:13 centos kernel: ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300) May 26 14:06:13 centos kernel: ata5.00: configured for UDMA/133 May 26 14:06:13 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:06:13 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:06:13 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:06:13 centos kernel: ata5.00: device reported invalid CHS sector 0 May 26 14:06:13 centos kernel: ata5: EH complete May 26 14:06:13 centos kernel: ata5: EH in SWNCQ mode,QC:qc_active 0xFF0 sactive 0xFF0 May 26 14:06:13 centos kernel: ata5: SWNCQ:qc_active 0xF0 defer_bits 0xF00 last_issue_tag 0x7 May 26 14:06:13 centos kernel: dhfis 0xF0 dmafis 0xE0 sdbfis 0x0 May 26 14:06:13 centos kernel: ata5: ATA_REG 0x41 ERR_REG 0x84 May 26 14:06:13 centos kernel: ata5: tag : dhfis dmafis sdbfis sacitve May 26 14:06:13 centos kernel: ata5: tag 0x4: 1 0 0 1 May 26 14:06:13 centos kernel: ata5: tag 0x5: 1 1 0 1 May 26 14:06:13 centos kernel: ata5: tag 0x6: 1 1 0 1 May 26 14:06:13 centos kernel: ata5: tag 0x7: 1 1 0 1 May 26 14:06:13 centos kernel: ata5.00: exception Emask 0x1 SAct 0xff0 SErr 0x0 action 0x6 frozen May 26 14:06:13 centos kernel: ata5.00: Ata error. fis:0x21 May 26 14:06:13 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:06:13 centos kernel: ata5.00: cmd 60/08:20:78:cf:d0/00:00:03:00:00/40 tag 4 ncq 4096 in May 26 14:06:13 centos kernel: res 41/84:38:f8:bf:20/84:00:00:00:00/40 Emask 0x10 (ATA bus error) May 26 14:06:13 centos kernel: ata5.00: status: { DRDY ERR } May 26 14:06:13 centos kernel: ata5.00: error: { ICRC ABRT } May 26 14:06:13 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:06:13 centos kernel: ata5.00: cmd 60/20:28:d8:c0:20/01:00:00:00:00/40 tag 5 ncq 147456 in May 26 14:06:13 centos kernel: res 41/84:38:f8:bf:20/84:00:00:00:00/40 Emask 0x10 (ATA bus error) May 26 14:06:13 centos kernel: ata5.00: status: { DRDY ERR } May 26 14:06:13 centos kernel: ata5.00: error: { ICRC ABRT } May 26 14:06:13 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:06:13 centos kernel: ata5.00: cmd 60/48:30:68:c0:20/00:00:00:00:00/40 tag 6 ncq 36864 in May 26 14:06:13 centos kernel: res 41/84:38:f8:bf:20/84:00:00:00:00/40 Emask 0x10 (ATA bus error) May 26 14:06:13 centos kernel: ata5.00: status: { DRDY ERR } May 26 14:06:13 centos kernel: ata5.00: error: { ICRC ABRT } May 26 14:06:13 centos kernel: ata5.00: failed command: READ FPDMA QUEUED May 26 14:06:13 centos kernel: ata5.00: cmd 60/08:38:f8:bf:20/00:00:00:00:00/40 tag 7 ncq 4096 in May 26 14:06:13 centos kernel: res 41/84:38:f8:bf:20/84:00:00:00:00/40 Emask 0x10 (ATA bus error) May 26 14:06:13 centos kernel: ata5.00: status: { DRDY ERR } May 26 14:06:13 centos kernel: ata5.00: error: { ICRC ABRT } May 26 14:06:13 centos kernel: ata5.00: failed command: WRITE FPDMA QUEUED May 26 14:06:13 centos kernel: ata5.00: cmd 61/08:40:b0:ff:d3/00:00:03:00:00/40 tag 8 ncq 4096 out May 26 14:06:13 centos kernel: res 41/84:38:f8:bf:20/84:00:00:00:00/40 Emask 0x10 (ATA bus error) May 26 14:06:13 centos kernel: ata5.00: status: { DRDY ERR } May 26 14:06:13 centos kernel: ata5.00: error: { ICRC ABRT } May 26 14:06:13 centos kernel: ata5.00: failed command: WRITE FPDMA QUEUED May 26 14:06:13 centos kernel: ata5.00: cmd 61/08:48:90:ca:3b/00:00:00:00:00/40 tag 9 ncq 4096 out May 26 14:06:13 centos kernel: res 41/84:38:f8:bf:20/84:00:00:00:00/40 Emask 0x10 (ATA bus error) May 26 14:06:13 centos kernel: ata5.00: status: { DRDY ERR } May 26 14:06:13 centos kernel: ata5.00: error: { ICRC ABRT } May 26 14:06:13 centos kernel: ata5.00: failed command: WRITE FPDMA QUEUED May 26 14:06:13 centos kernel: ata5.00: cmd 61/08:50:08:e0:3f/00:00:00:00:00/40 tag 10 ncq 4096 out May 26 14:06:13 centos kernel: res 41/84:38:f8:bf:20/84:00:00:00:00/40 Emask 0x10 (ATA bus error) May 26 14:06:13 centos kernel: ata5.00: status: { DRDY ERR } May 26 14:06:13 centos kernel: ata5.00: error: { ICRC ABRT } May 26 14:06:13 centos kernel: ata5.00: failed command: WRITE FPDMA QUEUED May 26 14:06:13 centos kernel: ata5.00: cmd 61/c8:58:48:b9:13/01:00:03:00:00/40 tag 11 ncq 233472 out May 26 14:06:13 centos kernel: res 41/84:38:f8:bf:20/84:00:00:00:00/40 Emask 0x10 (ATA bus error) May 26 14:06:13 centos kernel: ata5.00: status: { DRDY ERR } May 26 14:06:13 centos kernel: ata5.00: error: { ICRC ABRT } May 26 14:06:13 centos kernel: ata5: hard resetting link May 26 14:06:13 centos kernel: ata5: nv: skipping hardreset on occupied port May 26 14:06:14 centos kernel: ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300) May 26 14:06:14 centos kernel: ata5.00: configured for UDMA/133 May 26 14:06:14 centos kernel: ata5: EH complete
Debug ata error messages?
After replacing SATA cables (notably, the SATA v1 one) So, what actually happened after replacing both SATA cables?First, as mentioned in my question, I read both drives, no error there!Second, I had an idea of the errors could have been write-specific, so I made a write test!The following image has a large resolution, feel free to click to enlarge it:You can see for yourself, there are no more errors to be seen in dmesg, which makes me happy and proves my theory. At the time I assembled the server, I did not realize how old that cable was, which makes me sad. Anyhow, problem is gone for now.
Background When I assembled one of my servers with brand new disks WD Red 3TB, I have possibly made grave error in judgement, which was to use one older and one really old SATA (wikipedia) cables. My question is essencially of hardware background with a bit of history in running under Debian 10 Linux system.Those cables I talk about, there were 2 of them:One 5+ years old, but still SATA III certified, data cable. This one IMHO could go wrong if excessively bended or something, I am not aware of any maltreatment though, so maybe shielding got better in those years(?) I'm thinking, etc.I was surprised to find in the same server maybe 15+ years old SATA cable with only Serial ATA written on it, nothing else, and considering I have had smaller and bigger problems with my mdadm RAID 1 array since I have assembled this server in form of various dmesg disk I/O error messages and degrading the array in the end, I'm thinking if this single cable or possibly both of them could have caused me errors when reading and writing to the array.Replacing cables What I did today was to buy 2 German-made (found on stickers), possibly higher quality, SATA III certified new cables, and see what happens.TestingI booted the server up, un-mounted the array and stopped it.Have started running these two separate reading disk commands over night: pv < /dev/sdX > /dev/nullHave also started monitoring errors in dmesg and speed with nmon. After 1 hour, no single error or slowdown so far...Question Supposing, I wake up and there are no errors in dmesg after those HDDs are read in full, may I consider the old cables be the origin of errors, or there are things I have not considered? I could not decide if to post here or on SuperUser. If more suited elsewhere I will re-post in the morning if a lot of such comments arrive. Thank you for your time in any case.smartctl WD-WCC4N6EZXNSD smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.0-9-amd64] (local build) Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org=== START OF INFORMATION SECTION === Model Family: Western Digital Red Device Model: WDC WD30EFRX-68EUZN0 Serial Number: WD-WCC4N6EZXNSD LU WWN Device Id: 5 0014ee 210a9a0ef Firmware Version: 82.00A82 User Capacity: 3,000,592,982,016 bytes [3.00 TB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: 5400 rpm Device is: In smartctl database [for details use: -P show] ATA Version is: ACS-2 (minor revision not indicated) SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Sat Jun 20 08:47:05 2020 CEST SMART support is: Available - device has SMART capability. SMART support is: Enabled=== START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSEDGeneral SMART Values: Offline data collection status: (0x00) Offline data collection activity was never started. Auto Offline Data Collection: Disabled. Self-test execution status: ( 0) The previous self-test routine completed without error or no self-test has ever been run. Total time to complete Offline data collection: (40380) seconds. Offline data collection capabilities: (0x7b) SMART execute Offline immediate. Auto Offline data collection on/off support. Suspend Offline collection upon new command. Offline surface scan supported. Self-test supported. Conveyance Self-test supported. Selective Self-test supported. SMART capabilities: (0x0003) Saves SMART data before entering power-saving mode. Supports SMART auto save timer. Error logging capability: (0x01) Error logging supported. General Purpose Logging supported. Short self-test routine recommended polling time: ( 2) minutes. Extended self-test routine recommended polling time: ( 405) minutes. Conveyance self-test routine recommended polling time: ( 5) minutes. SCT capabilities: (0x703d) SCT Status supported. SCT Error Recovery Control supported. SCT Feature Control supported. SCT Data Table supported.SMART Attributes Data Structure revision number: 16 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x002f 200 200 051 Pre-fail Always - 0 3 Spin_Up_Time 0x0027 179 178 021 Pre-fail Always - 6050 4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 31 5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0 7 Seek_Error_Rate 0x002e 100 253 000 Old_age Always - 0 9 Power_On_Hours 0x0032 097 097 000 Old_age Always - 2443 10 Spin_Retry_Count 0x0032 100 253 000 Old_age Always - 0 11 Calibration_Retry_Count 0x0032 100 253 000 Old_age Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 31 192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 3 193 Load_Cycle_Count 0x0032 200 200 000 Old_age Always - 2423 194 Temperature_Celsius 0x0022 116 109 000 Old_age Always - 34 196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0 197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0030 100 253 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0 200 Multi_Zone_Error_Rate 0x0008 100 253 000 Old_age Offline - 0SMART Error Log Version: 1 ATA Error Count: 2033 (device log contains only the most recent five errors) CR = Command Register [HEX] FR = Features Register [HEX] SC = Sector Count Register [HEX] SN = Sector Number Register [HEX] CL = Cylinder Low Register [HEX] CH = Cylinder High Register [HEX] DH = Device/Head Register [HEX] DC = Device Command Register [HEX] ER = Error register [HEX] ST = Status register [HEX] Powered_Up_Time is measured from power on, and printed as DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes, SS=sec, and sss=millisec. It "wraps" after 49.710 days.Error 2033 occurred at disk power-on lifetime: 424 hours (17 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 02 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 10 02 00 00 00 a0 00 2d+13:04:28.795 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 00 2d+13:04:28.794 IDENTIFY DEVICE ef 03 46 00 00 00 a0 00 2d+13:04:28.794 SET FEATURES [Set transfer mode] ef 10 02 00 00 00 a0 00 2d+13:04:28.794 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 00 2d+13:04:28.793 IDENTIFY DEVICEError 2032 occurred at disk power-on lifetime: 424 hours (17 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 46 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 03 46 00 00 00 a0 00 2d+13:04:28.794 SET FEATURES [Set transfer mode] ef 10 02 00 00 00 a0 00 2d+13:04:28.794 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 00 2d+13:04:28.793 IDENTIFY DEVICE c8 00 08 00 00 00 e0 00 2d+13:04:28.779 READ DMA ef 10 02 00 00 00 a0 00 2d+13:04:28.779 SET FEATURES [Enable SATA feature]Error 2031 occurred at disk power-on lifetime: 424 hours (17 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 02 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 10 02 00 00 00 a0 00 2d+13:04:28.794 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 00 2d+13:04:28.793 IDENTIFY DEVICE c8 00 08 00 00 00 e0 00 2d+13:04:28.779 READ DMA ef 10 02 00 00 00 a0 00 2d+13:04:28.779 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 00 2d+13:04:28.778 IDENTIFY DEVICEError 2030 occurred at disk power-on lifetime: 424 hours (17 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 08 00 00 00 e0 Device Fault; Error: ABRT 8 sectors at LBA = 0x00000000 = 0 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- c8 00 08 00 00 00 e0 00 2d+13:04:28.779 READ DMA ef 10 02 00 00 00 a0 00 2d+13:04:28.779 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 00 2d+13:04:28.778 IDENTIFY DEVICE ef 03 46 00 00 00 a0 00 2d+13:04:28.778 SET FEATURES [Set transfer mode] ef 10 02 00 00 00 a0 00 2d+13:04:28.778 SET FEATURES [Enable SATA feature]Error 2029 occurred at disk power-on lifetime: 424 hours (17 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 02 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 10 02 00 00 00 a0 00 2d+13:04:28.779 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 00 2d+13:04:28.778 IDENTIFY DEVICE ef 03 46 00 00 00 a0 00 2d+13:04:28.778 SET FEATURES [Set transfer mode] ef 10 02 00 00 00 a0 00 2d+13:04:28.778 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 00 2d+13:04:28.777 IDENTIFY DEVICESMART Self-test log structure revision number 1 No self-tests have been logged. [To run self-tests, use: smartctl -t]SMART Selective self-test log data structure revision number 1 SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS 1 0 0 Not_testing 2 0 0 Not_testing 3 0 0 Not_testing 4 0 0 Not_testing 5 0 0 Not_testing Selective self-test flags (0x0): After scanning selected spans, do NOT read-scan remainder of disk. If Selective self-test is pending on power-up, resume after 0 minute delay.WD-WCC4N5EKLTNX smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.0-9-amd64] (local build) Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org=== START OF INFORMATION SECTION === Model Family: Western Digital Red Device Model: WDC WD30EFRX-68EUZN0 Serial Number: WD-WCC4N5EKLTNX LU WWN Device Id: 5 0014ee 2bb548051 Firmware Version: 82.00A82 User Capacity: 3,000,592,982,016 bytes [3.00 TB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: 5400 rpm Device is: In smartctl database [for details use: -P show] ATA Version is: ACS-2 (minor revision not indicated) SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Sat Jun 20 08:50:48 2020 CEST SMART support is: Available - device has SMART capability. SMART support is: Enabled=== START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSEDGeneral SMART Values: Offline data collection status: (0x00) Offline data collection activity was never started. Auto Offline Data Collection: Disabled. Self-test execution status: ( 0) The previous self-test routine completed without error or no self-test has ever been run. Total time to complete Offline data collection: (39540) seconds. Offline data collection capabilities: (0x7b) SMART execute Offline immediate. Auto Offline data collection on/off support. Suspend Offline collection upon new command. Offline surface scan supported. Self-test supported. Conveyance Self-test supported. Selective Self-test supported. SMART capabilities: (0x0003) Saves SMART data before entering power-saving mode. Supports SMART auto save timer. Error logging capability: (0x01) Error logging supported. General Purpose Logging supported. Short self-test routine recommended polling time: ( 2) minutes. Extended self-test routine recommended polling time: ( 397) minutes. Conveyance self-test routine recommended polling time: ( 5) minutes. SCT capabilities: (0x703d) SCT Status supported. SCT Error Recovery Control supported. SCT Feature Control supported. SCT Data Table supported.SMART Attributes Data Structure revision number: 16 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x002f 200 200 051 Pre-fail Always - 0 3 Spin_Up_Time 0x0027 180 179 021 Pre-fail Always - 5975 4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 32 5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0 7 Seek_Error_Rate 0x002e 100 253 000 Old_age Always - 0 9 Power_On_Hours 0x0032 097 097 000 Old_age Always - 2443 10 Spin_Retry_Count 0x0032 100 253 000 Old_age Always - 0 11 Calibration_Retry_Count 0x0032 100 253 000 Old_age Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 31 192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 4 193 Load_Cycle_Count 0x0032 200 200 000 Old_age Always - 2443 194 Temperature_Celsius 0x0022 115 107 000 Old_age Always - 35 196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0 197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0030 100 253 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0 200 Multi_Zone_Error_Rate 0x0008 100 253 000 Old_age Offline - 0SMART Error Log Version: 1 ATA Error Count: 45 (device log contains only the most recent five errors) CR = Command Register [HEX] FR = Features Register [HEX] SC = Sector Count Register [HEX] SN = Sector Number Register [HEX] CL = Cylinder Low Register [HEX] CH = Cylinder High Register [HEX] DH = Device/Head Register [HEX] DC = Device Command Register [HEX] ER = Error register [HEX] ST = Status register [HEX] Powered_Up_Time is measured from power on, and printed as DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes, SS=sec, and sss=millisec. It "wraps" after 49.710 days.Error 45 occurred at disk power-on lifetime: 2416 hours (100 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 02 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 10 02 00 00 00 a0 08 04:26:20.066 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 08 04:26:20.066 IDENTIFY DEVICE ef 03 46 00 00 00 a0 08 04:26:20.066 SET FEATURES [Set transfer mode] ef 10 02 00 00 00 a0 08 04:26:20.065 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 08 04:26:20.065 IDENTIFY DEVICEError 44 occurred at disk power-on lifetime: 2416 hours (100 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 46 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 03 46 00 00 00 a0 08 04:26:20.066 SET FEATURES [Set transfer mode] ef 10 02 00 00 00 a0 08 04:26:20.065 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 08 04:26:20.065 IDENTIFY DEVICE ef 10 02 00 00 00 a0 08 04:26:20.046 SET FEATURES [Enable SATA feature]Error 43 occurred at disk power-on lifetime: 2416 hours (100 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 02 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 10 02 00 00 00 a0 08 04:26:20.065 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 08 04:26:20.065 IDENTIFY DEVICE ef 10 02 00 00 00 a0 08 04:26:20.046 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 08 04:26:20.046 IDENTIFY DEVICEError 42 occurred at disk power-on lifetime: 2416 hours (100 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 02 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 10 02 00 00 00 a0 08 04:26:20.046 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 08 04:26:20.046 IDENTIFY DEVICE ef 03 46 00 00 00 a0 08 04:26:20.046 SET FEATURES [Set transfer mode] ef 10 02 00 00 00 a0 08 04:26:20.045 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 08 04:26:20.045 IDENTIFY DEVICEError 41 occurred at disk power-on lifetime: 2416 hours (100 days + 16 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 04 61 46 00 00 00 a0 Device Fault; Error: ABRT Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- ef 03 46 00 00 00 a0 08 04:26:20.046 SET FEATURES [Set transfer mode] ef 10 02 00 00 00 a0 08 04:26:20.045 SET FEATURES [Enable SATA feature] ec 00 00 00 00 00 a0 08 04:26:20.045 IDENTIFY DEVICE ef 10 02 00 00 00 a0 08 04:26:20.030 SET FEATURES [Enable SATA feature]SMART Self-test log structure revision number 1 No self-tests have been logged. [To run self-tests, use: smartctl -t]SMART Selective self-test log data structure revision number 1 SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS 1 0 0 Not_testing 2 0 0 Not_testing 3 0 0 Not_testing 4 0 0 Not_testing 5 0 0 Not_testing Selective self-test flags (0x0): After scanning selected spans, do NOT read-scan remainder of disk. If Selective self-test is pending on power-up, resume after 0 minute delay.Warranty Both of those HDDs are under warranty, so I can get them exchanged if having proof of fault.
Replacing old SATA cables. Could the old ones be cause of dmesg errors on HDDs?
The hdparm command only does one thing, namely issuing a specific ATA command which tells the drive to transition to a standby state. This doesn't prevent anything from immediately waking up the drive with a new command however so depending on the drive itself, it may not even try to spin down (the smart ones wait a short period of time for incoming commands, and only spin down if there are none). Note that the hdparm man page does not guarantee that this will spin down the drive, it only says it will 'usually' do so. In contrast, the Eject option in a file manager usually does a lot more than that. At minimum, it does the following (though not necessarily in this exact order):It makes sure that there are no open files on the drive. It forcibly flushes all filesystem buffers for all filesystems mounted from the drive. It unmounts all mounted filesystems from the drive. It flushes any block-layer caches for the device, and may tear down any intermediary block layers running on top of the device (for example, if FDE is being used, that will get shut down cleanly). It flushes the device's write cache, if the device has a write cache enabled. If the device can be put into a low or minimal power state programmatically, it does so. If the device has physically removable media that can be ejected by software (for example, a CD drive), it issues the appropriate eject command. Otherwise, it may dissociate the block-level drivers for the device from the device itself, effectively shutting off communications with the device.Those first five steps functionally ensure that nothing in userspace will issue any commands to the device that would wake it from the low power state triggerd in the sixth step, and the final step ensures that the device is properly removed from the system, and treated as a newly connected device the next time it is connected.
A HDD, which is older than 10 years, is getting read using a SATA-to-USB adapter. When using sudo hdparm -y /dev/sdj, the HDD does not shut down. But when using the Eject option in the File Manager, the HDD stops rotating.Side fact: The eject option in Microsoft Windows does shut the HDD down as well. Why does hdparm not make the HDD spin down while the File Manager does?
Why does hdparm -y not spin down a HDD while the file managed does? (using Ejection option)
The interface may be SATA or SAS or SCSI (or at least in part, ATA/IDE), but the protocol spoken on the interface is either scsi or a substantially similar superset (or in the case of IDE, subset) of SCSI or can be easily emulated by the SCSI protocol layer in the kernel.
By doing udevadm info -a /dev/sda we can see something like: looking at parent device '/devices/pci0000:3d/0000:3d:02.0/0000:60:00.0/host6/port-6:0/end_device-6:0/target6:0:0/6:0:0:0': KERNELS=="6:0:0:0" SUBSYSTEMS=="scsi"However, this device is a SATA SSD, why it's subsystem is scsi? This line: KERNELS=="6:0:0:0" means SCSI address, correct? In my understanding, they are different interfaces( SATA & SCSI ).
Why the subsystem of a SATA device is scsi?
Nevermind, my old kernel parameter for Intel is the problem pci=nomsi, removing this flag on /etc/default/grub then sudo update-grub, then reboot solves my problem
I got these messages for all drives after upgrading motherboard and processor from Intel to AMD Happened on all 5 disks: ata1, ata14, ata2, ata5, ata6 (weirdly there's only 6 sata ports in the motherboard, but there's ata14?)How to solve this? If possible without reinstall ubuntu Already tried libata.force=noncq or libata.force=nosrst but still the same. Can boot thru recovery mode (fsck on all drives works fine) but not on normal mode.
ataX softreset failed 1st fis failed after switching motherboard
Try:Check SATA cable. Change it if possible. Try another SATA port, if possible.If none of these action solve the problem, then your hard drive is probably dead: [ 2211.157208] sd 5:0:0:0: [sda] tag#8 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 2211.157211] sd 5:0:0:0: [sda] tag#8 Sense Key : Medium Error [current] [ 2211.157214] sd 5:0:0:0: [sda] tag#8 Add. Sense: Unrecovered read error - auto reallocate failed [ 2211.157216] sd 5:0:0:0: [sda] tag#8 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00 [ 2211.157218] print_req_error: I/O error, dev sda, sector 0
there seems to be a problem with the hard disk. I just wanted to know if I can fix it somehow or I should throw it away. the problem is that the hard disk is not recognized. https://pastebin.com/2BzytHdC
SATA hard disk not recognized
RHEL's limitations are core- and RAM-based, not drive count-based; the wording is hinting at few chassis being able to mount more than 10 or so drives. Linux itself is limited to 128 SCSI drive devices (sda through sddx).
I came across the following blurb in some RHEL 6 training documentation: The number of drives that can be installed on modern computers has increased. With port multipliers, it's relatively easy to configure 16 Serial Advanced Technology Attachment (SATA) drives on a system (assuming you can fit all of those drives). Does this mean that RHEL 6 won't allow more than 16 SATA drives from a software perspective? Or just that practical hardware constraints usually don't allow for more than 16 but it's technically possible?
Does RHEL 6 enforce software constraints on the number of SATA drvices that can exist on a system?
This process will prevent uncertified software from booting. This may have benefits although I can't see them.You have a new security mechanism to control what can and what can not boot from your hardware. A security feature. You don't feel like you need it until it's too late. But I digress.I have read a thread on Linux mailing list where a Red hat employee asks Linus Torvalds to pull a changeset which implements facility to parse PE binaries and take a complex set of actions to let kernel boot in Secure Boot mode (as far as I can understand).Drivers, like your GPU firmware, have to be signed in line with Secure Boot, otherwise it can be yet another rootkit. The status quo is that those drivers are signed in PE format. The kernel can boot without those anyway, but hardware won't work. Parsing PE format in kernel is just a technically simpler choice for this than asking every hardware vendor to sign their blobs for each distro, or setting up a userspace framework to do this. Linus decides not to suck Microsoft's dick. That's not a technical argument.What benefits will I gain with UEFI and Secure Boot, as a home user?The most visible feature is UEFI fast boot. I've got my hands on several Windows 8 logo desktops and they boot so fast that I often miss to pop up the boot menu. Intel and OEMs have got quite some engineering on this. If you're the type of linux users who hate bloatedness and code duplication with a passion, you may also want to manage multiboot at firmware level and get rid of bootloaders altogether. UEFI provides a boot manager with which you can boot directly into kernel or choose to boot other OS' with firmware menu. Though it may need some tinkering. Also, fancier graphics during boot time and in firmware menu. Better security during boot (Secure Boot). Other features (IPv4/6 netboot, 2TB+ boot devices, etc.) are mostly intended for enterprise users. Anyway, as Linus said, BIOS/UEFI is supposed to "just load the OS and get the hell out of there", and UEFI certainly appears so for home users with fast boot. It certainly does more stuff than BIOS under the hood but if we're talking about home users, they won't care about that.How is this signing done?Theoretically, a binary is encrypted with a private key to produce a signature. Then the signature can be verified with the public key to prove the binary is signed by the owner of the private key, then the binary verified. See more on Wikipedia. Technically, only the hash of the binary is signed, and the signature is embedded in the binary with PE format and additional format twiddling. Procedurally, the public key is stored in your firmware by your OEM, and it's from Microsoft. You have two choices: Generate your own key pair and manage them securely, install your own public key to the firmware, and sign the binary with your own private key (sbsign from Ubuntu, or pesign from Fedora), or Send your binary to Microsoft and let them sign it.Who can obtain signatures/certificates? Is it paid? Can it be public? (It should be available in the source code of Linux, doesn't it?)As signatures/certificates are embedded in binaries, all users are expected to obtain them. Anyone can set up their own CA and generate a certificate for themselves. But if you want Microsoft to generate a certificate for you, you have to go through Verisign to verify your identity. The process costs $99. The public key is in firmware. The private key is in Microsoft's safe. The certificate is in the signed binary. No source code involved.Is Microsoft the only authority to provide signatures? Shouldn't there be an independent foundation to provide them?The technical side is rather trivial, compared to the process of managing PKI, verifying identity, coordinating with every known OEM and hardware vendor. This costs a dear. Microsoft happens to have infrastructure (WHQL) and experience for this for years. So they offer to sign binaries. Anyone independent foundation can step up to offer the same thing, but none has done it so far. From a UEFI session at IDF 2013, I see Canonical has also begun putting their own key to some tablet firmware. So Canonical can sign their own binaries without going through Microsoft. But they're unlikely to sign binaries for you because they don't know who you are.How will this impact open source and free kernels, hobbyist/academic kernel developers etc.Your custom built kernel won't boot under Secure Boot, because it's not signed. You can turn it off though. The trust model of Secure Boot locks down some aspects of the kernel. Like you can't destroy your kernel by writing to /dev/kmem even if you're root now. You can't hibernate to disk (being worked upstream) because there is no way to ensure the kernel image is not changed to a bootkit when resuming. You can't dump the core when your kernel panics, because the mechanism of kdump (kexec) can be used to boot a bootkit (also being worked upstream). These are controversial and not accepted by Linus into mainline kernel, but some distros (Fedora, RHEL, Ubuntu, openSUSE, SUSE) ship with their own Secure Boot patches anyway. Personally the module signing required for building a Secure Boot kernel costs 10 minutes while actual compilation only takes 5 minutes. If I turn off module signing and turn on ccache, kernel building only takes one minute. UEFI is a completely different boot path from BIOS. All BIOS boot code won't be called by UEFI firmware.A Spanish Linux user group called Hispalinux has filed a complaint against Microsoft on this subject to Europan Comission.As said above, no one except Microsoft has stepped up to do the public service. There is currently no evidence of Microsoft's intent of doing any evil with this, but there is also nothing to prevent Microsoft from abusing its de facto monopoly and going on a power trip. So while FSF and Linux user groups might not look quite pragmatic and have not actually sit down to solve problems constructively, it's quite necessary people put pressure on Microsoft and warn it about the repercussions.Should I be concerned? I reject to use neither proprietary software nor software signed by trusted companies. I have done so till now, and I want to continue so.Reasons to embrace Secure Boot:It eliminates a real security attack vector. It is a technical mechanism to give user more freedom to control their hardware. Linux users need to understand Secure Boot mechanism and act proactively before Microsoft gets too far on monopoly of Secure Boot policy.
I'm planning to buy a new laptop in the coming days, and I'm quite impressed with new, cool Ultrabooks. As a long-time GNU/Linux user, I'll of course install a distro of my choice on it. Chances are I'll have to buy a computer with Windows 8 pre-installed; and chances are it will run UEFI and have "secure boot", on which non-signed kernels won't boot. UEFI is probably good, BIOS may need to retire. I guess the hairy thing is Secure Boot. As far as I can understand, some trusted certificates will be embedded into firmware and so into the kernel etc.. If the kernel's certificate can be traced back to either one of firmware's, the kernel will boot, else UEFI will tell me off and refuse to boot. This process will prevent uncertified software from booting. This may have benefits although I can't see them. I wonder how can an open source kernel obtain one of these keys and still be free. I have read a thread on Linux mailing list where a Red hat employee asks Linus Torvalds to pull a changeset which implements facility to parse PE binaries and take a complex set of actions to let kernel boot in Secure Boot mode (as far as I can understand). They want to do this because Microsoft only signs PE binaries. Mr. Torvalds has kindly rejected this changeset, stating the kernel already implemets the standard, which is not PE. RedHat is trying to push this code to kernel so they won't have to fork it one day. See, this is a complicated thing. Let me ask my questions:What benefits will I gain with UEFI and Secure Boot, as a home user? How is this signing done? Who can obtain signatures/certificates? Is it paid? Can it be public? (It should be available in the source code of Linux, doesn't it?) Is Microsoft the only authority to provide signatures? Shouldn't there be an independent foundation to provide them? How will this impact open source and free kernels, hobbyist/academic kernel developers etc.. e.g. Will this boot (a very basic boot sector code): hang: jmp hang times 510-($-$$) db 0 db 0x55 db 0xAAA news item at this website was the inspration of this question. A Spanish Linux user group called Hispalinux has filed a complaint against Microsoft on this subject to Europan Comission. Should I be concerned? I reject to use neither proprietary software nor software signed by trusted companies. I have done so till now, and I want to continue so. Thanks in advance.
The UEFI & SecureBoot impact, how severe?
1. What is the initial "Continue boot" or "Enroll MOK" dialog that appears when you install Mint and reboot for the first time? That is produced by shimx64.efi when it detects that there is a new MOK in a OS-accessible UEFI NVRAM variable, waiting to be installed. 2. If I had enrolled the MOK key, would Virtualbox have installed without asking me to do anything? Most likely, yes. 2.5. What exactly does VirtualBox when it enrolls its own key? It probably just triggers update-secureboot-policy --enroll-key if it's available. 3. How can I do the "Enroll MOK" now after I have installed and configured my system and really don't want to re-install again? sudo apt install shim-signed sudo update-secureboot-policy --enroll-key4. Now I am afraid to install the proprietary NVidia drivers, because I didn't enroll MOK and am afraid that it won't work. Technically not a question, but don't worry. If you install the NVidia driver through Ubuntu's/Mint's 3rd-party driver management tool, it will probably just do the steps listed in 3.) above for you if you haven't already done that. If you use the installation package downloaded directly from NVidia, first install a dkms management tool for third-party modules, and then run the NVidia driver installer: sudo apt install dkmssudo ./NVIDIA-Linux-x86_64-<version number>.run --dkms \ --module-signing-secret-key=/var/lib/shim-signed/mok/MOK.priv \ --module-signing-public-key=/var/lib/shim-signed/mok/MOK.derdkms automates the rebuilding of the 3rd-party kernel modules (like the NVidia driver's) so you won't have to do it manually whenever you receive a kernel security update. 5. And, generally, what does this "Enroll MOK" thing do after the 1-st reboot? If you don't do the "Enroll MOK" on the next reboot right after running update-secureboot-policy --enroll-key, the enrollment procedure will be on hold, waiting for you to either complete it by selecting "Enroll MOK" on a subsequent boot, or to cancel it with sudo mokutil --revoke-import within Linux. Once you've completed the MOK enrollment procedure, you should not see that prompt again unless you lose the old MOK and enroll a new one. 5.1. Does it mean that it puts some Ubuntu keys in the BIOS? No, the enrollment procedure makes a key that is unique to your system and places it in /var/lib/shim-signed/mok/ accessible to root only, so the kernel module installation processes can use it, and enrolls a copy of the public part of the key to an UEFI NVRAM variable, so it can be used by shimx64.efi when booting. 5.2. Does it mean that if I do it, then all future proprietary kernel modules that I install will happen smoothly without enrolling their own MOKs? That's the idea, yes. Unfortunately not all third-party kernel module source packages have not yet been updated to seamlessly detect the presence of MOK and automatically use it if necessary.
I have a dual boot laptop Windows 10 / Linux mint 20. Secure boot enabled and also hard disk encryption, but the latter is maybe not important for the question. By the way, my question is very similar to this one: https://forums.linuxmint.com/viewtopic.php?t=274365 I installed Windows and after that - Linux Mint. After Mint installation, computer rebooted and I was asked to "Continue boot" or "Enroll MOK". I didn't know what to do and went to search online on the other laptop. While searching, the dialog apparently timed out and the computer just continued booting. Laptop is Dell Vostro 5581 updated to latest BIOS. Later on the same day, I installed Virtualbox from Oracle's web site (not from repository). During the installation in text mode on the console it asked me to confirm that I want to enroll MOK upon the next reboot and enter a temporary password. I did and rebooted and enrolled the MOK. (Not knowing what I am doing, by the way) So, here are my questions. All this secure boot thing is very new to me.What is the initial "Continue boot" or "Enroll MOK" dialog that appears when you install Mint and reboot for the first time? This appears before the OS even boots. I think it's a BIOS thing. And it seems to does not matter if you just continue boot or enroll the key. I did 2 Linux installations and in the 1-st one I chose to enroll the key, but on the 2-nd ignored it. There seemed to be no difference.If I had enrolled the MOK key, would Virtualbox have installed without asking me to do anything? What exactly does VirtualBox when it enrolls its own key?How can I do the "Enroll MOK" now after I have installed and configured my system and really don't want to re-install again? The other question on the forum (see link above) has an answer saying:I had the same problem. In order to set a new MOK password I've used the command sudo update-secureboot-policy --enroll-key however, on my installation there is no such command update-secureboot-policy.Now I am afraid to install the proprietary NVidia drivers, because I didn't enroll MOK and am afraid that it won't work.And, generally, what does this "Enroll MOK" thing do after the 1-st reboot? I really don't understand it. Does it mean that it puts some Ubuntu keys in the BIOS? Does it mean that if I do it, then all future proprietary kernel modules that I install will happen smoothly without enrolling their own MOKs?
"Enroll MOK" dialog after the 1-st reboot when you install Linux Mint 20.1 - what is it for (secure boot)?
As mentioned in the manpage,Unencrypted hibernation/suspend to swap are disallowed as the kernel image is saved to a medium that can then be accessed.Unencrypted hibernation stores the contents of the hibernated system’s memory as-is on disk. This allows an attacker to modify those contents while the system is hibernated, resulting in changes to the running system when it is resumed, thus defeating the lockdown. The manpage gives false hope that encrypted hibernation would be supported in lockdown, but that’s currently not the case, and the real requirement appears to be signed hibernation images rather than (or presumably in addition to, depending on the lockdown mode) encrypted images. Matthew Garrett has been working on fixing this; he described his proposal to get hibernation working with lockdown in February 2021, and gave an update with practical solutions to a couple of the remaining issues in December 2021. The general idea is to tie hibernation images to TPM states, such that a locked down system will only resume a hibernation image generated on that system and not modified since; getting there requires both knowing what TPM state is valid for the image, and that the TPM state was arrived at by the kernel on its own.
In my systemd jounal (journalctl) I often see this message:hibernation is restricted; see man kernel_lockdown.7This seems to stem from the kernel lockdown feature that (only?) is active when you boot in UEFI mode with secure boot enabled. As far as I understand that this feature is supposed to prevent a program running at user-space from modifying the kernel. While I do understand that so far, I just don't get one thing: Why does the kernel lockdown disable that feature? Why does it disable hibernation altogether? What is exactly is “insecure” about hibernation that this is disabled? It seems a locked down kernel does not want me to hibernate my device. Linux kernel v5.6.15 Fedora 32 SilverblueCross-posted at Fedora Ask.
Why does the kernel lockdown prevent hibernation?
Flash the ISO on the usb key as you would normally do. Then:navigate to ~\EFI\boot\ rename BOOTx64.EFI as loader.efi download signed shim.efi in the same folder rename it as BOOTx64.EFI boot the thing and enroll from disk the ~\EFI\boot\loader.efi hashEDIT: relevant bug
I've got a new laptop with a Samsung BIOS (version P08AFD) and Aptio Setup Utility. When I try to boot a USB stick with Arch Linux 2016.10.01 it says that the signature is invalid. The documentation seems to assume that I've already booted into Arch Linux. So I'm stumped for how to continue:Are the keys on the ISO somewhere? There is a tool in Aptio to add PK, KEK, DB and DBX files. Has the signature been invalidated by me making a custom USB stick from the official installation medium? Should this "just work"? I'm at a loss for why a Linux distro would stop supporting a common (if controversial) security feature, especially since they seem to have supported it for some time.The USB stick boots just fine on an older machine without Secure Boot support.
How to boot Arch Linux installation medium with Secure Boot enabled?
Aaargh - Ubuntu 16.04 version of efitools: 1.4.2. Latest version of efitools: 1.7.0. Problem solved!
Following the instructions here: Secure Boot - ArchWiki worked great last year (2016). However, any keys created since the start of 2017 are refused by my Dell Optiplex 7440's UEFI firmware. I can even set the date on my desktop to 31st Dec 2016 and create a valid Platform Key, but anything created with a later date fails to upload in the Custom Mode Key Management section of the BIOS with:Error replacing key. Please make sure that the new key is properly formatted with signature list and serialization headers.Exactly the same commands are used as before, just the date on the computer used to generate the key has changed: openssl req -newkey rsa:2048 -nodes -keyout PK.key -new -x509 -sha256 -days 3650 -subj "/CN=Platform Key/" -out PK.crt cert-to-efi-sig-list -g $uuid PK.crt PK.esl sign-efi-sig-list -k PK.key -c PK.crt -g $uuid PK PK.esl PK.authAny ideas gratefully received. This also works/fails in the same way on a Fujitsu machine.
UEFI Secure boot key restrictions?
2022-05-21 - systemd v251 Support for TPM2 + PIN has been merged in systemd-cryptenroll and is available as part of release v251.Changes in disk encryption:systemd-cryptenroll can now control whether to require the user to enter a PIN when using TPM-based unlocking of a volume via the new --tpm2-with-pin= option. Option tpm2-pin= can be used in /etc/crypttab.Source
I am currently aware of two recent methods to bind a LUKS encrypted root partition to a TPM2: systemd-cryptenroll and clevis. Both of them seem to release the encryption key after successfully checking the PCRs the key was sealed against. But I don't like the idea of the volume being decrypted without user interaction. I'd rather have a solution like it is offered by BitLocker for Windows: Either TPM and an additional PIN or a recovery key. Even though I searched the web quite exhaustively I was not able to find any hints in this direction. Is anybody aware of a solution? EDIT: There is a --recovery-key option for systemd-cryptenroll. I'm only concerned with the question how to get an additional PIN requirement when using the TPM.
LUKS + TPM2 + PIN
TLDR: Enter BIOS, this enabled the keyboard in MOK Manager for me. You don't need to change any setting there, you can directly exit it after entering it. I had the same problem after installing Linux Mint 20.1 on my Lenovo Legion 5 Pro 16ACH6H. After MOK Manager started it didn't recognize my keyboard. I had to shortly press the power button to turn it of. Now I turned it on, pressed F2 to get into my BIOS (the keyboard is working there). I directly left the BIOS without changing anything and voilà - the keyboard was working then! Linux Mint will only show the MOK Manager twice, if it isn't shown to you anymore you can bring it back by executing the following command from your Terminal: sudo update-secureboot-policy --enroll-key You need to press <Tab> to get to the "Ok", then enter any password, repeat and then shut down. Turn it on again and don't forget to enter the BIOS.
I am trying to enroll a MOK under Ubuntu 20.04.1 for supporting some third-party kernel modules while keeping Secure Boot enabled. The system boots fine with the stock kernel and modules, but I am having issues with using the Mok Manager to enroll the generated MOK that is being used to sign third-party kernel modules. When I start the enrollment process, I enter a password into the dialog while Ubuntu is running and it schedules for the Mok Manager to run on next boot to continue the enrollment process. When I reboot, I find myself in the Mok Management menu with four choices, the first being to continue boot and the second to enroll the generated MOK key. However, my keyboard does not seem to function at all during this time. Not even Caps Lock or Num Lock takes effect. If I wait long enough, it seems to time out and continue boot asking me to press any key to enter into the Mok Manager. I have found that F1 and F12 seem to enter into it, both keys that can be used to select BIOS options, but most other keys are still ignored. From Grub or other bootloaders, my laptop keyboard seems to work fine. An external USB keyboard did not help. This is a Lenovo Legion Y540. Is there something blocking the keyboard or something that needs to be loaded to enable it?
Keyboard does not work in MokManager during key enrollment
You can unpack the compressed module, sign it, and re-compress it unxz zfs.ko.xz sign-file sha1 "${key}" "${x509}" "zfs.ko" xz -f zfs.koor a bit more general (I use this for evdi, inspired by https://gist.github.com/dop3j0e/2a9e2dddca982c4f679552fc1ebb18df ) for module in $(dirname $(modinfo -n evdi))/*.ko*; do module_basename=${module:0:-3} module_suffix=${module: -3} if [[ "$module_suffix" == ".xz" ]]; then unxz $module echo sign-file sha1 "${key}" "${x509}" "${module_basename}" sign-file sha1 "${key}" "${x509}" "${module_basename}" xz -f ${module_basename} elif [[ "$module_suffix" == ".gz" ]]; then gunzip $module sign-file sha1 "${key}" "${x509}" "${module_basename}" gzip -9f $module_basename else sign-file sha1 "${key}" "${x509}" "${module_basename}" fi doneafter running sudo depmod -a modprobe evdi just works :)
I'm having a little trouble signing my zfs module in Fedora 27 using UEFI/Secure Boot and I hoped someone here might be able to help. As a quick explanation for how I would normally do this, I sign the VirtualBox module using keys I have already generated and registered with efibootmgr, with the following command: # /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 ./key.priv ./key.der $(modinfo -n vboxdrv) It works fine because vboxdrv exists as an ordinary kernel module, and I do the same thing successfully for every kernel update, and the process is generic enough that I should be able to do the same thing with zfs. But attempting to do so fails. Checking # modinfo -n zfs, I see that the zfs kernel module appears to exist as a compressed file - /lib/modules/4.15.17-300.fc27.x86_64/extra/zfs.ko.xz (and that is the correct current kernel version). To see if maybe there's another module that exists elswhere, I run # find / -name zfs.ko which returns nothing, so this .xz file is the only zfs module available. Fine, so I run # xz --decompress zfs.ko.xz. This tells me that the data is corrupt (the xz utility is what returns this error, suggesting that it isn't an xz-compressed file, or at least is modified in some way or otherwise can't be handled by the builtin xz). # modinfo zfs just returns the path to zfs.ko.xz and a modinfo error. So I'm at a loss at this point. Disabling secure boot is not really an option I want to consider. How am I supposed to sign a compressed module if I can't decompress the file first? Or is it already signed with a key available for me somewhere to download that I'm supposed to register?
Signing a compressed kernel module for use with Secure Boot
As you discovered, this is enforced by CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT. That setting is supported by a kernel patch which hasn’t been merged upstream; you’ll find it in Fedora and RHEL kernels but not in Arch. Since it hasn’t been merged upstream, you won’t find it in the upstream kernel documentation, or on any other site which describes the upstream kernel.
I recently secure-booted Arch and Fedora on my RTX3050 equipped laptop. As is the common knowledge, I had to sign my Nvidia modules on Fedora for the kernel to load them. However, I find that same is not the case with Arch. Arch loads the Nvidia modules even if they are not signed — provided, of course, that the kernel and the GRUB are signed. Upon researching, I came across this post on the ArchWiki mentioning the module.sig_enforce=1 kernel parameter to force signature verification. However, table 3 in this entry of Fedora docs, mentions that the said kernel parameter doesn't make any difference when SecureBoot is enabled.The kernel docs mention CONFIG_MODULE_SIG_FORCE option in the kernel configuration. So, I decided to take a look at Fedora's and Arch's configs. And sure enough, Arch doesn't have the option set. But, so doesn't Fedora. So why this difference in handling of the modules? EDIT: I found CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT option that is present in Fedora's config but not in Arch's, after a chat in Fedora's Matrix Room. But, I cannot find any documentation related to this at docs.kernel.org; only a reference here. Is there a different site for documenting all kernel config options?
How come Fedora ignores `module.sig_enforce` kernel parameter if SB is enabled but Arch does not?
For installing it you will need to disable Secure Boot in the BIOS, but after installation you can re-enable it if you want.
I have copied arch linux iso image in a usb using rufus. I want to install arch linux on my laptop But should I disable Secure Boot in BIOS settings? Many OS Installations need it to be disabled. Is it also true for installing Arch Linux?
Should I disable secure boot to install arch linux
The lockdown LSM module is what disables hibernation, and there is a kernel compile flag for this called CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT, set it to no and it won't enable lockdown in when EFI secure booted.
My current config is Windows-11 (required for my job) and Ubuntu 21.10 dual-booting on an HP Probook G10. Since I have to have secure-boot to run Win-11, I have to live without hibernation on Linux (really really difficult). I realize that hibernation is now officially disabled when secure-boot is enabled on all pre-built kernels. I appreciate the security and understand the nature of the decision for the lockout. But is there an "officially unofficial" way to relax this setting in a kernel compile config option or patch so that hibernation and secure-boot and co-exist, despite the staggering security risks it introduces? I just want to be able to boot Win-11 and Linux while accepting the full litany of risks that this would open me up to. Possible?
Patching the kernel to allow hibernation with secure-boot enabled
These are UEFI revocation list updates; they revoke signatures used for Secure Boot. Since you don’t use Secure Boot they are irrelevant for you. Since UEFI capsule updates are disabled you probably wouldn’t be able to apply them anyway.
I own a rather older piece of server, Dell PowerEdge T20, with the latest BIOS version A20, link to Dell updates, screen of the update in case link goes dead in time:This morning, when SSH'd into this server, I was greeted with a message that there is one firmware update available, see below for complete details, it also said I could run: fwupdmgr get-upgradesto get information about it, which I did. $ ssh-s up 18 hours, 31 minutes1 device has a firmware upgrade available. Run `fwupdmgr get-upgrades` for more information.root @ dell-poweredge-t20 /root # fwupdmgr get-upgrades WARNING: UEFI capsule updates not available or enabled in firmware setup See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information. Devices with no available firmware updates: • Samsung SSD 860 PRO 256GB • WDC WD5000BMVU-11A08S0 PowerEdge T20 │ └─UEFI dbx: │ Device ID: 362301da643102b9f38477387e2193e57abaa590 │ Summary: UEFI Revocation Database │ Current version: 77 │ Minimum Version: 77 │ Vendor: UEFI:Linux Foundation │ Install Duration: 1 second │ GUIDs: c6682ade-b5ec-57c4-b687-676351208742 ← UEFI\CRT_A1117F516A32CEFCBA3F2D1ACE10A87972FD6BBE8FE0D0B996E09E65D802A503 │ f8ba2887-9411-5c36-9cee-88995bb39731 ← UEFI\CRT_A1117F516A32CEFCBA3F2D1ACE10A87972FD6BBE8FE0D0B996E09E65D802A503&ARCH_X64 │ Device Flags: • Internal device │ • Updatable │ • Supported on remote server │ • Needs a reboot after installation │ ├─Secure Boot dbx: │ New version: 217 │ Remote ID: lvfs │ Summary: UEFI Secure Boot Forbidden Signature Database │ License: Proprietary │ Size: 13.8kB │ Created: 2020-07-29 │ Urgency: High │ Vendor: Linux Foundation │ Duration: 1 second │ Flags: is-upgrade │ Description: │ This updates the dbx to the latest release from Microsoft which adds insecure versions of grub and shim to the list of forbidden signatures due to multiple discovered security updates. │ │ Before installing the update, fwupd will check for any affected executables in the ESP and will refuse to update if it finds any boot binaries signed with any of the forbidden signatures. If the installation fails, you will need to update shim and grub packages before the update can be deployed. │ │ Once you have installed this dbx update, any DVD or USB installer images signed with the old signatures may not work correctly. You may have to temporarily turn off secure boot when using recovery or installation media, if new images have not been made available by your distribution. │ ├─Secure Boot dbx: │ New version: 211 │ Remote ID: lvfs │ Summary: UEFI Secure Boot Forbidden Signature Database │ License: Proprietary │ Size: 13.5kB │ Created: 2021-04-29 │ Urgency: High │ Vendor: Linux Foundation │ Duration: 1 second │ Flags: is-upgrade │ Description: │ This updates the dbx to the latest release from Microsoft which adds insecure versions of grub and shim to the list of forbidden signatures due to multiple discovered security updates. │ └─Secure Boot dbx: New version: 190 Remote ID: lvfs Summary: UEFI Secure Boot Forbidden Signature Database License: Proprietary Size: 14.4kB Created: 2020-07-29 Urgency: High Vendor: Linux Foundation Duration: 1 second Flags: is-upgrade Description: This updates the dbx to the latest release from Microsoft which adds insecure versions of grub and shim to the list of forbidden signatures due to multiple discovered security updates. root @ dell-poweredge-t20 /root # I never have updated my BIOS/UEFI with/from Linux. My first question would be: What is this update exactly designed for? (new BIOS?) Second maybe is it safe to proceed with the update, and are there any dis-/advantages? Thank you. Notes:This server runs Debian 11.Secure Boot is disabled on this machine.I have disabled UEFI capsule updates in the BIOS as a precaution.
What is this update exactly designed for? (new BIOS?)
Secure boot does not in itself protect against an attacker with physical access to the machine. I recommend using a password to protect against unauthorized access to the firmware setup. The primary goal of secure boot is to prevent malware from inserting compromised kernels and boot loaders. A user with physical access can enroll new public keys (i.e. store them in nonvolatile storage controlled by the firmware). These public keys are used to verify the integrity of the bootloader, the kernel, and anything else that is run at boot time. After enrolling a new key, the attacker can then install a new kernel, which is signed with the attacker's private key. Or an attacker with physical access can disable secure boot altogether. But, here's the crux: new keys can only be added if the person doing so has physical access to the screen and can enter the firmware setup. Physical access is required to be able to replace or add new keys. Secure boot is designed to protect against scenarios where an attacker tries to modify critical system files by breaking into the computer when the system has already been started. This break-in can happen via the network, or using a trojan horse program the legitimate user is tricked to run. Even with secure boot active, the attacker may be able to modify the kernel image, but the firmware refuses to start the kernel at the next boot, because the signature does not match. So, UEFI Secure Boot does have its uses, but here's an additional point to consider. Since computers are shipped with Microsoft's and the hardware manufacturer's keys preinstalled, it is not under your control which binaries are able to run at boot time on your computer. Bugs have been detected in signed GRUB images that can be used to circumvent secure boot. Microsoft and hardware vendors may be signing all kinds of binaries left and right, and you have no way of knowing. The solution to this problem is to get rid of all the firmware keys and replace them with your own. This way only you can sign binaries that are allowed to run (at boot time) on your computer. But beware: there are reports of some computers that require special drivers to boot, and these drivers are signed with keys that require the original public keys to be present, or the machine won't boot.
I'm setting up my arch linux to dual boot with windows and secure boot enabled. As far as I have understood secure boot, the goal is to prevent an attacker from modifying the boot manager and/or kernel. For windows, this also works when I leave my laptop unattended as a modified boot manager would not be signed with Microsoft's key. Almost all linux distros use shim, so do I. After setup and reboot I need to enroll the hash of the GRUB boot manager. So far so good. Then I simulate an attack by changing a byte in the grub binary and reboot. I am again prompted by to enroll its hash and can do so without any hassle. So how does this improve anything if a security violation can easily be "fixed" by enrolling a new hash? Is there something I have misunderstood?
Does secure boot + shim protect against evil maid?
Yes, it only applies to older versions of Ubuntu. The current release supports secure boot and there's no reason to disable it.
Can anyone tell me whether it is necessary, or even recommended to disable Secure Boot in UEFI before doing a fresh Ubuntu installation? Ditto for CSM or Legacy Boot(BIOS) mode. I leave both untouched from their defaults(enabled) and only disabled Fast Boot in UEFI before my most recent install (Ubuntu-mate 16.04). CSM enabled in my ASUS UEFI-BIOS means UEFI+Legacy Oprom are supported, which I assume means attempt UEFI first and fall back to BIOS Legacy if UEFI isn't supported. Although I had to boot a couple times before my new Linux install was recognized by UEFI, didn't seem to have any other issues. Just wondering is the 'disable Secure Boot' only applies to older versions of Ubuntu, or if there is some other advantage to doing so?
Latest Ubuntu and Secure Boot
gparted is a nice GUI tool for resizing partitions, or ext partitions at any rate. I have not tried it on NTFS filesystems, although apparently it can. So yes, you can resize now or later. Just backup your personal tish first, just in case. Of course, if you know what is good for you, you keep that backed-up anyway ;) Note that you should not resize a mounted partition, so if you want to resize /, you will have to boot a live CD (I'm sure they all have gparted) and do it from there.
Currently dual booting Windows 8 and Linux Mint 14, sooner or later I will give more space to my Linux system. Is resizing my Linux partition from the beginning a safe operation ? If yes, could you provide the name of an utility that would help me achieve this ? I am asking this because systematically when I did that under Windows using Acronis Disk Director the system was broken, I couldn't boot to Windows anymore because of an NTLDR missing. So unless I thought in advance to make a recovery disk I was unable to use it again !
Can I safely resize my partition from its beginning?
In mid-2020, a security vulnerability known as CVE-2020-10713 or BootHole was found. It affected just about all distributions that used GRUB2 with Secure Boot and had the GRUB acpi module included in their Secure Boot-compatible configuration. In its aftermath, security researchers focused more attention on the boot process to find other similar vulnerabilities. This led to a group of further vulnerabilities being found, fixed and published in GRUB2 in March 2021. Along with that, Debian had to revoke their old Secure Boot signing key, create new keys and make some changes to their bootloader signing process. Since Ubuntu had a similar Secure Boot infrastructure, they had to do much the same. Other distributions that copy their Secure Boot infrastucture from Debian/Ubuntu would have had to do the same, as another part of the security researchers' project was to gather a list of hashes of vulnerable GRUB and shimx64.efi versions and revoked Secure Boot signing keys. That list was to be added to the exclusion databases of future Secure Boot firmwares, and eventually distributed as Secure Boot exclusion database updates to existing systems. In August 9, 2022, Microsoft released a Secure Boot exclusion database update for Windows that included the exclusions for vulnerable versions of GRUB; a Secure Boot dbx update was also released for the Linux fwupd/fwupdmgr system. It would seem reasonable to assume that some coordination between Linux distributions and OS vendors was done to ensure all the major OSs were covered. Now, if Pop!_OS's boot components are now matching the newest exclusion lists, that would indicate they originate from Debian pre-March 2021, or in other words are at level equivalent to Debian 10.9 or older. It would seem that Pop!_OS has skipped some updates. Granted, they have a recommendation to disable Secure Boot, but since Pop!_OS is based on the corresponding release of Ubuntu, Ubuntu's support of Secure Boot indicates a functional Secure Boot support should have been achievable for Pop!_OS 22.04 LTS too. Perhaps System76 (Pop!_OS's developer) chose to skip getting a Secure Boot certificate from Microsoft? To me, this suggests that Pop!_OS's focus might be more towards style rather than substance. Basically, the Secure Boot revocation of August 9, 2022 was done to eliminate a false sense of security in case you're still using vulnerable components: your system is no more vulnerable than a system with no Secure Boot in the first place. If your system is physically secure, there should be no practical way for the attacker to use these vulnerabilities as a way into the system. But if you would rely on Secure Boot to make Evil Maid-type attacks more difficult than your "expected" level of attacker can pull off, then it looks like Pop!_OS might currently be the wrong choice for that use case.
I just downloaded Pop!_OS 22.04 LTS (NVIDIA) from the official website, verified the checksum, flashed to a pen drive, and attempted to boot from it. I forgot to disable Secure Boot as advised on the website, so unsurprisingly, I got an error message. However, the actual contents of the message surprised me:Operating System Loader signature found in SecureBoot exclusion database ('dbx'). All bootable devices failed Secure Boot verification.While I did expect the signature NOT to be found in the signature database, I did not expect to find it in the exclusion database. According to this website:dbx, the “forbidden signatures database.” Entries here are typically SHA256 hashes of specific UEFI binaries, i.e. those things that were signed by a certificate in the “db” list but later found to be bad (e.g. having a security vulnerability that compromises the firmware). So this is a “block” list.How come the signature of the software provided by System76 could have been once valid but since found to be bad? Is this a sign of some potential vulnerability in Pop!_OS?
Operating System Loader signature found in SecureBoot exclusion database ('dbx'). All bootable devices failed Secure Boot verification
If I include Microsoft's keys in my secure boot setup, then any malware which has a Microsoft key can boot my Linux binary. Can I restrict my Linux binary to be booted only by a bootloader signed with my personal key?No. You misunderstand the chain of trust. Earlier things need to verify later things. Later things can't meaningfully verify earlier things.I know I can sign the binary itself with my personal key, but that doesn't prevent malware with a different key from booting my binary.Correct.If this is impossible, I can still sign the Windows binary with my own key and get rid of Microsoft's keys, right?Yes, and this is what you have to do if you don't want code signed by Microsoft's keys to run.
If I include Microsoft's keys in my secure boot setup, then any malware which has a Microsoft key can boot my Linux binary. Can I restrict my Linux binary to be booted only by a bootloader signed with my personal key? I know I can sign the binary itself with my personal key, but that doesn't prevent malware with a different key from booting my binary. If this is impossible, I can still sign the Windows binary with my own key and get rid of Microsoft's keys, right?
Can I require binary X to be booted only by a bootloader signed with key Y?
I solved it. So my issue was that I didn't understand how I could deploy the shim key manually, as most methods utilize the mokmanager on their own system. This method doesn't work well with PXE, as you want to boot from another system. After trying different things as well as looking into the shim source code, I found this page on the arch wiki, which is about secureboot. This page initially didn't catch my attention as it doesn't mention PXE. I wanted to use shim with a key to allow for easier updating. There is one sentence there that says you can just copy the DER-encoded public key to a FAT filesystem, usually the EFI partition is used. So, in the end I used the shim binary I copied from the PXE server system which then used the public key stored in the EFI partition to verify the linux kernel and grub binary. It might also be necessary to check whether you can boot a kernel with a Microsoft/Windows/CentOS signature, so you can remove it if you want full control.
As the title suggests, I'm trying to set up a system that uses PXE boot to boot into CentOS7 with custom signing keys. This process is adapted from several guides but the gist of it is that I use grub to load a grub.cfg, linux kernel and initramfs.gz (which contains the filesystem) from a tftpserver. These are verified with GPG signatures. However then I got the error that my linux kernel is not signed correctly, while it is signed with my own db key for secure boot. The key should be installed correctly in UEFI, as the grub EFI binary is also signed and should also be verified by secureboot. Furthermore, I've also checked whether the GPG verification succeeded with the grub command line, which it did. After this, I read some articles online and came to the conclusion that I should use shim as a first stage bootloader (and also sign that with the same DB key). So copied it from a Centos vm and pointed the DHCP server to shim. The issue persists as it gives the same error message, but now it also gives a location: error: ../../grub-core/loader/i386/efi/linux.c:215:/vmlinuz has invalid signature.I can't seem to find the file which is responsible in grub, as it is probably a different version. My search led me to this redhat article. However the article is behind a paywall......I'm not asking access to the article (I'm not sure whether it is allowed) as it may be a completely different problem. I also tried to build shim on my own, providing the DER encrypted key during the build process, but that seems to change nothing. I'm also new to shim and I'm not sure whether the usage of the machine operator key (MOK) is mandatatory, or whether it is sufficient to just sign it with the DB key. Does any of you have any pointers for me? Thank you
Custom signed Centos 7 PXE Secureboot with Shim and grub: invalid kernel signature
In X.509v3 certificate lingo, a certificate extension can be specified as critical if the creator of the certificate (and/or the certifying authority) requires that whoever is validating this certificate must understand this extension or else treat this certificate as not valid. The "Basic constraints" extension is the most fundamental certificate extension: it determines whether the certificate is a regular certificate ("CA: False") or a Certification Authority certificate ("CA: True", with an optional path length value, i.e. the maximum allowed depth of intermediate CA certificates after this CA certificate). In all modern systems, the "Basic constraints" certificate extension should always be a critical extension. So, these attributes: X509v3 Basic Constraints: critical CA: Falsemean in human terms: "This is not a CA certificate. If it appears in a situation where a CA certificate would be needed, someone is definitely doing something wrong. If you don't understand this restriction, you should not rely on this certificate for any purpose at all." In other words, this is a perfectly normal and expected extension on any non-CA certificate. A non-critical X.509v3 extension should be safe to ignore if its meaning is not understood by the program attempting to validate the certificate. Since Secure Boot cannot be expected to check with any Certification Authorities at boot time, these attributes don't really have any meaning to Secure Boot. When Secure Boot is in effect, the firmware is supposed to verify that any requests to change the existing Primary Key (PK) or Key Exchange Keys (KEK) are signed with the private key corresponding to the current PK certificate, and that any requests to update the existing whitelist (db), blacklist (dbx) or timestamp (dbt) keys are signed with a private key corresponding to the current PK certificate or any of the current KEK certificates. At boot time, any executable code loaded should not match any of the blacklist (dbx) entries and should either be signed with a key matching one of the whitelisted (db) certificates, or the executable's cryptographic hash should be included in the whitelist directly. These checks are completely independent of the X.509 PKI hierarchy. The Secure Boot key certificates can still be part of a company's PKI hierarchy, so that the certificates can be externally verified if necessary, and at that point, the X.509v3 certificate extensions may come into play. But for boot-time Secure Boot checks, any X.509v3 certificate extensions seem to usually be completely ignored. Because it turned out that some system firmwares don't allow the system owner to modify the Secure Boot keys in a useful way, a shim.efi bootloader was developed. It provides an extension scheme to Secure Boot: the shim.efi is signed by Microsoft, and it provides a second whitelist (MOK, Machine Owner's Key) that is reasonably strongly guaranteed to be independent of firmware control, but otherwise under similar security conditions as the other Secure Boot key variables. The MOK enrollment process deals with NVRAM variables and shim.efi, so the results of the operation are not stored in regular files that could be rolled back with timeshift or similar. In fact, it looks like that the appropriate NVRAM variables are created with attributes that specify UEFI boot service access only, so only shim.efi or another UEFI boot-time tool could modify them once created... assuming that the firmware works according to the UEFI and Secure Boot standards.
After successfully installing Linux Mint 19.1 Cinnamon for the first time, I went through the recommended steps to take after the installation. Here I also upgraded my system (after checking for and installing drivers). During this upgrade process however, following message popped up:Your System has UEFI Secure boot enabled. UEFI secure boot is not compatible with the use of third party drivers. The System will assist you in disabling UEFI secure boot. To ensure that this change is being made by you as an authorized user, and not by an attacker, you must choose a password and then use the same password after reboot to confirm the change. If you choose to proceed but do not confirm the password upon reboot, Ubuntu will still be able to boot on your system, but these third party drivers will not be available for your hardware.I then set a MOK PW and rebootedd the machine, signing the key. However, i don't really know what prompted this message, and what key I signed there. I am thinking it had to do with the third-party Nvidia-driver I had installed before, since I rolled back my system yesterday with timeshift to right after the driver installation (before the system update). Then I disabled the nvidia graphics card (for which the driver was for), and upon updating the system once again, no message which prompted me to sign a key popped up. One of the currently signed keys, which i suspect it might be, has the following attributes, which sound bad: X509v3 Basic Constraints criticalCA: FalseAll in all my main questions are as follows: What does this all mean? What did I actually do with signing said key, and does this affect my system in any negative way? How can i find out what key i originally signed there and if said key is "safe"?
Signing a key via mokutil
The question resolved itself: If GRUB attempts to chainload a file that is not accepted by Secure Boot (if Secure Boot is activated), it will get an Access Denied error.
Can I, in GRUB, configure it to verify if the EFI file it is going to chainload being signed (using the Secure Boot database) and refuse to boot if not signed? I had to disable secure boot for GRUB to allow me to dual-boot between Android and Windows. I don't want to lose that security for my Windows system. I know GRUB can check the signature of Linux kernels, but what about EFI bootloaders? Is it possible? How?
Verify integrity of EFI file before chainloading
Your OS Loader needs to include a copy of the public part (a.k.a. the certificate) of the key you'll be using to sign your own kernel. Any time that key changes, you will need to have your OS Loader re-signed by Microsoft. You might want to study the source code of the shimx64.efi Secure Boot shim bootloader that is used by many major distributions to handle Secure Boot: https://github.com/rhboot/shimAlternatively, you would have to get a copy of the public part of your kernel signing key added to the db UEFI NVRAM variable. Normally this is only possible if you replace the Secure Boot primary key (PK UEFI NVRAM variable) on your system. It depends on your system's firmware implementation how (or indeed if) this can be done. Common possible ways:If your UEFI firmware settings ("BIOS settings") include a way to directly edit the Secure Boot keystores, that could be used to add your kernel signing key directly to the db variable. You might have to reset or replace the PK primary key first, see below.If your UEFI firmware settings don't include a way to directly edit Secure Boot keystores, but include a way to zero out the PK primary key of Secure Boot, this can be enough to get you started. Zeroing out the PK places Secure Boot in Secure Boot Setup Mode, in which any kernel can be booted and all Secure Boot keystores can be edited. Setup Mode ends when a new Secure Boot primary key (i.e. a digital certificate similar to what is used in signing kernels for Secure Boot) is stored into the PK keystore variable.While in Secure Boot Setup Mode, all the Secure Boot keystores should be editable by OS-level programs, like efivar https://github.com/vathpela/efivar.git or sbsigntools https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git for example. In practice this does not always work; it depends on the properties of the UEFI implementation in your system's specific firmware. If your firmware does not allow editing Secure Boot keystores by OS-level programs, you might have better luck by using a UEFI-mode tool, like KeyTool.efi from the efitools package: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git (It is possible to protect UEFI NVRAM variables so that they are only accessible to boot-time .efi programs, not by the regular OS; I've seen some UEFI implementations that seem to restrict the Secure Boot keystores in this way, although the Secure Boot specification does not require that.)
I am writing my own OS loader (Boot Loader) in UEFI. The OS Loader is Microsoft Signed so it can run under secure-boot. The OS Loader will be able to load Windows or Linux Kernel based on User's Selection (Something similar to GRUB) Since I have built Linux Kernel as EFI Stub, I can load it from my OS Loader. However, I have a specific requirement. I will be self-signing the Linux Kernel. How do I establish chain of trust to make sure that I am loading my own self-signed Linux Kernel and not some other unsigned kernel? Edited on 21-Jan-2022 after working on suggestions from telcoM Continuing from the answer from telcoM, I downloaded SHIM source from https://github.com/rhboot/shim I also created PKI keys following https://www.rodsbooks.com/efi-bootloaders/secureboot.html#initial_shim $ openssl req -new -x509 -newkey rsa:2048 -keyout MOK.key -out MOK.crt -nodes -days 3650 -subj "/CN=Your Name/" $ openssl x509 -in MOK.crt -out MOK.cer -outform DERBuilt SHIM source using make VENDOR_CERT_FILE=MOK.cerSigned my kernel.efi with MOK.key to get signed grubx64.efi (This is because DEFAULT LOADER in SHIM is grubx64.efi. I just went ahead with defaults) sbsign --key MOK.key --cert MOK.crt --output grubx64.efi kernel.efiFinally, used shimx64.efi as loader.efi (using PreLoader https://blog.hansenpartnership.com/linux-foundation-secure-boot-system-released/) because at present I don't have shimx64.efi signed by Microsoft. In addition, mmx64.efi and fbx64.efi are also enrolled through HashTool.efi along with shimx64.efi (loader.efi) Here is the flow. PreLoader.efi --> loader.efi(shimx64.efi) --> grubx64.efi(kernel.efi) With SecureBoot disabled, everything works fine and I am able to boot Linux Kernel. However, with SecureBoot enabled, I am not able to start grubx64.efi image. Further updates I figured out that I should have used MokManager (mmx64.efi) to enroll MOK.cer. Tried using mmx64.efi and enrolled MOK.cer. However, it looks like the Key is not registered successfully. Am I missing anything?
UEFI Self-Signed Kernel loading from a Microsoft Signed OS Loader
The concept of MOK is not officially part of Microsoft's Secure Boot. It's implemented by Shim, a special loader that actually overrides the firmware's Secure Boot handling – it has its own signature verification code that allows MOK-signed loaders to completely bypass the built-in SB verification. Therefore the MOK database is stored as an ordinary EFI NVRAM variable named MokList, with the only protection being that it's marked as "visible to boot services only", i.e. you can see it from within the EFI Shell environment but not through /sys/firmware/efi/efivars from a running OS. (Shim creates a read-only copy of it named MokListRT for the Linux mokutil to see.) EFI variables are namespaced by vendor GUID, so in theory two copies of Shim (coming from different sources) could have independent MokList variables, and only the one supported by Fedora's Shim would be visible as MokListRT from within Fedora. (I don't know if that's actually the case.) A new Ubuntu installation would then see the previous Ubuntu MOK. A very manual way to clean things up is to download EFI Shell and configure the system to boot into it. From there you might be able to use Ubuntu's MokUtil.efi – or run dmpstore -b to get a list of all EFI variables (including the Boot Services-only ones), looking for any instance of 'Mok', then delete them one by one using dmpstore -d <name> -guid <guid>. In the dmpstore output, NV mean non-volatile (e.g. MokStore is NV whereas MokStoreRT is not NV and only exists in temporary RAM); BS means available to boot services (EFI apps); and RT maeans available to runtime services (visible by OS).
Good evening, after searching on google I didn't find the answer to my question. When installing a distribution such as Ubuntu with secure boot activated, the installer creates a MOK key in the NVRAM which can be seen with ‘mokutil -l ’. Later, I decide to change distribution to Fedora, the installer will insert its own key in the NVRAM that I can see with ‘mokutil -l’ but the Ubuntu key is not visible from Fedora. Does this mean that each distribution creates its own database in NVRAM? Is it possible to see the previously installed keys of other distributions? To clean NVRAM of these old MOKs from old distributions? This is for security reasons, but also to save space. As the amount of NVRAM is very small, isn't there a risk that it will be full if you install frequently? Restoring the Secure Boot factory settings in the UEFI resets the PEK, KEK, DB and DBX keys but does not seem to remove the MOK keys in my case.
About Secure Boot, MOK and NVRAM
The answer was very simply, run it as root sudo mokutil --import MOK.der
When I run mokutil --import MOK.der, I get ❯ mokutil --import MOK.der input password: password should be 1~256 characters input password: Failed to enroll new keys
When I run mokutil, I get Failed to enroll new keys
For the most part an AV just scans files. It will remove malicious Windows payloads when running on Linux (and vice versa). The detection doesn't depend on the host architecture or operating system at all, as malware code is not being run by the AV at runtime. So, as long as you mount your Windows NTFS partition somewhere under Linux, you can tell your Linux AV to scan the files in it for malware (or just let it do it's default thing where it scans all possible filesystems). Thus you are just plain looking for Linux AV software, with no special requirements.
Hopefully, not too broad of a question. For Windows 10, I was considering dual booting at least for the purposes of malware detection and removal. While AVG, and probably others, offer live rescue discs, what is feasible from an outside source? Ideally I would use a laptop running Linux to scan the windows pc, but let's assume a dual-boot scenario. Can I "install" AVG, Kaspersky, et. al. "to" Linux to scan another partition on the same hard drive? The target pc uses secure boot, UEFI.
how do I scan the windows partition for malware?
Closest thing to UEFI alternative is coreboot.
From what I know UEFI and its Secure Boot are deeply problematic and certainly not the way forward. See: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#Criticism Also here it says:In case of SecureBoot the UEFI system which needs to validate the signatures is not open source. And even if it would be open source this does not mean that systems come pre-installed with the key you used for signing.So I am asking if there is an open source version of what UEFI's Secure Boot aims to do?
Is there an open source alternative to UEFI's Secure Boot? [closed]
You are getting kernel security updates, which include a new kernel package with a new set of kernel modules to match it each time. Apparently you don't have any automation set up to rebuild your NVIDIA kernel modules whenever that happens. There is a package called dkms which can automate the rebuilding of third-party kernel modules on installation of a new kernel image. You should install the dkms package using your package manager (e.g. sudo apt install dkms or with your preferred GUI tool), and if you are using the driver installer provided by NVIDIA, use the option --dkms with the installer. If you are using the same MOK key each time, there should be no need for the key (re)installation procedure. If you used Debian/Ubuntu tools to create your MOK, there should be two files in /var/lib/shim-signed/mok/ directory: the private key as MOK.priv and the public key as MOK.der. But you said you have your own signing keys at some other known path, so you can use them instead. So, if you are using NVIDIA's installer, you might run it this way: sudo ./NVIDIA-Linux-x86_64-<version number>.run --dkms \ --module-signing-secret-key=/var/lib/shim-signed/mok/MOK.priv \ --module-signing-public-key=/var/lib/shim-signed/mok/MOK.der After a successful installation using DKMS, the command sudo dkms status should output a list of one or more kernel versions that have the NVIDIA driver modules built for them: nvidia, <driver version>, <kernel version>, x86_64: installed
From time to time my NVIDIA drivers (signed with MOK) are not being loaded on my dual boot machine (Ubuntu 22.04 and Windows 11). I'm resolving the issue by reinstalling the same drivers with the same signing keys. Signing keys are on the same path all the time (I'm not deleting them or moving somewhere else). It's constantly happening every 1-2 months. What could cause that? Edit: I'm only re-installing the drivers (step 6: https://askubuntu.com/a/1049479), re-enroll is not needed
MOK signed NVIDIA drivers are not loading after some time
From the screenshots you posted, I see that the firmware copyright messages specify year 2014... and that the "Advanced" section has a submenu titled "Windows 8/8.1 Configuration". Back in 2014, Windows 8.1 was still the newest version of Windows for desktops, and Secure Boot was introduced in Windows 8. It is very likely the "Windows 8/8.1 Configuration" submenu contains the Secure Boot settings, if they exist at all. If you're lucky, you may find there a full set of controls for Secure Boot: not only an enable/disable switch, but a way to manipulate the Secure Boot keystores (PK, KEK, db and dbx) too. But if the only thing you'll find is a "Clear Secure Boot PK" or similar option, that might be enough: when the Secure Boot Primary Key (PK) is cleared, all the Secure Boot keystores should become freely modifiable with a suitable tool, like KeyTool.efi from James Bottomley's efitools package. Clearing the PK should also allow you to boot everything. Since the Secure Boot keystores are essentially UEFI firmware NVRAM variables with special protection settings, they should in theory be modifiable from within a running OS. However, on 2014-era systems, I've had better luck with the bootable tools, whenever the BIOS menus have been insufficient. When trying to update Secure Boot keystores from within a running OS on systems this old, I've often encountered firmware bugs.
Follow up to Grub updated and now I can't get in to the BIOS, how can I fix it?. Short version: couldn't boot to a USB thumbdrive after updating grub. I reset the BIOS to factory default (with the jumper) and now I can't boot at all, it says "Invalid signature detected. Check Secure Boot Policy in Setup." Worth reiterating that this system was working fine before I put in a new hard drive and migrated the old OS over to the new hard drive with Clonezilla. Got that all running fine but then when I went to increase the partition size with gparted I found that I couldn't boot from the USB stick. The typical advice is to disable secure boot in the BIOS in the Security tab. Except I don't have that. I have options to set passwords and that's it. Nothing about it in the Boot options either. I flashed the BIOS to a current version last year, pretty sure that doesn't get reset if I bridge the CMOS jumper. This is a linux machine, not a dual boot. Screenshots (literally) here: https://i.sstatic.net/ntDF6.jpg How do I fix this secure boot error without having the option to disable secure boot?
Reset my BIOS. Now how do I fix "Invalid signature detected. Check Secure Boot Policy in Setup."?
More and more Linux distributions are adding the necessary facilities for full support of Secure Boot. That can include include configuring Secure Boot with a custom certificate, and signing third-party modules using that certificate when installed using the distribution's standard procedure. If the provider of the third-party modules provides pre-signed modules, it might also be possible to add the public certificate of that module provider to the kernel's whitelist. If all the necessary facilities for handling Secure Boot are not yet in place in a particular Linux distribution, then disabling Secure Boot may be necessary to either allow the use of third-party kernel modules, or the use of that Linux distribution altogether. KDE Neon is apparently an Ubuntu-based Linux distribution, and so it has the same Secure Boot facilities as the corresponding version of Ubuntu Linux. Personally I don't use Ubuntu, but I understand they've spent a lot of effort to integrate Secure Boot to the standard installation process and to make it as user-friendly as possible. Note that Secure Boot for Third Party drivers may require a more complex configuration than just Secure Boot, but it seems the installer might be programmed to cover both cases. Bottom line: assuming that everything works as it should, it is certainly possible that the installer can make the proper preparations to support Secure Boot with third-party drivers. But if you encounter problems, be aware that some of them may be caused by Secure Boot-related UEFI firmware bugs or limitations of Dell's particular implementation of Secure Boot. In that case, you may have to look for the option to disable Secure Boot in the system's firmware settings (commonly called "BIOS settings", but Secure Boot requires UEFI, and UEFI is not a traditional BIOS). If you want to understand what is happening in more detail, this webpage might be helpful, although it is not about Ubuntu-style distributions specifically.
I try to install KDE Neon 18.04 on my Dell Laptop (from USB drive). The installer asks me if I want to use third party software/drivers. Yes, I want to use them (when available). Directly below that option I am allowed to configure Secure Boot. When ticking that checkbox I need to set a password for Secure Boot. Directly above, it says that I need Secure Boot for Third Party drivers. If this is correct I suppose I need to configure Secure Boot and set a password. However I always have been under the opposite impression. I thought that using Secure Boot may prevent (unsigned) third party drivers from being installed. So, where is my mistake? Should I configure Secure Boot and a corresponding password or not?
Neon installation - Secure Boot vs third party drivers
Turned out the problem was that I had tried to install a 32 bit version of Linux. When installing on an x86 system with Secure Boot (UEFI) a 64 bit version of Linux is needed.
After installing a Linux distro (Fedora 19, to be exact) on a Windows 8 machine I got the message:No boot disk has been detected or the disk has failed.What did I do wrong?
Why am I getting "no boot disk has been detected" after installing Linux?
Upgrading to Ubuntu 13.10 fixed the problem for me.
I seem to have run into some difficulties trying to install Linux alongside my USB. I made a bootable USB stick and done all the UEFI firmware settings from which I disabled fast boot. Now when I run my USB from the boot menu, the first screen shown is the options for Linux: "try it for free", "install Ubuntu" and so on. Regardless of the option I choose, the screen just goes blank and that's it. Does anyone have any suggestions?
Ubuntu load and hang on live USB [closed]
You don't enroll a specific signature; you enroll the (public part of the) key you use to make the signatures. Usually (= unless you take over the control of the entire Secure Boot key hierarchy on your system), that key is called the Machine Owner's Key, or MOK for short. Since Zorin is based on Ubuntu, which is in turn based on Debian, I'd expect that the standard location for the MOK signing key will be the same as in Debian, i.e. the directory /var/lib/shim-signed/mok/. That directory should contain two files: MOK.der is the public key that can be used to check the validity of the signatures, and a corresponding MOK.priv, the private key that can be used to create signatures. To restart the MOK enrollment procedure with an existing key (with which your NVidia modules are already signed), run: sudo mokutil --import /var/lib/shim-signed/mok/MOK.derIt will ask you to set a one-time password for the completion of the enrolling procedure, which will happen during the next reboot. Once you reboot the system, the Secure Boot shim will start a MOK Manager EFI utility (/boot/efi/EFI/<distribution>/mmx64.efi) which will ask for the password you just set, and a final confirmation that you really wish to enroll the MOK. This procedure ensures that you can only enroll the MOK if you both have root privileges and can access the physical system console.
I installed the proprietary NVIDIA drivers on my PC using the option my distribution (Zorin OS) gave me upon first installation. Unfortunately, the signature of the driver was not enrolled to MOK, which lead to Secure Boot stopping it from loading. Running modinfo nvidia tells me that the drivers are indeed signed, yet mokutil --list-enrolled doesn't show the signature of the driver anywhere. So it hasn't been enrolled. How can I enroll the driver signature to MOK afterwards? I only found solutions about signing a module yourself, then enrolling your own signature to MOK - but I already have it signed, I just can't find a way to get the signature from modinfo into MOK. Thanks in advance!
MOKutil: Enroll key of already installed driver
If Secure Boot is disabled, the signature on a signed kernel isn’t used, and it behaves like an unsigned kernel.There are no incompatibilities, and you can load modules without signing them.See above, no special build is required.Yes, you can have unsigned kernels alongside signed kernels.
Mostly a general linux question, but where it needs to be specific I am referencing Debian 12 Bookworm amd64 UEFI booting through grub(not direct kernel stub). I have secure boot disabled in firmware for some multiboot reasons and I have options for signed or unsigned kernels.Are there any negative impacts of a signed kernel, possible incompatibilities or failures to load modules? The signed kernel is about 2% larger which is insignificant for my system. Do use the same modules or require separate special builds? Can I have a signed and and an unsigned one the system at the same time, similar to having an older stable and very new kernel of the same series, or regular and real-time kernels?
Is there a downside to a signed kernel?
Try clearing the PK (Primary Key) before trying to input other keys. This should place Secure Boot into Setup Mode in which there should be minimal restrictions on key updates. After updating any other Secure Boot key variables to suit your needs, input your key as the PK to return Secure Boot to normal mode. Primarily, you'll want your key in the db key variable, since it's the whitelist: unless specifically blacklisted, any *.efi signed with a key that's in the whitelist variable will be allowed to execute by Secure Boot. The dbx key variable is the blacklist: when loading any file signed with a blacklisted key, or whose hash matches a blacklisted hash, the firmware will stop it from loading and/or won't allow it to execute. The KEK key variable controls (programmatical?) updates to the db and dbx while Secure Boot is in normal mode. If possible, you'll want your key in this variable too. The PK variable controls updates to the KEK variable, and holds only one key - ideally yours, instead of the system manufacturer's default key. Your OvmfPkKek1.pem is probably the file needed by UEFI, but there are several possible formats it might expect. If the firmware cannot read a PEM file (either as-is or with a *.cer or *.crt suffix), try converting it into a DER format: openssl x509 -in OvmfPkKek1.pem -inform PEM -out OvmfPkKek1.cer -outform DERThe suffix of the DER file might have to be either *.cer or *.crt. Some UEFI user interfaces expect specifically EFI Signature List files (*.esl), which you can generate using the efisiglist command, that can probably be found in a package pesign, or the cert-to-efi-sig-list command from package efitools. To convert a DER-format certificate into an EFI Signature List: efisiglist --outfile OvmfPkKek1.esl --add --certificate=OvmfPkKek1.ceror cert-to-efi-sig-list OvmfPkKek1.cer OvmfPkKek1.eslWhile not in Secure Boot Setup Mode (i.e. while PK is set), it's possible the firmware user interface will only accept ESL files signed with a Secure Boot key whose certificate is in KEK or PK key variable. This follows the same rules as when updating the Secure Boot keys programmatically from a running operating system. If so, the expected file suffix for those could be *.auth. The sign-efi-sig-list command in the efitools package can generate *.auth files from *.esls. Note that you'll have to create a separate *.auth file for each key variable, even if you use the same actual key: sign-efi-sig-list -a -c OvmfPkKek1.pem -k OvmfPkKek1.key db OvmfPkKek1.esl signed-key-for-db.auth sign-efi-sig-list -a -c OvmfPkKek1.pem -k OvmfPkKek1.key KEK OvmfPkKek1.esl signed-key-for-KEK.auth sign-efi-sig-list -a -c OvmfPkKek1.pem -k OvmfPkKek1.key PK OvmfPkKek1.esl signed-key-for-PK.auth
I'm producing a yocto build, and want to enable UEFI Secure Boot on the intel machine I'm using. This is a pretty basic yocto build, using core-image-minimal and meta-intel. The artifacts it produces look like: ./core-image-minimal-intel-corei7-64.wic ./bzImage-intel-corei7-64.bin ./bzImage--6.1.38+git0+d62bfbd59e_11e606448a-r0-intel-corei7-64-20240208204456.bin ./core-image-minimal-intel-corei7-64.manifest ./OvmfPkKek1.crt ./OvmfPkKek1.pem ./systemd-bootx64.efi ./core-image-minimal-intel-corei7-64-20240215181510.rootfs.tar.xz ./microcode.cpio ./modules-intel-corei7-64.tgz ./core-image-minimal-intel-corei7-64-20240215181510.rootfs.manifest ./microcode_20230808.cpio ./modules--6.1.38+git0+d62bfbd59e_11e606448a-r0-intel-corei7-64-20240208204456.tgz ./bzImage ./core-image-minimal-intel-corei7-64-20240215181510.testdata.json ./grub-efi-bootx64.efi ./ovmf.vars.qcow2 ./core-image-minimal-intel-corei7-64.qemuboot.conf ./ovmf.secboot.code.qcow2 ./linuxx64.efi.stub ./OvmfPkKek1.key ./ovmf.secboot.qcow2 ./core-image-minimal-intel-corei7-64.tar.xz ./core-image-minimal-intel-corei7-64-20240215181510.rootfs.wic ./ovmf.code.qcow2 ./core-image-minimal.env ./core-image-minimal-systemd-bootdisk-microcode.wks ./ovmf.qcow2 ./core-image-minimal-intel-corei7-64-20240215181510.qemuboot.conf ./core-image-minimal-intel-corei7-64.testdata.jsonMy boot partition looks like: ./loader ./loader/loader.conf ./loader/entries ./loader/entries/boot.conf ./EFI ./EFI/BOOT ./EFI/BOOT/bootx64.efi ./bzImageI can't figure out how to enable secure boot using these files. There's an option to enroll a signature, and when I do that using the bootx64.efi file, and then try and boot, I get some sort of bzImage error, and then something about a security policy violation. I get similar (but different) errors when I try and do the same process on a random Kali linux install off of a USB drive. There are also uefi options like "enroll signature", "enroll PK", "enroll KEK", etc., and I tried these hoping to be able to select those OvmfPkKek1* files yocto is producing, assuming those are the keys, but they don't show up on disk when browsing my boot partition via the uefi interface, even though I copied them over. I'm not sure why. Any ideas how I make this install work with secure boot?
How do I enable UEFI secure boot for a linux build made with yocto?
MOK.pem is generated on Ubuntu/Debian systems with extended usage attributes set to support kernel module signing only. That certificate is not usable to sign UEFI bootloaders or kernels as needed to pass verification by shim. In shim source code you can see that: #define OID_EKU_MODSIGN "1.3.6.1.4.1.2312.16.1.2" static BOOLEAN verify_eku(UINT8 *Cert, UINTN CertSize) { ... x509 = d2i_X509 (NULL, &Temp, (long) CertSize); if (x509 != NULL) { eku = X509_get_ext_d2i(x509, NID_ext_key_usage, NULL, NULL); if (eku) { ... if (OBJ_cmp(module_signing, key_usage) == 0) return FALSE; ... } } return TRUE; }Meaning if module_signing extended key usage is set, the signing cert is not considered valid by shim for the purposes of validating grub or linux kernel binaries. Create your own secureboot signing certificate without such an EKU, enroll it into either mok or db, and use it for signing. Ref: https://wiki.ubuntu.com/UEFI/SecureBoot/KeyManagement/KeyGeneration Ref: https://github.com/rhboot/shim/blob/main/shim.c#L106
I'm running ubuntu with Secure Boot on. Everything works fine when I use a kernel that comes packaged from cannonical. Still, I have issues running a self-signed kernel. I'm pretty sure my signature with MOK key is OK (verification below), but still when I try to boot the kernel from grub, after selecting the correct entry, I get an error that reads "Loading ... error: bad shim signature." I'm wrapping my head around it and can't find a solution. Why, even though both kernels are signed with MOK keys, one of them works and the other doesn't? Verification: root@T495:~# sbsign --key /var/lib/shim-signed/mok/MOK.priv --cert /var/lib/shim-signed/mok/MOK.pem /boot/vmlinuz Image was already signed; adding additional signatureroot@T495:~# sbverify --list /boot/vmlinuz signature 1 image signature issuers: - /C=PL/ST=Poznan/L=Poznan/O=none/CN=Secure Boot Signing/[emailprotected] image signature certificates: - subject: /C=PL/ST=yes/L=yes/O=none/CN=Secure Boot Signing/[emailprotected] issuer: /C=PL/ST=yes/L=yes/O=none/CN=Secure Boot Signing/[emailprotected] signature 2 image signature issuers: - /CN=ubuntu Secure Boot Module Signature key image signature certificates: - subject: /CN=ubuntu Secure Boot Module Signature key issuer: /CN=ubuntu Secure Boot Module Signature keyand root@T495:~# openssl x509 -in /var/lib/shim-signed/mok/MOK.pem -fingerprint -noout SHA1 Fingerprint=81:A2:93:CB:06:6F:52:BA:D9:E2:39:68:9D:FA:E2:2B:0C:95:3C:F7 root@T495:~# mokutil --list-enrolled | grep "81:a2:93" SHA1 Fingerprint: 81:a2:93:cb:06:6f:52:ba:d9:e2:39:68:9d:fa:e2:2b:0c:95:3c:f7I have no idea what is going on :|
Can't load self-signed kernel with Secure Boot on: "bad shim signature"
Okay so while I did not manage to sign Microsoft's KEK I just force re-signed esp/EFI/Microsoft/Boot/bootmgr.efi and esp/EFI/Microsoft/Boot/bootmgtf.efi with my keys. And yes, after time windows update I might need to re-sign it but I have automatic updates disabled and I those files should not be updated too offen.
I am in the process of configuring Secure Boot with my own keys (PK, KEK and DB). And so far I have done everything:Building Unified Kernel Image (UKI) Making standalone GRUB binary Generating own PK, KEK and DB keys; signed GRUB and UKI.And I can boot into GRUB and Linux with Secure Boot enabled. But I also dual boot Windows and here is where the problem begins. So far I have tried signing Microsoft KEK CA with my PK, but my Laptop (Dell Precision 7740) refuses to append it to KEK, because it's "not signed properly". And another issue is Microsoft DB Signing Certificate. I am not sure how I am supposed to approach it, is it signed already by Microsoft KEK or am I supposed to sign it with my own KEK? Below I list commands I used to generate my certificates and what I have tried to do in order to import Microsoft's Certificates. Generating Keys: mkdir certs cd certs uuidgen --random > GUID.txtopenssl req -newkey rsa:4096 -nodes -keyout PK.key -new -x509 -sha256 -days 3650 -subj "/CN=example PK/" -out PK.crt openssl x509 -outform DER -in PK.crt -out PK.cer cert-to-efi-sig-list -g "$(< GUID.txt)" PK.crt PK.esl sign-efi-sig-list -g "$(< GUID.txt)" -k PK.key -c PK.crt PK PK.esl PK.authopenssl req -newkey rsa:4096 -nodes -keyout KEK.key -new -x509 -sha256 -days 3650 -subj "/CN=example KEK/" -out KEK.crt openssl x509 -outform DER -in KEK.crt -out KEK.cer cert-to-efi-sig-list -g "$(< GUID.txt)" KEK.crt KEK.esl sign-efi-sig-list -g "$(< GUID.txt)" -k PK.key -c PK.crt KEK KEK.esl KEK.authopenssl req -newkey rsa:4096 -nodes -keyout db.key -new -x509 -sha256 -days 3650 -subj "/CN=example DB/" -out db.crt openssl x509 -outform DER -in db.crt -out db.cer cert-to-efi-sig-list -g "$(< GUID.txt)" db.crt db.esl sign-efi-sig-list -g "$(< GUID.txt)" -k KEK.key -c KEK.crt db db.esl db.authNOTE: I replaced my actual CN name with example because I don't want to share it's name. What I have tried to do with Microsoft Certificates: # Certificates in PEM format are in the .crt files. I do this conversion, because otherwise some of the command below would fail and .auth file would not contain almost anything, only around ~30 bytes of arbitrary data) openssl x509 -in microsoft_kek_ca_2011-06-24.bin -out microsoft_kek_ca_2011-06-24.crt openssl x509 -outform DER -in microsoft_kek_ca_2011-06-24.crt -out microsoft_kek_ca_2011-06-24.cer cert-to-efi-sig-list -g "$(< GUID.txt)" microsoft_kek_ca_2011-06-24.cer microsoft_kek_ca_2011-06-24.esl # Here I actually sign it. I don't get any errors and .auth file in size looks similar to other .auth files. But my Laptop still refuses to import it. sign-efi-sig-list -g "$(< GUID.txt)" -k PK.key -c PK.crt KEK microsoft_kek_ca_2011-06-24.esl microsoft_kek_ca_2011-06-24.authopenssl x509 -in microsoft_windows_pca_2011-10-19.bin -out microsoft_windows_pca_2011-10-19.crt openssl x509 -outform DER -in microsoft_windows_pca_2011-10-19.crt -out microsoft_windows_pca_2011-10-19.cer cert-to-efi-sig-list -g "$(< GUID.txt)" microsoft_windows_pca_2011-10-19.cer microsoft_windows_pca_2011-10-19.esl # Here I gave up, the issue is that I need signed efi list (.auth) in order to import it to my BIOS. But in order to create signed list I would need KEK keys, and obvisly I don't own keys to Microsoft KEK, so I just tried signing it with my own KEK. Again, BIOS refuses to import it. sign-efi-sig-list -g "$(< GUID.txt)" -k KEK.key -c KEK.crt db microsoft_windows_pca_2011-10-19.esl microsoft_windows_pca_2011-10-19.authNOTE: I downloaded Microsoft's KEK and DB from official documentation. As a closing word I want to say that I am not willing to use SHIM or MOK, because I need and want control which having own PK, KEK and DB keys gives. And I consider SHIM/MOK to be half-baked/work-around. And it doesn't really address the issue. But rather gives a dirty fix. Thanks for help in advance!
How to configure Secure Boot with own keys and import Microsoft KEK and DB certificates?
Whether it’s normal for your system depends on a number of factors; however 100°C is on the high end for a desktop system and you should try to address that. Typically, that would involve improving the system’s cooling: the overall airflow in the case itself (assuming your CPU isn’t water-cooled), the CPU cooler and its interface to the CPU, etc. In any case, your CPU won’t cook itself: it knows its limits, and it will throttle itself (reduce its frequency) if it needs to cool down. If that happens, you’ll see corresponding messages in the kernel logs (sudo dmesg).
I have a new desktop computer with Intel i7-12700 32GB RAM. I am doing build code stuff, I use the sensors command to check CPU temperature, and I found most of the cores are @ 100C. Is that normal? Will CPU hardware itself control the frequency to fit the temperature? update I checked dmesg and found many logs as below: mce: CPUxx: Package temperature above threshold, cpu clock throttledIt looks like the CPU control itself not higher than 100C.
CPU temperature often reaches 100°C
i3status Using i3status I believe you can change your configuration slightly so that it gets the CPU's core temperature directly from /sys by providing a path to its value. So change your rule to something like this: order += "cpu_temperature 1" # and more if you like... # order += "cpu_temperature 2"#... cpu_temperature 1 { format = "T: %degrees °C" path = "/sys/devices/platform/coretemp.0/temp1_input" }# cpu_temperature 2 { # format = "T: %degrees °C" # path = "/sys/devices/platform/coretemp.0/temp2_input" # }Here are 4 other ways to get your temp: /proc $ cat /proc/acpi/thermal_zone/THM0/temperature temperature: 72 Cacpi $ acpi -t Thermal 0: ok, 64.0 degrees CFrom the acpi man page: -t | --thermal show thermal information/sys $ cat /sys/bus/acpi/devices/LNXTHERM\:01/thermal_zone/temp 70000lm_sensors If you install the lmsensors package like so: Fedora/CentOS/RHEL: $ sudo yum install lm_sensorsDebian/Ubuntu: $ sudo apt-get install lm-sensorsDetect your hardware: $ sudo sensors-detectYou can also install the modules manually, for example: $ sudo modprobe coretemp $ modprobe i2c-i801NOTE: The sensor-detect should detect your specific hardware, so you might need to modprobe <my driver> instead for the 2nd command above. On my system I have the following i2c modules loaded: $ lsmod | grep i2c i2c_i801 11088 0 i2c_algo_bit 5205 1 i915 i2c_core 27212 5 i2c_i801,i915,drm_kms_helper,drm,i2c_algo_bitNow run the sensors app to query the resulting temperatures: $ sudo sensors acpitz-virtual-0 Adapter: Virtual device temp1: +68.0°C (crit = +100.0°C)thinkpad-isa-0000 Adapter: ISA adapter fan1: 3831 RPM temp1: +68.0°C temp2: +0.0°C temp3: +0.0°C temp4: +0.0°C temp5: +0.0°C temp6: +0.0°C temp7: +0.0°C temp8: +0.0°C coretemp-isa-0000 Adapter: ISA adapter Core 0: +56.0°C (high = +95.0°C, crit = +105.0°C)coretemp-isa-0002 Adapter: ISA adapter Core 2: +57.0°C (high = +95.0°C, crit = +105.0°C)This is on my Thinkpad T410 which has i5 M560. Here's one of the cores: $ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 37 model name : Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz stepping : 5 cpu MHz : 1199.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat tpr_shadow vnmi flexpriority ept vpid bogomips : 5319.22 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management:
I want to use i3status to display my CPU-Core temperatures (haswell i7). However the setting: order += "cpu_temperature 1" #... cpu_temperature 1{ format = "T: %degree °C" } #doesn't display the correct core temperature. The numbers it shows seem to correspond to the value xsensors shows for temp1, if I change the 1 to 2 above it corresponds to xsensors temp2. Trying 3 or 4 doesn't have any effect. However I want to get the true core temperatures of all 4 cores with i3 status. How can I do this?
How to get core temperature of haswell i7 cores in i3status
This answer documents definitive information on Linux support for Intel QST, which was assembled by tracking down archives of the defunct lm-sensors mailing list and directly contacting the authors of some of those messages. The information here is organized in chronological order of the development of Linux QST support. History of Linux QST SupportIn February 2010, the Intel QST SDK was made publicly available. A June 2011 Intel forum post later mentioned that the HECI driver from www.openamt.org was no longer needed to run the SDK. A February 2012 message on the lm-sensors mailing list showed the kind of information available via a modified version of the Intel QST SDK (the "gigaplex version"), and indicated that hwmon QST support would be welcome, if it could be implemented without relying on the QST SDK: Fan Speed Sensor 1: Health: Normal Usage: Processor Thermal Module Fan Reading: 1063 NonCrit: 300.000 Crit: 250.000 NonRecov: 200.000Fan Speed Controller 1: Health: Normal Usage: Processor Fan Controller Control: Manual Duty Cycle: 2.95If someone finds the time to dig through the SDK and write a hwmon driver, I would be happy to review and test it. That looks like a major effort, though, since it looks like at least some of the SDK code would have to be ported to run in the kernel.By December 2012, someone had actually developed just such a driver, as evidenced in this message on the LKML:I've written a driver for the Intel Quiet System Technology (QST) function of the Management Engine Interface found on recent Intel chipsets.The module was originally developed for Linux 2.6.39, was named qst-hwmon, and provided support for QST v1 by implementing an entire mei driver from scratch. There was further discussion about a second module qst2-hwmon that would implement support for QST v2. A March 2013 note on the hwmon hardware support page indicates that all known attempts to implement Linux support for Intel QST had apparently stalled:(2013-03-20) The ICH8 (82801H) and several later Intel south bridges have embedded sensors, named MEI or QST. These are not yet supported, due to a lack of technical documentation and support from Intel. The OpenAMT project is supposed to help, but in practice not much is happening. Or maybe there is some hope? Or here, or here.However, a November 2014 bug report by the original developer of qst-hwmon indicated that the driver was still being worked on as late as November 29, 2014, and that it had been ported to Linux 3.14.18. Current State of Linux QST SupportThe qst-hwmon kernel module I finally managed to track down the current location of the git repository for the kernel module. To get a copy of the source code: git clone http://eden.mose.org.uk/mei.gitThis kernel module has not yet made it into the main Linux kernel source (as of kernel 4.19). The code compiles cleanly for Linux 4.16.7, producing 4 modules, which should be copied to the appropriate modules directory: make cp intel-mei.ko /lib/modules/4.16.7/kernel/drivers/hwmon/ cp mei-pci.ko /lib/modules/4.16.7/kernel/drivers/hwmon/ cp qst-dev.ko /lib/modules/4.16.7/kernel/drivers/hwmon/ cp qst-hwmon.ko /lib/modules/4.16.7/kernel/drivers/hwmon/And update the module dependencies: depmodThen the modules may be loaded: modprobe intel-mei modprobe mei-pci modprobe qst-dev modprobe qst-hwmonAnd then you can verify that the /sys/bus/intel-mei/devices/ folder contains some relevant entries. This is not currently working for me, but I believe it is due to having the default Intel MEI driver compiled into the kernel. Further work will be needed to get lm_sensors to detect the qst_hwmon driver. The above mailing list archives indicate that lib-sensors may need to be patched to properly identify the intel-mei bus provided by these modules. Update: I'm in contact with the developer of the driver, so I hope to get the definitive instructions documented here soon.Alternative Approach using Intel QST SDK and meifand Here is a writeup (December 2015) on controlling fans via the "gigaplex version" of the Intel QST SDK (February 2012), and using meifand (not lm-sensors) as a daemon process to access the sensor information.
I am trying to find a way to access and/or control fan speed via Linux on an Intel Q45 Express/ICH10DO chipset. This chipset contains a feature called Intel Quiet System Technology (Intel QST), which is a part of the Intel Management Engine (Intel ME) running on an embedded co-processor. Intel describes QST as follows:The Intel Management Engine (ME) hosts a firmware subsystem – Intel Quiet System Technology (QST) – that provides support for the monitoring of temperature, voltage, current and fan speed sensors that are provided within the Chipset, the Processor and other devices on the Motherboard. For each sensor, a Health Status, based upon established thresholds, will be determined at regular intervals. Intel QST also provides support for acoustically-optimized fan speed control. Based upon readings obtained from the temperature sensors, Intel QST will determine, over time, the optimal speeds at which to operate the available cooling fans, in order to address existing thermal conditions with the lowest possible acoustic impact.The Intel ICH10 datasheet states:5.24 Intel® Quiet System Technology (Intel® QST) The ICH10 implements three PWM and 4 TACH signals for Intel Quiet System Technology (QST). Note: Intel Quiet System Technology functionality requires a correctly configured system, including an appropriate (G)MCH with Intel ME, Intel ME Firmware, and system BIOS support.It goes on to describe the PWM Outputs, TACH Inputs and Thermal Sensors. This article claims that a Linux driver for Intel QST was available in December 2012:Earlier this year there was early support for Intel QST in LM_Sensors while being announced now is a new Intel QST driver for Linux. The code for this new Quiet System Technology driver is currently on GitHub.The above-mentioned code was not actually in github, but rather on a privately hosted git repository (http://mose.dyndns.org/mei.git) that used the defunct dyndns.org service. I have spent some time looking through the Linux kernel source (v4.16.7) but so far, I haven't found any trace of this driver.Was Intel QST support ever included in the Linux kernel? If so, which driver/kernel module(s) are required for Intel QST support?
What is the state of Linux kernel support for Intel Quiet System Technology (Intel QST)?
The whole story you mention is actually a kind of bug in iio-sensor-proxy or in your DE code who makes use of iio-sensor-proxy info. Is not bios or kernel that does the rotation but the marriage between iio-sensor-proxy and your Desktop Environment. DE like Gnome (and Cinnamon as turns out) does screen auto rotate based on the data provided by iio-sensor-proxy in dbus. You can try to remove/purge iio-sensor-proxy and screen rotation will go away completely. It is not clear if this is a iio-sensor-proxy bug or a Cinnamon bug. It could be iio-sensor-proxy that is reading in a wrong way your accelerometer data or could be Cinnamon who even if it receives correct data by sensor-proxy, rotates the screen wrongly. You can clarify this issue by running monitor-sensor in root terminal. This utility comes with iio-sensor-proxy package and displays in terminal the current state of accelerometer / current screen orientation. If orientation is correctly displayed by monitor-sensor then it is a Cinnamon bug. But i'm 90% sure that this is an iio-sensor-proxy bug and you should report it to the developer. PS: It had been also mentioned that sensor-proxy had been working well with kernels up to version 4.7 but had some problems with kernel 4.8 and above. You could try to install an older kernel (i.e 4.7) for testing. If monitor-sensor reports correctly the orientation and this is a Cinnamon bug, as a workaround you could disable Cinnamon auto screen rotation feature and run a kind of shell script that will make the correct rotation based on the data of monitor-sensor. PS: Gnome gives the option to completely disable auto screen rotation, i'm not sure if Cinnamon has this option too. In XFCE that iio-sensor-proxy is installed but XFCE devs are not performing auto screen rotation (yet) we apply this script to have auto screen rotation: https://linuxappfinder.com/blog/auto_screen_rotation_in_ubuntu PS: Improved version for touch screens with transformation matrix: https://github.com/gevasiliou/PythonTests/blob/master/autorotate.sh Update for future reference / future "google searches" As advised in comments, by running monitor-sensor in a root terminal and observing the messages provided by iio-sensor-proxy it proved that iio-sensor-proxy is correctly understood the real screen orientation. As a result this seems to be a Cinnamon bug that though it gets correct info by iio-sensor-proxy is rotating the screen wrongly. You can disable the Cinnamon auto rotation feature and try the auto-rotation script as advised above (https://linuxappfinder.com/blog/auto_screen_rotation_in_ubuntu). To disable Cinnamon internal autorotation you need to apply settings set org.cinnamon.settings-daemon.plugins.orientation active false as advised in OP's comment.
I've recently got a non-touchscreen hp laptop with a hdd accelerometer. After upgrading it to Debian testing I noticed that whenever I tilt my laptop upwards past +45 deg, the screen rotates upside down. The opposite happens when I tilt my laptop -45 deg. To clarify, I am facing my laptop with the screen facing me with the keyboard parallel to the ground. The screen also rotates whenever I tilt my laptop clockwise or counterclockwise. Is there a file where I can edit to change the screen's rotational direction? The accelerometer in /proc/bus/input/devices shows this: I: Bus=0019 Vendor=0000 Product=0000 Version=0000 N: Name="ST LIS3LV02DL Accelerometer" P: Phys=lis3lv02d/input0 S: Sysfs=/devices/platform/lis3lv02d/input/input7 U: Uniq= H: Handlers=event6 js0 B: PROP=0 B: EV=9 B: ABS=7 EDIT: I found that watch -n 1 'cat /sys/devices/platform/lis3lv02d/position' is similar to what is found with the command below. Except it just displays coordinates such as (18,18,1098). evtest /dev/input/event6 shows this: william@wksp0:~/Downloads$ sudo evtest /dev/input/event6 Input driver version is 1.0.1 Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0 Input device name: "ST LIS3LV02DL Accelerometer" Supported events: Event type 0 (EV_SYN) Event type 3 (EV_ABS) Event code 0 (ABS_X) Value 20 Min -2304 Max 2304 Fuzz 18 Flat 18 Event code 1 (ABS_Y) Value -38 Min -2304 Max 2304 Fuzz 18 Flat 18 Event code 2 (ABS_Z) Value 1105 Min -2304 Max 2304 Fuzz 18 Flat 18 Properties: Testing ... (interrupt to exit) Event: time 1483747056.088195, type 3 (EV_ABS), code 1 (ABS_Y), value -23 Event: time 1483747056.088195, -------------- SYN_REPORT ------------ Event: time 1483747056.124189, type 3 (EV_ABS), code 0 (ABS_X), value 20 Event: time 1483747056.124189, type 3 (EV_ABS), code 1 (ABS_Y), value -38 Event: time 1483747056.124189, type 3 (EV_ABS), code 2 (ABS_Z), value 1105 Event: time 1483747056.124189, -------------- SYN_REPORT ------------ Event: time 1483747056.210931, type 3 (EV_ABS), code 0 (ABS_X), value -18 Event: time 1483747056.210931, type 3 (EV_ABS), code 1 (ABS_Y), value -28 Event: time 1483747056.210931, type 3 (EV_ABS), code 2 (ABS_Z), value 1107...EDIT2: After some googling, I've come across this which lead me to some interesting files that have little to no help on this. :P
accelerometer + screen rotation on non-touchscreen laptop?
The driver in Linux 5.14 doesn't support these APUs yet, it will be available in 5.15 but you can grab it now and compile in 5.14 (must be safe).
I've built a new computer with a AMD Ryzen 5700G and to my surprise, no sensor information is picked up whatsoever. I thought perhaps the new AMD chips would not yet be recognized by Linux, but the docs say otherwise. Here's sudo sensors-detect: # sensors-detect version 3.6.0+git # System: Gigabyte Technology Co., Ltd. B550I AORUS PRO AX [Default string] # Kernel: 5.14.6-arch1-1 x86_64 # Processor: AMD Ryzen 7 5700G with Radeon Graphics (25/80/0)This program will help you determine which kernel modules you need to load to use lm_sensors most effectively. It is generally safe and recommended to accept the default answers to all questions, unless you know what you're doing.Some south bridges, CPUs or memory controllers contain embedded sensors. Do you want to scan for them? This is totally safe. (YES/no): Silicon Integrated Systems SIS5595... No VIA VT82C686 Integrated Sensors... No VIA VT8231 Integrated Sensors... No AMD K8 thermal sensors... No AMD Family 10h thermal sensors... No AMD Family 11h thermal sensors... No AMD Family 12h and 14h thermal sensors... No AMD Family 15h thermal sensors... No AMD Family 16h thermal sensors... No AMD Family 17h thermal sensors... No AMD Family 15h power sensors... No AMD Family 16h power sensors... No Hygon Family 18h thermal sensors... No AMD Family 19h thermal sensors... No Intel digital thermal sensor... No Intel AMB FB-DIMM thermal sensor... No Intel 5500/5520/X58 thermal sensor... No VIA C7 thermal sensor... No VIA Nano thermal sensor... NoThe kernel version should be new enough, and the 5700G should be detected as 'AMD Family 19h', but clearly it isn't. I've tried manually loading the k10temp module to no effect. I've also tried reinstalling lm_sensors, updating the system and installing the 3rd party utility 'Zenpower', but still sensors looks quite pathetic: iwlwifi_1-virtual-0 Adapter: Virtual device temp1: N/A acpitz-acpi-0 Adapter: ACPI interface temp1: +16.8°C (crit = +20.8°C)nvme-pci-0400 Adapter: PCI adapter Composite: +43.9°C Is it perhaps the Zen 3 APU's that can't be detected? Or is there some other module or setting I'm missing?
No temperature reading on Ryzen 5700G?
I just solved this problem for my Lenovo Miix 320. You already have the driver name: udevadm info -n /dev/iio:device0In your case: KIOX000A Then find out vendor and productname with dmidecode (should be one of the first hits, in my Case LENOVO and XF80): dmidecode | grep Manufacturer dmidecode | grep ProductNow just put the things together: sensor:modalias:acpi:[driver name]*:dmi:*:svn[Manufacturer]*:pn[Product Name]:*without the square brackets. I found this information on: https://www.aixin.fr/jipeblog/?p=119
I have a tablet with builtin sensors which allow me automatic screen rotation, based on iio-sensors-proxy. However, the screen orientation is off, and I need to fix it. On it's GitHub page (https://github.com/systemd/systemd/blob/master/hwdb/60-sensor.hwdb) is explained how to change this behavior: Create a file /etc/udev/hwdb.d/61-sensor-local.hwdb and write to it sensor:modalias:<parent device modalias>:dmi:<dmi string>and ACCEL_MOUNT_MATRIX=1, 0, 0; 0, 1, 0; 0, 0, 1 (this matrix has to be changed ofc). Problem : I have no idea how to get the neccessary information for the first line, the sensor-prefix. Solution : Final file contains: sensor:modalias:acpi:KIOX000A*:dmi:*:svnEVE*:pnEveV:* ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1What I've found so far: This gives me device name: udevadm info --export-db | grep iio P: /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-KIOX000A:00/iio:device0 N: iio:device0 E: DEVNAME=/dev/iio:device0 E: DEVPATH=/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-KIOX000A:00/iio:device0 E: DEVTYPE=iio_device E: IIO_SENSOR_PROXY_TYPE=iio-buffer-accel E: SUBSYSTEM=iio E: SYSTEMD_WANTS=iio-sensor-proxy.serviceThis gives me more info about the device: udevadm info -n "/dev/iio:device0" P: /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-KIOX000A:00/iio:device0 N: iio:device0 E: DEVNAME=/dev/iio:device0 E: DEVPATH=/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-KIOX000A:00/iio:device0 E: DEVTYPE=iio_device E: IIO_SENSOR_PROXY_TYPE=iio-buffer-accel E: MAJOR=245 E: MINOR=0 E: SUBSYSTEM=iio E: SYSTEMD_WANTS=iio-sensor-proxy.service E: TAGS=:systemd: E: USEC_INITIALIZED=1959744And via pci I find the so-called modalias: cat /sys/devices/pci0000:00/0000:00:15.0/modalias pci:v00008086d00009D60sv00008086sd00007270bc11sc80i00Would really appreciate help from here on!My system: Linux jva 4.14.5-1-ARCH #1 SMP PREEMPT Sun Dec 10 14:50:30 UTC 2017 x86_64 GNU/Linux running under GNOME 3.26.2 (Wayland-seesion) Tablet: Eve V i7Y
Change iio-sensors data via custom ACCEL_MOUNT_MATRIX
Use sensors-detect to configure the missing sensors, if they are available. At my machine, there is a second sensor device handling the per-core sensors: [...] coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +54.0°C (high = +80.0°C, crit = +98.0°C) Core 0: +53.0°C (high = +80.0°C, crit = +98.0°C) Core 1: +53.0°C (high = +80.0°C, crit = +98.0°C) Core 2: +49.0°C (high = +80.0°C, crit = +98.0°C) Core 3: +54.0°C (high = +80.0°C, crit = +98.0°C)
I have a Phenom X3-8450e which has a total of 3 cores. But when I ran "sensors" on a terminal I got this: $ sensors atk0110-acpi-0 Adapter: ACPI interface Vcore Voltage: +0.99 V (min = +0.85 V, max = +1.60 V) +3.3 Voltage: +3.38 V (min = +2.97 V, max = +3.63 V) +5 Voltage: +5.02 V (min = +4.50 V, max = +5.50 V) +12 Voltage: +11.98 V (min = +10.20 V, max = +13.80 V) CPU FAN Speed: 1985 RPM (min = 600 RPM, max = 7200 RPM) CHASSIS FAN Speed: 0 RPM (min = 600 RPM, max = 7200 RPM) POWER FAN Speed: 0 RPM (min = 600 RPM, max = 7200 RPM) CPU Temperature: +32.0°C (high = +60.0°C, crit = +95.0°C) MB Temperature: +27.0°C (high = +45.0°C, crit = +95.0°C)As you can see it only displays a combined CPU Temperature: +32.0°C. But how can I show the individual temperature of each core?
How to check the cpu temperatures core by core?
I found the solution, there are some files on /sys/class/drm/card0/device the file pp_dpm_mclk indicates GPU memory clock, and the file pp_dpm_sclk indicates GPU core clock, mine: $ egrep -H . /sys/class/drm/card0/device/pp_dpm_* /sys/class/drm/card0/device/pp_dpm_mclk:0: 300Mhz /sys/class/drm/card0/device/pp_dpm_mclk:1: 1500Mhz * /sys/class/drm/card0/device/pp_dpm_pcie:0: 2.5GB, x8 * /sys/class/drm/card0/device/pp_dpm_pcie:1: 8.0GB, x16 /sys/class/drm/card0/device/pp_dpm_sclk:0: 214Mhz * /sys/class/drm/card0/device/pp_dpm_sclk:1: 481Mhz /sys/class/drm/card0/device/pp_dpm_sclk:2: 760Mhz /sys/class/drm/card0/device/pp_dpm_sclk:3: 1000Mhz /sys/class/drm/card0/device/pp_dpm_sclk:4: 1050Mhz /sys/class/drm/card0/device/pp_dpm_sclk:5: 1100Mhz /sys/class/drm/card0/device/pp_dpm_sclk:6: 1150Mhz /sys/class/drm/card0/device/pp_dpm_sclk:7: 1196Mhz And the file power_dpm_force_performance_level indicates the profile, which can be low, auto or manual, the default is auto, when low it runs always on lowest clock, which is not exactly what I want, so I set it to manual and made a script that keeps changing the clock according the GPU temperature, voilà, it worked! To change the clock on manual profile just write a number to file pp_dpm_sclk that represents the line, starting with 0, in my case till 7. If you are interested on my script here is it.
I was wondering how Linux could handle a Gamer Computer, so I have built one, but as we know GeForce does not like Linux so much as AMD, that is why I choose the last. I built up a computer with AMD Ryzen 7 1800X CPU and Radeon RX 560D GPU, as the Vega is too expensive for me to purchase, and the benchmarking said 560 is the best cost-benefit ratio currently. After some research I discovered the suffix D means it has slightly less clock speed in order to save some power consumption in comparison with RX560 without D. After countless crashes during random gaming I finally found out the problem is the GPU overheating, it's fan speed tends to follow the CPU fan speed, but of course the CPU is much less required than the GPU in some games. I partially solved the problem by customizing the fan speed based on GPU temperature instead of CPU, it is now growing gradually, and achieves the maximum speed on 50 Celsius degrees, but the problem is: on some games it holds on maximum speed all the time, and eventually still crashes. Describing the crash: the screen blinks and then became black, GPU fan stops, keyboard led blinks and then turn off, mouse the same, other CPU fan keeps, sometimes the system keeps frozen forever, sometimes the system auto reboot. As a reboot is required I could not find any tip on system logs, initially I though it was a kernel panic, but even using kdump and duplicating the kernel the system stills crashes the way I could not recover it. I do not know if Windows would have the same problem, but I strongly believe does not, I have never seen someone with the same problem on Windows, so my question is: there is some way to tell the kernel to make GPU take it easy when it is about to overheat, maybe just auto reducing the GPU clock speed?
How to prevent GPU from overheating and auto turning off
In the end I managed to get it working thanks to the support of one of the iio-sensor-proxy and kernel developers. In my case I had to pull iio-sensor-proxy from git and apply this patch: diff --git a/src/drv-iio-poll-light.c b/src/drv-iio-poll-light.c index c2c5821..b568e78 100644 --- a/src/drv-iio-poll-light.c +++ b/src/drv-iio-poll-light.c @@ -37,7 +37,7 @@ iio_poll_light_discover (GUdevDevice *device) return FALSE; path = g_build_filename (g_udev_device_get_sysfs_path (device), - "in_illuminance_input", + "in_illuminance_raw", NULL); ret = g_file_test (path, G_FILE_TEST_IS_REGULAR); g_free (path); @@ -130,7 +130,7 @@ iio_poll_light_open (GUdevDevice *device, drv_data->interval = get_interval (device); drv_data->input_path = g_build_filename (g_udev_device_get_sysfs_path (device), - "in_illuminance_input", + "in_illuminance_raw", NULL); return TRUE;Compiled and installed as per README instruction and finally enabled iio-sensor-proxy.service Now I have automatic brightness adjustment working. Finally, the dev has submitted a patch to linux kernel that in future will enable iio-sensor-proxy working out of the box also on computers having similar ALS without requiring to patch iio-sensor-proxy.
I have a Dell XPS 13 Laptop (old series) with ArchLinux and Gnome 3.18. I've read in official gnome 3.18 release notes thatIf a light sensor is present, GNOME will now automatically adjust the display brightness in order to adjust for the ambient light level. Can be tested using a ColorHugALS device for those who don't have built in hardware. Windows 8 compatible hardware is supported. A switch in the control center's power panel allows automatic display brightness to be turned on/off.My ambient light sensor is not supported by Linux kernel out of the box, however I have compiled and installed / loaded this module and now my sensor appears as /sys/bus/acpi/devices/ACPI0008:00/. For example I can do $ cat /sys/bus/acpi/devices/ACPI0008:00/iio\:device0/in_illuminance_raw 153and read current raw illuminance. However this seems not to be detected / supported by gnome as I still don't get a "switch in the control center's power panel" and display brightness is not automatically adjusted.How can I make it work?
Ambient light sensor support in GNOME 3.18
Do you currently have any compute in0 statements in your /etc/sensors.conf, /etc/sensors3.conf or /etc/sensors.d/*.conf that would apply to sensor chip nct6798-isa-0290? If you have, comment them out and run sensors --set as root. Then look at the value again. According to my old notes (probably scribbled up from a datasheet found who-knows-where in the internet), the Nuvoton NC6798D's voltage inputs have a range of 0 .. 2.048 V with a 8-bit accuracy, and a number of inputs have a built-in 2x divider to extend the range. These inputs with the range doubler are in2, in3, in7, in8 and in9, possibly also in0. That would mean that the lowest significant bit in each voltage register would signify a change of either 8 or 16 mV, depending on whether the input has the divider or not. The voltage sensors with the built-in divider are integral to the chip, and have default designations:in2 = AVSB in3 = 3Vcc (normal 3.3V rail) in7 = 3Vsb (stand-by 3.3V input) in8 = Vbat (CMOS battery voltage) in9 = Vtt (processor memory controller voltage?)It sort of looks like something may be applying an extra 2x divider to your in0 value. If so, adding something like chip "nct6798-isa-0290" # add this if it does not already exist compute in0 @*2, @/2 # then add this line _after_ the previous oneto your lm-sensors configuration should fix it.
I am trying, and failing, to determine my CPU's Vcore voltage. My CPU is a Ryzen 3700X in an ASRock 570M Pro motherboard, using Arch Linux (fully updated). I downloaded the lm_sensors package, ran sensors-detect and accepted all scans, and then ran watch sensors. My output when the CPU is idle with only the terminal running is attached below. Under load, the only voltage value that changes is in0, reaching up to about 720 mV (on one core at 100%). Some guides online suggest that in0 is usually the Vcore, but it is far too low for this to be the case here. The 3700X has a normal operating voltage of between .2 V and 1.5 V, with the latter being reached when a single core is boosting at max load. (The temperatures and fan speeds appear correct based on my testing.) What can do I to correctly read my Vcore? Thank you. amdgpu-pci-0800 Adapter: PCI adapter vddgfx: 1.11 V fan1: 1471 RPM (min = 0 RPM, max = 4100 RPM) edge: +27.0°C (crit = +91.0°C, hyst = -273.1°C) power1: 47.25 W (cap = 180.00 W)k10temp-pci-00c3 Adapter: PCI adapter Tdie: +29.8°C (high = +70.0°C) Tctl: +29.8°C nct6798-isa-0290 Adapter: ISA adapter in0: 96.00 mV (min = +0.00 V, max = +1.74 V) in1: 1.66 V (min = +0.00 V, max = +0.00 V) ALARM in2: 3.46 V (min = +0.00 V, max = +0.00 V) ALARM in3: 3.33 V (min = +0.00 V, max = +0.00 V) ALARM in4: 1.83 V (min = +0.00 V, max = +0.00 V) ALARM in5: 1.10 V (min = +0.00 V, max = +0.00 V) ALARM in6: 1.20 V (min = +0.00 V, max = +0.00 V) ALARM in7: 3.46 V (min = +0.00 V, max = +0.00 V) ALARM in8: 3.28 V (min = +0.00 V, max = +0.00 V) ALARM in9: 1.66 V (min = +0.00 V, max = +0.00 V) ALARM in10: 1.02 V (min = +0.00 V, max = +0.00 V) ALARM in11: 624.00 mV (min = +0.00 V, max = +0.00 V) ALARM in12: 1.04 V (min = +0.00 V, max = +0.00 V) ALARM in13: 928.00 mV (min = +0.00 V, max = +0.00 V) ALARM in14: 904.00 mV (min = +0.00 V, max = +0.00 V) ALARM fan1: 895 RPM (min = 0 RPM) fan2: 1023 RPM (min = 0 RPM) fan3: 752 RPM (min = 0 RPM) fan4: 629 RPM (min = 0 RPM) fan5: 0 RPM (min = 0 RPM) fan6: 3161 RPM (min = 0 RPM) fan7: 0 RPM (min = 0 RPM) SYSTIN: +30.0°C (high = +105.0°C, hyst = +95.0°C) sensor = thermistor CPUTIN: +26.5°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor AUXTIN0: +15.0°C sensor = thermistor AUXTIN1: -61.0°C sensor = thermistor AUXTIN2: +13.0°C sensor = thermistor AUXTIN3: +31.0°C sensor = thermistor SMBUSMASTER 1: +51.0°C (high = +105.0°C, hyst = +95.0°C) SMBUSMASTER 0: +29.5°C PCH_CHIP_CPU_MAX_TEMP: +0.0°C PCH_CHIP_TEMP: +0.0°C intrusion0: ALARM intrusion1: ALARM beep_enable: disabled
How to measure CPU voltage on a 570 motherboard with lm_sensors?
tree behaves that way because it doesn’t dereference symlinks by default. The -l option will change that: tree -l /sys/class/hwmon/but you’ll have fun making sense of all the output.
If I understand correctly, in Linux, everything is a path, right down to each piece of hardware. I am trying to get information about how my sensors are structured, so I thought I would just use tree to map out all the things in my hwmon directory. However, tree does not behave the same with this directory as I am accustomed to. When I run tree on a normal directory, I get the subdirectory structure without using the -R or -L flags: $ tree /home /home └── boss ├── clones ├── Desktop ├── Documents │ ├── modules.txt │ ├── old_docs │ │ └── assorted │ └── prepscript.txt ├── Downloads ├── Music ├── Pictures ├── Public ├── Templates └── Videos12 directories, 2 filesbut I try to do the same with HWmon, it only goes one level deep, even if I do use the -R flag and even though there is stuff deeper: $ tree /sys/class/hwmon/ /sys/class/hwmon/ ├── hwmon0 -> ../../devices/pci0000:40/0000:40:01.3/0000:43:00.0/hwmon/hwmon0 ├── hwmon1 -> ../../devices/pci0000:00/0000:00:01.3/0000:09:00.0/hwmon/hwmon1 ├── hwmon2 -> ../../devices/pci0000:40/0000:40:03.1/0000:44:00.0/hwmon/hwmon2 ├── hwmon3 -> ../../devices/pci0000:00/0000:00:18.3/hwmon/hwmon3 ├── hwmon4 -> ../../devices/pci0000:00/0000:00:19.3/hwmon/hwmon4 ├── hwmon5 -> ../../devices/virtual/thermal/thermal_zone0/hwmon5 └── hwmon6 -> ../../devices/platform/nct6775.656/hwmon/hwmon67 directories, 0 files $ tree /sys/class/hwmon/hwmon0 /sys/class/hwmon/hwmon0 ├── device -> ../../../0000:43:00.0 ├── fan1_input ├── name ├── power │ ├── async │ ├── autosuspend_delay_ms │ ├── control │ ├── runtime_active_kids │ ├── runtime_active_time │ ├── runtime_enabled │ ├── runtime_status │ ├── runtime_suspended_time │ └── runtime_usage ├── pwm1 ├── pwm1_enable ├── pwm1_max ├── pwm1_min ├── subsystem -> ../../../../../../class/hwmon ├── temp1_auto_point1_pwm ├── temp1_auto_point1_temp ├── temp1_auto_point1_temp_hyst ├── temp1_crit ├── temp1_crit_hyst ├── temp1_emergency ├── temp1_emergency_hyst ├── temp1_input ├── temp1_max ├── temp1_max_hyst ├── uevent └── update_interval3 directories, 27 filesWhat causes this difference in behavior, and can I just get a simple tree of all the devices?
Why can't tree fully list /sys/class/hwmon? And how could I do that?
Usage: sensors | ./color_sensors.awk Usage with watch: watch -c 'sensors | ./color_sensors.awk' #!/usr/bin/awk -fBEGIN { DEFAULT_COLOR = "\033[;m"; RED = "\033[1;31m"; MAGENTA = "\033[1;35m"; # CPU_thresholds cpu_high = 60; cpu_middle = 50; # GPU_thresholds gpu_high = 80; gpu_middle = 70; }function colorize(temp, mid_trsh, high_trsh) { new_color = ""; temp_number = temp; gsub("[^0-9]","",temp_number); gsub(".$","",temp_number); if(temp_number >= high_trsh) new_color = RED; else if (temp_number >= mid_trsh) new_color = MAGENTA; return new_color temp DEFAULT_COLOR; }/Core/ { $3 = "\t" colorize($3, cpu_middle, cpu_high); } /Physical id/ { $4 = "\t" colorize($4, cpu_middle, cpu_high); } # Multiple spaces added for alignment here - "\t ". /temp1/ { $2 = "\t " colorize($2, gpu_middle, gpu_high) " "; } { print; }Result:
I use sensors to keep an eye on CPU temperatures on the console. This is part of the output: coretemp-isa-0001 Adapter: ISA adapter Physical id 1: +45.0°C (high = +80.0°C, crit = +90.0°C) Core 0: +39.0°C (high = +80.0°C, crit = +90.0°C) Core 1: +39.0°C (high = +80.0°C, crit = +90.0°C) Core 2: +40.0°C (high = +80.0°C, crit = +90.0°C) Core 3: +38.0°C (high = +80.0°C, crit = +90.0°C) Core 4: +40.0°C (high = +80.0°C, crit = +90.0°C) Core 8: +39.0°C (high = +80.0°C, crit = +90.0°C) Core 9: +38.0°C (high = +80.0°C, crit = +90.0°C) Core 10: +38.0°C (high = +80.0°C, crit = +90.0°C) Core 11: +39.0°C (high = +80.0°C, crit = +90.0°C) Core 12: +39.0°C (high = +80.0°C, crit = +90.0°C)nouveau-pci-0200 Adapter: PCI adapter GPU core: +0.92 V (min = +0.92 V, max = +1.00 V) fan1: 2220 RPM temp1: +48.0°C (high = +95.0°C, hyst = +3.0°C) (crit = +105.0°C, hyst = +5.0°C) (emerg = +135.0°C, hyst = +5.0°C)I would like to 'colorize' this output. In particular, if temperatures are above a certain threshold, I would like them to be shown in red. So, for example, let's say the threshold is 60, then any occurence of +60.0°C, +61.0°C, +62.0°C, and so on should be in red (ideally, I would like an orange level and a red level based on two different thresholds, but a one level solution would be great as well). Ideally, this should also work with watch sensors.
Colorize output from sensors
It seems you could do this by editing the /etc/sensors3.conf file as discussed here. To have sensors use describing labels like above, you can add the following section to /etc/sensors3.conf, if not already there. Use the sensor location findings below.You could add the details as below. chip "thinkpad-isa-0000" label fan1 "Fan" label temp1 "CPU" label temp2 "HDAPS" label temp3 "PCMCIA" label temp4 "GPU" label temp5 "System battery (front left, charging circuit)" label temp7 "System battery (rear right)" label temp9 "Bus between Northbridge and DRAM; Ethernet chip" label temp10 "Southbridge, WLAN and clock generator" label temp11 "Power circuitry"You could probably get information about your model from here.
The temp[[:digit:]] things are confusing. Can the output of sensors be more human readable? $ sensors acpitz-virtual-0 Adapter: Virtual device temp1: +59.0°C (crit = +127.0°C) temp2: +60.0°C (crit = +100.0°C)thinkpad-isa-0000 Adapter: ISA adapter fan1: 2990 RPM temp1: +59.0°C temp2: +53.0°C temp3: +41.0°C temp4: +76.0°C temp5: +36.0°C temp6: N/A temp7: +33.0°C temp8: N/A temp9: +43.0°C temp10: +51.0°C temp11: +49.0°C temp12: N/A temp13: N/A temp14: N/A temp15: N/A temp16: N/A Now it is like the following. Do they indicate my laptop is healthy? Do I have to worry about that? The reported temperatures are when I am opening 100 tabs in chrome browser now. They are achieved when I use a cooler and scale the cpu frequency to the lowest 0.8GHz. WIhtout a cooler, the highest temperature will be over 80 celcius. If further without cpu freq scaling, the highest can be 90 and 100 celcius. $ sensors acpitz-virtual-0 Adapter: Virtual device CPU_0: +57.0°C (crit = +127.0°C) CPU_1: +56.0°C (crit = +100.0°C)thinkpad-isa-0000 Adapter: ISA adapter Fan: 2939 RPM CPU neighbourhood (also via ACPI THM0): +57.0°C Ultrabay: +51.0°C Express card: +38.0°C ATI graphics module: +73.0°C Main battery (always around 50°C): +36.0°C n/a (probably ultrabay battery): N/A Main Battery (fits about the value reported by smapi): +33.0°C n/a (probably ultrabay battery): N/A Hard disc: +40.0°C Intel graphics module: +48.0°C Heatsink?: +46.0°C n/a: N/A n/a: N/A n/a: N/A n/a: N/A n/a: N/A
How do I know what tempX mean in sensors output?
It sounds like you are going to have to do some manual intervention to get ACPI working properly with your hardware https://github.com/vmatare/thinkfan/ echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkfan.confLoad the module like this. $ su # modprobe thinkpad_acpi # cat /proc/acpi/ibm/fanThen enable the module Systemctl enable thinkfanYou will need to configure temp profile by editing the /etc/thinkfan.confExamples are provided as thinkfan.conf.simple Good luck
Here I am repeating a question previously asked in a sister forum, as it is relevant here and I have neither received a response, nor been able to resolve the issue. On my ThinkPad T470 which is a dual boot with Linux Ubuntu 18.04 and Windows 10, everything was working fine in Ubuntu until after a while I needed to boot Windows. Since then, the fan on the laptop runs constantly at full speed on Ubuntu. I have tried the common solutions such as setting acpi_osi=!Windows 2012 in the grub setting according to this answer or setting fan speed using thinkfan according to this answer. I have also checked my BIOS setting, but every thing looks normal as some options are set for performance and some set to be balanced between performance, energy consumption, and fan noise. The problem is Ubuntu seems to not recognize the BIOS settings or any other settings for that matter. None of the solutions above made any difference in the fan noise. Any help would be appreciated. GUESS: I am suspicious about ACPI not doing its job for some reason. OBSERVATION 1: One observation that may be worth mentioning is that the fan runs at normal/low speed when I boot the laptop and the grub menu prompts me to choose an operating system (Ubuntu or Windows) to continue with. Then the fan takes off to full speed as I choose Ubuntu. I think this means that BIOS settings work fine. OBSERVATION 2: Trying to use fancontrol according to this answer, after running sudo pwmconfig, I get the following message: hwmon3/pwm1_enable stuck to 2 Manual control mode not supported, skipping hwmon3/pwm1. There are no usable PWM outputs.EDIT 1: The power settings in Ubuntu doesn't seem to alter fan speed. EDIT 2: Fan runs normally on Windows. EDIT 3: The BIOS version on my machine is 1.59
Fan constantly running at full speed
I found out i7z actually does report the Vcore on my system. My terminal was simply not wide enough to show the last column, which was indeed Vcore. So a partial answer is: use i7z. However, it would be even better to have this data collected by lm-sensors too. Currently it does not, so most monitoring programs that use lm-sensors as backend do not show the data.
I've been using Linux for 99% of the time on my Dell XPS15 9550. It has an Intel i5-6300HQ (Skylake) CPU. On Windows, I can monitor the voltage of the CPU using a plethora of different software: Intel XTU, HWinfo, CPU-Z, AIDA64 and many more. On Linux, my only shot seems to be with LM-Sensors... which unfortunately does not find any voltage sensor even with a deep search from sensors-detect. Other tools such as turbostat, powerstat or i7z also do not read CPU voltages. No voltage sensor is found by any of the generic monitoring software I have tried (such as KSysGuard). Is there any way to read Skylake CPU voltages (directly from the CPU) in Linux, something that is so trivial in Windows? Is there a module which I am not loading, maybe?
How to monitor CPU voltage for a Dell XPS15 9550 (Skylake i5-6300HQ) under Linux
I can tell you roughly what these sensors are, if that helps: eth0_dsa0-virtual-0 is a temperature sensor on the eth0 device, that is, a motherboard or card LAN adapter. You have two chips on an I2C bus (slow simple serial bus), probably both lm75 (and you made a copy-and-paste error for the first). That's a simple temperature sensor chip. From the temperature displayed, somewhere inside your case. The thermal zone is something defined by the BIOS. The value is below room temperature, so something seems to be wrong. It doesn't look like you have installed a driver for your CPU temperature. In the end, the only person who knows exactly what components are in your computer is you, and we can't guess what's in there. Figuring out the exact hardware is a bit of a puzzle, it takes reading all hardware manuals you have (motherboard etc.), looking at the chips you can see on your motherboard, googling for them chip identifiers, finding the missing drivers, etc. Edit Yes, 48 and 49 are the addresses of lm75-i2c-0-48 and lm75-i2c-0-49 on the I2C bus, though I'm not sure if it's hexadecimal or decimal. Both are on bus 0. Look at /sys/bus/i2c to see your I2C busses and devices (only present if detected by some kernel modules).
I am using lm sensor in my embedded linux. It is working fine. When I am executing the sensors command I am getting following data. lm75-i2c-0-48 Adapter: 21a0000.i2c temp1: +28.5 C (high = +80.0 C, hyst = +75.0 C) lm75-i2c-0-49 Adapter: 21a0000.i2c temp1: +26.5 C (high = +80.0 C, hyst = +75.0 C) eth0_dsa0-virtual-0 Adapter: Virtual device temp1: +35.0 C (high = +100.0 C) mx_thermal_zone-virtual-0 Adapter: Virtual device temp1: +10.5 C (crit = +85.0 C)I want to know which temperature belongs to which sensor. Like what is the cpu temperature and what is environment temperature. Thank You.
Which temperature belongs to which sensor?
# sensors -fshould do it according to man sensors:-f Print the temperatures in degrees Fahrenheit instead of Celsius.
So after installing lm-sensors and hddtemp , I run sensors in the command line in linux, when it displays the temperatures it does it in Celsius, how can I make it display the temperature in Fahrenheit?
Sensors : How to display the temperature in Fahrenheit?