date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,418,080,813,000 |
On a linux system many device names can be seen under /dev. This must be defined somewhere in the linux kernel source code, the udev code, device trees or driver code.
For example, where is the source code located that determines a floppy drive should start with fd or that a hard disk starts with sd ?
|
There's the LXR (Linux cross reference) project where you can select your kernel version and search the code.
(Note: The old http://lxr.linux.no doesn't work properly anymore, at least for me; search is broken for newer kernel versions.)
Searching for "floppy" (without quotes) and a couple of attempts peeking into th... | Source code for device names |
1,418,080,813,000 |
I have an external eSATA-hdd on an OpenSUSE 12.2 system. The external hdd has an LVM on a dm-crypt partition.
I mount it by powering it up and then doing
rescan-scsi-bus.sh
cryptsetup -v luksOpen
vgchange -ay
mount
Now when I want to power the hdd down, I do
umount
vgchange -an extern-1
cryptsetup -v remove /dev/... |
Yes, you can find the information in /sys/block/$DEVICE/slaves. If you only have the canonical name you can use readlink to get the details, e.g:
devdm="$(readlink -f /dev/mapper/extern-1-crypt)"
dm="${devdm#/dev/}"
ls /sys/block/$dm/slaves/
If you want to remove all you can just utilize directly the sys filesystem:
... | Detecting the device of a crypto mount |
1,418,080,813,000 |
Is it possible to swap logical device names of two NVME SSD drives installed in a laptop (Lenovo Legion 5 Pro 2022) without phisically swapping their port positions?
I would like the current /dev/nvme0n1 to become /dev/nvme1n1 and vice versa.
If it's possible, how do I do this?
My OS is Ubuntu 22.04LTS.
|
While it's not entirely impossible to change the order, doing so won't solve any problem and will only create more, so you shouldn't do it.
Device names are assigned on a first come, first serve basis, which means the order can change anytime and you should not rely on it at all. Stick to (PART-) UUID/LABEL, one of th... | Swap logical device names of two NVME SSD drives |
1,418,080,813,000 |
I want to be able to write data to a file descriptor then read it back later in bash.
This would look like:
# some line to create LOOPBACK_FD
echo foo >${LOOPBACK_FD}
cat <${LOOPBACK_FD}
# foo is printed
I know that I can use variables to store the output of commands like in:
MYMESSAGE=$(echo foo)
echo ${MYMESSAGE}
... |
echo foo >${LOOPBACK_FD}
cat <${LOOPBACK_FD}
That will not work -- no matter how LOOPBACK_FD is created or opened, or if it's accessible via the filesystem or not.
The cat will keep waiting for an EOF which will not come as long as the calling script (which is waiting for cat to terminate) will keep the writing end... | How can I make a loopback file descriptor in bash? |
1,418,080,813,000 |
How can I mount /dev from C? I'm writing a simple init, and I know this sounds stupid but I would like to have /dev mounted to another folder.
The manpages for mount() don't show dev as a supported option.
|
The manpage for mount(2) only gives examples and mentions /proc/filesystems for an exhaustie list. This latter file lists devtmpfs which is what you are looking for.
The resulting C program would then be something like:
if (mount("-", "/.../dev", "devtmpfs", 0, NULL) != 0) perror("mount");
| How can I mount /dev from C? |
1,418,080,813,000 |
Have two Android phones Motorola and HTC both not working on Cinnamon 18.
They were both working on Cinnamon 17.2.
I have installed MTP tools. The commands mtp-detect and lsusb both return Vids and Pids with no apparent errors.
Plugging in the phones I select File Transfers but nothing happens ie no connection sound a... |
Solved
The problem was "Gvfs-Backends" package was not installed. Installed it via Synaptic Package Manager. How it became uninstalled is a mystery. I found this by comparing Gvfs packages on a working laptop to the not working laptop in the Synaptic Package Manager, for those who may encounter this problem. So ev... | MTP File Transfer not working on Linux Cinnamon 18 |
1,418,080,813,000 |
I understand from my previous question that the /dev/xconsole file can be created using mkfifo.
On my system (Debian Wheezy), /dev/xconsole gets created automatically. I am wondering who creates it (udev ?) and how I can configure that a second file gets created automatically, i.e. /dev/xconsole2
|
On Debian typically the selected syslogd package takes care of creating the /dev/xconsole pipe. You probably have rsyslog installed; look at the /etc/init.d/rsyslog script and search for create_xconsole which is the shell function that creates /dev/xconsole; it's trivial to modify that to create a second file.
| create several /dev/xconsole files automatically upon boot |
1,418,080,813,000 |
I am trying to understand how computers work and I was thinking about peripherals. Here is what I understand so far but some parts are missing.
Using an Arduino, I send some text every second (a then b then c, ...) via UART to a Pandaboard. I guess that there is a special chip on the Pandaboard or its microprocessor t... |
The files in /dev are device files, they are not real files. They don't, usually, have content on disk (a few representing raw disks do). There is nothing in the file. If you do ls -l /dev, you will see all there is to these "files": A name, some special bits, see first character of mode (is is not d=directory, -=regu... | What happens under the hood when some data is sent/received on an uart (or similar)? |
1,358,318,430,000 |
I just finished the first version of a Linux kernel module I've written in C. The module creates a device file (/dev/wn0) that controls a USB device with three LED lights. For example, running as root, I can do this:
echo "#ff0000" >/dev/wn0
...and the device will glow bright red.
My problem is that I want unprivileg... |
Ok, I see some possibilities:
The quickest way, the whole point of POSIX permissions and ownership: you want someone to be able to read and/or write, you set the permissions accordingly. Just put these people in a group and change the device ownership to that group, giving the group write permissions. You may have t... | Standard way to expose device file to userland applications running on an unprivileged user account? |
1,358,318,430,000 |
Today a fuse blew out which turned off a small server.
This server has an USB-HDD connected to it, but since I connected it about 3-4 months ago, I never turned the server totally off (no electricity), but only issued an occasional sudo reboot.
This USB-HDD was listed under /dev/sdc, so I had a mounted partition via s... |
You should not attempt to get a fixed /dev/sdX name at all. You should just not use such a name directly.
What you should do is reference your disk (or disk's partition) by an autodetected identifier provided under /dev/disk/. Among the choices available there, /dev/disk/by-id/ has entries tied to the serial number of... | External USB-HDD became /dev/sda after power off, how to pin it to /dev/sdc? |
1,358,318,430,000 |
AFAIK the container terminology, what I'm essentially trying to accomplish is to write my own "container runtime".
What I'm doing:
user@host:~$ mkdir test
user@host:~$ cd test
user@host:~/test$ mkdir dev
user@host:~/test$ mkdir proc
user@host:~/test$ echo 1 |sudo tee /proc/sys/kernel/unprivileged_userns_clone
user@hos... |
Quick fix for your problem: mount the tmpfs with a mode= option (which sets the permissions of the root dir of the filesystem), and use a mode without either the sticky bit (01000) or the write permission for others (002) -- which are both on by default:
root@host:~/test# mount -o mode=0755 -t tmpfs none dev/
You're ... | How to make /dev inside linux namespaces |
1,358,318,430,000 |
When installing a Ubuntu, Manjaro or other Graphical Linux distro on laptop, when press the airplane mode button on laptop, Airplane mode can be enabled.
How the concept of airplane mode works in Linux distro?
Is it just a set of rule toward Bluetooth, and wifi and other wireless stuff?
Does the implementation of airp... |
Mostly, "Airplane mode" means to disconnect any radio ("wireless") connections, AND stop sending any active probes to find possible connections.
On most Linux systems, Wi-Fi network connections are managed through NetworkManager. Other wireless network connection managers are available.
Additionally, there is a conce... | The concept of "Airplane Mode" in Linux |
1,358,318,430,000 |
I am using a new installation of Arch Linux and whenever I boot my system I have to wait for 90 seconds as there is a start job running for my network interfaces.
I installed Arch yesterday and whenever I do ip a I get that ethernet interfaces is in DOWN state. I used a wired usb tether to complete the whole installat... |
I'd say it's very likely the problem you're seeing is with the [email protected] that's configured on your system. So my recommendation would be to disable it, hopefully that's enough to make that timeout during boot disappear:
$ sudo systemctl disable dhcpcd@eth0
I'll go over the evidence to support that claim. Ther... | A start job is running for eth0 |
1,358,318,430,000 |
I need to retrieved the grab state of an evdev device in a program. More specifically, I need to retrieve the state of the grab pointer in the evdev struct seen here: https://elixir.bootlin.com/linux/v4.20/source/drivers/input/evdev.c#L42 (if it is NULL or not NULL). Is this at all possible from userspace, e.g. throug... |
To determine whether a device is currently grabbed, from userspace, you can try to grab it yourself; either using the EVIOCGRAB ioctl yourself, or libevdev_grab in libevdev:
if (!ioctl(evdevfd, EVIOCGRAB, (void *) 1)) {
// We grabbed the device, no one else had it; release it
ioctl(evdevfd, EVIOCGRAB, (void *)... | Access grab state of evdev device |
1,358,318,430,000 |
I'm wondering if devtmpfs is special with respect to namespaces.
Here's my system info (using Vagrant for testing)
vagrant@ubuntu-xenial:~/test$ uname -a
Linux ubuntu-xenial 4.4.0-135-generic #161-Ubuntu SMP Mon Aug 27 10:45:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
A basic demonstration explains best:
vagrant@ubunt... |
I believe it is related to the file system flag FS_USERNS_MOUNT (https://lwn.net/Articles/652468/).
A quick grep of the kernel seems to indicate it's not set for devtmpfs: livegrep.com results
If someone has a better answer I'd be happy to accept it instead!
| Is devtmpfs special with respect to namespaces? a permissions problem |
1,358,318,430,000 |
I have a gamma spectrometer that connects as a USB HID. When it is inserted dmesg helpfully informs me that two device files were made for it, hiddev0 and hidraw2 (obviously, the numbering isn't important.)
Based on the documentation and a visual inspection of the bytes, I want to be reading from hidraw2. But I am c... |
Partial answer:
The driver is hid-generic, so the next step is to look at the HID descriptor. As root, do
mount -t debugfs none /sys/kernel/debug
And then look at the contents of /sys/kernel/debug/hid/<dev>/rdesc, where <dev> identifies your device.
The HID descriptor describes the format of what you can read from a... | Format of hiddev bytes? |
1,358,318,430,000 |
I want to remove my external HDD as safely as possible.
I want to use umount --lazy:
Lazy unmount. Detach the filesystem from the file hierarchy now, and clean up all references to this filesystem as soon as it is not busy anymore. (Requires kernel
2.4.11 or later.)
Then after a short delay I... |
You could try to remount the volume read-only. This works only if nothing on that volume is opened for writing.
You will probably not get rid of the race condition that a file could be opened read-only or that a process could have its current working directory on that volume but if you detach the hardware then you can... | List processes accessing device after `umount --lazy` |
1,358,318,430,000 |
I am wondering if there was a way to list files on a device without mounting it (i.e la output )
|
Yes, sort of. There are tools like PhotoRec that operate on block devices direclty without mounting them.
| Can I list my usb content without mounting it? |
1,358,318,430,000 |
I reading a Linux book that told me I can check the dma channels by reading /proc/dma.
This is what I see when I run cat /proc/dma:
2: floppy
4: cascade
I'm confused because that looks like old school ISA DMA. I thought this kind of DMA was no longer in use and the DMA controller it required was physically no longe... |
The ISA dma controller is still included on any system that has an ISA bus, which your typical desktop system still has these days, mostly to support floppy disk and IDE disk controllers ( which AHCI SATA controllers can still emulate for backward software compatibility ). Instead of being its own physical chip, its ... | What is /proc/dma? Is it just for legacy support? |
1,358,318,430,000 |
In some distributions /dev/fuse is owned by root:fuse while in other distributions /dev/fuse is owned by root:root. I'm using CentOS which belongs to the former set of distributions. And I'm wondering if it is secure for me to change the ownership on /dev/fuse to root:fuse.
|
Since FUSE is "File System in User Space", this could derive in undesired mounts, or virtual file system structures in your system that you didn't foresee/want to be there at all.
Changing ownership of devices implies that other users may use directly these devices without needing administrative rights (root/sudo). Ch... | Changing ownership on /dev/fuse - security issues? |
1,358,318,430,000 |
My problem is that I can't login. If I try to loggin with correct username and password it doesn't do anything. I have error message on boot failed to create static device Nodes in /dev . This happened after sudo pacman -Sy xterm and restart of the system. My kernel version is 4.1.6-1-ARCH This is not my image but by ... |
Libncurses was recently updated from /usr/lib32/libncursesw.so.5 to /usr/lib32/libncursesw.so.6. There would have been a matching bash update, but you don't have it.
In fact, I just found this in my own pacman.log:
[2015-09-19 23:45] [ALPM] upgraded ncurses (5.9-7 -> 6.0-3)
[2015-09-19 23:45] [ALPM] upgraded readline ... | Arch linux can't login |
1,358,318,430,000 |
I want to create a loop device myself, I want it to have a special name, say /dev/loop-test-0. I want it to be up after I reboot the machine. I though that I can use mknod for this, but this doesn't seem to work. I look on the other loop device I have in the system and they all look like
brw-rw----. 1 root disk 7, ... |
A loop device is a particular type of block device, managed by the loop device driver. A loop device is a block device whose content is stored in a file, similar to the way a SCSI disk device is a block device whose content is stored on a SCSI disk, a USB storage device is a block device whose content is stored on a U... | What is the difference between loop device and block device? [closed] |
1,358,318,430,000 |
I have a situation in which same device trees are used with different kernels.
Can the device trees be build only once and used with all kernels?
The reason I ask this is because I found the device tree compiler having a separate repository that the kernel.
Also the explanation from this answer doesn't relate device t... |
After being in a situation where this could be tested I've witnessed that you can't use a device tree compiled for kernel 3.10 on kernel 3.14. and vice versa.
| Is the device tree compiler tied to the kernel version? |
1,358,318,430,000 |
In my laptop (running Linux) I have only one SSD, connected to the SATA3 port.
Why I have two sdx entries in /dev directory?
In particular I see /dev/sda and /dev/sdb, and /dev/sda is the SSD:
# fdisk -l
Disk /dev/sda: 128.0 GB, 128035676160 bytes, 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector siz... |
With the update (lshw … output) there is the answer now:
product: xD/SD/M.S.
That's your laptop's cardreader. Also, capabilities: removable.
UPDATE:
As for the mentioned /sys/block/sdb/queue/rotational value being 1, this parameter actually influences the I/O scheduling algorithm in Linux. Probably, it should have bee... | Why I have two /dev/sdx entries with a single disk? |
1,358,318,430,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,358,318,430,000 |
How to check the device number of a device in /proc/1/ns/{ns}?
I've read the code for a Go library (see below), which states that it's possible to determine, if a container is in the host namespace or not: the device number of an unnamespaced /proc/1/ns/{ns} is 4 and anything else is higher.
Now, in a fresh Debian con... |
What does the 4026531837 in 'user:[4026531837]' mean here?
These numbers are the inode numbers of files implemented by the nsfs filesystem, which could be opened and used with the setns(2) to associate a process with a namespace.
How can I list the device numbers of the files /proc/1/ns/{ns}?
According to a system... | How to check the device number of a device in `/proc/1/ns/{ns}`? |
1,358,318,430,000 |
I have the following situation. DEV1 <---> PC1 <---> PC2
DEV1 is connected over serial to PC1 where a device file is created in /dev/ttyUSB0. PC1 and PC2 are in the same network. I can always just ssh from PC2 into PC1 and then open the serial port and communicate with DEV1 but i want to automate this, to skip ssh-ing... |
USB/IP is a way to expose USB devices on the network
http://usbip.sourceforge.net/
or usbip package on debian
| Forwarding device file traffic over ssh to another pc |
1,358,318,430,000 |
I've got two devices on my LAN: a Raspbian jessie and an Ubuntu 14.04. The latter has some nfs shared folders, which are available from Raspbian at startup, set up in its /etc/fstab file as:
192.168.1.10:/mnt/nfs/HDD /mnt nfs defaults,nofail,noatime 0 0
The problem is coming up when Ubuntu is offl... |
The automounter was designed exactly for this kind of problem. It automatically mounts drives (local or remote) only when they are needed, and unmounted them when they are no longer being used.
Install autofs on your NFS client and comment out (or remove) the entries in /etc/fstab. Edit /etc/auto.master and ensure tha... | Ignore unmounted file systems |
1,358,318,430,000 |
I have an IP-CAM that streams video over RTSP and I want to detect bar codes from it with zbarcam (from Ubuntu's zbar-tools package).
According zbarcam's manual, it expects to be given a video4linux character device (default /dev/video0). How can I let it receive that RTSP stream instead?
I tried to use mplayer, but... |
Try something on these lines:
sudo apt-get install v4l2loopback-utils gstreamer1.0-tools
sudo modprobe v4l2loopback # might not be needed
gst-launch-1.0 -v rtspsrc location=rtsp://your_stream_url ! v4l2sink device=/dev/video1
Then you should be able to use zbarcam against /dev/video1 as usual.
| How do I send RTSP video to a program that reads from a character device? |
1,358,318,430,000 |
I have installed Archlinux, and after that GRUB. I manually entered menu entries for both my Windows and Arch installation.
GRUB has no problems booting, and can successfully load in Windows. It can't load in Arch though. Linux will kick me into a recovery shell with no /deb/sda files. The USB is properly detected ho... |
Apparently the fstab didn't get saved or got cleared. Reconfiguring this file solved all problems.
| Unable to find root device / sda partitions missing |
1,358,318,430,000 |
I'm reading a shell program implementation in C ( the xv6 shell from MIT's 6.828 Operating System Engineering course ).
The main() function for this shell starts with the following code:
//Assumes three file descriptors open
while((fd = open("console", O_RDWR)) >= 0){
if(fd >= 3){
close(fd)
break;
... |
This code snippet opens /dev/console. The resulting file descriptor is the lowest-numbered file descriptor that isn't already open. If that number is at most 2, the loop is executed again. If that number is 3 or above, the descriptor is closed and the loop stops.
When the loop finishes, file descriptors 0 to 2 (stdin,... | open() console for default file descriptors |
1,358,318,430,000 |
I think my question is related to udev and/or udisks, but I am really not sure at all what's going on here. To start with, my system works more or less fine. The less part is due to the fact that, after some upgrades to my Debian install, the /dev folder started acting weird, in relation to what I used to think I knew... |
Udisks uses its own device naming scheme. It follows the same naming rules that are normally followed by udev (the program that manages entries in /dev), but it has its own implementation of these rules, it doesn't rely on the entries in /dev.
The entry for the root filesystem shown by mount is not reliable, because t... | udev weirdness: /dev/hda1 mounted but file not present |
1,358,318,430,000 |
On Linux, I'm looking for a way to run grub-install <device> and update-grub in a chrooted environment without some devices being taken into account by GRUB (I don't want them to appear at boot).
From a system on a disk A, I want to chroot to a disk B with its own system, to install grub there. So grub installs itself... |
It looks like you are trying are trying to control the way grub menus are generated. These are generally configured from scripts in /etc/grub.d. I believe the one you are specifically interested in is "os-prober" which finds other installed operating systems.
Of course if you wanted to remove all other operating sys... | Hide devices in chrooted environment |
1,358,318,430,000 |
I'm using FreeBSD-12.0-RELEASE-amd64, when I list all the files in /dev, I don't see /dev/dsp (note there's no output after the first command), but when I list the file by explicitly specifying its name, it is found. Even more weird, when I then ls -al /dev again (and grep for dsp, like in the initial command), the /d... |
Thanks to all the comments. The main takeaways for me were:
Do not use ls /dev for checking which devices are on the system, but use dmesg instead (and in the particular case of sound cards, 7.2.2 Testing Sound is really useful)
devfs has the ability to create device nodes on demand (when they are first accessed)
Th... | FreeBSD: /dev/dsp exists ("ls -al /dev/dsp"), but does not show in "ls -al /dev" |
1,535,967,504,000 |
Why can I (or cannot) mount a mounted device again? What is happening?
For example:
/tmp/test$ sudo mount /dev/sda5 ./1;echo ${?}
0
/tmp/test$ sudo mount /dev/sda5 ./2;echo ${?}
0
/tmp/test$ sudo mount | grep test
/dev/sda5 on /tmp/test/1 type ext4 (rw,relatime,data=ordered)
/dev/sda5 on /tmp/test/2 type ext4 (rw,rela... |
Seem this reason is the -w and -r flag for multiple locations mount need same.
For example(/dev/sda5 is already mounted with -o rw):
$ sudo mount -r ./grub.iso ./1;echo $?
0
$ sudo mount -r ./grub.iso ./2;echo $?
0
$ sudo mount -r ./grub.iso ./3;echo $?
0
$ sudo umount ./1 ./2 ./3;echo $?
0
$ sudo mount -r /dev/sda5 /... | Why can I (or cannot) mount a mounted device again? What is happening? |
1,535,967,504,000 |
I known that I can give a specific name to the TUN interface using --dev option, but I didn't and I have now on a router machine something like a hundred client configs. with less clients I was able to dig the log to search for the name of the interface and link it to a named config file, but now there is too much act... |
So I came with a solution inspired by A.B comment.
$ ps ax | \
awk '/[o]penvpn/{print $7" "$1;system("grep iff /proc/"$1"/fdinfo/*")}'`
which give me both running config and it's linked TUN interface.
| How to link a tunX interface to a specific OpenVPN instance? |
1,535,967,504,000 |
I have one USB touchscreen connected to my hardware setup but using cat /proc/bus/input/devices gives me two entries for the same device :
I: Bus=0003 Vendor=2965 Product=5023 Version=0110
N: Name="Kortek Kortek Touch"
P: Phys=usb-0000:00:14.0-3.4/input2
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.4/3-3.4:1... |
I think I found the reason behind this.
The same device is exposed to USB subsystem as two devices with different interfaces.
like in the entry Sysfs=/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.4/3-3.4:1.2/0003:2965:5023.0006/input/input7, the device exposes Interface 2 of the hardware as seen from the string 3-3.4:... | Multiple entries in /proc/bus/input/devices for same device |
1,535,967,504,000 |
I've got an embedded/headless Debian Linux box which boots from a read-only filesystem image. The configuration is set up so that I can (seemingly) write to the filesystem, but any changes to the filesystem do not actually get written to the flash device and thus do not survive a reboot.
This box has an on-motherboar... |
You need to run ifup -a to bring up the network interfaces after modprobing e1000e. Adding some small delays with sleep 2 won't hurt either.
So, try:
ifdown -a ; sleep 2 ; modprobe -r e1000e ; sleep 2; modprobe e1000e ; sleep 2; ifup -a
| How to swap out the driver of a network device on a running Debian Linux box? |
1,535,967,504,000 |
I currently have a minimal install of Red Hat 6.5 running, on the machine I need to talk to a modbus device. I am wondering what tools and drivers are needed on a linux machine to talk to a modbus device for the main purpose of reading? I did see some on google and I'm interested if anyone has actual experience using... |
You can use a programming language to open a socket and roll-your-own library, using the modbus spec. Otherwise you can use an existing library, I have no experience with any of them, but this looked promising: http://libmodbus.org/documentation/
| talk to modbus device |
1,535,967,504,000 |
I'm trying to develope a pci driver but I can not compile it because my pci header is quite different from books and references. My distribution is 3.15.7-1-ARCH.
http://lxr.free-electrons.com/source/include/linux/pci.h
When the reference's pci.h looks complete, I can not understand why my laptop's header is just belo... |
The free-electrons header is internal to the kernel source, and you will find it if you look in [src]/include/linux; if you are compiling kernel code, that should be in play.
The header you've pasted is the system header, from /usr/include/linux. That's for user land code that needs access to the constants and macro... | PCI header in my laptop looks different from free-electrons' PCI header |
1,535,967,504,000 |
With the following command i'm trying to capture 10fps and send them the device driver. Now i want 8 bit gray raw frames (640x480= 307200 bytes per frame) to be send to the device driver. I can't figure out how to set the output with ffmpeg or the intput with v4l2 to this format.
ffmpeg -f v4l2 -r 25 -s 640x480 -i /de... |
First, check pixel formats are supported by your output device driver:
v4l2-ctl --list-formats -d /dev/devicedriver
the pixelformat you want to pass to the v4l2-ctl command line is the fourcc shown in the result, eg:
Pixel Format : 'YUYV'
in this case your command line would be:
v4l2-ctl --set-fmt-video-out=width=6... | ffmpeg webcam to device driver , output 8 bit grayscale |
1,535,967,504,000 |
On my Mac, when I 'eject' a network-mounted share, my Mac presents me with the following message, and attempts to get processes to close open file handles and cleanly dismount the share. My question is, how exactly does it accomplish that? I suppose it enumerates file handles open with my share's path, and then send... |
I don't know but with a random USB stick and a program
$ df | grep Vol
/dev/disk1s2 12228 20 12208 1% 512 0 100% /Volumes/Firmware
$ perl -E 'say $$; chdir "/Volumes/Firmware" or die "nope $!"; sleep 9999'
66433
We can indeed stall the eject, but before that we need some debugging of the process, here provid... | How does 'eject' get processes to close file handles? |
1,535,967,504,000 |
Why is it possible to look at the contents of a block device's file like /dev/sda using cat or a hex editor?
Why can I not do the same for a character device like /dev/pts/3?
|
Devices on Unix act like files, but are not the same. For some devices it made more sense to the implementer of the device software for both reading and writing, for others just implementing just one of those made more sense.
It is not because /dev/pts/3 is a character device that you cannot read from it, other such d... | Looking at the content of a character device's file [duplicate] |
1,364,649,541,000 |
In Ubuntu 11.04, I unwisely right clicked and "safely unmounted the drive" of my Sony HDR-XR150 connected via USB. Now, when I plug my digital camera into my computer via USB, Ubuntu either doesn't register the new drive, or flashes the "recognition and choice of what to do with the USB drive" screen briefly.
Please h... |
You could manually mount the camera: http://manpages.ubuntu.com/manpages/natty/man8/mount.8.html
| How do I access a digital camera drive via usb after safely removing it? |
1,364,649,541,000 |
What's the generic way to mute/unmute my system's default sound output?
$ amixer set Master mute
amixer: Unable to find simple control 'Master',0
$ amixer scontrols
Simple mixer control 'IEC958',0
Simple mixer control 'IEC958',1
Simple mixer control 'IEC958',2
Simple mixer control 'IEC958',3
Simple mixer control 'IEC... |
I've been using this command for ages now:
pactl set-sink-mute @DEFAULT_SINK@ toggle
This mutes/unmutes depending on the current state.
Also to increase volume: pactl set-sink-volume @DEFAULT_SINK@ +3%
or decrease volume: pactl set-sink-volume @DEFAULT_SINK@ -3%
| How to mute/unmute default sound output |
1,364,649,541,000 |
There have been multiple questions asked about this, like Understanding ls output, What are columns in ls -la?, What does 'ls -la' do?, What do the fields in ls -al output mean?, etc..
I've also come across many other websites with articles attempting to explain it.
What every single one of them seems to have in commo... |
ls is specified by POSIX, that’s the common reference. The output formats are described in the “STDOUT” section.
| Where do I find documentation for the output of ls -l? |
1,364,649,541,000 |
Chroot allows us to change the root directory, or rather root directory of specific process. Now obviously this does restrict the process to the specified tree (unless it doesn't relinquish the privilidges).
But I wondered what other limitations could arise within this context.
Specifically regarding access to devi... |
Functionally, nothing. Literally all that the chroot() call does is update where the kernel anchors path resolution for your process. In particular, unless you also drop root privileges, you can still access /proc and /sys (because you can just make the appropriate mount() system calls, no external binary needed), y... | What are limitations chrooted system? [closed] |
1,364,649,541,000 |
After every reboot I have to set chmod o+rw /dev/ttyS0 to be able to print to my POS printer via serial port in bash.
Is it possible to save permissions and also baud rate, bits, stop bit and parity after the device is closed?
|
you can check the group owner of /dev/ttyS0 with:
ls -l /dev/ttyS0
and then add your user in this group:
usermod -a -G {group-name} username
| How to set custom permissions on /dev/ttyS0 so that they persist after reboot? |
1,364,649,541,000 |
cfgmgr is a command under AIX/ksh that checks for new hardware; e.g. new HDD's that have been added without a shutdown.
Question: Are there any similar commands under Linux? If "fdisk -l" doesn't recognize the new HDD (only after reboot). Or is Linux different from AIX, and this command is not needed?
|
In general, with modern hardware, a modern kernel, and a modern distribution, hardware recognition should happen automatically.
There is, however, a program called "kudzu" which will do what you want — attempt to detect new hardware, and add the appropriate configuration. I think, because of the changes in modern syst... | cfgmgr like command under Linux? |
1,364,649,541,000 |
I'm building a service that checks for file uniqueness on block devices. File uniqueness on a system appears that it can be guaranteed through the pair (st_dev, st_ino), where st_dev is the device number and st_ino is the inode number. These values come directly from the stat system call. However, I can't find any ref... |
Yes, the device number of a block device can change: these are assigned dynamically when the system boots up. Adding and removing devices (and sometimes even changes to your BIOS firmware) can result in things being discovered in a different order, and thus having different device ids.
If you want to uniquely identify... | Can device numbers change after reboot? |
1,364,649,541,000 |
Well I'm trying to identify a device in my program so I can classify and get the power status of a device. The thing is that I'm getting different values on the same OS but using different machines.
I know I can use:
upower
demidecode
acpi
But if for some reason is not available I want to have another option!
What is... |
These are acpi names (4 character, upper case...) BAT0 is the first battery, the second if you had one would be BAT1. ADP0 is the first ac-ADaPter.
| What is the difference between BAT0 and ADP0 on the linux kernel? |
1,364,649,541,000 |
Is it possible to make the device filesystem name , /dev/sdi1 , shown by lsblk -f stay constant every time we disconnect and reconnect the SanDisk USB Cruzer drive? I am running Ubuntu Linux 16.04 on an Lenovo Thinkstation desktop computer.
I believe the SanDisk USB Cruzer drive automatically mounts on insertion.
If i... |
You would need to specify the mounting point based on the device's UUID.
You should refer to the official Ubuntu documentation page on the subject for usage details.
Here are examples (your output will be different, but similarly formatted). The command:
sudo blkid
produces an output similar to:
/dev/sda1: TYPE="ntfs... | Is it possible to make the device filesystem name , /dev/sd?1 , stay constant every time we reconnect the SanDisk USB Cruzer drive? |
1,364,649,541,000 |
I understand that block/character device files are created programmatically (by the drivers themselves?) to facilitate communications with device drivers using standard I/O calls. But why one would create these device files from command line using mknod?
Please provide some common use cases.
|
Historical reasons. Originally, before devfs existed, these device files were created by hand or by a script called MAKEDEV. This is also why many drivers have a fixed device number assignment; because the device numbers had to be known so that the device files would work properly.
There aren't really any common use c... | What are some common use cases for creating block/character device files from the shell with mknod? |
1,364,649,541,000 |
note: I don't want to use a udev rule.
I need to change (programmatically) the permissions of some device. To understand what I have to do (in code) I want to do this using just chmod command.
So far, I've tried this:
root# ls -l /dev/sdb
brw-rw-rw- 1 root disk 8, 16 Apr 7 05:27 /dev/sdb
root# chmod 0600 /dev/sdb
r... |
If I understand you right then there is some file system on /dev/sdb that you have mounted. What matters here are the permissions in the file system that resides on /dev/sdb, the permissions of /dev/sdb are completely irrelevant for your question. Except that with permissions 0666 anyone can bypass the access contro... | Can I change permissions on a device with chmod? |
1,364,649,541,000 |
I am monitoring file operations events (VFS).
I have a problem with BTRFS filesystem, BTRFS is using subvolumes, All highest hierarchy directories in btrfs has the same inode (256/512).
Short story:
When I receive file operation event, I receive the path and then resolve it to inode.
By resolving I mean: given a pat... |
Instead of going to the dentry - inode - superblock - device id.
I get the device Id using the getattr(..) on the dentry.
My solution is taken from the Suse patch in the subject (after alot of google digging).
https://patchwork.kernel.org/patch/2825842/
| BTRFS how to get real device Id |
1,364,649,541,000 |
So, I came across the ttyname function (unistd.h) and had to test it out.
#include <unistd.h>
#include <stdio.h>
int main(void) {
printf("%s\n", ttyname(0));
return 0;
}
On my machine, it echos out /dev/ttys011. I discovered it's a device!
echo "Hello" > /dev/ttys011
Woah, running that from another terminal pro... |
Your shell, or whatever process was in the foreground, was already reading the terminal to which is was attached, which was /dev/ttys011. Then you started another process, a cat also reading the same terminal at the same time.
Now there are two processes competing for the same input from the terminal. Each time you ty... | Why does tapping a TTY device only capture every other character? |
1,364,649,541,000 |
I am using /dev/xconsole to send system logs from rsyslog. That works great, because I am don't have to store the logs on disk.
I would like to have another similar file , i.e /dev/xconsole1 where I can send other kind of logs.
How can I create such special file?
When I go to /dev and ls it does not show complete majo... |
Not every file under /dev is a device file that has major/minor numbers.
Example
$ ls -l |grep initctl
prw-------. 1 root root 0 Sep 17 13:27 initctl
$ stat initctl
File: ‘initctl’
Size: 0 Blocks: 0 IO Block: 4096 fifo
Device: 5h/5d Inode: 8882 Links: 1
Access: (0600/prw... | create several /dev/xconsole files |
1,364,649,541,000 |
I have recently acquired a device driver for an integrated watchdog timer on a x86 board on which I am running a minimal Linux system. The kernel is 3.6.11 and it has been built using buildroot.
My installation does not run udev so I am required to manually perform an insmod and mknod for any drivers that I require. I... |
If it uses the normal kernel watchdog interface, that's at /dev/watchdog, which is 10, 130 here.
It may also export another one (/dev/watchdog0, etc.). You can find that by querying sysfs:
$ cat /sys/class/watchdog/watchdog0/dev
253:0
$ cat /sys/class/watchdog/watchdog0/uevent
MAJOR=253
MINOR=0
DEVNAME=watchdog0
And... | Installing a platform driver |
1,364,649,541,000 |
I was wondering how logical volume, logical disk, volume, partition, physical disk and filesystem are related and correspond to each other?
I am confused about these concepts and would like to have some general idea and big picture.
|
First you have physical disk, because you bought it, it is one piece of hardware. Disk provides some storage, which you (for several reasons) would not like as one piece, but divide it (logically, not with knife) into parts -- partitions. For consistency when you don't like several partitions, you have to create one a... | logical volume, logical disk, volume, partition, physical disk and filesystem |
1,364,649,541,000 |
For udev device entries, what is the technical difference between a "property" and an "attribute"? How are they customarily created (generated?) and used? Which one is the better source of truth?
I'm asking in the context of a Raspberrypi Python application that should detect any hot-plugged serial port adapters and d... |
Properties are set by udev rules and can be modified by other rules.
Attributes are read by udev from sysfs nodes. Assigning a value to attribute in udev rule causes write this value to sysfs node and affects device behavior.
You can consider properties as simple variables. But attributes have getters and setters, you... | What's the difference between device properties and device attributes in udev? |
1,364,649,541,000 |
I'm working with USB and I want to read the content of usb device descriptor in /dev/bus/usb/00x/00y - it is a character device.
I used fopen to open it as a binary file with "rb" parameter. But when I do the seek and tell to get file size, it returned 0 bytes in size. Is there a way to read it as a binary file?
void ... |
As steve mentioned, file size is rarely meaningful on a character device.
So the solution is simply open, read, be done. What is even the purpose of ftell here? If you want to allocate a buffer in advance, the answer is, you can't.
I suggest you try what your program does with /dev/tty. Maybe first think what you expe... | How to open and read a character device as binary file? |
1,364,649,541,000 |
I'm working on a Linux-like operating system for aarch64, based on a 5.6.4-v8+ kernel for Raspberry Pi 3 (Model B+).
The Kernel configuration options include:
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
It is possible to verify that the system is effectively mounted.
dmesg | grep devtmpfs
[0.071] devtmpfs: initialized
... |
To my knowledge, the kernel does not automatically mount devtmpfs. It has to be done from userspace, either "manually" (one of the start scripts contains something like: mount -t devtmpfs none /dev), or via fstab.
On my custom linux systems (raspberry zero/4, and 86_64), I do not rely on a mounting mechanism based on ... | Is it necessary to mount devtmpfs with /etc/fstab? |
1,364,649,541,000 |
Can filesystems be created only on block devices, but not on character devices?
Can a filesystem be viewed as a block device itself (for example, when programming to use a file system)?
My guess is yes, not very surely based on the followings:
There is a diagram for Linux, from Operating System Concepts:
It seems th... |
File systems in general are built on block devices, unless they are used as an interface to the kernel or access files across the network or are implemented in user space. If you want to store files on a hard disk or ssd, accessing it as a block device is the easiest way. There exist file systems like SquashFS that do... | Can filesystems be created only on block devices, but not on character devices? |
1,364,649,541,000 |
What does it mean if I get this message during scp ?
scp: /dev/fd/3/fd/3/fd/3/fd/3/fd/3/fd/3/fd/3/fd/3/fd/3/fd/3/fd/3/fd/3/fd/5/31/rd/c6d16: No such device or address
What I'm doing is
scp -r [email protected]:/* .
|
The process that is doing the recursion at the remote end is running as the superuser, and has recursed into /dev/fd. Several of its open file descriptors are for directories that it is in the process of reading as part of the recursion. Since they look like subdirectories as it traverses /dev/fd it is recursing the... | No such device or address |
1,364,649,541,000 |
I'm using a Raspberry Pi running Raspian to control some home automation hardware. One piece of hardware speaks over RS232, so it connects to my RPi using a USB-to-RS232 adapter. Another connects over USB, but emulates a serial port.
When I'm only using one piece of hardware, everything is fine: I just tell my softwar... |
For serial devices you should find them named by topology under /dev/serial/by-path/, so if you use the same usb hubs and ports it should stay constant. Eg:
ls -l /dev/serial/by-path/pci-0000:04:00.0-usb-0:2.1.1:1.0-port0
... /dev/serial/by-path/pci-0000:04:00.0-usb-0:2.1.1:1.0-port0 -> ../../ttyUSB0
Similarly, you s... | Raspian: Statically map /dev/ttyUSB* |
1,364,649,541,000 |
I'm playing around with terminal and found stdin@ in /dev. Several questions here.
1) What does an item with an @ symbol at the end of it mean/suggest? When is it used?
2) As the question suggests, it is a link. What command can I use to figure out what this points to?
|
The @ indicates a symbolic link. Your ls is probably an alias to ls -F (and additional flags). If you unalias ls or explicitly execute /bin/ls you won't see the filetype decorations.
Execute ls -l /dev/stdin to see the target of the symbolic link.
On Linux, /dev/stdin links to /proc/self/fd/0 (/dev/stdin is a link ... | The /dev directory contains the system devices. /dev/stdin is a link. To what does it point? |
1,364,649,541,000 |
I tried the below command, I read it from a book
sudo ls | tee /dev/tty3a
This command gives to me Permission denied, even with sudo.
Here tty is the teletypewriter, I know this already. But what is meant 3a with tty?
|
The names of device files in /dev vary between Unix variants. There are a few that you'll find everywhere, such as /dev/tty meaning the current terminal. It seems that /dev/tty3a is the name of the fourth serial port¹ on some Unix variants including Solaris and SCO OpenServer. The Linux equivalent would be /dev/ttyS3.... | Combination of tee and tty [closed] |
1,364,649,541,000 |
I have a Mac upgraded from Mavericks to Yosemite. When I tried to run VMware Fusion, I got an error stating:
Could not open /dev/vmmon: No such file or directory.
Please make sure that the kernel module `vmmon' is loaded.
A brief search turned up to say that this behavior happens when something else gloms on all the ... |
The VMWare application includes a kernel extension (kext). Yosemite requires a signed kernel extensions, and the older VMWare did not include a signed kernel extension. As a result, the old kernel extension will not load under Yosemite. You'll need to upgrade to VMWare Fusion 7, which includes the signed driver. ... | Why is my Mac, upgraded from Mavericks to Yosemite, no longer giving VMware Fusion needed resources? |
1,364,649,541,000 |
So, yesterday I updated the recently released Fedora 18, this has been done:
Packages Altered:
Updated grubby-8.20-1.fc18.x86_64 @?fedora
Update 8.22-1.fc18.x86_64 @updates
Updated java-1.7.0-openjdk-1:1.7.0.9-2.3.3.2.fc18.x86_64 ?
Update 1:1.7.... |
The sound drivers are part of the kernel. Try booting into an older kernel to see if your sound device is restored.
| Updated Fedora 18 - no sound devices, just dummy output |
1,364,649,541,000 |
What is the difference & relation between audio sink and audio card/device?
Can a sink sink into more than 1 device of the same audio card? aka, sink-device ca be a one-to-many relation?
PS: I'm not a total noob but I'm also not very knowledgeable in Linux audio
aplay -l
**** List of PLAYBACK Hardware Devices ****
car... |
Some sink refers to some flow of data. (in some particular sound-server terminology)
Without any sound server, an audio app would output its audio samples directly to the hardware audio device. No need of any sink concept in these cases.
The sink concept appeared with some particular sound server (never read it used r... | What is the difference & relation between audio sink and audio card, device? |
1,364,649,541,000 |
I want to update the console-setup.service to detect screen resolution using fbset -s and adjust console font size accordingly. For fbset, I need /dev/fb0 to be present, but I don't know which service I should create a dependency on. How is /dev/fb0 created on startup?
|
/dev/fb0 is created by the kernel as soon as the first framebuffer display driver has detected and initialized the respective display controller hardware.
If that driver is built into the kernel, it might effectively already be there when userspace processes start running.
If you add a udev rule like:
SUBSYSTEM=="grap... | Which service creates /dev/fb0 node? |
1,364,649,541,000 |
I made an .qcow2 image and mounted it as described here:
https://bytefreaks.net/gnulinux/how-to-mount-a-qcow2-disk-image-that-does-not-contain-an-ubuntu-lvm-installation
But I have a problem with the 2 last steps when I'm trying to disconnect my nbd device using commands:
#Disconnect the image from the NBD device
qemu... |
First you need to unmount the image.
Here the complete process I use:
umount /dev/mapper/vg_name--lv_name
vgchange -a n lv_name
qemu-nbd -d /dev/nbd0 # or 1, 2, etc.
nbd-client -d /dev/nbd0 # or 1, 2, etc.
vgchange -ay
modprobe -r nbd
| Can't disconnect nbd device |
1,364,649,541,000 |
for my script, I need to complete block devices in /dev, so that when I do
my_script.sh <TAB>
it will complete /dev/ and offer me all disks that are listed in /dev (not in subdirectories). So for example:
my_script.sh <TAB>
my_script.sh /dev/
my_script.sh /dev/<TAB>
sda sdb sdc mmcblk0p1
my_script.sh /dev/sd
sda sd... |
Try:
_arguments -S : \
'--foo' \
'--bar' \
'*:block devices:(( /dev/*(-%b:t) ))'
(-%b:t) is a glob qualifier, %b to select block devices, - for that selection to be made after symlink resolution, the :t modifier to select only the tail of those files.
You could use _files, and benefit from colouring for i... | zsh completion: complete block devices in /dev |
1,364,649,541,000 |
I have two I2C devices I want to connect to my Linux device. A temperature sensor, TMP117, worked fine by writing it to the /sys/bus/i2c/devices/i2c-x/new_device. In addition, I want to add an accelerometer, ADXL343. However, when using the same method as with the TMP117, I receive an error in dmesg that the GPIO for ... |
From https://www.kernel.org/doc/Documentation/i2c/instantiating-devices follows, that you can only pass an I²C address as parameter. So, how would the kernel know on which GPIO line that interrupt line is connected?
So, complex drivers that encompass more hardware than just an I²C device cannot be used this way.
The "... | When dynamically adding I2C device through sysfs. Is it possible to also define the GPIO pins that comes with the I2C device? |
1,364,649,541,000 |
Hopefully this question isn't too abstract, it touches on a bunch of software throughout the stack.
We all know about /dev/stdin, /dev/stdout, and /dev/stderr. What if I wanted to create a new standard stream, /dev/stdjson? What software would need to support that? I'm assuming that I don't need to pass a file descrip... |
The thing about the standard streams is that they're assumed to be available when a process starts, which means that file descriptors to them are passed to every program. (It's even allowed for the system to open some unspecified file on those file descriptors if they otherwise would remain closed after execve().) The... | What would need to be changed to create a new standard stream? |
1,364,649,541,000 |
I'm trying to share my computer's camera with the remote computer. In order to do this, I wanted to share my own computer's camera with the udp port(stream), take the stream on the remote computer and put it on the virtual camera. So I thought I could use my own camera on platforms like google meet with my remote comp... |
I could not convert the video stream using GStreamer. But ffmpeg works for me. I started sending and receiving video streams using Ffmpeg for both remote and local machines.
For Local Linux Machine:
ffmpeg -i /dev/video0 -f mpegts udp://<ip>:<port>
For Remote Linux Machine
ffmpeg -i udp://<ip>:<port> -f v4l2 /dev/vid... | How to convert stream data which come over udp to video device? |
1,364,649,541,000 |
I was studying about the activity/change while copy pasting file in USB. Seems like the stat attribute gets changed on every action on USB drive. So what does each value of these stat denotes?
Command used:
udevadm info --attribute-walk --name=sdb1
A Part of output:
ATTRS{stat}==" 263 14879 17884 1145 ... |
For a block device, the stat udev attribute shows the device’s statistics, which can also be seen in the corresponding entry under /sys/devices (udevadm info will show the full path) and under /sys/block (/sys/block/sdb/sdb1/stat in your example).
The entries can be seen in block/genhd.c and are documented in the kern... | What is the meaning of `ATTR{stat}==“ ...”` on udev attributes? |
1,364,649,541,000 |
After reboot
~$ arecord -l
arecord: device_list:270: no soundcards found...
and
$ sudo arecord -l
**** List of CAPTURE Hardware Devices ****
Home directory not accessible: Permission denied
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH ... |
I was to add myself to audio group. This was the group owner of /dev/snd/*
| Permanently grant permission to /dev/snd for all users? |
1,364,649,541,000 |
The devices listed by the rfkill command are completely different from the device names listed by the ip command:
> rfkill
ID TYPE DEVICE SOFT HARD
0 wwan tpacpi_wwan_sw unblocked blocked
1 wlan phy0 unblocked blocked
8 wlan phy7 unblocked unblocked
> ip link
1: lo: <LOOPB... |
Wireless comes in two aspects:
the wireless hardware device phy, usually named phyX.
its associated network interface(s) dev usually named wlanY.
For a given wireless hardware device phyX, it's even possible to create additional network interfaces associated to it, when it has the capabilities to do so. That's how i... | device names in rfkill output do not match those from ip |
1,364,649,541,000 |
I can understand each process fd 0,1,2 is pointing to /dev/stdin, /dev/stdout, /dev/stderr. If I write some data to /dev/stdin to I was able to receive data from fd 1 of the respective process only.
If every process stdout (fd 1) is pointing to /dev/stdout then if I write some data to /dev/stdin should broadcast to a... |
On Linux, /dev/std{in,out,err} don’t connect to devices, they give access to each process’ corresponding file descriptors. See the output of ls -l /dev/std*:
lrwxrwxrwx. 1 root root 15 Feb 24 09:34 /dev/stderr -> /proc/self/fd/2
lrwxrwxrwx. 1 root root 15 Feb 24 09:34 /dev/stdin -> /proc/self/fd/0
lrwxrwxrwx. 1 root r... | how /dev/stdout is pointing to different process separately in linux? |
1,364,649,541,000 |
I noticed a strange issue when creating RAID array with mdadm. As far as I see, it creates additional devices of md type. According to the kernel.org documentation, the md device type is Metadisk (RAID) devices.
The metadisk driver is used to span a filesystem across multiple
physical disks.
However, this starte... |
When a block device is added to the system, the kernel attempts to parse any partition table that may exist on the device, and if successful, will add block devices for the partitions it thinks exists because of what it read in the partition table. Note that support for many partition table types can be configured int... | MDADM creates additional block devices |
1,364,649,541,000 |
I've mounted a cdrom device with mount -o exec /dev/sr0 /media/cdrom0, since I couldn't execute files on it, when the drive was initially mounted by the virtual machine.
Now, when I run cat /proc/mounts, I get the following output:
/dev/sr0 /media/cdrom0 iso9660 ro,relatime 0 0
It seems that the drive is still mounted... |
/proc/mounts and mount don’t show settings which are included in the default settings, so you can assume that an entry which doesn’t show the contrary is using the defaults (see the documentation there for defaults):
rw, suid, dev, exec, auto, nouser, and async.
If /proc/mounts doesn’t list noexec, then the file sys... | How do I see that a device is mounted with `exec` option using either mount or /proc/mounts? |
1,364,649,541,000 |
I am trying to access a remote machine through ssh and check the model of a device that it is connected to a specific COM port; I know what port it is.
I have tried some commands, but they either don't work cause I am on a ssh connection or the machine I am accessing doesn't have the modules to run this commands insta... |
OK, so the PC is not the important thing but the mystery device attached to the COM port is?
Unfortunately, the COM port is a very low-level connection with no automatically provided metadata, so there is no universal tool like lsserial that could straight up tell you useful information to identify the device with 100... | How can I check the model of a device connected to a specific COM through a ssh connection |
1,558,535,463,000 |
I'm writing a kernel module. I can easily create a character device in /dev/ but I want to have 3 devices available to my user and it would be nice to put them all under a /dev/ subdirectory.
Possible example (exists on my openSUSE box):
# ls -l /dev/bsg
total 0
crw-rw---- 1 root root 252, 0 Jul 17 14:28 0:0:0:0
crw-... |
I found a way that works for me, one that doesn't use udev rules (I'd rather do it programmatically). This is easier than I thought earlier.
alloc_chrdev_region for number of devices.
Create classes for each device (each with different names)
Set the classes' devnode field with your custom function ex: return kasprin... | How to create multiple devices in a /dev/ subdirectory (kernel driver) |
1,558,535,463,000 |
I did on a terminal sudo cat /dev/char/10:130, which in the uevent has name of watchdog, and it outputs a message from the kernel saying that watchdog did not stop !, and after a couple of second it powers off, why?
What am I exactly doing?
I'm running Raspbian lite on a Raspberry 3b+.
|
/dev/char/10:130 is a character device with major device number 10 and minor number 130. In non-embedded Linux systems it is more commonly named /dev/watchdog.
When you open a watchdog device, a timer (often a hardware-level timer) starts ticking down. The program that opened the watchdog device is expected to periodi... | Why raspbian lite powers off when doing `sudo cat /dev/char/10:130`? |
1,558,535,463,000 |
My laptop for some reason will not power an external 2.5" HDD, so I am using a Raspberry PI to connect to the drive.
The problem is, I am struggling to perform tasks such as formatting disks and backing-up/restoring partitions. For example:
$ sshfs [email protected]:/dev/ /media/pi-dev
# ntfsclone -r -O /media/pi-dev... |
SSHFS cannot do this. It cannot access block devices. (Source.)
You have four options:
SSH into the Pi, and mount the drive. Eg:
root@pi# mount /dev/sda1 /mnt/disk
Then use SSHFS to mount it on your laptop. Eg:
user@laptop$ sshfs [email protected]:/mnt/disk/ /media/pi-disk
Now you can modify files on the hard drive... | How do you use SSHFS to work on drives in /dev/ |
1,558,535,463,000 |
Can anyone explain this one:
Embedded Arm system, Linux 3.18.44. No SELinux or anything:
# ls -l /dev/console
crw------- 1 root root 5, 1 Jan 6 02:40 /dev/console
# ls -l /tmp/console
crw------- 1 root root 5, 1 Jan 6 02:39 /tmp/console
# echo foo > /dev/console
foo
# echo foo > /tmp/... |
/tmp is mounted nodev and /dev isn't ...?
| Can't write to /dev/console through node not in /dev |
1,558,535,463,000 |
How could I forcibly remount a device? Say I have a device (/dev/shm) which from some reason isn't mounted, how could I remount it without rebooting the system? In other words, I need a remount without reboot.
Please share a way and give your opinion on the best practices you know for using it.
|
Try to put -o option to remount for changing flags.
mount -t tmpfs -o remount,rw,nosuid,nodev tmpfs /dev/shm
For details read about "FILESYSTEM INDEPENDENT MOUNT OPTIONS" section.
http://manpages.ubuntu.com/manpages/precise/en/man8/mount.8.html
| How could I forcibly remount a device without a reboot? |
1,558,535,463,000 |
I need use the watchdog, but I can't find any watchdog device. It means I need softdog? But I use modprobe softdog it still does not work. So I download the new Kernel 4.10.10. But I don't know how to find the sofedog modules. Just like this.
So where I can find the softdog modules?
|
The software watchdog option is now in Device Drivers->Watchdog Timer Support->Software watchdog
It can be a bit tedious to search for the location of certain options in the menuconfig but it actually took me less than a minute to find it.
| I can't find the /dev/watchdog |
1,558,535,463,000 |
This answer states:
A mounted network share will have a deviceId which is why you can
create a symlink to a mounted location.
So, if "a mounted network share will have a deviceId", files mounted with sshfs will have a physical device associated with them, like any other filesystem would do. I mounted a remote dire... |
Sshfs uses FUSE, the File System in UserSpace infrastructure, so it's not associated to a block device at all (and of course not to a character device, either). I don't know how the device number stats output is related to that kernel infrastructure, if it is related at all and not just random content.
| Device major/minor number for remote filesystem |
1,558,535,463,000 |
What does the following /dev related syntax do?
mv directory /dev/partition/subdirectory
Does this just make a new 'subdirectory' in the 'partition' device or what? I guess I've never seen a subdirectory in a disk partition. Is there any special behavior or is this just a normal subdirectory?
This code is from this... |
Those instructions are wrong, and you'll get an error
eg
% ls -l /dev/vda1
brw-rw---- 1 root disk 253, 1 Sep 16 17:45 /dev/vda1
% mkdir X
% sudo mv X /dev/vda1/X
mv: failed to access '/dev/vda1/X': Not a directory
You just can't do what that says.
| mv directory to a device partition's subdirectory, e.g. mv directory /dev/partition/subdirectory? |
1,558,535,463,000 |
In /proc/locks I have:
21: POSIX ADVISORY READ 6813 fd:02:32374949 1073741826 1073742335
On the other hand /dev does not have any device with major id of fd.
Does anyone know what to do in this case? I am on fedora 22.
|
Are you sure you don't have any? fd is decimal 253 which is the virtblk device driver (eg vda2).
% ls -l /dev/vda2
brw-rw---- 1 root disk 253, 2 Aug 24 07:49 /dev/vda2
Alternatively,if you want to find the actual file it's pointing to, rather than the device, we could cheat and look at /proc/6813/fd to see what file... | How to find device whose major id is "fd" |
1,558,535,463,000 |
My /etc/fstab doesn't include the disk the system booted from, basically because I made some changes and forgot to include this. The initial /boot and / directories are on different drives.
I noticed this because when I upgrade the system and grub and kernel get updated the changes are made to the /boot directory unde... |
The root filesystem is passed to the kernel upon boot using the root argument. So you should be able to:
cat /proc/cmdline
and then look for root=/some/path, or perhaps root=UUID=longstring. For instance, I get:
BOOT_IMAGE=/boot/kernel-genkernel-x86_64-4.4.0-sabayon root=UUID=18f3b5a1-3994-43ef-ad6d-cb4c86ff5f95 ro q... | How to work out which drive and directory your system booted from if it is not mounted in /etc/fstab? |
1,558,535,463,000 |
Why is the size of a character or block file given as comma separated?
crw-rw-rw-. 1 root root 1, 3 Mar 8 10:15 /dev/null
brw-rw----. 1 root disk 8, 1 Mar 8 10:15 /dev/sda1
Size of a file is the number of bytes occupied in the storage device. For character or block files what will be size? And can you please exp... |
These values do not represent the size in anyway, but make reference to some sort of device identification.
Have a look at the Linux Documentation Project page, where they say:
Devices are defined by type, such as 'block' or 'character', and
'major' and 'minor' number. The major number is used to categorize a
dev... | Size of a character/block file |
1,558,535,463,000 |
Is it possible to disable evdev's EmulateWheel option when using specific programs? In my use case, I would like to be able to interact with the Acme text editor and with some VMs using my Thinkpad's middle-trackpoint-button as just an ordinary middle button rather than an "EmulateWheelButton".
It would be less conven... |
You can modify the properties of input devices with the xinput command. See Make mouse movements scroll when the middle button is held down for a detailed explanation. You'll want something like
xinput --set-prop 'Thinkpad Trackpoint' 'Evdev Wheel Emulation' 0
where Thinkpad Trackpoint is the name of the device found... | Disable emulated scroll wheel (EmulateWheel) for specific programs |
1,558,535,463,000 |
I have an SSD that I suspect failing silently now and then. I have run badblocks on it and it is clear that it is not bad sectors but might instead be some race condition in the electronics, in which case a retry would probably read the data correctly.
Normal magnetic disks have some ECC to correct errors by taking up... |
btrfs and zfs are engineered for data integrity.
By default, btrfs duplicates meta-data on single device configurations. I think you can duplicate data too, although I've never done it.
zfs has copies=n - which I think of as RAID1 for a single-disk. Consider that the amount of redundancy chosen will negatively impact... | ECC on a single block device |
1,558,535,463,000 |
I searched /dev/autofs from https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
I searched for /dev/autofs in and found that it is 10,235. I used debian and stat /dev/autofs shows 10,235 but in centos it shows 10,235 in hexadecimal which is a,eb. May I ask why this is so?
This file /dev/autofs after the ... |
/dev/autofs provides access to the autofs mount control interface; this is a set of ioctls which can be used to retrieve information about autofs mounts and to configure them. See Miscellaneous Device control operations for the autofs kernel module in the kernel documentation for details.
The behaviour change in stat ... | What file is /dev/autofs? |
1,558,535,463,000 |
In Linux, the device files in /dev have major and minor numbers:
# ll /dev
...
crw--w---- 1 root tty 4, 8 Jan 5 09:02 tty8
crw--w---- 1 root tty 4, 9 Jan 5 09:02 tty9
crw-rw---- 1 root dialout 4, 64 Jan 5 09:02 ttyS0
crw-rw---- 1 root dialout 4, 65 Jan 5 09:02 ttyS1
cr... |
Yes, you can find out which majors correspond to which drivers by looking at /proc/devices; for example
$ cat /proc/devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
[...]
246 cec
247 hidraw
248 firewire
249 ptp
250 pps
251 bsg
252 rtc
253 dax
254 gpioc... | Is there a way to determine which module corresponds to which major number? |
1,558,535,463,000 |
I was trying to mount an encrypted SD card on Kubuntu 20.04.
lsblk gives me this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 97,9M 1 loop /snap/core/10577
loop1 7:1 0 97,9M... |
Device encryption is implemented using a kernel framework called device mapper (that's where the dm-3 comes from, it's a third device mapper device in your system). "Mounting" an encrypted device has two steps:
Unlocking/opening the device (in your case the first partition on your SD card). You already did this step ... | Mounting encrypted SD card: where does /dev/dm-3 come from? |
1,558,535,463,000 |
What does PS in ttyPS* stands for?
Where, in general, can I find the expanded names of devices under /dev?
|
NOTE: This answer is assuming Linux
Where, in general, can I find the expanded names of devices under /dev?
The devices have no "expanded names", but
udevadm info -a /dev/ttyPSx
will tell you a lot of interesting info about them.
If you don't have udev, you can get the type, major and minor of the device, look it ... | What does PS in ttyPS* stands for? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.