date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,530,474,646,000 |
I want to find out what gnome-disk is doing, how to do the same on the command line and how to undo whatever gnome-disk does. (It can not undo all it does itself.)
I have already experimented a little and found out the following: the USB memory thumb drive ("stick") I played with has at least 3 "state levels" to toggl... |
How to do power-off on the command line?
echo 1 > /sys/bus/usb/devices/3-2.1/port/disable
The port is bus_nr-port.by.port.hub.chain.seperated.with.dots, i.e. 3-3 or 3-2.4.6. In those two examples the port is on bus 3. First example is just port 3, second example is a chain of two hubs, where the first is in port 2 of... | How to disconnect and reconnect USB devices on the command line? |
1,530,474,646,000 |
Let's say:
$ ls -l /dev/input/by-id
lrwxrwxrwx 1 root root 10 Feb 10 03:47 usb-Logitech_USB_Keyboard-event-if01 -> ../event22
lrwxrwxrwx 1 root root 10 Feb 10 03:47 usb-Logitech_USB_Keyboard-event-kbd -> ../event21
$ ls -l /dev/input/by-path/
lrwxrwxrwx 1 root root 10 Feb 10 03:47 pci-0000:00:14.0-usb-0:1.1:1.0-event-... |
Kernel does not decide the bInterfaceProtocol. The value is received from the connected USB device.
A variety of protocols are supported HID devices. The bInterfaceProtocol
member of an Interface descriptor only has meaning if the bInterfaceSubClass
member declares that the device supports a boot interface, other... | Is value of bInterfaceProtocol fixed or decided by Kernel? |
1,530,474,646,000 |
I am trying to run a usbreset program against lsusb which has several devices with the same device identifier.
I run lsusb to list the devices, and add a | grep [identifer] to only list the devices with that identifier.
I need to then run an awk command to get the bus and device number, which will be inserted into a u... |
The line is disappearing because of the read line invocation, not AWK. I would go about this differently:
lsusb -d 1234:a1b1 | while read _ bus _ device _; do
sudo ./usbreset "/dev/bus/usb/${bus}/${device%:}"
done
This uses lsusb’s own ability to filter devices, then reads the bus and device identifiers into the ... | lsusb | grep | Awk command is cutting off the first result |
1,530,474,646,000 |
From what I understand, devices connected to different controllers should show up under different USB busses. However, when I connect a keyboard to the xHCI controller, it is still listed under one of the EHCI busses. See the >>>> markers in the listings:
$ lspci | grep -i usb
>>>> 00:14.0 USB controller: Intel Corpor... |
USB 3.0 in 5G mode isn't compatible to USB 2.0 or earlier, so the way they implemented compatibility is to use one pin pair in the same position as for USB 2.0 for legacy devices, and two new pin pairs for "real" USB 3.0 devices, as you can see e.g. in the pinout on Wikipedia.
So your 00:14.0 xHCI controller is reall... | lsusb lists devices on different PCI controllers under the same USB hub |
1,500,581,594,000 |
Linux Mint 17 Cinnamon (Ubuntu 14.04)
HDA Intel PCH
The microphone works well (tested with VLC's capture mode), but Skype won't catch any sound. Only PulseAudio is listed in Skype's configuration as microphone option. Amplifying the input audio to the very top (>100%) manages to get some sound, but it's distorted and ... |
SkypeTroubleshooting article in Ubuntu's Help Wiki solved the issue very neatly. I used the "older Ubuntu versions" instructions.
Skype has been known to mess up the mixer settings. So disable the
automatic configuration of the mixer controls in Skype: right-click
with your mouse on the Skype icon in the system t... | Fix Skype audio input in Mint 17 Cinnamon |
1,500,581,594,000 |
I've found a solution that doesn't work by me:
audio - Monitoring the microphone level with a command line tool in Linux - Super User
https://superuser.com/questions/306701/monitoring-the-microphone-level-with-a-command-line-tool-in-linux
The problem is that they are using Maximum amplitude to detect sound. However it... |
(Answer based on various comments, as this method seems to be acceptable, and comments are not guaranteed to stay.)
Look at the first recording ("10 secs of silence") in an audio editor, e.g. audacity. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 sec... | How to monitor microphone volume level? |
1,500,581,594,000 |
I'm running Crunchbang++ (Debian stretch with pulseaudio).
When I plug in my headset, the laptop's mic works but not the one of the headset -- that would be OK. But when I unplug it, I can see in "Sound preferences" the "connector" switching from "Microphone" to "Internal microphone" which is recording constant noise ... |
What could cause this behavior? Your laptop most likely has both audio-in channels mixed up:
With the headset detected, it wants to switch to the external microphone (expected behaviour), but actually uses the internal one.
When plugged out, it believes to switch to the internal one as expected, but chooses the exter... | Internal mic works when headset is plugged in only |
1,500,581,594,000 |
I know it is possible to check whether the webcam is currently opened or not. But is there a similar way to check whether it is currently being recording from a microphone?
I was poking around a bit in /dev/snd/, had a quick look at Pulseaudio functionality, and was running up and down the web. Unfortunately I couldn'... |
A general solution that does not rely on Pulseaudio would be ideal.
Most if not all popular modern Linux distros use Pulseaudio which opens ALSA kernel devices and keeps them open at all times which means the solution must probably involve it.
Also if PA is installed and running, applications cannot read from/write ... | How to detect whether a program records from the microphone? |
1,500,581,594,000 |
I'm running Pop OS on a Lenovo T495s. My onboard microphone was working fine but after updating to 20.04 I am getting no sound from it.
When I run pavucontrol I see two input devices:
Digital Microphone - Family 17h (Models 10h-1fh) Audio Controller Digital Microphone. Shows no input.
Headphones Stereo Microphone (un... |
I had the same problem with Ubuntu 20.04. What I did was to update the linux kernel. If you type
uname -a
to find out which version you have, then see if you are on 5.6 or 5.8
I was on 5.6-1020 and then updated to 5.8 by using the following command:
sudo apt install linux-image-5.8.0-23-generic linux-headers-5.8.0-23... | Microphone recognised in pavucontrol but not useable |
1,500,581,594,000 |
Every hardware device ( incl. the internal microphone, I suppose ) works under some driver.
How to find out which is the specific driver controlling the work of the internal microphone on a PC that works under Linux?
|
lspci -v
Lspci is a command on Unix-like operating systems that print a "list" of detailed information about all buses and PCI devices in the system.
output:
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cedar
HDMI Audio [Radeon HD 5400/6300/7300 Series] Subsystem: XFX Pine
Group Inc. Cedar HDMI ... | How to find out the internal microphone's driver on a Linux PC? |
1,500,581,594,000 |
A couple of comments on Hacker News suggest that, on FreeBSD, you can:
use cat to send a file ( a .wav file for instance ) to the audio
speaker (/dev/dsp).
record from the mic using a similar method.
send a live stream across the network (using netcat?)
I can nearly do the first one. I do cat /dev/random > /dev/dsp ... |
cat somefile.wav > /dev/dsp
cat /dev/dsp > record_from_mic.wav
cat /dev/dsp | nc -l 1234
| Playing, recording, and streaming sound with cat and /dev/dsp |
1,500,581,594,000 |
Back when COVID started, I got myself a USB webcam (this one, to be specific). I found the fact that you have to plug it into the audio jack to be a little annoying, but otherwise it worked fine. For reference, I was running Windows 10 back then.
Recently I switched to Linux Mint (Ulyana Cinnamon, if it's any help). W... |
Well, as it turns out, it is the webcam's fault. The sound chip thingy (?) in the webcam isn't configured properly, such that the computer thinks it's both an input and an output.
Solution: In Pulse Audio Volume Control go to the "Configuration" tab and set the audio profile to "Analog Stereo Duplex". Then go to the o... | Plugging in webcam microphone causes sound to stop working |
1,500,581,594,000 |
I have a bluetooth headphones with a mic connected to Linux Mint. On blueman (bluetooth Manager) I am able to see the audio profile selected as A2DP sink so the output is working fine.
I know for microphone to work I have to select the profile HSP/HFP but I am not able to select that option and get and error "Failed ... |
I was able to get my AirPods Pro working on Linux Mint 20 by following these instructions:
https://reckoning.dev/airpods-pro-ubuntu/
I wish I understood better what the problem is, but whne it comes to headphone profiles I have no experience or knowledge. All I know is that it came down to "in order for a microphone t... | Bluetooth headphone's mic not working on Linux Mint |
1,500,581,594,000 |
I use the following script to monitor my microphone:
while true; do
printf "$(AUDIODEV=hw:2,0 rec -n stat trim 0 1 2>&1 |
awk 'BEGIN { ORS="" } /^Maximum amplitude/ { print "Max. amplitude: "$3}
/^Rough\s+frequency/ { print " Frequency: "$3}
/^Maximum\s+delta/ { print " Max. del... |
I found a solution in the meanwhile. It is based on piping the output of rec to base64 so that it can be encoded to ASCII and stored in a bash variable. If it is time to analyze the segment's volume and frequency I run base --decode on the variable contents. In the script below only volume is analyzed. If it exceeds t... | Monitor microphone and save filtered segments |
1,500,581,594,000 |
I have a Bluetooth headset and I'd like to pipe the microphone of the headset to the speaker(the port) of my laptop. And I would like to take the microphone input on my laptop and pipe it to my Bluetooth headphones.
|
For Pulseaudio, use module-loopback. First get the names of the sources and sinks:
pacmd list-sources | grep name:
pacmd list-sinks | grep name:
The create a loopback connection with
pacmd load-module module-loopback source="..." sink="..."
with the names of the source and sink you want, without the angular brackets... | Pipe audio through headphones and mic jack |
1,456,043,351,000 |
I installed Skype 4.3.0.37 on my machine (debian 7 64bits XFCE 4.10) and both incoming and outgoing audio is not woring. I tried the echo sound service of skype but to no success.
Here my configuration details:
Sound config:
Skype sound devices config
|
It looks like you are communicating directly with the hardware with your configuration. This might cause multiplexing problems (it has for me in the past). You might consider installing the pulseaudio sound server to handle multiplexing the device to multiple pieces of software that want to use it, and the pavucontr... | Unable to listen or use microphone in Skype |
1,456,043,351,000 |
When monitoring audio input (microphone or line-in) using Audacity, I can see the current input level.
How can I monitor the input and see the level in a text console?
|
With the arecord and sox command you can record a sample of 1s and measure its level:
arecord -qd 1 file && sox file -n stat
Here's an example of output:
Samples read: 8000
Length (seconds): 1.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.992188
Minimum amplitude: -0.992188
Mid... | Text-mode tool to view audio input level |
1,456,043,351,000 |
So, I've been playing with bash scripting on Linux and attempting to level up my terminal wizardry. I've learned about piping data from /dev/video0 for web cams, and quickly creating image files from it, in a few different ways.
Next up, I'm wondering if I can do the same with audio. It seems like it must be possible,... |
No, sound in Linux is based on alsa: no user space nodes for audio stream like /dev/video0.
You can do some piping though: If you want to dig into this: two keywords: alsa, pipeline.
Have fun!
| Is there a /dev/video0 like default for pc-microphones? |
1,456,043,351,000 |
I am trying to reconfigure the setup of my microphone with HDAjackRetask however when I click reply I get the message:
tee: /sys/class/sound/hwC1D0/reconfig: No such device
Here is a screenshot:
I am running Deepin 15.1 desktop. Thanks in advance!
|
If you follow hdajackretask source, you can see it creates nothing else than a script in temp folder and run it with root privileges.
I'd suggest to start from that; errors.log may have some additional clue.
And then: does reconfig file exist in the first place?
Because it's not even created if kernel hasn't been comp... | HDAjackRetask: tee: /sys/class/sound/hwC1D0/reconfig: No such device |
1,456,043,351,000 |
My various microphones work fine, and I can record myself with various applications, but I can't hear myself talking while recording. All I need is some application that will play the mic without a lot of fuss, just to hear my own voice.
I'm wondering if there's a CLI solution to my question, for example using mplayer... |
arecord -f cd - | aplay -
Should do it but it may lead to quite nasty consequences if you're not using headphones.
Also read this topic: https://askubuntu.com/questions/123798/how-to-hear-my-voice-in-speakers-with-a-mic
| How to hear the mic from the CLI? |
1,286,483,993,000 |
I know that it can, in some circumstances, be difficult to move a Windows installation from one computer to another (physically move the hard drive), but how does that work on Linux? Aren't most of the driver modules loaded at bootup? So theoretically would it be that much of a hassle?
Obviously, xorg configs would ch... |
Moving or cloning a Linux installation is pretty easy, assuming the source and target processors are the same architecture (e.g. both x86, both x64, both arm…).
Moving
When moving, you have to take care of hardware dependencies. However most users won't encounter any difficulty other than xorg.conf (and even then mode... | Moving Linux install to a new computer |
1,286,483,993,000 |
Does anyone know how I can copy my customizations of XFCE's settings plus its appearance to another machine?
The settings for appearance/design, panels, keyboard shortcuts and geany are not there yet, like at all.
So far I have done:
copied ~/.config/{autostart,xfce4,Thunar} (not literally like that)
logged out and b... |
Xfce usually stores its configuration files in ~/.config/xfce4 (as well as ~/.local/share/xfce4 and ~/.config/Thunar). Copying these directories to your laptop should do the job. Keyboard shortcuts are stored in ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml, so they should get copied as well... | How to copy all my XFCE settings between two computers/machines? |
1,286,483,993,000 |
I'm trying to move my emails Maildir from an old CentOS server to a new Debian server.
rsync -avz /home/me/Maildir ssh root@ipaddress:/var/vmail/me/Maildir
I tried to copy a 8GB account, didn't work, try to move another about 20mb, didn't work, tried to use -avn, didn't work either.
sync error: some files/attrs were ... |
Error 23 is defined as a "partial transfer" and might be caused by filesystem incompatibilities, such as different character sets or access control lists. In this case, it could be caused by files in /home that begin with a . and are thus marked hidden.
In this case you could try something like:
rsync -avz --exclude='... | rsync error: some files/attrs were not transferred |
1,286,483,993,000 |
To the best of my understanding, all linux process are actually files, is it possible to copy a running process from one machine to another?
for example - copy a running tomcat server from one machine to another without having to restart the server
|
To the best of my understanding, all linux process are actually files
You shouldn't take the metaphor too literally. Linux processes can indeed be accessed through a pseudo file system for debugging, monitoring and analysis purpose but processes are more than just these files and "copying" them from a source host /p... | Is is possible to copy a running process between machines? |
1,286,483,993,000 |
I want to migrate the configuration of an Ubuntu desktop to a new box with different hardware. What is the easiest way to do this? /etc/ contains machine and hardware specific settings so I can't just copy it blindly. A similar problem exists for installed packages.
edit: This is a move from x86 to x86-64.
|
First, if you're going to keep running 32-bit binaries, you're not actually changing the processor architecture: you'll still be running an x86 processor, even if it's also capable of doing other things. In that case, I recommend cloning your installation or simply moving the hard disk, as described in Moving linux in... | How do I migrate configuration between computers with different hardware? |
1,286,483,993,000 |
I currently run a Windows server with Active Directory. But since we're no longer using Exchange 2007, it became a fancy file server with authentication.
I would like to move the AD to a Linux server. What would be the best way to do this? And which LDAP server should I use?
Update there won't be any Windows clients l... |
Samba v.3 is able to be a NT4 style domain controller. If you had a AD server running for Exchange, that is not good enough.
Samba v.4 will be able to be a Windows 2003 style domain controller, but is not done yet. Not by far.
Next question would be: do you have any Windows clients left? If so, you have a problem. Win... | How would you migrate from a Windows AD to a Linux LDAP server? |
1,286,483,993,000 |
Assume I have two Debian 11 systems. System A with custom application setup. etc. And a vanilla system B. Now I would like to transfer the whole setup from A to B. I found some links, where users tried to transfer the whole root tree or clone their system to another drive. The main effort in this solutions are to re-i... |
One way is to create a blank os and copy all folders and files that you need.
There are a lot of tutorials for that.
Check for how to create a linux system backup with rsync
How To Backup Your Entire Linux System Using Rsync
Full system backup with rsync
The other way and the best way to clone a whole drive, partition... | Migration of a working Debian 11 system to another |
1,286,483,993,000 |
Using pacemaker in a 2 nodes master/slave configuration.
In order to perform some tests, we want to switch the master role from node1 to node2, and vice-versa. For instance if the current master is node1, doing
# crm resource migrate r0 node2
does indeed move the resource to node2. Then, ideally,
# crm resource migra... |
I know this bit old; but it seems like no one answered this satisfactorily, and the requester never posted if his problem was solved or not.
So here is an explanation.
When you perform:
# crm resource migrate r0 node2
a cli-prefer-* rule is created.
Now when you want to move the r0 back to node1, you don't do:
# crm ... | Pacemaker: migrate resource without adding a "prefer" line in config |
1,286,483,993,000 |
I'm running a Linux Mint 12 virtual machine in Virtualbox. I would like to move it into a dual-boot setup with my Windows 7 installation. I have lot of settings in there, and apps installed, and my research says that I cannot just copy files.
I guess I could accomplish this by having some kind of list that I could the... |
I think you're on the right track. If I was in your position, this is how I'd tackle it:
Do a new install of Linux Mint 13, now that it's out. Hopefully it can manage repartitioning your disk and shrinking your existing NTFS partition non-destructively, but usually it's much safer and easier to simply install to a c... | Migrating a Virtualbox virtual machine into a physical dual-boot system |
1,286,483,993,000 |
I have quite some scripts that are still using the apt-key adv command. And I know this command is deprecated. And soon becoming unable to use.
Correct me if I'm wrong, but Debian 11 is the last Debian version supporting apt-key.
I also know we need to migrate to fetching the .asc file directly and put the file into t... |
The apt-key-less equivalent to your apt-key adv command is
gpg --recv-keys --keyserver keyserver.ubuntu.com A6616109451BBBF2
gpg --export A6616109451BBBF2 | sudo tee /etc/apt/trusted.gpg.d/somenicename.gpg
This assumes that gpg is installed.
There’s no general rule regarding the availability of keyring files; if you ... | Migrating away from apt-key adv |
1,286,483,993,000 |
I've been experimenting with ZFS + DRBD + live migration (I want to understand it well enough to write my own automation scripts before I start playing with ganeti again, and then openstack cinder). I have the ZFS + DRBD (in dual-primary mode) working well for shared storage.
However, live migration is only partially... |
I found a solution.
As I suspected, the cause of the problem was the lack of tsc_scale in the feature flags of surya's CPU.
It turns out that you can migrate a VM from a host without tsc_scale to a host with it, but a VM running on a host with tsc_scale can ONLY be migrated to another host with it.
Time to submit a bu... | 100% CPU utilisation and hang after virsh migrate |
1,286,483,993,000 |
Moving from OS X & Textmate to Ubuntu & gedit, the one feature of Textmate I am missing is it's command line tool.
With mate I was able to open a folder as a Textmate project using mate . from within the required directory. This is enormously useful as it speeds up my system navigation considerably.
Is there a way of ... |
This was answered on Superuser, Gedit open current directory from terminal - Ubuntu 10.10. Looks like the answers are still relevant.
| open whole folder in gedit |
1,286,483,993,000 |
I bought new computer with Win 10 pre-installed. I installed Debian on a new partition (same disc) and everything went well. But now I added new disc and I would like to move Debian to this disk.
Is there an easy way to do it?
I tried to use dd to copy the Linux partition to the new disc, but I'm not sure how to updat... |
#You can update grub following this guide.
Boot from Linux Live Boot
Determine the partition number of your main partition. sudo fdisk -l, sudo blkid or GParted can help you here. Make sure you use the correct partition number for your system!
Mount your partition:
sudo mount /dev/sdaX /mnt
If you have a separ... | Migrate Debian from one disc to another |
1,286,483,993,000 |
As opposed to people who want to get rid of systemd, I want to completely and safely remove sysvinit.
I've been using Debian since Debian 7.0 (Wheezy). Currently I'm using Debian 9.0 (Stretch). During one of the system upgrades there was move from sysvinit to systemd.
systemd works fine for me, but I've noticed that s... |
Why?
Even though you can remove sysvinit a lot of system packages still rely on sysvinit style scripts.
How can I safely get rid off sysvinit?
Is it safe to remove remains of sysvinit by...
This depends on what you have installed on your system, if no system components depend on them then yes it is safe, apt will tell... | Completely remove remains of sysvinit |
1,286,483,993,000 |
I have decided to try out Linux Mint instead of the horrible Ubuntu Unity experince.
I have a separate partition for my /home folder, which I'd like to preserve of course. So I'm curious: is it possible for me to install the 64bit version of Mint without user dotfiles making trouble? More specifically, will it matter ... |
Generally speaking, user configuration files don't care about your architecture. I don't know of any exception in any current popular application. Of course, I can't exclude some weird program that stores binary data differently on x64 and amd64, but I wouldn't bet on you having any.
You can share dot files between di... | Moving from Ubuntu 32bit: Mint 64bit or Mint 32bit? |
1,286,483,993,000 |
I'm not a system administrator, but my organization is considering replacing /bin/sh in Red Hat Enterprise Linux 6+ with a hard link to /bin/ksh. How foolhardy would this be?
The background to this question is that we're migrating a third-party application from AIX 5.3 to RHEL 6+. This application executes shell comma... |
System-wide, this would be very foolhardy for exactly the reason you suspect - it will cause massive breakage in startup scripts and system utilities that depend on sh-compatible behavior. As Ulrich says, a much safer alternative is to crate a chroot, or simply set the default shell of all new users to /bin/ksh though... | Installing ksh as the standard shell in Redhat: Foolhardy? |
1,286,483,993,000 |
I would like to copy my "settings" from my desktop to my laptop. I am running KDE on Arch. I am not sure what to do with ~/.config, ~/.local, and ~/.kde4 since they have subdirectories with names that match my desktop hostname. If I naively copy everything, I get all sorts of errors/warning when logging in and trying ... |
This is a really, really lame (non-)feature of KDE. ~/.config and ~./local actually do not have anything to do with it -- they are XDG standard filesystem hierarchy things used by various independent applications, not KDE.
After you install, get out of X (so KDE is not running) and try copying just your old ~/.kde/sh... | How to copy settings from one machine to another? |
1,286,483,993,000 |
I have the following procedure for replicating a Fedora workstation setup.
Boot from a Live CD, make tgz's of the filesystems.
Go to new machine, make filesystems, dump the tgz's in the proper places.
Adjust UUID's in /etc/fstab and /boot/grub/menu.lst
Run grub-install
Reboot!
The nice thing is that DHCP assigns the... |
On my machine it is
/etc/udev/rules.d/70-persistent-net.rules
This is a Debian squeeze machine, but it is probably similar for other Linux distributions. Mine looks like
# This file was automatically generated by the /lib/udev/write_net_rules
# program, probably run by the persistent-net-generator.rules rules file.
#
... | After cloning Fedora 14 install to another machine, onboard NIC is seen as eth1 instead of eth0. Why? |
1,286,483,993,000 |
My motherboard suddenly died, but it was an old machine(running natty). So I put together a new Ubuntu system with a clean 14.04 install (same username) and mounted the old drive (with the full filesystem) as secondary device.
How can I get a full list of software installed on the old machine, from its disk mounted on... |
Mount the old drive, e.g. under /mnt/old and then do:
dpkg --root-dir /mnt/old --get-selections | grep -F ' install' ' | cut -f 1
dpkg has facilities built-in to install/list/de-install on a filesystem not based directly under /.
| How can I get a full list of software installed on a non-functioning system, from its disk mounted on a new one? |
1,286,483,993,000 |
I have an Ubuntu Server 10.04 VPS (Virtual Private Server) that hosts my website. I would like to clone this VPS and create a VirtualBox machine from it. How can I do this?
|
I think you want to look at the command VBoxManage convertfromraw or VBoxManage clonehd. I can't remember exactly how to do it, but I found these two guides: http://www.virtualbox.org/wiki/Migrate_Windows and http://www.pendrivelinux.com/boot-a-usb-flash-drive-in-virtualbox/.
Once you have the hard drive converted, y... | VirtualBox image from running VPS |
1,286,483,993,000 |
I recently bought a new laptop and I would like to migrate to it with as little hassle as possible. I don't want to do a fresh install since I have made various tweaks to my current setup for things like automounting remote drives from my NAS, configuring networking etc. that I would prefer not to have to redo.
My cur... |
The following stands here only for comfort of editing reasons. As it is not worth more than a comment, please feel free to remove it.
ext4 : Starting with linux-5.10, ext4 comes with some new, lighter-weight journaling method also known as fast-commit.
Benchmarks report 20-200% improvement for local filesystems and 3... | Is this a safe way to migrate my data to a new computer? |
1,286,483,993,000 |
I'm a KDE user, and When I switch Linux distributions, I don't want to copy my entire home folder, since most of the configuration files there will be created automatically when I install\run programs on the new installation.
There are, however, some applications that I've put a lot of work into their configuration, a... |
All the file associations are stored in
~/.local/share/applications/mimeapps.list
For the KDE acitivies have a look at these files
activitymanagerrc
plasma-desktop-appletsrc
| Migrating the KDE configuration files |
1,286,483,993,000 |
What packages do I need to install to migrate my CentOS 5.7 server to identical version of RHEL. I have RHN subscription but I don't want to create a fresh install and move files.
|
Despite the fact that both distributions are built from mostly the same sources the installed binaries are not the same.
For copyright reasons the CentOS team (just like the Unbreakable Linux team at Oracle) has to remove certain Red Hat owned material (logos etc.) and recompile.
So even if your install the necessary ... | How to migrate from CentOS to RHEL? |
1,286,483,993,000 |
On debianized linux distros there is dpkg --get-selections, dpkg --set-selections, dpkg -C to respectively list installed packages, select a list of packages for installations, and list packages that are in a partially installed or broken state. I am wondering if something like this exists for FreeBSD (ports, not pac... |
/usr/ports/ports-mgmt/portmaster man page has example how to do bulk port re-install.
| Is there a port list migration command set for FreeBSD? |
1,286,483,993,000 |
My motherboard suddenly died, but it was an old machine(running natty). So I put together a new Ubuntu system with a clean 14.04 install (same username) and mounted the old drive (with the full filesystem) as secondary device.
How can I migrate mysql setup and data, and apache setup and data from the old drive to the ... |
The Ubuntu 11 to 14.04 upgrade means your kernel libraries, and therefore, binaries will have to be different, including Apache and MySQL server. So, you have to install the binaries again and you can only copy text configuration files and hope that the configuration parameters still work.
For Apache, install Apache f... | How to migrate MySQL and Apache data & settings, if a machine is not working but I can mount the old drive on a new one? |
1,383,839,643,000 |
I am migrating from CentOS 5.5 to 6.4 and have a custom installation that installs specific RPMs. The problem I running into is that some RPMs from CentOS 5.5 are no longer in the 6.4 distribution, so my make fails because it can't find a rpm in the source distribution.
Is there a good way to determine what RPMs I mi... |
Remove the version numbers and you'll typically have to go through these lists by hand. I've never seen a automatic way to do it.
My usual tactic is to take that list minus the numbers and then get the list of packages from the next versions repo, and side-by-side diff them or use meld.
RPM Tools you'll likely use in ... | CentOS installation rpms 5.5 vs. 6.4 |
1,383,839,643,000 |
All the posts I've found are about moving to new machines or migrating an entire OS from one HDD to another. I don't really know what the hell I'm doing, but I'm apparently the Linux expert.
We currently have a 1TB server with a RAID configuration. I'm not sure what type of RAID, yet. We will need to expand our HDD s... |
Mount /dev/md2 first as something like /srv/DataNew, run a 1st round of copy as root (actually I'd suggest rsync, IMHO it's better for this kind of job):
rsync -a --delete /srv/Data/ /srv/DataNew
Optionally you can re-run the cmd - the 2nd execution should be faster (rsync is capable of skipping files already copied ... | How do I migrate a RAID system to a larger set of HDDS? |
1,383,839,643,000 |
Is there a tool that handles generic migration of config? For example if I have httpd, postfix, MySQL and users and groups data, is there a tool that can extract the config data for each service so that I can apply it on another system.
Generally speaking is there a tool (or strategy) that handles this for all service... |
One the popular accepted solutions to this problem is using a configuration management system. Some examples are puppet, chef, and saltstack.
These systems allow you to define exactly what a server (or in some cases an application stack) looks like. Using these tools you define a server's state, including its configur... | Tool for migration of service configuration |
1,383,839,643,000 |
I've got a linux box running Fedora 19 that I want to move to CentOS 6.4. Rather than trying to do something fancy with the current disk (which has also accumulated a lot of sludge over the years), I'm going to get a new disk, put CentOS on that, and then move the to-be-preserved bits of stuff from the old disk to th... |
I have always done it by pulling the disk I want to keep during the install. That way there is no chance of me picking the wrong disk while setting up partitions.
Move the disks around so the new OS drive is in the first port and by default the boot drive. Leave the other disk out during install. Then put it back i... | Migrating from one linux install to another: How to keep the second disk around? |
1,383,839,643,000 |
So my trusty Linux box died after 10 years of faithful service. The memorial will be Friday afternoon.
Anyway, I am moving to a Mac (lesser of two evils - a Win 10 machine was the other option), and I don't think I want to run Linux on it directly - I booted with a live cd of Mint 18 and the video resolution was won... |
In OS X, there is a hidden directory ~/Library, whose subdirectories will contain that kind of user settings. This is for historical reasons: it is similar to pre-OS X versions of MacOS used to do.
Here is a MozillaZine KB article that has the exact paths for Firefox on Windows, Linux and Mac:
http://kb.mozillazine.or... | Migrate from Linux Mint to OS X [closed] |
1,383,839,643,000 |
I want to replace my system drive with a larger one and would prefer not to reinstall the main OS (OpenSUSE) or, even though seldom used, Windows. Installing Windows and Suse would take seemingly forever and I'd rather not have to rebuild my preferences and custom settings for the Suse install.
The other bootable syst... |
Since I needed to get this done I had to use a process which I was reasonably sure would work, even if not the ideal I had hoped for. Until someone has a better answer, for later users, I'll answer with what I did do, successfully.
The initial problem statement included the information that BIOS boot was in use and th... | Migrate multi-boot system to larger disk without reinstalling |
1,383,839,643,000 |
I have Ubuntu 18.04 LTS installed on a 1000 GB HDD /dev/sda (93% free space) on my laptop:
/dev/sda1 -> 512M - vfat - EFI System Partition
/dev/sda2 -> 732M - ext4 - Linux File System (
/dev/sda3 -> 930.3G - crypto_LUKS - Linux File System (empty)
I would like to use a 120 GB SSD (not yet installed)... |
option a)
install fresh and copy over your personal files / restore installed packages
option b)
save your disk encryption key from the old install
boot from CD/USB (I would use ubuntu install media, because there you can install all missing tools)
clone partition 1 and 2
create partion 3 new with cryptsetup/zuluCr... | How to clone Ubuntu 18.04 LTS from HDD to SSD? |
1,383,839,643,000 |
I have a mini home server running Debian 8.7 that during the initial installation had a 1tb hard drive mounted to / and a 60gb ssd mounted to /home. I would now like to remove the ssd for use in another project but am at a loss for how exactly to do so. I would like to have my home folder which has a bit of stuff from... |
You could (change <editor> to you text editor of choice):
sudo cp -Rp /home /home-copy
sudo <editor> /etc/fstab
In the editor, change:
UUID=e39ea57f-7d07-4e53-8f2a-1571b23d06fe /home ext4 defaults
To
# UUID=e39ea57f-7d07-4e53-8f2a-1571b23d06fe /home ext4 defaults
Then:
sudo mv /home /home-old
sudo mv /home-copy... | Removing hard drive mounted to /home |
1,383,839,643,000 |
I'm using Linux Mint 17.3 and have created a new smaller disk with Mint 18. Now my plan is to mount the old partition from /mountpoint/oldroot/home/ into /home on the new system. So I create all 3 users with same user name and password as on the old system and then edit /etc/fstab, right?
Questions:
I need to make su... |
I ended up adjusting the GID and UID of the new install to those of the old installation using usermod -u <old-uid> <login> and groupmod -g <old-gid> <login> and made sure that the home directories are named the same on the new as on the old system. To change to the new home directories, I edited the fstab to mount th... | Remounting /home from other partition on new install without copying |
1,383,839,643,000 |
I have a laptop with Linux Mint Rosa (17.3) installed on it. It's the 32-bit version, as I didn't even consider the possibility this several year-old laptop could have a 64-bit processor. As it turns out, it does, and I'm considering making the swap to 64-bit.
I have spent quite some time fine-tuning my settings, how... |
It's certainly possible to backup & restore the settings you have made, but how to do it depends on which settings you mean.
Generally I'd divide the settings into two categories:
User Settings
These are the settings like the mentioned layout of my panels, they are specific to your user and should usually be stored in... | Is it possible to migrate (some) settings when changing from 32-bit to 64-bit? |
1,383,839,643,000 |
There was Debian Jessie on server and I tried to migrate it to Debian Stretch.
I want to upgrade our server to actual version of Debian.
The command sudo apt-get update give me errors:
Err http://ftp.us.debian.org wheezy/main Sources
404 Not Found [IP: 64.50.233.100 80]
Err http://ftp.us.debian.org wheezy/contrib S... |
There’s probably another configuration file in /etc/apt/sources.list.d referencing Wheezy. You should remove those entries too.
The errors are harmless, but I understand why you want to get rid of them!
| Migration to Debian Stretch ask about 'Wheezy' |
1,383,839,643,000 |
I have a Debian Wheezy i386 machine, and I have to migrate all packages to another machine with Wheezy amd64.
I tried to select all packages with dpkg --get-selections, but there are many libraries with *-i386 suffix, and I'm wondering what will happen if I try to install those packages on the other machine, because ... |
Packages whose names contain i386 will in all likelihood need manual processing. There might be corresponding packages with amd64 in their name, e.g. kernel packages; those would be appropriate in this case. Others won’t have direct equivalents, e.g. ia32-libs-i386, and will have to be handled appropriately using mult... | Debian migration from i386 to amd64 arch |
1,383,839,643,000 |
I tar'd the repository folder (including the CVSROOT) and copied it to the new server, then un-tarred it. When I connect to CVS via Eclipse, I can get the sourcecode, however the server is not providing the versions, branches or history.
Is there some extra step I might have missed?
|
I ran the following commands (using user 'cvs' and repository folder 'repository') and now the branches, tags and versions are available.
chown -R cvs repository
chgrp -R cvs repository
chmod -R 775 repository
chmod -R +s repository
| Migrated CVS to new server - but where have the branches and versions gone? |
1,383,839,643,000 |
I am going on a trip (bus) and I will not be bringing my computer. However, I would like the comfort of my Linux operating system the way I like it, with my programs and files.
I was wondering if it is safe to simply take out my SSD from my main computer, put it in an anti-static bag, pad it with the clothes in my sui... |
Modern Linux installations are generally fairly portable. Moving a bootable disk to another machine with different specs should generally work, at least to the point where you can log in to the console, and probably all the way through to a working graphical X11 session, as long as the CPU architecture remains the sam... | Is it Safe to Transfer SSD to Another Computer? |
1,383,839,643,000 |
High Level Description
So I currently have a convoluted ZFS setup and want to restructure it, reusing some of the existing hardware.
I know that the recommended way of doing something like this is to backup all data, destroy the old pools, create the new ones and restore the data, the question is on how to best do thi... |
So I found out that error correction happens on receive, so creating an intermediate file isn't a good idea.
I also found out that my datasets don't have a set volsize (checked with zfs get volsize) so I only have to watch out for the total used size, as opposed to the pool size.
I also cam across how to one-way mirr... | ZFS: Best Practices for Restructuring multiple pools with encrypted datasets at once |
1,383,839,643,000 |
I have the following scenario, I have two programs running one in the background and one in front. The back program is doing some stuff for the front program. once the back program has done the necessary configuration it signals that it has finished the backup support for first program and the now the front program ne... |
It is difficult to understand the requirement as specified, so first I will try to show where additional explanation may be needed.
You have tagged this post with "Migration", so I assume these programs already exist and are known to work on some non-Linux architecture. The concepts of inter-process communication and ... | How to switch from one process to another process and kill the first process |
1,539,294,126,000 |
Operating System Concepts says
Consider a sequential read of a file on disk using the standard
system calls open(), read(), and write(). Each file access requires
a system call and disk access.
Alternatively, we can use the virtual memory techniques discussed so
far to treat file I/O as routine memory accesses. This app... |
Memory mapping a file directly avoids copying buffers which happen with read() and write() calls. Calls to read() and write() include a pointer to buffer in process' address space where the data is stored. Kernel has to copy the data to/from those locations. Using mmap() maps the file to process' address space, so the... | How does memory mapping a file have significant performance increases over the standard I/O system calls? |
1,539,294,126,000 |
I was going through documentation regarding mmap here and tried to implement it using this video.
I have a few questions regarding its implementation.
Does mmap provide a mapping of a file and return a pointer of that location in physical memory or does it return with an address of the mapping table? And does it allo... |
Answering things in order:
It returns a pointer to the location in virtual memory, and virtual memory address space is allocated, but the file is not locked in any way unless you explicitly lock it (also note that locking the memory is not the same as locking the region in the file). An efficient implementation of m... | Understanding mmap |
1,539,294,126,000 |
I'm interested in the way Linux mmaps files into the main memory (in my context its for executing, but I guess the mmap process is the same for writing and reading as well) and which size it uses.
So I know Linux uses paging with usually 4kB pagesize (where in the kernel can I find this size?). But what exactly does t... |
There is no direct relationship between the size of the executable and the size in memory. Here's a very quick overview of what happens when a binary is executed:
The kernel parses the file and breaks it into section. Some sections are directly loaded into memory, in separate pages. Some sections aren't loaded at all... | Memory size for kernel mmap operation |
1,539,294,126,000 |
I am working on a system where we lock files in memory using mmap and MAP_LOCKED and MAP_POPULATE for performance. If we do this with a file that is in tmpfs, will it use the existing tmpfs memory area or will it make a copy for the mmap?
|
Tmpfs is a file system which keeps all files in virtual memory.
tmpfs lives completely in the page cache and on swap
mmap copies file data to the disk cache when it needs the data to be in memory. With tmpfs, all the data is already in the disk cache (or swapped out). So mmapped data won't be copied: it's already in... | If I mmap a file from tmpfs, will it double the memory usage? |
1,539,294,126,000 |
Playing with strace, it appears to me that ld.so.cache and libc.so.6 are opened and mapped to memory for almost every process. At least those processes that I experimented with. Doesn't this mean that these processes are mapped into process memory many many many times?
Sure, these files are pretty small, but isn't t... |
Yes, every process gets its own mapping of the libraries it needs.
Yes, most of the data is shared, so every process “sees” the same physical memory (at different linear addresses), assuming the same version of each file is shared.
You can see the various mappings by looking at the maps file inside each process’ /pr... | ld.so.cache and libc.so.6 memory-mapped for every call? |
1,539,294,126,000 |
Varnish, a HTTP accelerator, uses a ~80MB file backed SHM log that is mlock()ed into memory. The Varnish docs recommend to store the file on tmpfs to avoid unnecessary disk access. However if the entire file is locked into memory, does the Linux kernel still write to the backing file?
I tried to monitor this using ino... |
Varnish appears to use a plain memory-mapped file for its shared memory (instead of, e.g., POSIX shm_open). From the source:
loghead = mmap(NULL, heritage.vsl_size,
PROT_READ|PROT_WRITE,
MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED,
heritage.vsl_fd, 0);
On BSD, MAP_NOSYNC requests that the kernel not write ... | File backed, locked shared memory and disk interaction |
1,539,294,126,000 |
On a modern 64-bit x86 Linux, how is the mapping between virtual and physical pages set up, kernel side? On the user side, you can mmap in pages from the page cache, and this will map 4K pages in directly into user space - but I am interesting in how the pages are mapped in the kernel side.
Does it make use of the "w... |
On a modern 64-bit x86 Linux?
Yes. It calls kmap() or kmap_atomic(), but on x86-64 these will always use the identity mapping. x86-32 has a specific definition of it, but I think x86-64 uses a generic definition in include/linux/highmem.h.
And yes, the identity mapping uses 1GB hugepages.
LWN article which mentions ... | How is the page cache mapped in the kernel on 64-bit x86 architectures? |
1,539,294,126,000 |
Based on my research on mmap(), I understand that mmap uses demand paging to copy in data to the kernel page cache only when the virtual memory address is touched, through page fault.
If we are reading files that are bigger than the page cache, then some stale page in the page cache will have to be swapped out reclaim... |
will the page table be updated to map the corresponding virtual memory address to the address of the old stale page in the cache (now containing new data)? How does this happen?
When mmap() is called, it creates a mapping in the process's virtual address space to the file specified. This mapping merely sets up the a... | Does mmap() update the page table after every page fault? |
1,539,294,126,000 |
I have a large tar file (60GB) containing image files. I'm using mmap() on this entire file to read in these images, which are accessed randomly.
I'm using mmap() for the following reasons:
Thread safety -- I cannot seek an ifstream from multiple threads.
I can avoid extra buffering.
I get some caching (in the form o... |
A read-only mmap is largely equivalent to open followed by lseek and read. If a chunk of memory that's mapped in a process is backed up by a file, the copy in RAM is considered part of the disk cache, and will be freed under memory pressure, just like a disk cache entry created by reading from a file.
I haven't checke... | Behavior of mmap'd memory on memory pressure |
1,539,294,126,000 |
I am trying to understand what happens when a file, which has been mapped into memory by the mmap system call, is subsequently written to by other processes.
I have mmaped memory with PROT_READ protection in "process A". If I close the underlying file descriptor in process A, and another process later writes to that f... |
If I close the underlying file descriptor in process A,
closing the file descriptor doesn't change anything at all
another process later writes to that file (not using mmap; just a simple redirection of stdout to the file using > in the shell), is the mmaped memory in the address space of process A affected?
It ma... | mmap: effect of other processes writing to a file previously mapped read-only |
1,539,294,126,000 |
I want to create a number of named memory regions in my program, and mmap them somewhere so that other processes can read them. I can't guarantee that only one instance of my program will run at a time. Ideally, I'd like to put the blocks under /proc/self/<blockname> or such. Is this possible? Or is there another plac... |
No, you cannot add your structure in a meaningful way to /proc because it is generated (not a "real" filesystem). Likewise /sys on some machines. Changing the structure of /proc isn't straightforward (see for example Creating a folder under /proc and creating a entry under the folder).
Further reading:
Linux Filesy... | Can I add to /proc/self? |
1,539,294,126,000 |
I learned default stack size for each process is limited to 8MB and mmap_base is calculated based on stack size in rlimit and random value. Code below is mmap_base function which calculates mmap_base address in x86(linux/include/uapi/asm-generic/resource.h).
static unsigned long mmap_base(unsigned long rnd)
{
uns... |
The process main thread stack size cannot grow larger than the set limit. The default value of this limit is 8 MB. Exceeding this limit will result in a segmentation fault and the process will be sent a SIGSEGV signal, by default killing it. The maximum size of the stack can be changed with ulimit -s before starting t... | program stack size |
1,539,294,126,000 |
Why is it that I cannot mmap /dev/random or /dev/urandom on Linux?
I get errno 19 which is ENODEV.
When I try the same code with /dev/zero it works.
int fd = open(path, O_RDONLY);
assert (fd > 0);
void* random = mmap(NULL, size, PROT_READ, MAP_PRIVATE | MAP_FILE, fd, 0);
int err = errno;
assert... |
You cannot mmap() /dev/random or /dev/urandom. Nor can you seek() them for that matter. And as a general rule, you cannot mmap() unseekable things. Pipes are another example of things you cannot mmap() because they are not seekable.
/dev/random and /dev/urandom are fundamentally stream-based, sequential access, device... | mmap /dev/random |
1,539,294,126,000 |
I'm kind of confused by mmap.
Well, I know that when we malloc a big size of memory, we will invoke the function mmap, which will allocate an area in memory. In this case, mmap just allocate some memory for some process.
However, I've heard that mmap is a kind of technique, which allows us to map a file, which is loca... |
mmap provides a way to map pages of memory. In Linux (among others), those pages of memory can have different backing devices: notably, files, and nothing at all (for anonymous mappings, MAP_ANONYMOUS), or rather a swap device or file.
While the use cases are completely different, there is a common theme: allocating a... | mmap a file vs mmap in malloc |
1,539,294,126,000 |
I am conducting some research on Grsecurity on Hardened Gentoo, see http://en.wikibooks.org/wiki/Grsecurity. To be more specific, I am trying to find an example where subject mode x makes a difference.
As said in the wiki: subject mode x: Allows executable anonymous shared memory for this subject.
Now, the kernel reje... |
According to Brad Spengler the subject mode x applies to System V shared memory only, see http://forums.grsecurity.net/viewtopic.php?f=5&t=3935. On top of that PaX strikes unless MPROTECT is disabled for the binary under consideration.
| Grsecurity subject mode x |
1,539,294,126,000 |
I am reading the Linux Progamming Interface.
49.9 MAP_NORESERVE and Swap Space Overcommitting
Some applications create large (usually private anonymous) mappings,
but use only a small part of the mapped region. For example, certain
types of scientific applications allocate a very large array, but
operate on on... |
Swap isn’t really a second-level cache for memory; it’s one of several backing stores for memory. When the kernel needs to allocate a page of physical memory, but doesn’t have enough free memory, it needs to evict another page; it can only do that if the contents of the evicted page are either discardable, or can be r... | What is lazy swap reservation? |
1,539,294,126,000 |
I have a very large disk drive (2TB), but not very much RAM (8GB). I'd like to be able to run some big data experiments on a large file (~200GB) that exists on my disk's filesystem. I understand that will be very expensive in terms of disk bandwidth, but I don't mind the high I/O usage.
How could I load this huge fil... |
It only makes sense to use a file-backed mapping to mmap a file, not an anonymous mapping. If you want to write to the mapped memory and have the changes get written back to the file, then you need to use a shared mapping. With a file-backed, shared mapping, you don't need to worry about the OOM killer, so as long as ... | Mmaping tremendously large files |
1,539,294,126,000 |
We're emulating a Cortex M3 cpu and would like to pass some parameters to the guest during run-time. The simplest idea seems to be to write directly to some memory area. I tried simply adding -mem-path /tmp/qemu.ram which did nothing. Adding
-object memory-backend-file,id=mem,size=128K,mem-path /tmp/qemu.ram \
worked... |
I have successfully demonstrated this in qemu 8.0.3 (and failed in 4.2.1)
qemu-system-ppc -M ppce500,memory-backend=foo.ram -cpu e500 -m 256M,slots=2,maxmem=1g -d guest_errors,unimp -bios $PWD/test.elf -s -object memory-backend-file,size=256m,id=foo.ram,mem-path=$PWD/realmemory,share=on,prealloc=on
The key is "mem... | Mapping guest RAM to file in qemu |
1,539,294,126,000 |
I have a latency sensitive application running on an embedded system, and I'm seeing some discrepancy between writing to a ext4 partition and an ext2 partition on the same physical device. Specifically, I see intermittent delays when performing many small updates on a memory map, but only on ext4. I've tried what seem... |
One word: Journaling.
http://www.thegeekstuff.com/2011/05/ext2-ext3-ext4/
As you talk about embedded im assuming you have some form of flash memory? Performance is very spiky on the journaled ext4 on flash. Ext2 is recommended.
Here is a good article on disabling journaling and tweaking the fs for no journaling if y... | Ext4 exhibits unexpected write latency variance vs. ext2 |
1,539,294,126,000 |
It is possible to write on /dev/mem without using mmap?
I'm enabling pull-up resistors on a Raspberry Pi inside an LKM and the function void *mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) doesn't exists.
I've tried to use open (to later convert it into filp_open) but it does nothing:
#inc... |
/proc and device nodes in /dev are intended for user-space; the kernel doesn’t need them, and kernel modules shouldn’t use them.
Instead, to access GPIOs, you should use ioremap and the various ioread... and iowrite... functions: ioremap to get an address corresponding to the physical address you’re after, and the oth... | Write in /dev/mem without using mmap |
1,539,294,126,000 |
I'm curious because today the only way I know how to give two different processes the same shared-memory is through a memory-mapped file, in other words, both processes open the same memory-mapped file and write/read to/from it.
That has penalties / drawbacks as the operating system needs to swap between disk and memo... |
Apologies in advance if that is a silly question, but is there such a thing as a pure shared memory between processes, not backed by a file.
Not a silly question!
There is, it's the default way of getting it; (SYSV) shmget is the function you use to get these shared memory buffers. You assign a string name to it, a ... | Is it possible for two processes to use the same shared-memory without resorting to a file to obtain it, be it a memory-mapped file or /dev/shm file? |
1,539,294,126,000 |
I'm not 100% certain about whether this is a U&L question or a SO question. On balance I'm posting it on U&L as it's OS related.
Background
As far as I know, Linux will load shared libraries (.so files) by memory mapping them as copy-on-write. One advantage of this is that multiple processes which share the same larg... |
At least in some configurations, yes, containers can share memory mappings for files in the same layer in different images.
Here’s an experiment to demonstrate this. I’m using two different images, one based on the other:
$ docker history 5f35156022ae
IMAGE CREATED CREATED BY ... | Do docker containers share RAM for files memory mapped from the same layer but a different image? |
1,539,294,126,000 |
I have a process that reads data from a hardware device using DMA transfers at a speed of ~4 * 50MB/s and at the same time the data is processed, compressed and written to a 4TB memory mapped file.
Each DMA transfer should (and do on average) take less than 20ms. However, a few times every 5 minutes the DMA transfers ... |
Linux has some realtime options, though it is not a realtime kernel as such.
This allows a process to demand that it is scheduled before non-realtime processes, as soon as it is ready, and to hold on to the cpu for as long as necessary.
By default processes are given scheduling policy SCHED_OTHER. You can
set this to ... | mmap and slow DMA transfers |
1,539,294,126,000 |
As I understand, 'MAP_SHARED' flag in mmap() shares any changes made by a process to the memory map immediately with other processes and eventually writes the changes back to the file. Is it possible to share the in-memory changes with other processes but not write the changes back to file? Does it need a new type of ... |
tl;dr; you should use a file which only lives in RAM
like on Linux are the files returned by memfd_create(2) or by opening a file from a tmpfs filesystem [1].
In that case the memory will be backed by the swap instead of a regular file or device -- if there's any swap configured. Beware that if the file is big, this w... | mmap(): Is it possible to prevent writing back to file with MAP_SHARED flag? |
1,539,294,126,000 |
I'm following this answer, trying to generate some major page faults with mmap:
#include <fcntl.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/stat.h>
int main(int argc, char ** argv) {
int fd = open(argv[1], O_RDONLY);
struct stat stats;
fstat(fd, &stats);
posix_fadvise(fd, 0, stats.st_size, POSI... |
Yes, the kernel does readahead by default (what you called prefetching), see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/filemap.c?h=v5.5#n2476
You can disable readahead on this memory region by calling posix_madvise() after mmap() with the POSIX_MADV_RANDOM advice.
| Weird major page fault number when reading sequentially / randomly in mmap region |
1,539,294,126,000 |
I have an app that uses multiple memory mapped files. If I check the major page faults numbers (with /proc/<pid>/stat), they skyrocket.
I was wondering if it's possible to monitor somehow what memory mapped files are affected by the page swap ins and outs for a process?
At least I would like to see see what mmap-ed fi... |
perf trace -F maj
http://man7.org/linux/man-pages/man1/perf-trace.1.html
To connect to an existing process, use -p $PID. If you don't want to show system calls, pass --no-syscalls as well. The system call arguments won't be shown with the same level of detail as strace.
| Monitoring page cache / memory mapped files access |
1,539,294,126,000 |
I'm writing my own data store directly on top of a block device. To ensure durability I want to sync to disk. But here's the thing: I want to sync only part of it.
I'm keeping a journal for crash recovery, and write my future changes to the journal before applying them to the actual place on disk. Then I want to ensur... |
There is a Linux-specific system call: sync_file_range()
(Sidenote, using block devices is not portable to FreeBSD)
| Partial fsyncs when writing to block device |
1,496,166,008,000 |
I'm not sure about when to use nc, netcat or ncat.
If one is the deprecated version of another?
If one is only available on one distribution?
If it is the same command but with different names?
In fact I'm a bit confused. My question comes from wanting to do a network speed test between two CentOS 7 servers. I came ... |
nc and netcat are two names for the same program (typically, one will be a symlink to the other). Though—for plenty of confusion—there are two different implementations of Netcat ("traditional" and "OpenBSD"), and they take different options and have different features.
Ncat is the same idea, but from the Nmap project... | What are the differences between ncat, nc and netcat? |
1,496,166,008,000 |
In a solution of an exercise I found this:
nc -z [serverip] [port]
What does it do?
On nc man page I found
-z zero-I/O mode [used for scanning]
not very explanatory... Searching on the web I found the Netcat Cheat Sheet which says:
-z: Zero-I/O mode (Don’t send any data, just emit a packet without payloa... |
It can be more useful to think of -z option as meaning "immediately close the connection". My version of nc has this to say about port scanning:
PORT SCANNING
It may be useful to know which ports are open and running services on a target machine. The -z flag can
be used to tell nc to report open ports, rather than ... | What is `nc -z` used for? |
1,496,166,008,000 |
I know this is not a very descriptive title (suggestions are welcome), but the fact is that I've been pulling my hair over this for hours and I have no clue where the root of the problem might lie.
I wrote a simple Bash script for CLI chat between peers on a local network:
#!/usr/bin/env bash
# Usage: ./lanchat <loca... |
I have tested your script in Debian 12 (localhost to localhost, separate working directories) and I confirm the problem. My nc is from netcat-traditional 1.10-47 (i.e. not from netcat-openbsd).
The problem is in -q 0 of the listening nc. From man 1 nc:
-q seconds
after EOF on stdin, wait the specified number of secon... | Odd inconsistency between executing and sourcing Bash script |
1,496,166,008,000 |
I'm wondering if there's any way to get telnet to send only a \n, not a \r\n.
For example, if one process is listening on a port like this, to print the bytes of any traffic received:
nc -l 1234 | xxd -c 1
Connecting to it from netcat with nc localhost 1234, and typing "hi[enter]":
0000000: 68 h
0000001: 69 i
00... |
You can negotiate binary mode. Once in this mode you cannot leave it. Negotiation means the telnet client will send a special byte sequence to the server, which you will have to ignore if you are not implementing the protocol.
Subsequent data is sent unchanged, in line mode. Client:
$ telnet localhost 1234
Connected ... | Any way to send just "\n" in Telnet? |
1,496,166,008,000 |
Can anybody tell me why I am getting bad request while executing this command
echo -e "GET http://www.yellowpages.com.eg/Mjg3NF9VUkxfMTEwX2h0dHA6Ly93d3cubG90dXMtYWlyLmNvbV8=/Lotus-Air/profile.html HTTP/1.1\n\n" | nc www.yellowpages.com 80
The same web site opens fine in the browser.
|
The headers in an HTTP request must use CRLF (Windows) line endings. (See Wikipedia or RFC 2616.) Many servers support LF (Unix) line endings as an extension, but not this one.
In addition, HTTP 1.1 requires a Host: header line, as Warren Young pointed out. (See Wikipedia or RFC 2616).
echo -e "GET http://www.yellowpa... | How do I get a URL over HTTP with netcat? |
1,496,166,008,000 |
I used following command for port scanning of my machine
nc -zv 192.168.1.1 1-100
but I want to filter only succeeded message from following output.Hence i used the following command
nc -zv 192.168.1.1 1-100|grep succeeded
But no use, still it shows full output
nc: connect to 192.168.1.1 port 1 (tcp) failed: Conne... |
Change your command to this:
nc -zv 192.168.1.1 1-100 2>&1 | grep succeeded
2>&1 causes stderr of a program to be written to the same file descriptor as stdout. nc writes to stderr by default, pipe will only get stdout hence grep will miss the data.
See section 3.5 here for more info All about redirection.
| How to filter the success message when using nc port scan |
1,496,166,008,000 |
Today I was reading the nc man page and stumbled on this command. I know that:
mkfifo /tmp/f is creating a named pipe at /tmp/f.
cat /tmp/f is printing whatever is written to that named pipe
and the output of cat /tmp/f is been piped to /bin/sh
/bin/sh is running interactively and stderr is redirected to stdout.
`the... |
Such a command is taking advantage of IO redirection and and sh interactive mode which is on by default when attached to a TTY.
Note that cat stays open on a FIFO. Thats your first clue. When sh runs all its ever doing is directing its stdout and strerr to the TTY. Instead sh is not attached to a TTY. Normally sh auto... | How does this command work? mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc -l 1234 > /tmp/f |
1,496,166,008,000 |
When I try to run nc -l 1337 -e /bin/bash, it says:
nc: invalid option -- e
usage: nc [-46AacCDdEFhklMnOortUuvz] [-K tc] [-b boundif] [-i interval]
[-p source_port] [--apple-delegate-pid pid] [--apple-delegate-uuid uuid]
[-s source_ip_address] [-w timeout] [-X proxy_version]
[-x proxy_address[:port]] [hos... |
You don't have to use nc -l 1337 -e /bin/bash. Instead, an alternative that works exactly the same is nc -l 1337 | /bin/bash outputs everything it receives into /bin/bash.
| Is nc (netcat) on MacOS missing the "-e" flag? |
1,496,166,008,000 |
I'm using curl to request a specific URL and getting 200 OK response:
curl -v www.youtypeitwepostit.com
* About to connect() to www.youtypeitwepostit.com port 80 (#0)
* Trying 54.197.246.21...
* Connected to www.youtypeitwepostit.com (54.197.246.21) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www... |
The relevant RFC, Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing contains the answer to your question: that each line of a HTTP request should end with CR/LF.
The grammar for the HTTP Message Format specifies that each header line should end with a Carriage Return character (0x0d in ASCII) followe... | What's the difference between using netcat (nc) and curl for HTTP requests? |
1,496,166,008,000 |
The following variable include for example this values
echo $SERVERS
server1,server2,server3,server4,server5
and when I want to pipe them on different lines then I do the following
echo $SERVERS | tr ',' '\n'
server1
server2
server3
server4
server5
now I want to add another pipe ( echo $SERVERS | tr ',' '\n' | ..... |
With awk:
$ servers='server1,server2,server3,server4,server5'
$ awk -v RS=, '{print NR "........" $0}' <<<"$servers"
1........server1
2........server2
3........server3
4........server4
5........server5
or, to output the line numbers with left-padding
awk -v RS=, '{printf "%3d........%s\n",NR,$0}' <<<"$servers"
(cho... | convert one line values to multiple lines with numbering order |
1,496,166,008,000 |
Consider /var/run/acpid.socket. At any point I can connect to it and disconnect from it. Compare that with nc:
$ nc -l -U ./myunixsocket.sock
Ncat: bind to ./myunixsocket.sock: Address already in use. QUITTING.
nc apparently allows only single-use sockets. Question is then, how do I create a socket analogous to /var/... |
You do it with the -k option to nc.
-k Forces nc to stay listening for another connection after its cur-
rent connection is completed. It is an error to use this option
without the -l option. When used together with the -u option,
the server socket is not connected and it can receive... | How to create a public unix domain socket? |
1,496,166,008,000 |
I've read the manual of nc, it tells me that nc -l means
Used to specify that nc should listen for an incoming connection rather than initiate a connection to a remote host. It is an error to use this option in conjunction with the -p, -s, or -z options. Additionally, any timeouts specified with the -w option are i... |
Being the target of an incoming connection doesn't prevent netcat from sending data. Once a client has connected, it can both send data to and receive data from the client. In this case, it's sending data to the Flink client.
| How to understand the action of nc -l |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.