date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,342,452,810,000 |
Is SCADA one of the RTOS out there (it's used for real-time control and data acquisition)?
|
SCADA describes "Supervisory Control and Data Acquisition" systems - it often is Real Time, but doesn't have to be. There is usually a component that is real time (eg for logging, or managine pressures etc in machinery - ie essential heartbeat stuff) but this isn't absolutely necessary.
Many are still legacy code with... | Is SCADA an RTOS? |
1,342,452,810,000 |
I would like to check if USB disk is mounted in a C application. I know that in a script I can accomplish this via mount | grep /mnt (the mount point where udev mounts the USB drive) but I need to do this in a C application. Earlier I used to accomplish this using system("sh script.sh") but doing this is causing some ... |
If you need to check the full list of mount points, use getmntent(3) or its thread-safe GNU extension getmntent_r(3).
If you just want to quickly check whether a given directory has a filesystem mounted on it or not, then use one of the functions in the stat(2) family. For example, if you want to check if /mnt has a f... | Detect if USB disk is mounted in C application in Linux |
1,342,452,810,000 |
Is there a GUI to track any socket connection sent to this computer and which program that initiates it?
Also if possible track any incoming connection sent to this computer and which program that handles it (as a realtime popup indicator if possible) ?
For example:
"/bin/x owned by user x tries to connect to x.x.x.x:... |
There is old school console tool:
nethogs - Net top tool grouping bandwidth per process
e.g. run in this manner:
# nethogs eth0
NetHogs version 0.8.0
PID USER PROGRAM DEV SENT RECEIVED
11173 user rtorrent eth0 111.001 4.358 KB/sec
13159 user rtorrent ... | Linux GUI to track connections made from/to this computer |
1,342,452,810,000 |
For the purpose of profiling a program I would like to run it uninterrupted on one CPU.
To do this I use a combination of taskset and chrt:
# taskset -c 1 chrt -f 99 ./my_program
Now my question is if there is a tool that lets me check if/how often the process is nevertheless interrupted by context switches to the ke... |
You can use perf; for example,
perf stat -e context-switches,cpl_cycles.ring0,cpl_cycles.ring123 your_command
will produce a summary similar to
Performance counter stats for 'your_command':
1 context-switches
11,890,096 cpl_cycles.ring0 ... | How to check if/how often my process is preempted by the kernel? |
1,450,448,182,000 |
I'm trying to install a kernel with the RT_PREEMPT patch on a Lubuntu 16.04 distro and running into some issues I'm not sure how to deal with. I've downloaded the sources for kernel v4.4.12 (linux-4.4.12.tar.xz) and what I believe to be the appropriate RT_PREEMPT patch (patches-4.4.12-rt20.tar.xz), both from kernel.or... |
You probably wanted to take patch-4.4.12-rt20.patch.xz, not patches-4.4.12-rt20.tar.xz. As the extension hints, the latter is a tar archive, not a single patch file. Apparently it contains the same patches as the single-file version, but with commit messages etc.
patch is smart enough to ignore useless stuff (like the... | Applying RT_PREEMPT |
1,450,448,182,000 |
We have a problem of losing about one frame every 60 seconds or so with four USB cameras hooked up to Ubuntu 20.04 with the Realtime Linux patches applied. From the user code ioctl(VIDIOC_DQBUF) call level we see that v4l2_buffer.sequence skips a buffer, but with no error reported. What makes it odd is that one camera... |
Is it possible that a higher priority task or thread is interfering with your USB cameras / ports?
By default on PREEMPT_RT (or when using threaded interrupts on mainline linux) all IRQ threads will be run at 50 prio with SCHED_FIFO. So unless you've set these threads/tasks of yours to a higher priority, it's very pos... | Why would USB video be dropping frames in Realtime Linux? |
1,450,448,182,000 |
I cannot remember this command (and googling was unsuccessful), but there is a way to get the list of actions performed by a process, that outputs something like
# listprocessactions -p 1234
0.321 Open "A" /var/log/nginx/supersite.log
0.322 Write to /var/log/nginx/supersite.log
0.401 Close /var/log/nginx/super... |
You want strace(1) for that; it lists all the system calls made. See the manual page for details on various ways to present the trace data.
You might also find ltrace(1) useful if you want inter-library calls rather than system calls traced.
| Command to list in real time all the actions of a process |
1,450,448,182,000 |
I wish to install Xenomai which works on Linux providing a kind of hard real time environment.
x86/64 architectures are supposed to contain the "System Management Mode" which prevents them from being used for hard real time systems.
By "System Management Mode" I mean this: http://en.wikipedia.org/wiki/System_Managemen... |
System Management Mode is not the only thing that makes x86 bad at hard real time. The unpredictability of the execution speed due to caches, pipelines and so on makes x86, and any other high-end processor, bad at real time. All these features that make a processor fast on average also make the worst case difficult to... | System Management Mode in embedded systems |
1,450,448,182,000 |
I need to synchronize an IO pin value with a write to a serial port from user space (because I wasn't yet able to do it from kernel space - see my other question). My code (leaving out error checking) is as follows:
char buf[3] = {'U','U','U'};
int fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY); // supposed to be blocking... |
For tty devices, you must use tcdrain() on the file descriptor.
| Knowing when a write() on a serial port has finished transmitting data |
1,450,448,182,000 |
Hurd is actually not Unix nor Linux. But more superior says. Where Plan9 and Linux are in the range of Unix/Linux. eCos and FreeRTOS is also completely not unix/linux.
What is the main differences between Hurd and FreeRTOS/eCos and General Unix/Linux?
Can i name FreeRTOS or eCos tree as Hurd family? As those OS are n... |
No neither eCos nor FreeRTOS are Hurd based. They are different operating systems.
eCos and FreeRTOOS are Realtime Operating systems and don't have to do anything with Hurd. Don't try to just arbitrary put different kind of Operating systems together.
Plan9 is also considered a successor of Unix and is as far as i kn... | Hurd vs Plan9 vs Linux vs eCos vs FreeRTOS what are the main differences specially with Hurd? |
1,450,448,182,000 |
I'm using the ptp4l and phc4sys services to syncronize the clocks of my Centos 7.4 servers to a central PTP source. The services regularly write syslog records like the one below.
I haven't found any documentation explaining what each field here means, and what the units are. I'd appreciate any leads!
Nov 14 17:07:26... |
Looking through the file print.c, I found the following snippet in the "print" function:
if (use_syslog) {
syslog(level, "[%ld.%03ld] %s%s%s",
ts.tv_sec, ts.tv_nsec / 1000000,
message_tag ? message_tag : "", message_tag ? " " : "",
buf);
}
print.h defines more macros using this fu... | Interpretation of PTP4L and PHC2SYS syslog records |
1,450,448,182,000 |
I want to use network emulation (netem) on a PREEMPT-RT kernel to emulate latency and jitter down to 0.5 ms +- 10 %.
Thus, I initially thought that I have to adapt the internal kernel clock rate to at least 2000 Hz as this means I can add time-deterministic delays of 0.5 ms.
However, it seems that with lower kernel cl... |
So is the kernel clock rate adaption needed at all
Not at all and since a long time ago :
netem has used high res timers for several years and is independent of
HZ value.
High resolution timers's granularity does not depend on the linux kernel timer frequency (CONFIG_HZ). They are only limited by the clock source ... | How does Kernel Clock Rate matter in network emulation (by netem)? |
1,450,448,182,000 |
I am trying to get my own custom Real-time Linux on a Raspberry Pi 4B. My status is this:
I built the Linux 5.9.1 version, and have my own version of U-Boot, RFS with which I am able to successfully load and start the kernel, mount RFS, as well as reach the Kernel console also.
I need to apply the Real-time patch on... |
I raised it in Kernel.org, and then got a response that apparently it was intended to behave that way.
https://lore.kernel.org/linux-rt-users/[email protected]/
This basically meant that when we use 5.9.1 version with arm64 architecture, we need to disable KVM and then the Fully preemptible option comes up immediately... | Real-time patch on Linux 5.9.1 does not show fully-preemptible option for arm64 option |
1,450,448,182,000 |
I am running a python program on the raspberry Pi (Raspbian) that I would like to give higher priority. I want to run the following command :
$ sudo chrt --rr 50 python3 loopExample.py
I have read people using "PREEMPT_RT patch". Is this needed to use SCHED_FIFO SCHED_RR effectively?
|
SCHED_FIFO and SCHED_RR are supported on the standard Linux kernel, the PREEMPT_RT patches aren’t required. See the sched(7) manpage for details of the kernel’s scheduling policies.
The PREEMPT_RT patches reduce the kernel’s latency by enabling preemption in even more places than the mainline kernel currently supports... | SCHED_RR and SCHED_FIFO only work on "prempt kernal"? |
1,450,448,182,000 |
I am looking to generate raw Ethernet frames with payload that is preloaded into memory.
The Ethernet frames (10-60 full frames) should be generated at 1 ms intervals with no exception.
What would be my option to do this? My concern is in regards to the real-time requirements of such an application. Interrupts shoul... |
1ms is plenty to generate a few Ethernet frames, but on a typical Linux system, you can't count on not having the occasional pause. Even if you make your process high-priority, I don't think you can expect to always make a 1ms deadline.
RTLinux combines a real-time operating system with Linux. Linux runs as a non-real... | Generate raw Ethernet frames with memory preloaded payloads at < 1 ms intervals |
1,450,448,182,000 |
I recently applied the rt patch to my kernel in an attempt to lower the worst-case latency of sending messages over USB. Unfortunately I have seen no improvement in the worst-case over the unpatched kernel. Is there a patch I need for libusb, or even another way to communicate over USB to take advantage of the RT kern... |
For the most part the RT kernel will make subtle changes to insure your frame time is not over run.
Even then it is generally considered that the difference is very small, its more of a "if you aren't quite there, this might tip you over" adjustment.
If your USB performance is not good enough for what you are doing, ... | Is there a way to get libusb to behave in real time? |
1,450,448,182,000 |
we were trying to get the best result with software PWM on raspberry pi with Raspbian. We made a python script which starts PWM on a GPIO pin, and observed the results with the oscilloscope.
It didn't do well, the delay wasn't acceptable.
After that we set the realtime priority of our software PWM process to 99 and c... |
I didn't make a visible effect because the process was run in user space and it was given real time priorities in context of other processes in user space.
However, the kernel space was still loaded with interrupts, and when other processes got their (small) share of processor time, they could have initiated a system... | Change of real time priority made no visible effect |
1,471,868,313,000 |
After an upgrade to debian wheezy (I did not upgrade the kernel - it is still 3.8.2) I can no longer start jackd in the way I used to do it. I get you are not allowed to use realtime scheduling.
My investigation show, that this is related to a sudo command in my script, where I sudo from root to martin. The sudo is r... |
I would imagine that sudo is preserving your environment of the root user, and therefore may not have paths or other environment variables that the martin user has set. It may be also that you need to run jack via sudo from a shell with the -s /path/to/shell option.
However as root, you have the rights to su (substit... | Losing (realtime) permission when sudoing from root to myself |
1,471,868,313,000 |
I have Linux with a kernel that was compiled with the real-time patch, but the config option CONFIG_PREEMPT_RT_FULL was not enabled (it says in /proc/config that it is not set).
Do you now if there is any way to turn this on, without having to recompile the kernel?
I guess it's not possible but maybe there's some way?... |
No, it’s a solely compile-time configuration option, there’s no runtime equivalent. You’ll need to rebuild your kernel.
| Enable CONFIG_PREEMPT_RT_FULL after the kernel compilation |
1,471,868,313,000 |
I am customizing a Linux real-time system using the Linux 6.4.0 kernel and patch-6.4.6-rt8 patch. When running make menuconfig, which configurations should be turned off to improve real-time performance?The system mainly serves as a robotic arm controller.
The system at this time, using cyclictest to test the delay ef... |
None, in general. The realtimeness of your system is not dictated by the features it has, but whether you apply the -rt patchset or not, and whether you do design and run the software that needs to be a realtime task appropriately. The only thing within an -rt-patched kernel that'd increase latency would be a driver t... | To create a Linux RT real-time system, which functions in the kernel should be cropped out? |
1,471,868,313,000 |
In APUE, chapter 12 page 454, it is mentioned that:
To avoid erroneous behavior, a thread must block the signals it is waiting for ...
The similar is said in the standard:
The signals defined by set shall have been blocked at the time of the call to sigwait(); otherwise, the behavior is undefined.
What erroneous/u... |
This answer first takes the readers to the historical perspective of standard development, then it brings the attention of the readers to specific texts of the standard to explain the reason for the requirement.
In XPG Issue 3, sigaction, along with sig*set, sigismember, sigpending, sigprocmask, and sigsuspend, are in... | Why is it necessary to block a signal before sigwait()'ing it? |
1,471,868,313,000 |
Correct me if I'm wrong:
As far as I searched around the web, the main difference between a micro-controller (like Arduino) and a SBC (like Raspberry Pi) is that the micro-controller is atomic which means it runs your code line by line and does nothing else, no delay. But a SBC (RPi for example) runs an OS, and the OS... |
Turned out that what I had in my mind is kind of possible (but it's complex).
We have two ways to tell Linux to exclude one or more CPUs from its normal process scheduling.
The isolcpus boot option (documentation)
The Linux specific cpusets (documentation)
After that, a program can tell Linux that it wants to be r... | Can Linux use a CPU core as a micro-controller? |
1,471,868,313,000 |
I have computer where I'm trying to install real-time kernel.
My OS:
# uname -a
Linux localhost.localdomain 3.10.0-1127.el7.centos.plus.i686 #1 SMP Sun Apr 5 18:08:31 UTC 2020 i686 i686 i386 GNU/Linux
I have created file /etc/yum.repos.d/CentOS-rt.repo with following content
# CentOS-rt.repo
[rt]
name=CentOS-7 - rt
... |
It seems that real time kernel is available on AMD64/x86_64 architectures only - yours is i386 (32 bit). Repo URLs can be accessed from a browser, so if you open CentOS 7 real time kernel or Centos real time kernel on Cern you'll see only 64 bit support. This is also confirmed on Red Hat's real time kernel installatio... | Install a real-time kernel on CentOS 7 i386 |
1,471,868,313,000 |
I'm looking to expand and also get more current information from the question asked here. I have a requirement for real-time behavior that has is sub-millisecond and am now exploring what my options are. I am working with Centos, and ideally would be a more recent kernel (>4.14) for support for my chipset. As I un... |
Kernel version 3.10 is the version RHEL 7.x (and so also CentOS and related distributions) is locked on. RedHat will maintain a version of that kernel and backport any necessary bugfixes and new drivers as part of the active support for their distribution. When RHEL 8.0 will be released, it will have a new kernel vers... | Available options for real-time Linux (Centos 7) and their relation to one another [closed] |
1,471,868,313,000 |
From here: http://www.xenomai.org/index.php/RTnet:Installation_%26_Testing#Testing_with_a_single_node_.28local_loopback.29
TODO: simplify the following steps.
- Then you need to edit the file rtnet.conf under the /usr/local/rtnet/etc folder for the correct setup to run RTnet. Edit the following parameters:
- Se... |
In the last source distribution, (rtnet-0.9.12.tar.bz2), I can see rtnet-0.9.12/drivers/experimental/rt_r8169.c, so the rt_ nomenclature remains. The module filename should be rt_r8169.ko. It's not there either because it wasn't compiled, or because it failed to compile (it is under the ‘experimental’ subdirectory, af... | What is the realtime equivalent of the module r8169? |
1,471,868,313,000 |
I just checked my timings: it takes about 0.41-0.45 seconds to open a new gnome-terminal window and about 0.55-0.65 seconds to open kitty. And it does bother me a bit that it takes so much time to open (I want it to be close to instant, like UI elements are responding to mouse/keyboard events). I want some suggestions... |
I found out that only kitty (among those who I tested) can support ligatures. And looking at how it improves, I don't think anything can substitute it for me. And after some research, I found that (probably on a lot more speedy PC) some people manage to open kitty in 0.2s (0.1s to load OpenGL and 0.1s for the rest). A... | Time it takes to open a new terminal window |
1,471,868,313,000 |
I have two computers that are connected via an Ethernet cable with Ubuntu 22.04 installed on them. I have a client on computer A) which is sending UDP packets to a server on computer B) and I am measuring the latency and jitter of these packets in different scenarios. I have written the source code of the client and s... |
If you want to reduce network latency and jittering, being said that it will always increase cpu load whatever the trafic and, in some cases, also decrease the throughput under heavy trafic :
A/ THE DEFINITVE HAMMER : BUSY POLLING ! (Big fat warning, the less number of cpus you get, the more you will sacrifice on ever... | Why is there less latency and jitter when there is additional high bandwidth traffic between two computers with Ubuntu 22.04 installed on them? |
1,471,868,313,000 |
For instance, I know it's possible to easily install several desktop interfaces and choose what session to log into on startup.
Is this type of thing possible for choosing between kernels? I would like to be able to install the low latency and realtime kernels on my system while still being able to use the normal kern... |
Yes, it is possible. You have to choose your kernel at GRUB2 boot menu.
See under Advanced options for Debian. Some GRUB2 config:
Disable hidden GRUB2 boot menu in /etc/default/grub. Comment GRUB_HIDDEN_TIMEOUT="5"
and GRUB_HIDDEN_TIMEOUT_QUIET="true" or change it to false.
Set a resonable time to see the menu GRUB_T... | How to Choose Between Real-Time, Low-Latency and Normal Kernels on Startup? |
1,471,868,313,000 |
While reading the standard, I noticed that bunch of APIs were,
Introduced in Issue 5 for alignment with POSIX realtime APIs,
Marked for option group membership in Issue 6, and
Moved to Base in Issue 7 (SUSv4).
Q: Does this mean that all systems conforming to "Unix(R) V7" product standard are realtime systems? Wha... |
This is the asker's attempt at guessing.
Just like POSIX Threads, the realtime APIs are found useful in regular applications, coupled with the fact that specifications for these APIs being implementable without major obstacle, operating systems supporting these interfaces become more common, so the standard move them ... | Single Unix Specification version 4 (Issue 7) moved bunch of Real-Time APIs to Base, What Next? |
1,471,868,313,000 |
I am trying to achieve a multi-room audio setup in my house using Raspberry Pis. How can I get VLC playing simultaneously out the local headphone port while also streaming it to other devices via trx?
Background:
I have found a fantastic package called trx which allows low-latency streaming using the Opus codec across... |
I've finally figured out the multiroom audio Raspberry Pi conundrum!
The solution was to bring in PulseAudio. ALSA cannot do it alone because of the Raspberry Pi's ALSA bcm2835 driver limitations. The driver cannot copy data from one stream to another using mmap for reasons I don't quite understand. This is the case e... | Duplicating audio in pure ALSA for playback on local device and streaming via trx |
1,510,643,983,000 |
I'm having a little issue. I've a live system which run on RHEL 6.7 (VM) and have VMware 6.5 (which is not managed by our group) . The issue is, the other group tried to extend the capacity of an existing disk on a VM. After that, I ran a scan command to detect new disk as usual with echo "- - -" > /sys/class/scsi_hos... |
Below is the command that you need to run to scan the host devices so it will show the new hard disk connected.
echo "- - -" >> /sys/class/scsi_host/host_$i/scan
$i is the host number
| How to detect new hard disk attached without rebooting? |
1,510,643,983,000 |
Does anyone know if there is an elegant way to tell an external usb drive not to spin down after a period of inactivity? I've seen cron based solutions that write a file every minute, but nothing that smells of nice unixey elegance. There must be a hdparm, or scsi command that I can issue (usb drives are accessed vi... |
Yeah, it's generally built into the firmware. Some drive manufacturers provide an MS Windows based management tool that will allow you to modify various parameters, including disabling the "sleep" or spin down timer. If you have access to a Windows box it might be worth it to pursue that angle.
| Prevent a USB external hard drive from sleeping |
1,510,643,983,000 |
I'm attempting to write raw data to a USB device connected to my computer. I'm using Kali Linux, and I found the correct filepath: "/dev/usb/003/013" . However, when I try to write data to it I get an error.
root@kali:~/usb# printf "test" > /dev/bus/usb/003/013
bash: printf: write error: Invalid argument
I also trie... |
Usb devices are far more complex than simply pipes you read and write. You'll have to write code to manipulate them. You (probably) don't need to write a kernel driver. See http://libusb.info (née libusb.org) and http://libusb.sourceforge.net/api-1.0. This claims to work with Linux, OSX, Windows, Android, OpenBSD, etc... | How can I write raw data to a USB device |
1,510,643,983,000 |
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-Acc... |
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 th... | Why do my SATA devices show up under /proc/scsi/scsi? |
1,510,643,983,000 |
I am experimenting with some old SCSI tape drives, and I have successfully written some data to a tape, but I am struggling trying to read it back again.
# tar tvf /dev/st0
tar: /dev/st0: Cannot read: Cannot allocate memory
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now
# dd if=/... |
Ok, I think I've worked this out.
TL;DR
Use dd with a large block size to read from the tape instead:
dd if=/dev/nst0 bs=1M | tar tvf -
Background
When you write to tapes, the data is written in units called blocks. These are like sectors on a hard disk. Where hard disk blocks were fixed at 512-bytes for many years... | "Cannot allocate memory" when reading from SCSI tape |
1,510,643,983,000 |
I/O to my software RAID6 often freezes for around 30 seconds after which everything is back to normal.
After the freeze is over this is put into syslog:
Mar 14 18:43:57 server kernel: [35649.816060] sd 5:0:23:0: [sdy] CDB: Read(10): 28 00 6c 52 68 58 00 04 00 00
Mar 14 18:43:58 server kernel: [35651.149020] mptbase: i... |
I have solved the problem by buying a SAS2008 card. It still complains a little in the log, but it never blocks the disk I/O. Also I have tested it supports 4 TB SATA drives, whereas the LSI-SAS1068E only supports 2 TB.
As I will be returning the LSI-SAS1068E to the seller, I will not be able to try out other suggesti... | mptscsih: ioc0: task abort: SUCCESS (rv=2002) causes 30 seconds freezing |
1,510,643,983,000 |
How can I list scsi device ids under Linux?
|
cat /proc/scsi/scsi
| Find scsi device ids under Linux? |
1,510,643,983,000 |
I have a list of scsi disks that I need to remove. The list is considered random at best and changes from time to time. I want to remove everything except a predefined list that I have created. Let's assume for now that I only want to keep:
/dev/sda
/dev/sdb
The command I need to execute is:
"echo 1 > /sys/block/sdX... |
Here's an approach that should work:
Get the list of sdX devices to exclude
exclude=$(cut -d/ -f3 exclude.txt)
Iterate over the /sys/block/sdX directories:
for sysfile in /sys/block/sd? ; do
Extract the sdX name from that path, and build the delete file name
dev=$(basename $sysfile)
del=$sysfile/device/delete
... | "echo 1 > /sys/block/sdX/device/delete" on all disks except predetermined list |
1,510,643,983,000 |
from the df -k command, I see sda, sdb, sdc disks. They have some partitions (for example, sda has sda1, sda3). I want to detach sdb and sdc temporarily for OS upgrade. How exactly can I tell which disk is which? (actually I know sdc is the disk I recently attached, but how can I tell sda,sdb,sdc, from the SCSI connec... |
You can get the make and model of each physical block device with lsblk:
$ lsblk -do +VENDOR,MODEL,SERIAL
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT VENDOR MODEL SERIAL
sda 8:0 0 1.8T 0 disk ATA WDC WD20EARS-00M WD-WCAZA571XXXX
sdf 8:80 0 465.1G 0 disk WD My ... | how to tell which disk is sda and which is sdb disk? |
1,510,643,983,000 |
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:... |
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
vendo... | Match PCI address of SATA controller and SCSI address of attached disks |
1,510,643,983,000 |
I'm writing an initramfs-script and want to detect usb-sticks as fast as possible.
When I insert an usb 2.0 stick, the detection of idVendor, idProduct and USB class happens within 100 ms. But the scsi subsystem does not "attach" until about 1 s has passed and it takes another 500 ms before the partition is fully reco... |
You can change the timeout by writing to /sys/module/usb_storage/parameters/delay_use.
For older usb disks, a settle delay of 5 seconds or even more may be needed (and 5 was the default until it was reduced to 1 second in 2010), presumably because the controller is starved of power while the disk motors are initializi... | Why does it take so long to detect an usb stick? |
1,510,643,983,000 |
In DMESG I see:
[sdb] Attached SCSI removable disk
How does Linux decide what is removable and not removable?
Is there a way I can look up if a device is "removable" or not other than the log, for example somehwere in /sys or /proc?
|
All block devices have a removable attribute, among other block device attributes. These attributes can be read from userland in sysfs at /sys/block/DEVICE/ATTRIBUTE, e.g. /sys/block/sdb/removable.
You can query this attribute from a udev rule, with ATTR{removable}=="0" or ATTR{removable}=="1".
Note that removable (t... | How to tell if a SCSI device is removable? |
1,510,643,983,000 |
I would like to list only the USB storage devices connected to my computer. Since these are SCSI disks, I used the command lsscsi, which lists the USB drives as well as my computer's hard drive and CD drive. Is there a way to ignore the memory storage that's not a USB? I have also tried lsusb, but this includes my key... |
This answer checks the list of all attached block devices and iterates over them with udevadmin to check their respective ID_BUS.
You can see all attached block devices in /sys/block. Here is the bash script from the linked answer that should let you know if it is a USB storage device:
for device in /sys/block/*
do
... | What is a Linux command that lists only USB storage devices? |
1,510,643,983,000 |
I want to blink the failing device in my 24-disk SAS enclosure.
I have found sg_ses --index 7 --set=locate /dev/sg24 which is supposed to identify slot 7.
But how do I figure out which slot/index /dev/sdh is?
This is not obvious as Linux does not name /dev/sdX after the slot, but after the sequence it was detected. Th... |
After cycling around /sys for a while, I found this solution:
# echo /sys/class/enclosure/*/*/device/block/sdaa
/sys/class/enclosure/2:0:35:0/Slot 15/device/block/sdaa
# echo 1 > '/sys/class/enclosure/2:0:35:0/Slot 15/locate'
Or:
# echo 1 > /sys/class/enclosure/*/*/device/block/sdaa/../../enclosure*/locate
To blink... | Locate disk in SAS enclosure |
1,510,643,983,000 |
Run dmesg and grep on [sda] Mode Sense: to return a row such as this:
[sda] Mode Sense: 00 3a 00 00
What do the 4 bytes of data represent 00 3a 00 00?
Its likely the answer is contained in a subsequent row of output such as:
[sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
... but I would ... |
They are the first four bytes in the buffer returned from a mode sense command (see drivers/scsi/sd.c, sd_mode_sense()). The meaning can be gleaned by looking at drivers/scsi/scsi_lib.c, scsi_mode_sense()): this routine returns a structure called "data" which, according to a comment, abstracts the mode header data; th... | dmesg Output - Mode Sense - Bytes Explanation |
1,510,643,983,000 |
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.
|
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
| How to prevent FreeBSD from disconnecting a drive device? |
1,510,643,983,000 |
Similar to this question I a am interested in completely ignoring a drive, but in my case it is one drive which is exposed to the system as a SCSI drive. I have two drives from 21 drives in the server failing and failing:
[2524080.689492] scsi 0:0:90900:0: Direct-Access ATA ST3000DM001-1CH1 CC43 PQ: 0 ANSI: 6... |
The very high SCSI device numbers (scsi 0:0:90903:0) show that there's a problem in this case that the hardware keeps dropping & re-initializing the drive.
The MPT SAS hardware does most of the re-initializing itself here, so we can't entirely control that from the Kernel. Separately, you mention having 21 drives, so ... | How to get Linux to completely ignore a SCSI drive? |
1,510,643,983,000 |
Regardless of what data I write to my LTO-4 tape drive /dev/nsa0, writing is very slow (less than 1 MB/s) and the tape is constantly being wound back and forth in a shoe-shine pattern. No speed problem occurs when reading or erasing (with mt erase) tapes.
It appears that this problem occurs since I tried to enable SM... |
It is possible that the buffering mode has been set to “unbuffered.” This is a special feature of LTO tape drives, forcing them to return from a WRITE command only after the data has been written to the tape. This stops any streaming from happening and causes the observed effects.
Unfortunately FreeBSD does not provid... | My LTO tape drive is slow and “shoe-shines” on FreeBSD |
1,510,643,983,000 |
Under the /sys/class/scsi_device folder I have the following:
root@linux01:/sys/class/scsi_device # ls
1:0:0:0 2:0:0:0 2:0:1:0 3:0:0:0
How can I know how each of these devices is related to the disk?
For example, how can I determine if device 2:0:1:0 is disk /dev/sdb?
root@linux01:/sys/class/scsi_device # sfdisk... |
An easy way to get the correspondence is to look at the device/block subdirectory in the /sys hierarchy:
# ls -1d /sys/class/scsi_device/*/device/block/*
/sys/class/scsi_device/1:0:0:0/device/block/sr0
/sys/class/scsi_device/2:0:0:0/device/block/sda
/sys/class/scsi_device/2:0:1:0/device/block/sdb
/sys/class/scsi_devic... | Correspondence between SCSI device entries in /sys and the disks in /dev |
1,510,643,983,000 |
I have Ubuntu 12.04.1 LTS 64-bit on a PowerEdge 2900. My current setup has two 300GB disks (no RAID), but I want migrate the system to three new 600GB disks. I'm trying to connect the new disks, make a RAID5 array, and copy my partitions to the new RAID, but i'm not sure if the server has hot-plug support or, in parti... |
Proper SAS/SATA connectors are hot plug safe, so as long as you are using those connectors both for data and power ( not the usual PC molex power connector ) then you won't hurt anything plugging them in.
| How to check if hot-swap or hot-plug are activated on my Linux machine |
1,510,643,983,000 |
I have a Debian 9 running.
It has a SSD connected as well as a fibrechannel link to a SAN storage.
As far I see both are visible as /dev/sdX devices.
How can I find out what is the disk and what is the storage?
Where is the storage configured in the system?
|
More convenient way is to use lsscsi utility.
From documentation about FC:
For FC devices (logical units), the '--transport' option will show the
port name and the port identifier instead of the SCSI INQUIRY
"strings". For example:
$ lsscsi -g
[3:0:0:0] enclosu HP A6255A HP04 - /dev/s... | SCSI: SAN or local disk? |
1,510,643,983,000 |
I can't execute the "lsscsi" command in linux, I keep getting "command not found" when I try to run it.
How can I solve this issue?
|
You're missing the package "lsscsi". You can run yum install lsscsi (on Red Hat based distributions) or apt-get install lsscsi (on Debian based distributions).
| Failed in execute of "lsscsi" command [closed] |
1,510,643,983,000 |
I can usually see this log in dmesg:
sd 5:0:0:0: [sda] Attached SCSI disk
Can you please explain what are these 4 numbers?
Will these numbers change after reboot? or it should be constant?
|
The four numbers represent a SCSI address, often referred to as H:C:T:L. The four components are host, channel (or bus), target, and LUN.
With drives you’re likely to encounter on an end-user system (SATA, consumer NVMe, USB), the channel, target, and LUN will all be zero. The host number will depend on which port the... | sd 5:0:0:0: [sda] Attached SCSI disk, what are these four numbers? Will they change? |
1,510,643,983,000 |
Linux debian squeeze 6.0.6 (2.6.32-5-amd64) is supplied with quite an old 02.100.03.00 version of the mpt2sas driver.
I do wish to install a much newer mpt2sas driver version. In know there are backported kernel versions available, like bpo.3 and bpo.4. Those backports both contain version 10 of the mpt2sas driver.
Th... |
Use the newer Linux driver version 15.00.00.00 from LSI. This 700 MB download also contains precompiled binaries for Debian 6.0.5.
Installation instruction for amd64 architecture - adapted from the included readme - are:
# cd debian\rpms-03
# dpkg -i mpt2sas-15.00.00.00-3_Debian6.0.5.amd64.deb
And the output is:
Sele... | How to install much newer mpt2sas driver version in debian squeeze? |
1,510,643,983,000 |
I'm trying to use the following command:
dd if=/dev/urandom of=/dev/sg11 bs=16K count=1
But when executing it, I get the following error:
dd: writing `/dev/sg11': Function not implemented
When I try with dd if=/dev/urandom of=/dev/sg11 bs=16K count=1 conv=fsync, then I get a cannot allocate memory error, which becom... |
/dev/sgxx is a SCSI-generic device, which allows sending and receiving of raw SCSI commands. When you write to the device, you are expected to start the write with a SCSI header, which defines the operation you wish to do.
Writing random data to an sg device is really a bad idea. You'll be sending random SCSI commands... | dd outputting: "function not implemented" when trying to write to /dev/sg11 |
1,510,643,983,000 |
If it depends on the exact type of block device, then what is the default I/O scheduler for each type of device?
Background information
Fedora 29 includes a Linux kernel from the 4.19 series. (Technically, the initial release used a 4.18 series kernel. But a 4.19 kernel is installed by the normal software updates).
... |
Fedora 29 ships with the 4.18.16 kernel. It appears that CFQ is the default.
$ grep CONFIG_DEFAULT_IOSCHED= /boot/config-4.18.16-300.fc29.x86_64
CONFIG_DEFAULT_IOSCHED="cfq"
$ grep CONFIG_SCSI_MQ_DEFAULT /boot/config-4.18.16-300.fc29.x86_64
# CONFIG_SCSI_MQ_DEFAULT is not set
$ cat /sys/block/sda/queue/scheduler
noo... | What does Fedora Workstation 29 use as the default I/O scheduler? |
1,510,643,983,000 |
I have a DDS-1 tape (Sony 60M 1.3 GB tape) and am hoping to find a tape drive where I can still read it. The problem is that while I can find the associated compatible tape drives online, I am not sure if the interface would work. The older tape drives all rely on a SCSI connection. I am wondering if I am able to use ... |
Iomega were a common supplier of tape drives and accessories, catering for the home and small company market mostly. USB is not an ideal interface for such an adapter because of adapter software support, I/O speed and latency. If you can use a PCI or PCI-e card interface that would be an improvement. If the adapter yo... | How can I read and extract information from a DDS-1 tape today? |
1,510,643,983,000 |
When I try to take backup of data more than 1MB in a tape (LTO3) using tar command it showing me the following error.
xyz@localhost# tar -cvf /dev/nst0 file1.tar
file1.tar
tar: /dev/nst0: Cannot write: Input/output error
tar: Error is not recoverable: exiting now
Output of mt -f /dev/st0 status:
SCSI 2 tape drive:
Fi... |
From this line in the log:
st0: Sense Key : Medium Error [current]
it looks like either the tape is damaged or dirty, or the drive head is dirty or misaligned or damaged. First thing to try is to run a cleaning tape through the drive, then try writing to that tape again. If you get media errors again, try writing to ... | tar: /dev/nst0: Cannot write: Input/output error when taking backup |
1,510,643,983,000 |
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 sd... |
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... | Devices get renamed when SATA disk attached |
1,510,643,983,000 |
Here are my commands
mt -f /dev/st0 rewind
dd if=/dev/st0 of=-
As I understand it the first command rewinds my tape in /dev/st0, and the second command writes contents of /dev/st0 to -. My questions are
Where is -?
What is this command doing when it writes the data from the tape to -?
The result of the command is:
... |
It's been a long time since I've used tape. However, here's what I believe is happening
mt -f /dev/st0 rewind
This rewinds the tape in /dev/st0 ready for writing. Once the device is closed the tape is then automatically rewound because you didn't use the non-rewind device probably called something like /dev/nst0. Obv... | Testing LTO drive with mt and dd |
1,510,643,983,000 |
Due to shortage of free built-in SATA 3.0 plugs (6 totally) on my motherboard (Gigabyte 970A-DS3 rev.3) I've got an Adaptec RAID 5405 (3G SAS/SATA RAID) to move all "slow" SATA 1.0/2.0 devices to be connected to this card without creating any RAID. Adaptec RAID 5405 has one SFF-8087 connector and allows to connect up ... |
There is no possible to expose disk drives directly as block devices through Adaptec RAID controller. Almost all controllers from Adaptec don't support this feature - at least 5405, 5805 and, more general, a whole 3 and 5 series, though no information about 6 series of RAID controllers. Controller's BIOS doesn't allo... | SATA disk drive behind Adaptec RAID 5405 can't be detected as block device |
1,510,643,983,000 |
How do I configure multipath in testing VM (purpose is purely academical)?
I made new logical volume, modified multipath.conf to be as follows:
defaults {
udev_dir /dev
user_friendly_names yes
}
blacklist {
}
blacklist_exceptions {
device {
vendor "VMware,"
product "VMware Virtua... |
try this
multipathd -k
show config
On my system it seems that an empty blacklist is ignored and it contains, in addition to vendors blacklisted devices, these devnodes paterns:
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z]"
devnode "^dcssblk[0-9]*"
It matches "dm-"
you could try to add the... | Multipath to a logical volume in a staging VM |
1,510,643,983,000 |
We have CX4-120 EMC SAN storage, I expend existing LUN size to 20GB but now i am not able to see any cylinder changes on host fdisk -l output. Following command i am running to re-scan my hda or LUN
echo "1" > /sys/class/fc_host/host1/issue_lip
echo "1" > /sys/class/fc_host/host2/issue_lip
And then
echo "- - -" > /sy... |
All above command doesn't work if you expanding existing LUN or re-scaning existing LUN.
Solution:
echo "1" > /sys/block/<DEVICE>/device/rescan
Handy script:
cd /dev
for DEVICE in `ls sd[a-z] sd?[a-z]`; do echo '1' > /sys/block/$DEVICE/device/rescan; done
| Linux EMC scan Lun not working |
1,510,643,983,000 |
A "Linux debian 3.2.0-0.bpo.3-amd64 #1 SMP Thu Aug 23 07:41:30 UTC 2012 x86_64 GNU/Linux" system has at least 5 SCSI hosts:
root@debian:~# ls /sys/class/scsi_host
host0 host1 host2 host3 host4
root@debian:~# cat /sys/class/scsi_host/host0/proc_name
mpt2sas
root@debian:~# cat /sys/class/scsi_host/host1/proc_name... |
Since the large array is on a controller of a separate type (make and model, or rather: chipset), and nothing on it is needed for the system boot process, you can work around this by forcing a delayed controller initialization. The easiest way to do that is to simply blacklist the kernel module that does the kernel in... | How to skip/exclude one SCSI bus from scanning during boot? |
1,510,643,983,000 |
I am currently trying to back up data onto an LTO-4 tape using mt-st
and gnu tar 1.32, but I want to make sure I stop trying to copy things before the tape runs out! LTO-4 nominally has a capacity of 800G or 1.6T compressed. tapeinfo -f /dev/nst0 | grep Comp returns
DataCompEnabled: yes
DataCompCapable: yes
DataDeComp... |
MaxBlock from tapeinfo means the maximum block size that the drive supports. For example, when you used tar command, you might specify the block size by tar -b option. This size have the upper limit, and this limit corresponds to MaxBlock. On the other hand, mt-st -f /dev/nst0 tell shows where tape is. Indeed, if you ... | How do you determine the remaning capacity of a magnetic tape with mt or tar? How much space is in a block? |
1,522,331,345,000 |
I've replaced my backup server and I switched from a Debian Stretch to a CentOS7. I have a SuperLoader 3 LTO4 SCSI on an old adaptec SCSI 160. At first, I had to use the CentOSplus kernel which add the old SCSI aic7xxx module to have my hardware detected.
It's working, but I have a top speed to 2MB/s while I do a "bta... |
Sooo, after a discussion with another system engineer. We figured it could be the meltdown patch which is in fault here.
Because it's a old pcix controller, the driver structure may trigger the KPI and slow down/limit the throughput.
I tried by disabling the pti on the current kernel but no improvement, maybe there's ... | SCSI LTO4 very slow on CentOS 7 |
1,522,331,345,000 |
I have 4 disks (SATA) that I am 95% certain belong to a raid. The client/boss handed me a box with some disks in them and said recover data, reuse disks. There is another SCSI drive that I suppose is the primary/OS drive.
The box they came from have no power supply, and is the only thing I have with the old SCSI In... |
Hardware RAID implementation is realy specific to a controller. In case of non serous hardwarte controller you have absolutly no warrenty to recorver your data in cas of a controller faillure.
On software RAID with free softwere you can try to add the disk and a new computer, but it's not your case.
| SCSI's, SATA's, RAID's oh my. Please direct me the wizard of RAID recovery [closed] |
1,522,331,345,000 |
I want to format a MF 2HD floppy in a USB floppy disk drive. Since a USB floppy disk drive appears as a da(4) device instead of an fdc(4) device, the standard fdformat utility cannot be used. How can I format my floppy disk?
|
As no formatting program seems to exist, I wrote the following shell script which sends appropriate FORMAT UNIT commands to format all 80 tracks of a floppy disk. The device da0 is formatted unless a different device is supplied as an argument. The CDB has been taken from the UFI specification.
#!/bin/sh
set -e
exe... | How to format floppy disks in a USB floppy disk drive on FreeBSD? |
1,522,331,345,000 |
I am pretty new to SCSI and actually not even sure if this is the correct forum to ask. (I did because I found some SCSI questions :) So please feel free to improve/migrate this question.
I am playing with Fibre Channel transmission, and read in an internal document that unlike TCP, SCSI over FCP-3 is not guaranteed d... |
It might be one for ServerFault.
But you're quite correct. Fiber Channel doesn't have the same protection mechanisms as TCP. It's more like UDP in that regard (although that's a bit of a weak analogy) and for many of the same reasons - for some applications, TCP is bad solution because of those reliability mechanisms ... | How is reliability achieved with SCSI and SAN? |
1,522,331,345,000 |
I'm trying to ddrescue (through rescueCD) a drive, which keeps spinning down. e.g
ddrescue -N -n -A -M -f /dev/sdk /dev/sdd mapfile
Without rebooting I can get the drive for a short while through
echo "- - - " > /sys/class/scsi_host/host11/scan
I was hoping to 'watch' that command to run recurrently (bad idea?); but... |
As already noted in comments, you can find a reproducible path in /dev/disk/by-id (based on the device's manufacturer and serial number) or in /dev/disk/by-path (based on the port that the device is plugged in).
Although you can use these to create udev rules to force a specific drive letter, it isn't worth the troubl... | Force disk onto /dev/sdX |
1,522,331,345,000 |
I know that in general this means that I have a "bad disk". But I'm after a more specific reason for why I am getting these messages from the kernel:
sd 15:0:0:0: [sda] Attached SCSI disk
sd 15:0:0:0: [sda] Unhandled sense code
sd 15:0:0:0: [sda] Result: hostbyte=0x10 driverbyte=0x08
sd 15:0:0:0: [sda] Sense Key : ... |
From the SCSI2-Draft standard (the only one I have that isn't a PDF):
Table D.1 (continued)
+=============================================================================+
| D - DIRECT ACCESS DEVICE |
| . .W - WRITE ONCE READ MULTIPLE DEVICE ... | What does this key code qualifier mean? |
1,522,331,345,000 |
I have sucessfully passed to vm pci-e and pci pure devices.
I want to pass a scsi controller to a vm
the controller is seen by the os
06:06.0 SCSI storage controller [0100]: BusLogic BT-946C (BA80C30) [MultiMaster 10] [104b:1040]
Kernel driver in use: vfio-pci
Kernel modules: BusLogic
I detach the controller
... |
You need to use udev rules to change ownership of the devices you wish to passthrough to your user. To not get this memory error you also need to increase the memory limit your user is able to allocate.
I use Arch Linux, so these files might be on different locations on your distribution.
Create the group kvm if not ... | No way to pass to virtual machine this old scsi controller? |
1,522,331,345,000 |
I'm running VMWare Workstation 12.1.1 Pro under Windows 10, with a guest Linux Mint 17.2 with virtual hardware version 11.
My only current disk is a virtual SATA.
When I add a virtual SCSI device at 0:0, (creating a new 0.4GB disk as a test) I'm getting the error shown below.
I re-installed vmware-tools after creating... |
I was using the wrong tool:
hdparm(8) - get/set SATA/IDE device parameters
For SCSI, use:
sdparm(8) - access SCSI modes pages; read VPD pages; send simple SCSI commands
lsscsi(8) - list SCSI devices (or hosts) and their attributes
| VMware: `SG_IO: bad/missing sense data` on a fresh SCSI virtual disk |
1,522,331,345,000 |
When doing lsscsi:
$lsscsi
[0:0:2:0] disk FUJITSU MAM3184MP 0105 /dev/sda
[1:0:0:0] cd CREATIVE CD5233E 1.00 /dev/scd0
In my understanding:
H : SCSI host id
C : SCSI channel
T : Target Number
L : LUN
How do the 4 numbers from? Does it read from BIOS? or they were decided by OS?
any other Linux command can get thes... |
The numbers are assigned by the kernel (and its device drivers), based on hardware information where appropriate. Thus on a real parallel SCSI setup, the second field will identify the bus on the corresponding HBA, the third field will identify the target (which is commonly determined by jumpers on each device), and t... | How the h c t l numbers read from in lsscsi? |
1,522,331,345,000 |
QEMU newbie here. I am trying to boot a VM using QEMU, for increased performance I am trying to use a virtio-scsi mounted drive. I am following the steps given here. However when I boot my VM and I try to check for the virtio-scsi queues using ls /sys/block/sdb/mq/ I do not see the option of mq, does that mean I was u... |
Hopes this helps anyone facing the same issue, there is a config which has to be enabled while compiling the guest kernel -
CONFIG_SCSI_MQ_DEFAULT=y
You can then use ls /sys/block/sdq/mq/ to see the number of multi queues.
| QEMU virtio-scsi: Cannot see the number of queues after booting VM with virtio-scsi command |
1,522,331,345,000 |
I'm using LIO for SAN scsi.
The shared disks shown as LIO-ORG at client side.
Example;
[root@testing ~]# lsblk -S
NAME HCTL TYPE VENDOR MODEL REV TRAN
sdc 4:0:0:0 disk LIO-ORG mydisk 4.0 fc
I can change the VENDOR name if I build my own kernel but it's not sustainable.
So the questi... |
I sent a mail to target-devel maillist and thanks to "David Disseldorp" I got an answer from him.
This functionality was added recently via:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=54a6f3f6a43cf5a5ad0421e4440a4c7095e7a223
With this change (and 2d882847280e3ae1ddc95175d0fc2006e1... | Can I change LIO SCSI Disk Vendor name |
1,522,331,345,000 |
I have a RocketRaid 622 RAID controller card, installed on a machine running Linux Mint 18.2. The drivers have been successfully compiled and installed with dkms, after some customizations to make it compatible with the latest linux kernel.
One of the tools that comes with the card is a WebUI service. It depends on ... |
It looks like this simply doesn't work on newer versions of Ubuntu. The /proc/scsi filesystem has changed in a way that no longer works with the outdated RAID management software.
I have two options:
Set up on an older version of Ubuntu, likely one which is no longer supported.
(Maybe, untested) possibly compile a c... | /proc/scsi/<device> not found, but device is otherwise working |
1,453,750,202,000 |
I can't seem to find any information on this aside from "the CPU's MMU sends a signal" and "the kernel directs it to the offending program, terminating it".
I assumed that it probably sends the signal to the shell and the shell handles it by terminating the offending process and printing "Segmentation fault". So I tes... |
All modern CPUs have the capacity to interrupt the currently-executing machine instruction. They save enough state (usually, but not always, on the stack) to make it possible to resume execution later, as if nothing had happened (the interrupted instruction will be restarted from scratch, usually). Then they start exe... | How does a Segmentation Fault work under-the-hood? |
1,453,750,202,000 |
I was running a shell script with commands to run several memory-intensive programs (2-5 GB) back-to-back. When I went back to check on the progress of my script I was surprised to discover that some of my processes were Killed, as my terminal reported to me. Several programs had already successively completed before... |
It can.
There are two different out of memory conditions you can encounter in Linux. Which you encounter depends on the value of sysctl vm.overcommit_memory (/proc/sys/vm/overcommit_memory)
Introduction:
The kernel can perform what is called 'memory overcommit'. This is when the kernel allocates programs more memory t... | Will Linux start killing my processes without asking me if memory gets short? |
1,453,750,202,000 |
I have a command line application that when run does not do what it is supposed to do and at a certain point leaves the message:
Segmentation fault
What does this mean? What should I do?
|
A segmentation fault is the result of a memory access violation. The program has referred to a memory address outside of what was allocated to it, and the OS kernel responds by killing the program with SIGSEGV.
This is a mistake, since there is no point in trying to access inaccessible memory (it cannot be done). Mi... | Running application ends with "Segmentation Fault" |
1,453,750,202,000 |
When a segmentation fault occurs in Linux, the error message Segmentation fault (core dumped) will be printed to the terminal (if any), and the program will be terminated. As a C/C++ dev, this happens to me quite often, and I usually ignore it and move onto gdb, recreating my previous action in order to trigger the in... |
If other people clean up ...
... you usually don't find anything. But luckily Linux has a handler for this which you can specify at runtime. In /usr/src/linux/Documentation/sysctl/kernel.txt you will find:
core_pattern is used to specify a core dumpfile pattern name.
If the first character of the pattern is a '|',... | Segmentation fault (core dumped) - to where? what is it? and why? |
1,453,750,202,000 |
I am currently running a statistical modelling script that performs a phylogenetic ANOVA. The script runs fine when I analyse the full dataset. But when I take a subset it starts analysing but quickly terminates with segmentation fault. I cannot really figure out by googling if this could be due to a problem from my s... |
(tl;dr: It's almost certainly a bug in your program or a library it uses.)
A segmentation fault indicates that a memory access was not legal. That is, based on the issued request, the CPU issues a page fault because the page requested either isn't resident or has permissions that are incongruous with the request.
Afte... | Is a "segmentation fault" a system error or program bug? |
1,453,750,202,000 |
I have a script that calls a program (specifically, ttf2afm, part of tetex 3.0) that sometimes segfaults and sometimes doesn't. The information I need is always printed out before it segfaults, but I'm having a hard time stopping the pipe redirection from failing and not outputting anything to the pipe when the progra... |
I finally figured it out through a process of trial-and-error. The solution is kind of convoluted:
(trap 'true' ERR; exec ttf2afm "$FONT") |
grep ...
Apparently the exec causes ttf2afm to take over the subshell process with the trapped error, causing it to operate in an environment where it doesn't matter if it segfa... | Piping output from a segfaulting program |
1,453,750,202,000 |
This is Ubuntu 9.04, 2.6.28-11-server, 32bit x86
$ cat test.c
main() { int *dt = (int *)0x08049f18; *dt = 1; }
$ readelf -S ./test
...
[18] .dtors PROGBITS 08049f14 000f14 000008 00 WA 0 0 4
...
$ ./test
Segmentation fault
$
For the uninitiated: gcc creates a destructor segment, .dtors, in t... |
Those sections are marked GNU_RELRO (readonly relocations), which means that as soon as the dynamic loader has fixed up (at load time, there are no lazy relocations there) all the relocations, it marks those sections read-only. Note that most of .got.plt is on another page, so doesn't get the treatment.
You can see th... | .dtors looks writable, but attempts to write segfault |
1,453,750,202,000 |
(Follow-up on How to efficiently use 3D via a remote connection?)
I installed the amd64 package on the server and the i386 one on the client. Following the user's guide I run this on the client:
me@client> /opt/VirtualGL/bin/vglconnect me@server
me@server> /opt/VirtualGL/bin/vglrun glxgears
This causes a segfault, us... |
I don't know how this remote 3D works but if the client is indeed trying to run the amd64 executable, this is definitely the reason this message appears.
| Segmentation fault when trying to run glxgears via virtualGL |
1,453,750,202,000 |
I've realised recently that the kill utility can send any signal I want, so when I need to SIGKILL a process (when it's hanging or something), I send a SIGSEGV instead for a bit of a laugh (kill -11 instead of kill -9.)
However, I don't know if this is bad practice. So, is kill -11 more dangerous than kill -9? If so, ... |
The SIGSEGV signal is sent by the kernel to a process that has made an invalid virtual memory reference (segmentation fault).
One way sending a SIGSEGV could be more "dangerous" is if you kill a process from a filesystem that is low on space. The default action when a process receives a SIGSEGV is to dump core to a fi... | Is there any danger in using kill -11 instead of kill -9? |
1,453,750,202,000 |
I am connected with SSH to a machine on which I don't have root access. To install something I uploaded libraries from my machine and put them in the ~/lib directory of the remote host.
Now, for almost any command I run, I get the error below (example is for ls) or a Segmentation fault (core dumped) message.
ls: reloc... |
Since you can log in, nothing major is broken; presumably your shell’s startup scripts add ~/lib to LD_LIBRARY_PATH, and that, along with the bad libraries in ~/lib, is what causes the issues you’re seeing.
To fix this, run
unset LD_LIBRARY_PATH
This will allow you to run rm, vim etc. to remove the troublesome librar... | Almost no commands working - relocation error: symbol __getrlimit, version GLIBC_PRIVATE not defined in libc.so.6 |
1,453,750,202,000 |
With the latest version of Kile installed, trying to run it crashes with a segmentation fault:
$ kile
qt5ct: using qt5ct plugin
Invalid Context= "Apps" line for icon theme: "/usr/share/icons/Mint-Y/apps/16/"
Invalid Context= "Apps" line for icon theme: "/usr/share/icons/Mint-Y/apps/16@2x/"
Invalid Context= "Mimetype... |
After much searching, I found the answer in a Debian bug post exchange:
If the okular package is not installed, kile can not start and crashes
on a segmentation fault.
The solution was to run
sudo apt-get install okular
| Trying to run Kile gives a segmentation fault on Linux Mint 19 |
1,453,750,202,000 |
I've got a long-running program (becomes a daemon with daemon(3) call) that exits on Signal 11 (Segmentation Violation) every so often. I can't tell why. So, I wrote a SIGSEGV handler, set using the sigaction() system call. I set the handler function so that it has this prototype: void (*sa_sigaction)(int, siginfo_t ... |
The undocumented semantic of si_code = SI_KERNEL with si_errno = 0 is,
processor-specific traps
kernel segment memory violation (except for semaphore access)
ELF file format violations, and
stack violations.
All other SIGSEGVs should have a si_errno set to a non-zero value. Read on for the details.
When the kernel s... | sigaction(7): semantics of siginfo_t's si_code member |
1,453,750,202,000 |
I have a Busybox/Linux system where a mystery program is segfaulting rarely. Is there a way to find which program is doing this?
|
If the segmentation fault produces a "core" file, you can run file <core-filename> to identify the executable. You can also use ddd or gdb to debug the core file for more information.
| Is there a way to find out which program is segfault-ing? |
1,453,750,202,000 |
Scenario (Ubuntu 16.04):
I compile and run a C program (with -g, I get the traditional Segmentation Fault (core dumped), and then (of course) there is no mythical "core" file to be found. Some digging says to modify /proc/sys/kernel/core_pattern with a command to the effect of: echo '|tee /home/me/my_core_folder/my_co... |
The core(5) manpage describes the parameters affecting core dumps in detail, including their naming etc.
To answer your stated question, there is no generalisable way to find a core dump. By default, core is dumped in the process's current working directory, if the process is allowed to write there, if there's enough ... | How to view Core file (general) |
1,453,750,202,000 |
My assignment is to write a bash script that reads a directory and returns the file type of each file within, including all subdirectories. Using the find command is not allowed. I've tried to implement this using essentially two for loops, but I'm getting a segmentation fault. I found that the script does work howeve... |
If the "$name" it's processing is a directory, you need to call func on its contents, and not the original argument, or you get an infinite loop, and hence the segfault.
Your code can be greatly reduced by using a function on the original argument, and have the function apply to each item separately. Right now you're ... | Bash script segmentation fault |
1,453,750,202,000 |
Linux kernel keeps logging segfaults in ring buffer.
a.out[25415]: segfault at 8049604 ip 08049604 sp bf88e3fc error 15 in a.out[8049000+1000]
Is there a way to temporarily disable it? My usecase is that I'm running a testsuite that does all sorts of crazy things and I don't want to see segfaults in dmesg from that ... |
Okay, I eventually found it. It's called debug.exception-trace.
sysctl -w debug.exception-trace=0 or echo 0 > /proc/sys/debug/exception-trace will turn it off.
# dmesg -c
# dmesg
# echo 'main;' | gcc -xc - && ./a.out
<stdin>:1:1: warning: data definition has no type or storage class
Segmentation fault
# dmesg
[ 539.... | Is there a way to temporarily disable segfault messages in dmesg? |
1,453,750,202,000 |
System
Linux Mint 19.3 Cinnamon 64-bit, based on Ubuntu 18.04 LTS.
Related Hardware
GPU: NVIDIA, GeForce GTX 1060, Max-Q Design, 6 GB VRAM
CPU: Intel Core i7-7700HQ
Could anyone tell me if the following means anything special like that my Nvidia card is faulting? Could it be just a software error on Google Chrome ... |
No, it's not your Nvidia card that is at fault. Neither really is Chrome, either.
What happens first is that the Nvidia software crashes, stopping the render pipeline. Then, after a few seconds, chrome detects the GPU not rendering any more, tries to handle that, fails, and throws the segfault.
When the machine is in ... | Segfault in Google Chrome - is it Nvidia card related? How do I find out? |
1,453,750,202,000 |
I have a question about how Linux traps memory access errors. As far as I know, a user space program doesn't need to ask operating system every time it wants to access memory, now when the process tries to access a memory location not in it's address space the CPU must be having a way to stop this and communicate this... |
Your guesses seem about 100% correct.
There is hardware called a memory management unit (MMU) (Part of CPU). It is given page tables, that describe what pages do what (what are executable, readable, writable). If a process tries to do what it is not allowed to do, then the MMU interrupts the CPU. The CPU then executes... | How Linux finds out about illegal memory access error? |
1,453,750,202,000 |
In my production server running Red Hat Linux (V6) I got frequently core dumps from bash. This occurs from a couple of time a day to dozens of time a day.
TLTR
Resolution: install the bash-debuginfo to get more details from the core and locate the statement which cause the crash.
Cause: in this case it was because o... |
I installed the debuginfo tools as suggested by gdb and then I got the expression responsible for the crash:
#20 0x0000000000457ac8 in expand_compound_array_assignment (
var=<value optimized out>,
value=0x150c660 "$(logPath \"$@\")", flags=<value optimized out>
)
So now I know what and where is the issue.
In... | How to find why a bash exits with signal 11, Segmentation fault |
1,453,750,202,000 |
I can provoke a race condition that gives output similar to this in dmesg:
[ 5432.541379] perl[408327]: segfault at 22 ip 0000564eb8af9cc2 sp 00007ffec318cea0 error 6 in perl[564eb8af7000+1a1000]
[ 5432.541402] Code: 83 f8 05 0f 87 cf 00 00 00 0f b7 6b 22 66 81 fd 00 04 77 64 01 ed 8d 7d 05 48 63 ff 48 c1 e7 03 be 01 ... |
A ps aux run during the test reveals lines like:
tange 1471203 0.0 0.0 264173920 3776 pts/1 T 20:54 0:00 sort --buffer-size=50% -k3r
264173920 is 50% of 500 GB, and there are 20 of those.
meminfo says:
$ grep Committ /proc/meminfo
Committed_AS: 5291525876 kB
So my assumption that 500GB would be enough w... | Debug segfault race condition |
1,453,750,202,000 |
My default stack size (according to ulimit -s) is 8192 kB, so naturally the code below segfaults when I try to run it. Also, naturally, it works fine if I do a 'ulimit -s 9000'.
However, when I do a 'ulimit -s unlimited' the code segfaults again. Any ideas what is going on here?
If it's useful, I'm running Debian 10 w... |
Because for threads "unlimited" gives you only 2 MiBs on x86_64, see pthread_create man page:
If the RLIMIT_STACK resource limit is set to "unlimited", a per-architecture value is used
for the stack size. Here is the value for a few architectures:
┌─────────────┬────────────────────┐
│Ar... | Unlimited stack size with pthreads |
1,453,750,202,000 |
I have Ubuntu 11.10. server which suffered from power failure today. Ever since the power went back on the unit works only partially. Some services work OK, some does not start, e.g.
apache2ctl restart
Inconsistency detected by ld.so: ../sysdeps/i386/dl-machine.h: 640: elf_machine_rel_relative: Assertion `((reloc->r_i... |
These different segfaults are more likely an indication of something wrong with memory or with your disc connection than with corruption of the filesystem.
You should first check the memory by rebooting and selecting the memory checker from the grub menu and let it run at least for one pass. Re-seat the memory (after... | Ubuntu broken after power failure. How to fix? |
1,453,750,202,000 |
When applications segfault, I generally see messages like this in dmesg:
pstree[25678]: segfault at 0 ip 00007f58be0b3ae4 sp 00007ffe65b700a0 error 4 in libc-2.24.so[7f58be04d000+195000]
However, I think somehow I must have changed my kernel settings somewhere, because I no longer see these messages in dmesg. I am tr... |
A segmentation fault is not the same thing as a SIGSEGV signal. A signal is just a signal. When you have an actual segmentation fault, that is when the kernel will log it, and subsequently send a SIGSEGV signal to your application.
The logic behind this, and why the kernel only logs on a real segmentation fault, is th... | Toggling visibility of segmentation fault messsages in dmesg |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.