output
stringlengths
9
26.3k
input
stringlengths
26
29.8k
instruction
stringlengths
14
159
You could start screen with the -L option. This will cause screen to create a file screenlog.n (the n part is numerical, starting with a zero) in the current working directory. In your case this would look something like: screen -S session_name -L -X eval 'stuff "$cmd"\015' As long as you remember to clean up afterwards, this should match what you are after. For last line of the log, it can easily be obtained with tail -1 screenlog.0, or the entire log can be parsed however you wish.
I have a screen instance running, and I would need to execute some code inside the screen, and get the result out to my script. The first part is quite easy, I just screen -S session_name -X eval 'stuff "$cmd"\015'. (I modified a line I found in a script) The second part, getting out the output, is trickier. How can I get the whole output, whatever it's size?
How to get the output inside `screen` out to a script?
I found out what the problem was. The command defaults because I wasn't specifying a 2-channel (stereo) 192kHz audio input. Here's an example of a command that did work: $ arecord -f S24_LE -c 2 -r 192000 -d 20 test.wavThe -c 2 is what fixed my commands.
I'm having some mixed results with the arecord command in the terminal. The hardware I'm using consists of the Cirrus Audio Card for the Raspberry Pi. I'm trying to record a 24-bit 192kHz sound (from the onboard MIC) into a WAV file, and then play it back (through the headset). First I make sure to enable the MIC and headset: $ ./Record_from_DMIC.sh $ ./Playback_to_Headset.shThen I tried multiple commands, and got mixed results. $ arecord -f S24_LE -r 192 -d 20 test.wav Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 192000 Hz, Mono $ arecord: set_params:1087: Channels count non available # So I set the number of channels to 1 (even though it is that, by default) $ arecord -c 1 -f S24_LE -r 192 -d 20 test.wav Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 192000 Hz, Mono arecord: set_params:1087: Channels count non availableStill get the same error. I got rid of the rate (192kHz), and let it default: $ arecord -d 10 -c 1 -f S24_LE -t wav test.wav Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 8000 Hz, Mono $ arecord: set_params:1087: Channels count non availableStill getting the same error. So I just used an example run of the command I found online (http://linux.die.net/man/1/arecord): $ arecord -d 10 -f cd -t wav test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, StereoThis worked. But clearly used different values than from what I wanted. I also had trouble playing at 192kHz: $ aplay -c 1 -r 192000 test.wav Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, StereoI try to play at 192kHz, but it goes down to 44.1kHz. Does anyone have any idea as to why I'm getting all these weird errors and results?
Issues with arecord command: Channels count non available
Yes. Actually there are lots of ways. You can set up a sound dummy sound card device that you can just rip the data out of the device ... however this isn't a very useful format. More useful to you is something like the arecord utility that allows you to eavesdrop on the alsa output stream and save it to several known formats. Basically anything that you can get to play over the alsa sound system can be copied to a standard format sound file. Similar tools exist for pulse audio.
If I can send audio to the output devices, then I can record the same audio as a wave. With filesystems, you can just setup a loopback filesystem and write binary data on a file instead of a device. My question is: Can I send the audio signal to a (for instance) WAV file instead of my audio devices? How?
Can I setup a loopback audio device?
Interesting question, a long time ago I was thinking about simple recording of digital audio and video, possible via some virtual audio and video drivers, but never got there. I used your configuration file and had exactly same problem as you described. (I removed OSS compatibility drivers from ALSA to be sure, tested different kernels - did not seem to matter, and used Debian Wheezy) $ alsaplayer -d front audio.mp3$ mplayer -vo null -ao alsa:device=front video.mp4 AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)$ mplayer -ao alsa:device=front audio.mp3 AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)the above commands all play OK to speakers $ arecord -f cd -D loop | aplay -f cd -D front Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereonow recording from loop and playing to front $ alsaplayer audio.mp3 $ alsaplayer -d loop audio.mp3$ mplayer -vo null video.mp4 $ mplayer -vo null -ao alsa:device=loop video.mp4 AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)$ mplayer -ao alsa:device=loop audio.mp3 AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)all sending audio to loop and playing to speakers OK $ mplayer audio.mp3 AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)but here the sound is broken - very distorted!!! Just playing to default device. Playback specified via loop worked! After trying various changes I tested this modification of asound.conf pcm.!default { type plug slave.pcm "loopout" }It solved the problem! When the default device is loopout it works. Trying arecord -f cd -D loopin | aplay -f cd -D front did not have any effect. Not sure how the loop works but this was able to capture the audio. Or a bug in ALSA? Are you using Debian? Does it work for you? Notes to other suggestions to solve the problem: To dump the network stream: I assume if the application does not want you to save data, the transfer would be encrypted (https ???). In case the player does not check the server certificate how do you capture the data? What is your favorite quick & easy method how to become man in the middle and capture the stream? Pulseaudio: How do I get it running on Debian Wheezy? The Wiki says it just works. It did not. /etc/init.d/pulseaudio start [warn] PulseAudio configured for per-user sessions ... (warning).How do I troubleshoot what is going on? (Tools, diag?) Jack: I did not find any simple instructions how to install Jack. It seems quite complex. Does it assume Pulseaudio running? The documentation is confusing. Do you have a link for a nice quickstart (how to install and test to make sure it is working?) Do you assume that most audio applications (like Fios Voicemail Java player) will be able to play to Pulseaudio or Jack and not send audio to ALSA?
I am trying to save voicemail messages from Verizon Fios phone in best quality possible. The voicemail messages are available online, but for playing only (Java based player), no saving. Officially, there is no supported way how to save original digital voice messages as files from Fios Digital Voice service (no paid service, no anything, no reason why). My only idea was to record digital data from the player while on the way to the soundcard. I tried Linux ALSA configuration with loop device. # cat /etc/asound.conf# default device pcm.!default { type plug slave.pcm "loop" }# output device pcm.loopout { type dmix ipc_key 328211 slave.pcm "hw:Loopback,0,0" }# input device pcm.loopin { type dsnoop ipc_key 686592 slave.pcm "hw:Loopback,1,0" }# duplex plug device pcm.loop { type plug slave { pcm { type asym playback.pcm "loopout" capture.pcm "loopin" } } }This seems to be working and records audio, for example when playing something on Youtube the audio output goes to the loop device (default audio output) and I can capture it (not sure how it exactly works, I tested both 44.1kHz and 48 Khz) arecord -f cd -D loop | aplay -f cd -D hw:0,0 arecord -f dat -D loop | aplay -f dat -D hw:0,0But when I tried to capture Verizon Java audio player output, it is garbled and the length does not seem to match. I suspect it might be mono at 8 kHz and I tried different things, changing the frequency and formats, but nothing helped. Do you have any idea what is wrong here and how to record the messages? Is the problem in ALSA configuration? Or possibly kernel issue? (I am using 3.4.88). Any ideas would be very welcome.
recording audio from web-based audio player using ALSA loop device
The ipc_key is used for communication between the programs that share the same device. This means that you have to use different values for different hardware devices, but that all virtual devices that access the same hardware device (i.e., the same slave usb_audio_1) must use the same ID.
I'm trying to record audio that is being played on separate channels using arecord. I do this by executing the following command in separate threads in a python script: arecord -D plug:"+str(in_id)+" -c 1 -d "+str(duration)+" -f S16_LE -r "+str(rate)+" "+rec_filenamewhere in_id is the input channel variable that I pass to each of the threads. But then, the following error is thrown: ALSA lib pcm_dsnoop.c:606:(snd_pcm_dsnoop_open) unable to open slave arecord: main:722: audio open error: Device or resource busyWhen I run lsof /dev/snd/pcm* right before I start recording using arecord in my record function in the program, I see the following: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME aplay 12236 user4 mem CHR 116,3 493 /dev/snd/pcmC1D0p aplay 12236 user4 4u CHR 116,3 0t0 493 /dev/snd/pcmC1D0pMy device definition for input channels in .asoundrc is as follows: pcm.!default { type plug slave { pcm "hw:1,0" } }ctl.!default { type hw card 1 }pcm_slave.usb_audio_1 { pcm "hw:1,0" channels 8 rate 44100 buffer_size 4096 period_size 1024 }pcm.outch<num> { type dshare ipc_key <id> slave usb_audio_1 bindings [ <ch_num> ] hint.description "USB output/playback channel <num> (from output port <num>)" }pcm.inch<num> { type dsnoop ipc_key <id> slave usb_audio_1 bindings [ <ch_num> ] hint.description "USB input/capture channel <num> (from input port <num>)" }where <num> takes all values between 1 and 8 and <ch_num> takes all values between 0 and 7. Since, the error clearly says there is a definite problem with dsnoop, does that mean that it is not meant for simultaneous/multi-channel recording? I mean is there a conflict between dsnoop and dshare or if dsnoop can record/capture from only one channel at a time? Is there another way I can achieve this?
'Device or resource busy' error thrown when trying to record audio using arecord
Umm so looking at the pulseaudio documentation. man pulseaudio We have the following environment variables $PULSE_SERVER: the server string specifying the server to connect to when a client asks for a sound server connection and doesn't explicitly ask for a specific server. The server string is a list of server addresses separated by whitespace which are tried in turn. A server address consists of an optional address type speci‐ fier (unix:, tcp:, tcp4:, tcp6:), followed by a path or host address. A host address may include an optional port number. A server address may be prefixed by a string enclosed in {}. In this case the following server address is ignored unless the prefix string equals the local hostname or the machine id (/etc/machine-id). $PULSE_SINK: the symbolic name of the sink to connect to when a client creates a playback stream and doesn't explicitly ask for a specific sink.This should hopefully allow you to complete replace the pulseaudio sink, and if this isn't enough run our own single use pulseaudio server. Referring to this page (https://askubuntu.com/questions/60837/record-a-programs-output-with-pulseaudio), we find out about the parec/pacat command (they are aliases) which can record from and write to sinks and streams. Putting this together we have the following wrapper (which I haven't actually run - though I've successful got this method to work on an ad-hoc basis) sink_name="sink-$(date +%s)" pacat $sink_name.monitor parec -d steam.monitor | oggenc -b 192 -o /tmp/steam.ogg --raw - & pid=$! PULSE_SINK=$sink_name "$@" kill $pid
I would like to redirect the audio output of a program to file, on the command line, like in $ redirect-wrapper file.wav my-programso thatI don't hear the output of the program, i.e. the output should only go to the file I don't record anything besides the program, i.e. only this specific program is redirected to the file the rest of the audio system is left completely undisturbed, no configuration options changed back and forth or something like thatIs there a way to do this? This related question does not help, I need a command line solution, no "click there, then there". This is probably also related, but also relies on the graphical application pavucontrol. I found a terminal alternative to pavucontrol, pacmd. But this still only makes the following compromise possible:Get the default sink and save what it was. How? Probably grepping through pacmd list-sinks Set default sink to the snd-aloop sink with pacmd set-default-sink. Record from that sink. Launch application Wait until the application opened its sink input: pacmd list-sink-inputs | grep name-of-my-program if this finds something, the input is open. Change the default back to what it was with pacmd set-default-sink . Stop recording once the application closes.But this still changes the default sink for a timespan of up to a couple of minutes (the sink input isn't usually opened until the program is actually playing sounds which doesn't need to be right after launch). I implemented this compromise; Github. Still searching for non-compromising answers.
Programmatically redirect audio output of specific program to file
Slop (an application that queries for a selection from the user and prints the region to stdout) appears to be the easiest tool exactly fitting your purpose… since… it provides an example linked to ffmpeg capturing straight in its readme. ;-)slop can be used to create a video recording script in only three lines of code. #!/bin/bash slop=$(slop -f "%x %y %w %h %g %i") || exit 1 read -r X Y W H G ID <<< $slop ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f alsa -i pulse ~/myfile.webm
I have found a ffmpeg command to record area of my screen: ffmpeg -video_size 2000x1600 -framerate 25 -f x11grab -i :0.0+2140,280 output.mp4But to find the correct area, I had to do multiple trial/error runs and it was tedious. Is there some possibility to select area by mouse, and have it recorded by ffmpeg ? If there is no ready made solution, how would I hack together something that works in this way? in another post, somebody mentioned xrectsel, which prints coordinates of a rectangle selected by mouse. Is there some easier way to do this?
ffmpeg: record screen area selected by mouse
I found solution here:http://thenerdshow.com/index30e5.htmlthere I've found : $ amixer -c0 cset iface=MIXER,name='Input Source',index=1 'Front Mic' # (Record from Front Mic)slightly modified according to my sound-card and setup (default sound-card, different items ordering) : $ amixer cset name='Input Source',index=0 'Rear Mic'
So fat, I am setting up microphone settings : $ amixer set 'Rear Mic' 90% mute cap $ amixer set 'Rear Mic Boost' 80%But, after some sys. update, my default recoding chanell changed to 'Front Mic' : $ amixer sget 'Input Source' Simple mixer control 'Input Source',0 Capabilities: cenum Items: 'Front Mic' 'Rear Mic' 'Line' 'CD' 'Mix' Item0: 'Front Mic'How to change 'Input Source' to 'Read Mic' with amixer ? (Currently I do it manually with alsamixer or kmix - I would love to automatize it on startup).
amixer - How to change recording channel?
You can use Cheese (GNOME) if you just need just that, or VLC for more advanced features.
My webcam is detected correctly (and i can use it in skype without any issues), but how can i record video on linux preferably with gui tool ?
What is the best tool/tools to record video from webcam on linux?
You should try something like: flac -c -d -force-raw-format --endian=little --signed=unsigned input.flac | \ lame -r --little-endian --unsigned \ -s 44.1 [other encoding options here] - output.mp3On the flac side:-c means output to stdout -d decode -force-raw-format --endian=little --signed=unsigned force RAW, little-endian, unsigned outputOn the lame side:- read from stdin (this is nearly standard) -r read RAW pcm data --little-endian --unsigned match what lame outputs -s frequency: match that parameter with what your flac file contains You might need --bitwidth if your flac file isn't 16bits/sampleConcerning the endian-ness and signed-ness, not sure what the "native" format you have is (or how to determine that) - try a few combinations. As long as they match on both sides of the pipe, picking the wrong one should only cost CPU time.
My problem is very long recordings, longer than supported by WAV. I'm talking about continuous recordings of around eight hours in length. Now, I do most of my recording using sox into FLAC, which makes the most sense, since those are live recordings from an external sound card. Now, I'd like to encode that into MP3 or into AAC (in an MP4 container). The only way I managed to do that, is using FFmpeg, but I'd actually rather use an encoder application like lame, or neroaacenc. Now, I was doing that where possible, but I was using WAV as a detour. I was decoding the FLAC into WAV and then encoding the WAV into the end product. But as I said, it doesn't work for recordings over a certain length. Now, my idea was to use pipes and force decoding into RAW and then encode that into the target format. I need some help with this. Could someone please supply me with some examples how to decode a FLAC file, and encode that into MP3 using lame by piping RAW data?
How to encode huge FLAC files into MP3 and other files like AAC?
It turns out the sound stack developers have anticipated me and written a workaround specifically for situations like mine - I just wasn't able to find it at first. Aoss does exactly the desired thing: it preloads libaoss.so and then runs another command line, which will then see a /dev/dsp and be able to ioctl/read/write it. So instead of, e.g. autorecord -a -t -d 300 -o violin_concerto say /usr/bin/aoss autorecord -a -t -d 300 -o violin_concerto to have the obsolete tool work just like it used to. The alternative is to load the corresponding emulation kernel modules, which will create an actual /dev/dsp and even a /dev/audio: # modprobe snd_pcm_oss # modprobe snd_seq_oss # modprobe snd_mixer_oss(Of course, the responsible, future-facing thing to would have been to grow up, learn ALSA and pulseaudio programming, and port those old tools to the modern, more complicated sound API. But these days, I no longer have the time for tool-smithing that I used to.)
Recently my trusty home PC died after 10 years. The ensuing upgrade (from SuSE 10 to OpenSuSE 12.3) was something of a culture shock for me - none of the convenient shortcuts and utilities I had collected work anymore. Today I'm trying to get sound input working again. I used to record late-night programmes from my local radio station via the line input of my sound card via a tiny little utility that does nothing but open /dev/audio, perform a few ioctls and then read bytes from it (and write it to a WAV file with libsndfile). Nothing fancy, just a tiny "autorecord" utility that can record N seconds of sound, and can run through cron, without a front-end, without requiring X, and indeed without me having to be logged on. (It was originally adapted from xawtv's record.c.) Now this no longer works. Although my sound card is configured, I can no longer record sound with this tool - in fact, there doesn't seem to be a /dev/sound anymore! From what I've gathered, even in 2004 it was a grudgingly-supported legacy feature, while all the cool people were supposed to program against the much fancier and capable ALSA interface. What is the present-day recommended way of quickly grabbing input from the sound device? Can I re-enable /dev/sound emulation somehow? I suppose a third-party program might do the trick as well, as long as it doesn't require me to provide an X session or press buttons in the middle of the night.
What is the modern equivalent of reading `/dev/audio`?
Framerate applied to both streams, but since ffmpeg documentation examples are scattered I'll leave an answer here A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')" F="$(date --iso-8601=minutes | perl -pe 's/[^0-9]+//g').mkv" V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')" ffmpeg -loglevel error -video_size "$V" -f x11grab -i :0.0 -f pulse -i "$A" -f pulse -i default -filter_complex amerge -ac 2 -preset veryfast "$F"where #A=1 #F=2018121711440500.mkv #V=2560x1440ffmpeg the tool -loglevel error only print errors -video_size "$V" resolution of your screen (or less if you only want a subsection recorded) -f x11grab record the screen (screen recordings may not be possible on wayland?) -i :0.0 the X11 screen ID, (can also add +x,y for offset) -f pulse the audio driver -i "$A" the id of the audio stream -f pulse the audio driver again (maybe not needed?) -i default normally the system microphone -filter_complex amerge merge the 2 audio streams -ac 2 convert the 4 audio channels to 2 -preset veryfast go light on video encoding to avoid stuttering "$F" the output fileRemember that the parameter order matters, and pavucontrol can re-map audio only while ffmpeg is running.
What is the ffmpeg command to record screen and internal audio (on Ubuntu 18.04)? I'll omit the many things I tried that did not work and skip to the something close to what I am looking for; V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')" A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')" F="$(date --iso-8601=minutes).mkv" ffmpeg -video_size "$V" -framerate 10 -f x11grab -i :0.0 -f pulse -ac 2 -i "$A" "$F"I can get video but no audio. parecord -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor example.wav # index: 1will get audio.
record screen and internal audio with ffmpeg
Via ALSA emulation I don't have a Debian 6.0.x box to test on, but I think this way will probably work. Courtesy an example on the Arch wiki. First, use pacmd list-sources to find the name of your sound card's monitor stream. Grep for .monitor works pretty well: $ pacmd list-sources | grep '\.monitor' name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor> name: <alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor>I have two cards, hence two monitors. Then edit your ~/.asoundrc to set up an ALSA device for it, by adding lines like (but of course use your monitor device name, not mine): pcm.pulse_monitor { type pulse device alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor }ctl.pulse_monitor { type pulse device alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor }Then use arecord -f s16_le -t wav -r 44100 -D pulse_monitor /tmp/outfile.wav to record. Older PulseAudio Utilities Instead of using ALSA emulation, you can use parecord on the monitor you found above. Do so like this: parecord -d alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor outfile.wav. That should work with parec as well (in the LAME example below) Newer PulseAudio Utilities PulseAudio ships with a parecord command-line utility that can record sound going through it. To use it, first find the index of the stream you want to capture. Easy way from the command line is pacmd list-sink-inputs, which should give something like this: 1 sink input(s) available. index: 10720 driver: <protocol-native.c> ⋮ client: 87 <Chromium> ⋮I've omitted a bunch of lines; but you can see that's Chromium (where I have a music player running). The index: 10720 bit is important. To record it, it's as simple as parecord --monitor-stream 10720 outfile.wav. You can also write the output to stdout and use it as part of a pipe with parec; for example if you're short on disk space you could directly encode to MP3: parec --monitor-stream 10720 --format s16le --channels 2 --rate 44100 \ | lame -r -s 44.1 -b 16 --signed --little-endian --preset medium /dev/stdin outfile.mp3
I conduct business over Skype. Sometimes when I talk to clients they give a lot of instructions real quick. It would be nice to have a way to record conversations so that I could listen to them at a later point of time when I need them. I have noticed people suggesting 'recordmydesktop', 'xvidcap', and 'ffmpeg' for recording. However, I DO NOT want to record video. I just want to record voice calls while having my headphones on. This means that I should be able to record the sound inline, not record it externally by pulling out my headphones and putting my clients on speaker (I know they can hear that, and they don't like it). If there are ways you know that can solve my problem on a Debian 6 system, please let me know.
How to record Skype calls (audio) on Debian 6?
Just pass asciinema rec a file name as an argument, in which case it will simply save the recording to the local file and not try to upload it to the server. For example: $ asciinema rec demo.castYou can then play the recording locally (on the terminal) with: $ asciinema play demo.castAnd finally upload it with: $ asciinema upload demo.castSee the asciinema usage docs for more details on each of these. You mentioned hosting the recording in your own server. In that case, you might want to look at setting your own asciinema web app instance, which you need to run on your server in order to host screencasts you upload. That page has a link to the web app install guide (which by default runs in a Docker container.) Once you have that up and running, you can configure your local asciinema to upload to your server rather than the public one in asciinema.org. Alternatively, you can simply host the asciinema player along with the *.cast files in a webserver and embed them directly into an HTML page, which sounds like you are looking for, as there is no asciinema upload step involved. See these instructions for standalone usage of the asciinema-player app.
How can I record and play asciinema screen recordings in a LAN without internet connection? The tool uploads the recordings per default to the asciinema website but I want to keep it local and run the player on a local webserver.
How to use asciinema offline?
I figured it out myself. I was wrong to assume the "device" option would need a device name. Instead, a source (or sink, depending what you are trying to achive) name is needed. This for example gives me ALSA access to an individual microphone handled by pulseaudio: pcm.pulse_mic1 { type pulse device alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono } ctl.pulse_mic1 { type pulse device alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono }
I want to record audio from multiple input devices using ALSA and Pulseaudio. More precisely, I want to play UltraStar Deluxe. It is a game using SDL. As far as I can tell, it supports ALSA only. Everything is working fine as long as I simply use the virtual ALSA "pulse" device for output and input. Unfortunately, this only allows one input device, but I want to record from three independent (USB) microphones. Downmixing the three sources into one is not an option. https://wiki.archlinux.de/title/Pulseaudio#Mehrere_PulseAudio_ALSA_Ger.C3.A4te suggests to define an additional ALSA PCM by adding pcm.<pcmname> { type pulse device <devicename> }to my ~/.asoundrc. Unfortunately, I cannot work out what to use for the pulseaudio device name. I tried with what I guess it the pulseaudio name alsa_card.usb-0d8c_C-Media_USB_Audio_Device-00-Device. arecord -L shows the additional virtual ALSA PCM, but fails to record from it giving the error message ALSA lib pcm_pulse.c:752:(pulse_prepare) PulseAudio: Unable to create stream: Entität nicht vorhanden (that last german bit translates to something along Entity not existant). The virtual ALSA PCM does not show in UltraStar Deluxe. How can I achieve this? Is it possible at all? I use Pulseaudio for everything else and it works fine. Without Pulseaudio working with many programs is cumbersome and audio is flaky. Here is the output of pacmd list-cards: 4 card(s) available. index: 0 ... (HDMI Output Device stripped) index: 1 name: <alsa_card.pci-0000_00_1b.0> driver: <module-alsa-card.c> owner module: 6 properties: alsa.card = "0" alsa.card_name = "HDA Intel PCH" alsa.long_card_name = "HDA Intel PCH at 0xf6130000 irq 48" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1b.0" sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.id = "1e20" device.product.name = "7 Series/C210 Series Chipset Family High Definition Audio Controller" device.form_factor = "internal" device.string = "0" device.description = "Internes Audio" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" profiles: input:analog-stereo: Analog Stereo Eingang (priority 60, available: unknown) output:analog-stereo: Analog Stereo Ausgang (priority 6000, available: unknown) output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060, available: unknown) output:analog-surround-40: Analog Surround 4.0 Ausgang (priority 700, available: unknown) output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Ausgang + Analog Stereo Eingang (priority 760, available: unknown) output:analog-surround-41: Analog Surround 4.1 Ausgang (priority 800, available: unknown) output:analog-surround-41+input:analog-stereo: Analog Surround 4.1 Ausgang + Analog Stereo Eingang (priority 860, available: unknown) output:analog-surround-50: Analog Surround 5.0 Ausgang (priority 700, available: unknown) output:analog-surround-50+input:analog-stereo: Analog Surround 5.0 Ausgang + Analog Stereo Eingang (priority 760, available: unknown) output:analog-surround-51: Analog Surround 5.1 Ausgang (priority 800, available: unknown) output:analog-surround-51+input:analog-stereo: Analog Surround 5.1 Ausgang + Analog Stereo Eingang (priority 860, available: unknown) output:iec958-stereo: Digital Stereo (IEC958) Ausgang (priority 5500, available: unknown) output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Ausgang + Analog Stereo Eingang (priority 5560, available: unknown) off: Aus (priority 0, available: unknown) active profile: <output:analog-stereo> sinks: alsa_output.pci-0000_00_1b.0.analog-stereo/#0: Internes Audio Analog Stereo sources: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor/#0: Monitor of Internes Audio Analog Stereo ports: analog-input: Analoge Eingabe (priority 10000, latency offset 0 usec, available: unknown) properties:analog-input-microphone: Mikrofon (priority 8700, latency offset 0 usec, available: no) properties: device.icon_name = "audio-input-microphone" analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no) properties:analog-output: Analoge Ausgabe (priority 9900, latency offset 0 usec, available: unknown) properties:iec958-stereo-output: Digitaler Ausgang (S/PDIF) (priority 0, latency offset 0 usec, available: unknown) properties:index: 2 name: <alsa_card.usb-0d8c_C-Media_USB_Audio_Device-00-Device> driver: <module-alsa-card.c> owner module: 7 properties: alsa.card = "1" alsa.card_name = "C-Media USB Audio Device" alsa.long_card_name = "C-Media USB Audio Device at usb-0000:00:1d.0-1.5, full speed" alsa.driver_name = "snd_usb_audio" device.bus_path = "pci-0000:00:1d.0-usb-0:1.5:1.0" sysfs.path = "/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/sound/card1" udev.id = "usb-0d8c_C-Media_USB_Audio_Device-00-Device" device.bus = "usb" device.vendor.id = "0d8c" device.vendor.name = "C-Media Electronics, Inc." device.product.id = "0008" device.product.name = "C-Media USB Audio Device " device.serial = "0d8c_C-Media_USB_Audio_Device" device.string = "1" device.description = "C-Media USB Audio Device " module-udev-detect.discovered = "1" device.icon_name = "audio-card-usb" profiles: input:analog-mono: Analog Mono Eingang (priority 1, available: unknown) output:analog-stereo: Analog Stereo Ausgang (priority 6000, available: unknown) output:analog-stereo+input:analog-mono: Analog Stereo Ausgang + Analog Mono Eingang (priority 6001, available: unknown) output:iec958-stereo: Digital Stereo (IEC958) Ausgang (priority 5500, available: unknown) output:iec958-stereo+input:analog-mono: Digital Stereo (IEC958) Ausgang + Analog Mono Eingang (priority 5501, available: unknown) off: Aus (priority 0, available: unknown) active profile: <input:analog-mono> sources: alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono/#1: C-Media USB Audio Device Analog Mono ports: analog-input-microphone: Mikrofon (priority 8700, latency offset 0 usec, available: unknown) properties: device.icon_name = "audio-input-microphone" analog-output: Analoge Ausgabe (priority 9900, latency offset 0 usec, available: unknown) properties:iec958-stereo-output: Digitaler Ausgang (S/PDIF) (priority 0, latency offset 0 usec, available: unknown) properties:index: 3 name: <alsa_card.usb-0d8c_C-Media_USB_Audio_Device-00-Device_1> driver: <module-alsa-card.c> owner module: 8 properties: alsa.card = "2" alsa.card_name = "C-Media USB Audio Device" alsa.long_card_name = "C-Media USB Audio Device at usb-0000:00:1d.0-1.6, full speed" alsa.driver_name = "snd_usb_audio" device.bus_path = "pci-0000:00:1d.0-usb-0:1.6:1.0" sysfs.path = "/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/sound/card2" udev.id = "usb-0d8c_C-Media_USB_Audio_Device-00-Device_1" device.bus = "usb" device.vendor.id = "0d8c" device.vendor.name = "C-Media Electronics, Inc." device.product.id = "0008" device.product.name = "C-Media USB Audio Device " device.serial = "0d8c_C-Media_USB_Audio_Device" device.string = "2" device.description = "C-Media USB Audio Device " module-udev-detect.discovered = "1" device.icon_name = "audio-card-usb" profiles: input:analog-mono: Analog Mono Eingang (priority 1, available: unknown) output:analog-stereo: Analog Stereo Ausgang (priority 6000, available: unknown) output:analog-stereo+input:analog-mono: Analog Stereo Ausgang + Analog Mono Eingang (priority 6001, available: unknown) output:iec958-stereo: Digital Stereo (IEC958) Ausgang (priority 5500, available: unknown) output:iec958-stereo+input:analog-mono: Digital Stereo (IEC958) Ausgang + Analog Mono Eingang (priority 5501, available: unknown) off: Aus (priority 0, available: unknown) active profile: <input:analog-mono> sources: alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device_1.analog-mono/#2: C-Media USB Audio Device Analog Mono ports: analog-input-microphone: Mikrofon (priority 8700, latency offset 0 usec, available: unknown) properties: device.icon_name = "audio-input-microphone" analog-output: Analoge Ausgabe (priority 9900, latency offset 0 usec, available: unknown) properties:iec958-stereo-output: Digitaler Ausgang (S/PDIF) (priority 0, latency offset 0 usec, available: unknown) properties:Regards Hermann
Record audio from multiple devices with ALSA and Pulseaudio
The solution is to use JACK Audio Connection kit (http://jackaudio.org/). I ended up installed the KX Studio distro (based on Debian/Ubuntu) and I removed PulseAudio for simplicity.The podcasts will be interviews conducted via voice-over-IP (SIP) telephone. I want one side of the conversation in one channel and the other side in another channel. JACK allows me to do exactly this.
I want to use Audacity (or similar) to record audio for podcasting. The podcasts will be interviews conducted via voice-over-IP (SIP) telephone. I came across an excellent tutorial here: http://www.linux.com/learn/tutorials/367395-weekend-project-record-from-skype-calls-and-other-apps-on-linux It gives most of the steps I need. Most importantly, it describes how to capture both sides of the call from apps that don't support recording. "The real solution to capturing both sides of the call is to construct a virtual PulseAudio device that connects to both of them" and "Then record the null sink, capturing the merged audio in a single file." However, I want to do one thing differently. I don't want the audio of the conversation entirely "merged." I want one side of the conversation in one channel and the other side in another channel. There is actually a hardware device that does this and that's where I got the idea. The device is the JK Audio Inline Patch found here: http://www.jkaudio.com/inline-patch_dtails.htm It offers "a mini stereo output jack, caller on left channel, local voice on right channel." That's similar to what I want. I think I can do it like the tutorial describes without having to buy a $250 US hardware device. The original tutorial steps are: pacmd info cp /etc/pulse/default.pa ~/.pulse/default.pathen open default.pa in your favorite editor and add something like this (based on the info from pacmd info): # set up null sink and loopbacks to record voice calls load-module module-null-sink sink_name=mywiretap load-module module-loopback source=alsa_output.pci-0000_00_06.1.analog-surround-40.monitor sink=mywiretap load-module module-loopback source=alsa_input.pci-0000_00_06.1.analog-stereo sink=mywiretapFrom the tutorial: What's extra nice about this setup is that PulseAudio stores the application connection details automatically, so the next time you log in, you will not have to repeat the process of connecting the recording app to the Null Output Monitor — just fire up your audio recorder, phone your [interview subjects], and start talking... My question is, How do I capture my audio in one channel and the interview subject's audio in another channel of a stereo recording? Or how do I capture them entirely separately (if necessary) using Audacity? I fooled around with Audacity and I cannot open two windows and record two separate sources using Audacity (at least not that I could figure out). In case it is of interest my SIP client is Twinkle.
record audio on Linux - capture both sides of a VoIP conversation
The manual page for script gives the answer:-t, --timing[=file] Output timing data to standard error, or to file when given. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays.So "size of each chunk" is correct.
I am trying to understand the timing files produced by the script command (which are supposed to be read by scriptreplay while running typescript files). The timing file is always made of two columns, I guess the first one represents the delay before each chunk of the typescript file is printed. However, I have difficulty understanding the second column. Does it represent the size of each chunk? Or is it just an integer representing the ascii code of the last character in that chunk? Or is it something totally different? Well, I am guessing since I couldn't find any specification about the timing file format online. I tried reading the implementation of script and scriptreplay to no avail.
Understanding scriptreplay timing file
Might it be asciinema, showterm or PLAYTERM/ttyrec? Coincidentally a colleague of mine is right now trying to remember something like this as well.
I stumbled across a useful command line recorder that allows the user to copy the text when watching the 'recording'. I just cannot remember the name of the project. I just remember you can play and pause the video and the user can copy and paste the text in the video. Anyone know the name of the project?
Cannot remember the name of a CLI recorder software
@eyoung100's comments helped me find the solution on my own. In PulseAudio volume control's "Input Devices" tab, ensure that "Monitor of Built-in Analog Stereo" is not muted.
I am using Trisquel GNU/Linux 6.0.1 (a modified version of Ubuntu) on the XFCE desktop environment. I am trying to record the output of my speakers. I do not have a microphone, and so cannot use it for this purpose (and I don't want to, anyways, due to the loss of quality). Yet no matter what program I use (I have tried with many different programs including Audacity, RecordMyDesktop, GNOME Sound Recorder, and parec), PulseAudio volume control shows that the running program is not detecting any input, and the resulting files contain no audio. It is definitely set to "monitor of built-in analog stereo". In case it's relevant, the output of arecord -l is **** List of CAPTURE Hardware Devices **** card 0: SB [HDA ATI SB], device 0: ALC270 Analog [ALC270 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0Audacity shows this device as a recording option, but using it as input produces the same null results.
What is preventing me from recording the output of my speakers?
Excerpt from the arecord's man page: -d, --duration=# Interrupt after # seconds. A value of zero means infinity. The default is zero, so if this option is omitted then the record/play‐ back process will run until it is killed.This is the command I used to record sound indefinitely with a Kinobo Akiro USB microphone using a sampling rate of 48 kHz: arecord --device="hw:1,0" --format=S16_LE --rate=48 rec_$(date "+%F_%H-%M-%S").wavSee this answer on how to specify which device to use. To convert a WAVE file into mp3, you can use ffmpeg: ffmpeg -i rec.wav -acodec mp3 rec.mp3
I'm working with the application "arecord" (under Arch Linux). I'm want to capture sound from my microphone and save it to the disk. This is my command: arecord -f dat -d 2 --channels 1 -D hw:1,0 /tmp/test.wavThis captures a two seconds (-d -> duration) file and then saves it to disk. This basically works. What I want to do is to record an "infinite" sound track (without fixed duration) and save this track immediately to disk. Without waiting for it to finish. So, if I shut down the machine while recording (or there's a power outage), the sound track will be saved on the disk up to that moment. Is this possible?
Record from the microphone indefinitely
My solution was to use JACK Audio Connection kit (http://jackaudio.org/). I ended up installing the KX Studio distro (based on Debian/Ubuntu) and I removed PulseAudio for simplicity.How can I record two audio sources at the same time and create a file where one source is the left channel and the other source is the right channel of a lossless stereo audio recording? JACK allows me to do exactly this. I'm also using the Ardour software (DAW).
How can I record two audio sources at the same time and create a file where one source is the left channel and the other source is the right channel of a lossless stereo audio recording? My distro is Kubuntu 12.04 LTS. My audio source hardware is listed at bottom. Specifically, I believe the two sources I want to record at the same time are:alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog StereoFYI, this question might be relevant (but I don't understand the command shown there): how to merge two audio input source using avconv EDIT: this definitely seems relevant, but I am struggling to understand it: http://ubuntuforums.org/showthread.php?t=1962947 My first guess about how to do this is this simple script: #!/bin/bash OUTPUT="audio_`date +%Y-%m-%d_%H%M`" avconv \ -f alsa -ac 2 -i <alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor> \ -f alsa -ac 1 -i <alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo> \ -map 0:0 -map 1:0 \ -acodec flac \ -threads 0 \ -y $OUTPUTI assume I need to replace what is in angle brackets with the correct notation. I have no idea if the rest of the above script is even close... Here's my hardware info: $ pacmd list-cards Welcome to PulseAudio! Use "help" for usage information. >>> 3 card(s) available. [snip other cards] index: 2 name: <alsa_card.usb-Focusrite_Scarlett_2i2_USB-00-USB> driver: <module-alsa-card.c> owner module: 6 properties: alsa.card = "1" alsa.card_name = "Scarlett 2i2 USB" alsa.long_card_name = "Focusrite Scarlett 2i2 USB at usb-0000:04:00.0-2, high speed" alsa.driver_name = "snd_usb_audio" device.bus_path = "pci-0000:04:00.0-usb-0:2:1.0" sysfs.path = "/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb3/3-2/3-2:1.0/sound/card1" udev.id = "usb-Focusrite_Scarlett_2i2_USB-00-USB" device.bus = "usb" device.vendor.id = "1235" device.vendor.name = "Novation EMS" device.product.id = "8006" device.product.name = "Scarlett 2i2 USB" device.serial = "Focusrite_Scarlett_2i2_USB" device.string = "1" device.description = "Scarlett 2i2 USB" module-udev-detect.discovered = "1" device.icon_name = "audio-card-usb" profiles: output:analog-stereo: Analog Stereo Output (priority 6000) output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060) output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (priority 6055) output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500) output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 5560) output:iec958-stereo+input:iec958-stereo: Digital Stereo Duplex (IEC958) (priority 5555) input:analog-stereo: Analog Stereo Input (priority 60) input:iec958-stereo: Digital Stereo (IEC958) Input (priority 55) off: Off (priority 0) active profile: <output:analog-stereo+input:analog-stereo> sinks: alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#1: Scarlett 2i2 USB Analog Stereo sources: alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog Stereo ports: analog-output: Analog Output (priority 9900, available: unknown) properties: analog-input: Analog Input (priority 10000, available: unknown) properties: iec958-stereo-input: iec958-stereo-input (priority 0, available: unknown) properties: iec958-stereo-output: Digital Output (S/PDIF) (priority 0, available: unknown) properties:lsusb -v shows the Focusrite_Scarlett_2i2 as: Bus 003 Device 002: ID 1235:8006 Novation EMS idVendor 0x1235 Novation EMS idProduct 0x8006 Here is more info on this hardware: $ aplay -l **** List of PLAYBACK Hardware Devices **** [snip] card 1: USB [Scarlett 2i2 USB], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0$ arecord -l **** List of CAPTURE Hardware Devices **** [snip] card 1: USB [Scarlett 2i2 USB], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
audio recording - record two sources simultaneously, merge into a single 2-track recording
Is there a simple, application-independent way to record audio on given sound card?Yes ! There is ! What you are looking for is to simply record the output of your sound card. The easiest way would probably be to wire its outputs to its inputs… the aloop alsa driver will provide a wireless way. A/ So first ensure the driver is loaded & appropriately initialized : arecord -l can tell you this, displaying (on my system): card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7Of course depending on your implementation, the card id can differ from the above list. If you don't obtain that output then it might be because the driver is not loaded therefore fire : modprobe snd-aloop. In case you still don't succeed then ensure that the driver is selected in the kernel .config file (grep for CONFIG_SND_ALOOP) B/ Basically ensure it works as expected This driver provides a pair of cross-connected devices, forming a full-duplex loopback soundcard. The first application opening one device, will force the second application, trying to open the other device, to use its established parameters. Therefore no rate, format or channel number conversion is done. The consequence of this is, that you have to start the playback application first. So let's ensure it works as expected : 1/ Find whatever .wav file and play it to card 0 device 0 subdevice 0 : aplay -D hw:0,0,0 whatever.wav 2/ Record from associated cross-connected device card 0 device 1 subdevice 0: arecord -D hw:0,1,0 record.wav Of course you might need to adapt the card id to your configuration. 3/ Ensure it just works by playing record.wav on your alsa default device : aplay record.wav . If you can't hear anything, this will probably be because of some basic alsa misconfiguration. (I can elaborate if needed) Of course, working like this (directing playback to the loopback, output won't be sent to your default playback device, so you won't be able to hear anything while recording. This is anyhow possible via some particular alsa configuration. C/ Get both audio playing in your ears and enable recording Warning! : This will be the hardest part of the work since alsa configuration files have always needed an appreciable part of… magic. For this, you'll need to conceive from scratch either the /etc/asound.conf file (if your config is meant system-wide) or $HOME/.asoundrc (if the config is meant for your sole user) in order to create a couple of virtual sound devices. 1/ Start defining quasi aliases pcm.MAUDIO{ type hw card M2496 device 0 subdevice 0 nonblock true}ctl.MAUDIO{ type hw card M2496}This example being related to my own system with :MAUDIO (choose whatever you want instead) acting as an alias for future reference to the hardware sound device, M2496 coming from the CARD=M2496 associated to my preferred hardware device for sound playback (you should adapt according to your output of aplay -L) nonblock true because you don't want Alsa to lock the character special file (/dev/snd/pcmwhatever) associated to the device driver of your sound card. (So than any other application can also open it if needed)Then going on with the loopback device : pcm.loopin { type plug slave.pcm "hw:Loopback,0,0" }pcm.loopout { type plug slave.pcm "hw:Loopback,1,0" }2/ Of course you want a mixer pcm.dmixer{ type dmix ipc_key 219345 slave{ pcm MAUDIO format S32_LE period_size 1024 buffer_size 4096 }}For the ipc_key choose whatever unique shared memory key (check using ipcs -ma that the one you choose is not used). period_size and buffer_size values depend on your expectations in terms of latency (lower the values, lower the latency) and the performances of your system (lower the values, higher the probability of XRuns) 3/ Of course you want everything to work as before (without conf) pcm.!default{ type plug slave.pcm "dmixer" hint{ show on description "Alsa Default Device"}}This will define the alsa default device described as such on all apps enabling the selection of audio output devices. All we need now is to define a pseudo device able to duplicate it's input to both, the hardware sound device and the loopback device. This will be achieved thanks to alsa's multi plugin. 4/ Routing audio to hardware sound device and duplicate to loopback pcm.multi { type route; slave.pcm { type multi; slaves.a.pcm "MAUDIO"; slaves.b.pcm "loopin"; slaves.a.channels 2; slaves.b.channels 2; bindings.0.slave a; bindings.0.channel 0; bindings.1.slave a; bindings.1.channel 1; bindings.2.slave b; bindings.2.channel 0; bindings.3.slave b; bindings.3.channel 1; } ttable.0.0 1; ttable.1.1 1; ttable.0.2 1; ttable.1.3 1; }Note that instead of slaves.a.pcm "MAUDIO", you may prefer slaves.a.pcm "dmixer" For commodity, define an alias : pcm.pbnrec { type plug slave.pcm "multi" hint{ show on description "Alsa Playback & Record"}}D/ Let's GO! Shutdown & Reboot if you chose configuring system wide or logout login if you chose configuring user's own .asoundrc. From then, under any honest audio app enabling you to select the preferred audio output device, you should be able to choose the "Alsa Playback & Record" device, start playing then, on the command line, either :arecord on the "loopout" device ffmpeg on the "loopout" device if wishing resampling / other file formats. Fire whatever more convenient audio recording desktop utility like audacity.E/ Ha! This works as it should with players A,B,C but not with D,E,F apps Unfortunately, many suboptimal apps won't enable you to select the desired output device. Browsers in particular. Because they will output to alsa default pcm, you'll need to adapt your configuration file and change the pcm.!default description as detailed above for something looking like : pcm.!default { type plug slave.pcm "pbnrec" }F/ FTS! That still doesn't work with Firefox and Chrome. 1/ Chrome To be honest… I cannot tell since I use chromium. Chromium will default to pulseaudio output unless specifying the --alsa-output-device option. So, one should try launching chrome --alsa-output-device='default' and hear if it works, it does indeed up to my current chromium 96 2/ Firefox For whatever somber reason, Firefox decided to privilege pluseaudio so there is AFAIK no way to workaround this… with the official binary. However, building Firefox from sources, there is some make option which enables the build of an alsa backend. I can't tell how to achieve this under Debian, but this is almost certainly possible. All I can tell is that it works for me up to my current 91.4.0 version.CREDITS : Since OP wanted authoritative sources, everything in this answer was elaborated from :The official Alsa project asoundrc page, The official FFmpeg wikiALTERNATIVE A sound server can stand as a viable alternative to the alsa fiddlings described here above. (to the cost of some processing power) The sound server of choice has, for decades, always be the Jack Audio Connection Kit. Pulseaudio never managed to compete. But… this is another story.ADDITIONAL INFORMATION FOLLOWING COMMENTS 1/ Sample rate The snd-aloop driver is, in itself, not constrained to whatever fixed sample rate. Any of its subdevices can operate at a different sample rate if desired. However, the application that will be the first to open a subdevice will determine the sample rate (since no conversion is done) for the cross-paired subdevice. In practice, this means that the playback application outputing at PBSource Hz, the recording application will capture samples at PBSource Hz sample rate. In case this is not convenient, resampling needs to be done, it will be on behalf of the recording app. ffmpeg can achieve this on the fly, as would desktop recording apps (most likely thanks to ffmpeg) In practice, this also means that the pseudo device used to push sound to the hardware sound device will have its input sampled at PBSource Hz. There can indeed be a mismatch with the sound device (fixed) HW hz sample rate, this leading to bad sound. Alsa provides two ways to overcome this, either by :Using the rate plugin which will force the resampling to a given frequency. This is somehow suboptimal since alsa will then resample systematically. (even if the sample rate of the source and the given sample rate are identical) Using the dmix plugin (cf. above §C-2,3) which will automatically resample but only when needed.One can even select the preferred resampling algo via the definition of defaults.pcm.rate_converter.
Is there a simple, application-independent way to record audio on given sound card? Lets say I plug in USB headset, which appears as /dev/snd/foo. I then use zoom or skype or any other application to make a call. If the application does not allow recording natively, can I record the audio independently on the sound card level? I am using alsa, and I imagine (naively) that there might be some infrastructure to attach to, or "mirror" the sound card and dump audio to file? I need to record both channels (microphone, speaker), so there might be some mixing necesary? My OS is Debian 10, and I am using alsa (not pulseaudio)
alsa: record everything on given sound card
So after a lot of back and forth with Caleb we've finally come up with a solution to the problem. The login i was trying to do straight to the inventory management software was fiddly, but to quote as per our back and forward conversations tonight, this solved it. No need for recording keystrokes at all. Just good old noggin usage.The first connection in your script is to login and create a session in a cookie:curl -s -c cookiejar.txt -b cookiejar.txt -L -d '[emailprotected]&pass=******' -e 'https://my.channelgrabber.com/login.php' https://my.channelgrabber.com/login.php -o /dev/nullNext you can ask for another page, but you have to pass the previous one you were on. For example after the above, you can run:curl -s -c cookiejar.txt -b cookiejar.txt -L -e 'https://my.channelgrabber.com/index.php' https://my.channelgrabber.com/products.php -o products.html Doing this brought about what i needed perfectly. From here, i just deleted the cookie once it had been used and retrieved what i needed: rm -rf cookiejar.txt ...and set it on a cron job to run every 5 minutes. There's some extra lines i did regarding the full function but this right here is what fixed everything for me. It was a lot of trial and error. A big thank you again to Caleb who helped me with this whole thing.
I've been working on a small script today for our minimal server here where I can log into our inventory software, download the csv and put it into the web directory using a cron job periodically. Using script and scriptreplay I was able to get all this working perfectly, until I realized that scriptreplay was literally replaying the terminal output as opposed to the actual website I was loading using w3m the first time. So I'm looking for a way to record keystrokes via ssh in order to follow my initial instructions. Does anyone have any ideas? Failing that, does anyone have any alternatives? It's only a mini version of Ubuntu our server is running so no GUI.
Record keystrokes through ssh and be able to replay them
The following is simplest procedure I came up with. It will work on any GNU/Linux handheld, but instructions for an Ubuntu touch device are provided, anyway. On the handheld deviceUbuntu Touch specific: Increase the size of the system.img of your Ubports phone with some extra gigs. Ubuntu Touch specific: Make your rootfs writablesudo mount -o remount,rw /Proceed to install tor and rsync; for an Ubuntu Touch device it would besudo apt install tor rsyncHave this uncommented in your torrc/etc/tor/torrc ---------------- HiddenServiceDir /var/lib/tor/ssh/ HiddenServicePort 22 127.0.0.1:22Start torservice tor start # Ubuntu touch systemctl enable tor # Any other Ubuntu version systemctl start tor # Any other Ubuntu versionGet the onion address of your handheld/var/lib/tor/ssh/hostname -------------------------- your_onion_address.onionRecord from microphone witharecord ~/Music/recording.wavOn the remote computerInstall rsync and youtube-video-upload (follow the instructions on the website to configure it for your account). Write the recording.yaml corresponding to your recording.wav. Run the sync_and_upload.sh scriptsync_and_upload.sh ------------------------- #!/usr/bin/env bash watch -n <seconds_between_consecutive_syncs> rsync phablet@your_onion_address.onion /path/to/recording.wav & watch -n <seconds_between_consecutive_uploads> python3 -m youtube_video_upload /path/to/recording.yamlKnown issuesIt is not adviced by Ubuntu Touch manual to write on the rootfs, so you will have to repeat the procedure every time you upgrade your phone; After receiving a call, microphone mutes in the recording; Tor should start at boot; In Ubports/Ubuntu Touch everything should run into a libertine container.
Suppose you fear you could meet someone who will threaten you with death. Assuming the bad guy won't destroy your handheld (for example an Ubuntu Touch device) on sight, a barely decent form of protection would be to have your phone continuously stream its microphone to a remote server you do not have access to, programmed to publicly upload the recorded audio content on a popular YouTube channel on a regular basis, unless a circle of neutral, trusted, physically unavailable people for the threatener do not cancel it if nothing happened. I want to know how to do that.
How to use an handheld device with GNU/Linux and YouTube to protect from death threats?
In every second, you record 44100 frames (or whatever sample rate you have set). Just add up the number of frames read, and stop when you have recorded 60*44100 of them: total = 0 while total < 60 * 44100: l, data = inp.read() if l: total += l f.write(data) time.sleep(.001)
The below code records the audio for some time (I don't know how much) How to calculate the total time of its recording? For example, if I want to record for just one minute then how would I limit its time? #!/usr/bin/env python## recordtest.py ## ## This is an example of a simple sound capture script. ## ## The script opens an ALSA pcm forsound capture. Set ## various attributes of the capture, and reads in a loop, ## writing the data to standard out. ## ## To test it out do the following: ## python recordtest.py out.raw # talk to the microphone ## aplay -r 8000 -f S16_LE -c 1 out.raw# Footnote: I'd normally use print instead of sys.std(out|err).write, # but we're in the middle of the conversion between python 2 and 3 # and this code runs on both versions without conversionimport sys import time import getopt import alsaaudiodef usage(): sys.stderr.write('usage: recordtest.py [-c <card>] <file>\n') sys.exit(2)if __name__ == '__main__': card = 'sysdefault:CARD=Device' opts, args = getopt.getopt(sys.argv[1:], 'c:') for o, a in opts: if o == '-c': card = a if not args: usage() f = open(args[0], 'wb') # Open the device in nonblocking capture mode. The last argument could # just as well have been zero for blocking mode. Then we could have # left out the sleep call in the bottom of the loop inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NONBLOCK, card) # Set attributes: Mono, 44100 Hz, 16 bit little endian samples inp.setchannels(1) inp.setrate(44100) inp.setformat(alsaaudio.PCM_FORMAT_S16_LE) # The period size controls the internal number of frames per period. # The significance of this parameter is documented in the ALSA api. # For our purposes, it is suficcient to know that reads from the device # will return this many frames. Each frame being 2 bytes long. # This means that the reads below will return either 320 bytes of data # or 0 bytes of data. The latter is possible because we are in nonblocking # mode. inp.setperiodsize(160) loops = 1000000 while loops > 0: loops -= 1 # Read data from device l, data = inp.read() if l: f.write(data) time.sleep(.001)
Alsaaudio module, recording for specific amount of time
There are no faster presets for x264 than ultrafast, so you could:Reduce framerate from 60 to cinematic 24 or even 15 since we are talking about screen casting Use a different video codec Use hardware video encoding acceleration if your GPU supports it Add -thread_queue_size 1024 as encoding options. Some people say the output rate matters to have everything in sync, so try adding -r 60.I see no other options. Your computer is really slow by today's standards.
I'm trying to record lossless videos with ffmpeg ofMy screen My computer audio My microphone audiousing this script: MIC="alsa_input.usb-Logitech_Logitech_USB_Headset-00.mono-fallback" MONITOR="alsa_output.usb-Logitech_Logitech_USB_Headset-00.analog-stereo.monitor"AUDIO0=$(pactl list short | grep "$MIC" | grep -Po "[0-9]+" | head -1) AUDIO1=$(pactl list short | grep "$MONITOR" | grep -Po "[0-9]+" | head -1)ffmpeg \ -video_size 1920x1080 \ -framerate 60 \ -f x11grab -i :0.0 \ -f pulse -i $AUDIO0 \ -f pulse -i $AUDIO1 \ -map 0 -map 1 -map 2 \ -c:a copy \ -c:v libx264rgb \ -crf 0 \ -preset ultrafast \ video.mkvOn my slow computer it only records at about 7 FPS. Is there a way to record at a higher FPS while keeping it lossless and the file size fairly small? The 3 tracks also appear to be about a second out of sync with each other, with the screen first, the mic second, and the sound output third. I think it's because it recognizes them in that order when the recording is started. I can manually resync them, but it would be easier to fix the problem.
Lossless ffmpeg recordings with low resource usage
User "balanceofpain" on Reddit suggests: -- FFmpeg/avconv can do that. You'd have to start it as a different user so the person audited would be unable to interfere with it. The command will be similar to: avconv -f x11grab -s 1366x768 -r 25 -i :0.0 /tmp/out.mpgRemember to allow this user access to X with xhost +si:localuser:<auditorusername> -- Hence I could use XDG's autostart but seperate privileges with sudo (to prevent user killing task). The remaining question is whether the recording ends at the end of the session.
While I am aware of rfbproxy and ffmpeg's x11grab capability, all the examples online seem to be aimed at users wanting to record their own sessions. My usage model is to maintain a (reasonably) trustworthy audit record of remote access to a system. My problem is how to reconcile the files these create with the session metadata (notably the authenticated username). If the recording is started from within the session then I can capture the username, although this will expose the invocation to the user (e.g. if done via an XDG autostart). (logging the input events might be a viable alternative to full video recording) If the start/stop of the recording is not invoked from the users session, then how do I synchronize the start/stop with the beginning/ed of the users session? Users will be connecting to a Linux desktop (I've not started thinking about how Wayland fits in all this) via VNC.
X Window / VNC session recording
Finally got it working. The trick was to create a loopback and direct it to the recording sink: pacmd load-module module-null-sink sink_name=Recording sink_properties=device.description=Recording pacmd load-module module-combine-sink sink_name=Combined slaves=Recording,alsa_output.usb-Sennheiser_Communications_Sennheiser_USB_headset-00.analog-stereo sink_properties=device.description=Combined pacmd load-module module-loopback source=alsa_input.usb-Sennheiser_Communications_Sennheiser_USB_headset-00.mono-fallback sink=Recording latency_msec=1Now, application being recorded should be directed to use Combined sink through PulseAudio mixer. After that, parecord --channels=2 -d Recording.monitor output.wavSuch way it records sourced and sunk audio to the same channel(s) of output wav. I will experiment more with channel remapping to get sourced and sunk audio on separate channels but for now it's just enough.
I'm trying to record a Google Meet call I'm participating in (audio only). Creating a combined sink from a null sink and my headphones sink, redirecting browser to combined sink and recording null sink monitor fulfills the first part of that task: pacmd load-module module-null-sink sink_name=recording sink_properties=device.description=recording pacmd load-module module-combine-sink sink_name=combined sink_properties=device.description=combined \ slaves=recording,alsa_output.usb-Sennheiser_Communications_Sennheiser_USB_headset-00.analog-stereoNow I'm recording "theirs" side of call with parecord --channels=1 -d recording.monitor recording.wavNow the second part of the task is to record "my" side of call (the sound which is sourced from my microphone). Ideally I'd like to get the recording in a single file, putting sinked and sourced sound on different channels, but separate files will also do.
Recording from Pulseaudio sink AND source at the same time
TL,DR: I think you've mostly hit bugs in ffmpeg and/or other parts of the stack that seem be fixed by now. Your first command: ffmpeg -vaapi_device /dev/dri/renderD128 -f x11grab -video_size 2560x1440 -i :0 -r 60 -vf 'hwupload,scale_vaapi=format=nv12' -c:v h264_vaapi -qp 0 output.mp4 Works for me, on Debian Bookworm with ffmpeg 5.1 (I only changed the size to match my monitor), with no color issue and 60 fps, on the same GPU (6700 XT). So maybe there was (at the time) a bug somewhere in your version of ffmpeg or in VA-API drivers or something. It does not use the highest quality, -qp 0 may be out of the supported range for this encoder and subsequently ignored, apparently it falls back to a default value: No quality level set; using default (20). Values as low as -qp 1 seem to be accepted, and may bring enough quality for your needs.Regarding kmsgrab, note that using it requires either running as root, or having the CAP_SYS_ADMIN capability set. This may well be the cause for your error, and a fix is to set the capability on ffmpeg: setcap cap_sys_admin=ep /usr/bin/ffmpeg This is not ideal for security, and will break when ffmpeg is updated, but it works, and your command line runs fine for me too. Note also that using kmsgrab while also recording audio caused audio/video synchronization problems until at least ffmpeg 5.1: https://trac.ffmpeg.org/ticket/8377 If you want to use it, you probably want to upgrade to ffmpeg 6, which in my experience fixed that last issue.
I'm trying to record my screen losslessly (or at near lossless quality) with hardware acceleration on a 6700 XT with ffmpeg. I'm running Linux Mint with the 5.14.14-051414-generic kernel. I've tried: ffmpeg -vaapi_device /dev/dri/renderD128 -f x11grab -video_size 2560x1440 -i :0 -r 60 -vf 'hwupload,scale_vaapi=format=nv12' -c:v h264_vaapi -qp 0 output.mp4 ffmpeg says it's recording at 60 fps, but the recording is choppy and slightly miscolored. I'm assuming the color issue is from the color format nv12, but rgb or rgb8 gives an error. I've also tried using kmsgrab: ffmpeg -device /dev/dri/card0 -f kmsgrab -i - -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=2560:h=1440:format=nv12' -c:v h264_vaapi -qp 0 output.mp4 But it gives the error: [kmsgrab @ 0x558f001c8d80] Using plane 65 to locate framebuffers. [kmsgrab @ 0x558f001c8d80] Failed to get framebuffer 127: Invalid argument. pipe:: Invalid argumentThe number after Failed to get framebuffer is usually 127 or somewhere from 134 to 136. I got these commands here.
Hardware accelerated lossless recording on a 6700 XT using ffmpeg
You could replace rec with ffmpeg -f s16le -ar 32k -ac 1 -i pipe: file.wav ffmpeg -formats | grep PCM in case I'm wrong. Your outputrec WARN alsa: can't encode 0-bit Unknown or not applicablemight indicate you're actually recording from an actual microphone (which I presume is not connected).
I have an RTL-SDR radio receiver which outputs streaming data to stdout. I can listen to the audio with this command: $ rtl_fm -M wbfm -f 96.5M | play -r 32k -t raw -e s -b 16 -c 1 -V1 -As you can see, rtl_fm outputs a stream of samples consisting of 16-bit signed integers at a sample rate of 32 kHz. Now, I would like to record this audio using sox, so I tried $ rtl_fm -M wbfm -f 96.5M -g 25 | rec -e s -b 16 -r 32000 out.wavI'm getting a wav file alright, but it's just empty - all the values are zero. I tried $ rtl_fm -M wbfm -f 96.5M -g 25 | rec -e s -b 16 -r 32000 -t raw out.wavBut that only got me a file, Audacity didn't recognise as wav. If I import it as raw data, it's still all zeros. Like I wrote, when I run the play command, I have audio, but when I record, I get nothing. For what it's worth, here's the output from the record command: $ rtl_fm -M wbfm -f 96.5M -g 25 | rec -e s -b 16 -r 32000 -c 1 out.wav Found 1 device(s): 0: Realtek, RTL2838UHIDIR, SN: 00000001rec WARN alsa: can't encode 0-bit Unknown or not applicable Using device 0: Generic RTL2832U OEMInput File : 'default' (alsa) Channels : 1 Sample Rate : 32000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCMIn:0.00% 00:00:00.00 [00:00:00.00] Out:0 [ | ] Clip:0 Detached kernel driver In:0.00% 00:00:00.26 [00:00:00.00] Out:0 [ | ] Clip:0 Found Rafael Micro R820T tuner In:0.00% 00:00:00.51 [00:00:00.00] Out:8.19k [ | ] Clip:0 Tuner gain set to 25.40 dB. Tuned to 96771000 Hz. oversampling input by: 6x. Oversampling output by: 1x. Buffer size: 8.03ms Exact sample rate is: 1020000.026345 Hz Create UDP thread Created UDP thread Allocating 15 zero-copy buffers Main socket started! :-) Tuning enabled on UDP/6020 Sampling at 1020000 S/s. Output at 170000 Hz. In:0.00% 00:00:09.22 [00:00:00.00] Out:287k [ | ] Clip:0 ^CSignal caught, exiting!User cancel, exiting... In:0.00% 00:00:09.47 [00:00:00.00] Out:295k [ | ] Clip:0 Aborted. Signal caught, exiting! Reattached kernel driver
Why isn't sox recording anything?
Ffmpeg is capable of applying the same options to different inputs and outputs, which result in ffmpeg being sensitive to the position of the options. The following will use your settings and output to a FLAC file (recognized by the file ending): ffmpeg -f alsa -ar 48000 -ac 1 -i hw:0 testfile.flacThe settings are applied to the next input or output, so while it is not needed in your example, you can use the -acodec after listing your input files or streams, and before your output e.g.: ffmpeg -f alsa -ar 48000 -ac 1 -i hw:0 -acodec flac testfile.flac
Months ago I would occasionally record little snippets of audio as FLAC files using ffmpeg and ALSA. I used a command that looked more or less like this: ffmpeg -f alsa -ar 48000 -ac 1 -acodec flac -i hw:0 testfile.flac(hw:0 being my microphone's card via arecord -l) If memory serves, there was one other option in there somewhere that made the difference, but I can't tell what it would've been. It might've been similar to the --format options for arecord? I even dug through every single option in ffmpeg to see if I would find something familiar; no dice. Either way, now ALSA just screams that sample format 0x1500c is not supported… whatever that means. However, if I remove the -acodec flac option and change the file name to testfile.wav everything works like a charm. Except, of course, I don't get the file format I had intended. I'm very confident I still have all the necessary packages installed, but I can't for the life of me get this thing to cooperate!
How can one record mic audio straight to a FLAC file?
I'v found a solution. It appears that ttygif allows You to use a starting command with flag -e So it's enough to do ttyrec file_name -e "tmux a"Or in my case record-session -e "tmux a -t my_session"
I'm trying to record my tmux session. I've got an alias record-session which executes command from ttygif ttyrec ~/ttygif/files/last-session. As far as I understand ttygif starts new terminal instance and starts recording it. Normally I have to do $ record-session $ tmux a # Do something with tmux here # C-b D $ exit #to finish recordingBut I'd like make it a little bit more automatic becuase I don't like how it's recorded everytime when I type tmux a. I want to make an alias which would start recording and then attach to tmux session. I've tried:record-session ; tmux a (record-session ; tmux a) record-session & tmux a record-session && tmux a record-session | tmux a (tmux a ; record-session)Each without success. Every one of these commands starts the recording right after I close the tmux or doesn't record it at all. Any ideas what is the right way to do it?
Execute command inside another command
For anyone having this problem in the future, I fixed it by opening pavucontrol during recording.
I'm trying to record my screen, my mic, and my game audio with ffmpeg. This command records only my screen. ffmpeg \ -video_size 2560x1440 \ -framerate 60 \ -f x11grab -i :0 \ -map 0 \ -c:a copy \ -c:v libx264rgb \ -crf 0 \ -preset ultrafast \ video.mkvIt records at a steady 60 fps, and ffmpeg gives the output [x11grab @ 0x55717ef22dc0] Stream #0: not enough frames to estimate rate; consider increasing probesize Input #0, x11grab, from ':0': Duration: N/A, start: 1635606965.195981, bitrate: N/A Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 2560x1440, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb)) Press [q] to stop, [?] for help [libx264rgb @ 0x55717ef30a40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264rgb @ 0x55717ef30a40] profile High 4:4:4 Predictive, level 5.1, 4:4:4 8-bit [libx264rgb @ 0x55717ef30a40] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0 Output #0, matroska, to 'video.mkv': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (libx264rgb) (H264 / 0x34363248), bgr0, 2560x1440, q=-1--1, 60 fps, 1k tbn, 60 tbc Metadata: encoder : Lavc58.54.100 libx264rgb Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 frame= 174 fps= 60 q=-1.0 Lsize= 3866kB time=00:00:02.91 bitrate=10854.0kbits/s dup=0 drop=1 speed=1.01x If I try to record my audio by adding inputs to the command: ffmpeg \ -video_size 2560x1440 \ -framerate 60 \ -f x11grab -i :0 \ -f pulse -i "alsa_output.usb-DeSheng_Electronics_Inc._XIBERIA-00.iec958-stereo.> -f pulse -i "alsa_input.usb-DeSheng_Electronics_Inc._XIBERIA-00.mono-fallback" \ -map 0 -map 1 -map 2 \ -c:a copy \ -c:v libx264rgb \ -crf 0 \ -preset ultrafast \ video.mkvffmpeg gives the output [x11grab @ 0x55bf9b4e80c0] Stream #0: not enough frames to estimate rate; consider increasing probesize Input #0, x11grab, from ':0': Duration: N/A, start: 1635606747.731781, bitrate: N/A Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 2560x1440, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc Guessed Channel Layout for Input Stream #1.0 : stereo Input #1, pulse, from 'alsa_output.usb-DeSheng_Electronics_Inc._XIBERIA-00.iec958-stereo.monitor': Duration: N/A, start: 1635606747.770507, bitrate: 1536 kb/s Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Guessed Channel Layout for Input Stream #2.0 : stereo Input #2, pulse, from 'alsa_input.usb-DeSheng_Electronics_Inc._XIBERIA-00.mono-fallback': Duration: N/A, start: 1635606747.811649, bitrate: 1536 kb/s Stream #2:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb)) Stream #1:0 -> #0:1 (copy) Stream #2:0 -> #0:2 (copy) Press [q] to stop, [?] for help [libx264rgb @ 0x55bf9b519d80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264rgb @ 0x55bf9b519d80] profile High 4:4:4 Predictive, level 5.1, 4:4:4 8-bit [libx264rgb @ 0x55bf9b519d80] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0 Output #0, matroska, to 'video.mkv': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (libx264rgb) (H264 / 0x34363248), bgr0, 2560x1440, q=-1--1, 60 fps, 1k tbn, 60 tbc Metadata: encoder : Lavc58.54.100 libx264rgb Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s Stream #0:2: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s [pulse @ 0x55bf9b4f4000] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8) [matroska @ 0x55bf9b518280] Non-monotonous DTS in output stream 0:1; previous: 364, current: 358; changing to 364. This may result in incorrect timestamps in the output file. frame= 21 fps=0.0 q=0.0 size= 1kB time=00:00:01.01 bitrate= 7.7kbits/sframe= 21 fps= 21 q=0.0 size= 1kB time=00:00:01.01 bitrate= 7.7kbits/s [matroska @ 0x55bf9b518280] Non-monotonous DTS in output stream 0:1; previous: 843, current: 838; changing to 843. This may result in incorrect timestamps in the output file. [x11grab @ 0x55bf9b4e80c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)and records at 20 fps while printing "Non-monotonous DTS" and "Thread message queue blocking" messages every few seconds. I'm assuming the audio is somehow slowing the video recording down, how do I fix it?
ffmpeg recording slows down when audio inputs are added
Okay, after fiddling for an hour I found the solution. At first I got pulseaudio output source by running pactl list short sources. Which showed me this list - 0 alsa_input.usb-046d_0825_3AC10B90-02.mono-fallback module-alsa-card.c s16le 1ch 48000Hz RUNNING 1 alsa_output.pci-0000_06_00.1.hdmi-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz RUNNING 2 alsa_output.pci-0000_06_00.6.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz RUNNING 3 ladspa_output.mbeq_1197.mbeq.monitor module-ladspa-sink.c float32le 2ch 44100Hz RUNNINGIn my case the source is ladspa_output.mbeq_1197.mbeq.monitor. Finally I ran this command selecting the output source - ffmpeg -f x11grab -s 1920x1080 -i :0.0 -f pulse -i ladspa_output.mbeq_1197.mbeq.monitor -c:a ac3 -c:v libx265 -crf 22 -preset slower ~/Videos/Recording-$(date +%F-%I-%M-%N).mp4Hope this helps.
ffmpeg -f x11grab -s 1920x1080 -i :0.0 -f alsa -i default -c:a aac -c:v libx264 -crf 18 -preset slower ~/Videos/recording-(date +%F-%I-%M).mp4I'm using this command to record the screen and my intention is to record only the internal audio. But seems like the source is set to microphone. What will be correct command here?
How do I record just the internal audio with ffmpeg?
Reading the documentation for arecord (see man arecord) it writes,-r, --rate=#<Hz> Sampling rate in Hertz. The default rate is 8000 Hertz. [...]So you can see that the rate is not controlled through asound.conf; it's controlled using this command-line flag.
I'm attempting to change the default sample rate when recording audio with arecord. Currently, when running arecord test.wav the rate is 8000 Hz: arecord test.wav Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, MonoI can change the sample rate using the rate flag --rate 44100: arecord --format S16_LE --rate 44100 test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, MonoBut when I change the rate in asound.conf, it has no effect on recording (rate stays at 8000 Hz). Am I missing something? My asound.conf: # The IPC key of dmix or dsnoop plugin must be unique # If 555555 or 666666 is used by other processes, use another one# use samplerate to resample as speexdsp resample is bad defaults.pcm.rate_converter "samplerate"pcm.!default { type asym playback.pcm "playback" capture.pcm "capture" }pcm.playback { type plug slave.pcm "dmixed" }pcm.capture { type plug slave.pcm "array" }pcm.dmixed { type dmix slave.pcm "hw:wm8960soundcard" ipc_key 555555 }pcm.array { type dsnoop slave { pcm "hw:1,0" format S16_LE rate 44100 channels 1 } ipc_key 666666 }Ouput of arecord -L null Discard all samples (playback) or generate zero samples (capture) jack JACK Audio Connection Kit pulse PulseAudio Sound Server default eci eco usbstream:CARD=Headphones bcm2835 Headphones USB Stream Output sysdefault:CARD=wm8960soundcard wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Default Audio Device dmix:CARD=wm8960soundcard,DEV=0 wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Direct sample mixing device dsnoop:CARD=wm8960soundcard,DEV=0 wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Direct sample snooping device hw:CARD=wm8960soundcard,DEV=0 wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Direct hardware device without any conversions plughw:CARD=wm8960soundcard,DEV=0 wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Hardware device with all software conversions usbstream:CARD=wm8960soundcard wm8960-soundcard USB Stream OutputAddition How to change the default arecord sample rate when using PJUSA(PJSIP): PJUSA initializes ALSA at launch: 11:56:12.951 alsa_dev.c ..ALSA driver found 32 devices 11:56:12.951 alsa_dev.c ..ALSA initializedalsa_dev.c is located at pjproject/pjmedia/src/pjmedia-audiodev/alsa_dev.c The default sample rate is set in line 270: /* Set the default sample rate */ adi->default_samples_per_sec = 8000;Just change the value to the desired sample rate (microphone has to be capable of that sample rate).
Change default recording sample rate for "arecord"
I just deleted the entire partition and reinstalled. LVM was screwing it up all along. Works perfectly now.
ERROR: device '' not found. Skipping fsck. ERROR: Unable to find root device ''. You are being dropped to recovery shell I've been trying to install Arch Linux for some time, and keep running into this error. I seriously have no idea what to do. A little background: My computer originally had a dual boot with Fedora and Windows 10 (both 64-bit), Windows being installed first. I decided to replace Fedora with Arch. There are separate partitions for root, /boot/efi and /home, and I only overwrote root. I mounted the partitions, deleted everything except for /home (and /boot, which I mistakenly kept). I ran pacstrap -i /mnt base, installed the system and rebooted. It booted fine, but it used the Fedora bootloader, with the Fedora loading animation and everything. There were a few issues with the system, including certain services failing to start, and I suspected the Fedora bootloader was to blame. I booted back into the Arch installation USB, deleted everything, this time including /boot (but not /boot/efi, I didn't mount that.) I reinstalled again, and grub wouldn't recognize the vmlinuz image thingy. So I decided to boot back into the USB, chroot into the new Arch partition, and install rEFInd, my personal favourite bootloader. After installing rEFInd with pacman -S refind-efi and refind-install rEFInd was installed, and I rebooted into it. Windows will start, but when I try to start Arch, I get that error. I've run mkinitcpio -p linux multiple times. /etc/fstab looks completely normal. Here's what I've tried: https://superuser.com/questions/769047/unable-to-find-root-device-on-a-fresh-archlinux-install#788480 Moved block before autodetect, no effect http://www.linuxforums.org/forum/arch-linux/199189-error-device-not-found-skipping-fsck.html Fiddled around with refind.conf and refind_linux.conf, nothing I did worked https://superuser.com/questions/835120/error-unable-to-find-root-device-dropped-to-recovery-shell Double-checked, initramfs-linux.img is in the correct directory I've seen similar issues but none of their fixes worked for me. Any ideas on how I can get arch to boot? EDIT: I discovered I'm using an LVM thing. So yeah. My home, root and swap partitions are little LVM thingies (i don't know what to call them) in /dev/sda8. I don't know if this affects anything
Unable to find root device ''
I'm going to reanswer my own question here because there is now an official solution from rEFInd, and thus I believe this is the right way to go about this. The official guidelines can be found on the rEFInd web site. Following are the steps presented there:Boot to OS X, using whatever means is available to you. Holding Option (or Alt) while powering up will normally give you Apple's own boot manager, which should enable you to boot to OS X. If your rEFInd installation is currently starting but is not showing an OS X option, skip to step #7; but if rEFInd isn't starting, follow steps #2–7. If you've made changes to /EFI/refind/refind.conf, back it up. Remove the /EFI/refind directory tree; it's useless now, and its presence may cause confusion. Re-install rEFInd, as described in the Installing rEFInd page; but be sure to use the --esp or --ownhfs device-file option. The latter is preferable, but requires either a dedicated partition for rEFInd or an HFS+ data partition that is currently not bootable.Ensure that the partition to which you've installed rEFInd is mounted. The details depend on how you installed it:If you installed rEFInd to your ESP, typing mkdir /Volumes/esp followed by sudo mount -t msdos /dev/disk0s1 /Volumes/esp will probably work, although in some cases your ESP won't be /dev/disk0s1, so you may need to change this detail. If you used the --ownhfs device-file installation option, the target partition should already be mounted, normally somewhere under /Volumes. If not, locate it and mount it with Disk Utility or mount.If you backed up your refind.conf file, you can now copy it over your new refind.conf file. You should copy the file to either /Volumes/esp/EFI/refind/ (if you used --esp and mounted the ESP at /Volumes/esp) or to /Volumes/Mountpoint/System/Library/CoreServices/ (if you used a dedicated HFS+ volume; note that Mountpoint will be the name of the volume). Edit your new refind.conf file, which should be located as described in the previous step. In your favorite editor, locate the dont_scan_volumes line, which is commented out with a # symbol at the start of the line by default. Uncomment this line and remove the "Recovery HD" item from the line. Some users report that they need to enter one or two dummy entries, as in dont_scan_volumes foo,bar, to get it to work.
I want to dual boot my macbook with Arch Linux and thus tried to install rEFInd using the install script, however, after install rEFInd doesn't seem to start at all? Anyone experienced the same issue or have possible solutions on how to fix this?
Install rEFInd on OS X 10.10 Yosemite
Looking at the drive with gdisk renders: root@ubuntu-mate:~# gdisk /dev/sda GPT fdisk (gdisk) version 1.0.1Partition table scan: MBR: protective BSD: not present APM: not present GPT: presentFound valid GPT with protective MBR; using GPT.Command (? for help): vWarning: The 0xEE protective partition in the MBR is marked as active. This is technically a violation of the GPT specification, and can cause some EFIs to ignore the disk, but it is required to boot from a GPT disk on some BIOS-based computers. You can clear this flag by creating a fresh protective MBR using the 'n' option on the experts' menu.No problems found. 2925 free sectors (1.4 MiB) available in 2 segments, the largest of which is 2014 (1007.0 KiB) in size.Following the instructions from gdisk: Command (? for help): ? b back up GPT data to a file c change a partition's name d delete a partition i show detailed information on a partition l list known partition types n add a new partition o create a new empty GUID partition table (GPT) p print the partition table q quit without saving changes r recovery and transformation options (experts only) s sort partitions t change a partition's type code v verify disk w write table to disk and exit x extra functionality (experts only) ? print this menuCommand (? for help): rRecovery/transformation command (? for help): ? b use backup GPT header (rebuilding main) c load backup partition table from disk (rebuilding main) d use main GPT header (rebuilding backup) e load main partition table from disk (rebuilding backup) f load MBR and build fresh GPT from it g convert GPT into MBR and exit h make hybrid MBR i show detailed information on a partition l load partition data from a backup file m return to main menu o print protective MBR data p print the partition table q quit without saving changes t transform BSD disklabel partition v verify disk w write table to disk and exit x extra functionality (experts only) ? print this menuRecovery/transformation command (? for help): xExpert command (? for help): ? a set attributes c change partition GUID d display the sector alignment value e relocate backup data structures to the end of the disk g change disk GUID h recompute CHS values in protective/hybrid MBR i show detailed information on a partition l set the sector alignment value m return to main menu n create a new protective MBR o print protective MBR data p print the partition table q quit without saving changes r recovery and transformation options (experts only) s resize partition table t transpose two partition table entries u replicate partition table on new device v verify disk w write table to disk and exit z zap (destroy) GPT data structures and exit ? print this menuExpert command (? for help): nExpert command (? for help): wFinal checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!Do you want to proceed? (Y/N): Y OK; writing new GUID partition table (GPT) to /dev/sda. Warning: The kernel is still using the old partition table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) The operation has completed successfully.Reboot and I'm greeted by rEFInd again! Qubes won't boot any more of course. Seems the protective mbr created by Qubes was the problem.
I have a "test all the operating systems"-laptop which was running Windows and Ubuntu MATE, with rEFInd used as boot manager. Yesterday I installed Qubes on the last third of the drive. I've since read why you should not but for just testing the OS I would still not mind doing it. Unfortunately I can no longer boot the old OS:es. Neither rEFInd. After some reading I guess Qubes is legacy-boot only, but why that has completely broken my UEFI-booting the old systems I do not know. Qubes installation of grub boots fine, but if I try to launch rEFInd from it it fails: grub> ls (hd0) (hd0, gpt10) (hd0, gpt9) (hd0, gpt8) (hd0, gpt7) (hd0, gpt6) (hd0, gpt5) (hd0, gpt4) (hd0, gpt3) (hd0, gpt2) (hd0, gpt1) grub> chainloader (hd0,gpt3)/efi/Boot/bootx64.efi error: invalid signatureManually trying to select the efi-files from the computers firmware fails, the mouse even hangs when the firmware tries to list available efi-files from the hard drive. Booting rEFInd installed on a thumb drive works fine, so I conclude the firmware on the machine is intact, but the hard drive got messed up by the Qubes installer. What did it do to my drive? How can I restore it?
Qubes clobbered my boot, how can I re-enable efi booting?
The problem was a failing hard drive, with bad (repairable) sectors where this partition was.
I have a dual boot setup on a Windows machine with multiple partitions, the two Linux ones being encrypted using LUKS. For some reason, I can no longer restore a backup to my second Linux LUKS partition and properly boot into the LUKS splash screen so I can enter my decryption password. Instead, it tries to boot the root partition and throws a dracut error. The key partitions in my setup for this question are:/dev/sda1 EFI /dev/sda5 Boot for Fedora I /dev/sda6 Root for Fedora I -- ENCRYPTED LUKS /dev/sda7 Boot for Fedora II /dev/sda8 Root for Fedora II -- ENCRYPTED LUKSI use one combo (Fedora I Root and Boot) for my main driver. Then, if I want to try something new, I backup everything using tar and install it to to the second combo (Fedora II Root and Boot). So I happily go back and forth between my installs without risking borking my setup. Until recently, I was able to untar a system backup to the decrypted LUKS logical partition, chroot into it, and update the initramfs (using sudo dracut -vf). Doing this is what (I thought) told it to look for the LUKS partition when booting. And on reboot, that newly installed system would display the LUKS decryption splash, then after I entered the password, boot from the root partition. Now, however, I cannot seem to get a restored system using the second partition combo (Fedora II Root and Boot) to start at the LUKS splash screen. I have triple checked, and the setup is identical to the Fedora I combo. Specifically:On the Fedora I and Fedora II /bootpartitions (note: each is a separate partition), there is a file named refind_linux.conf the first stanza of which reads something like "Boot with standard options" "root=UUID=3a404a5a-3d2e-46cd-bf73-8f40e89efed3 ro rhgb quiet LANG=en_US.UTF-8 acpi_osi=Linux acpi_backlight=native", where 3a404a5a-3d2e-46cd-bf73-8f40e89efed3 is the UUID for the partition inside the encrypted partition (aka /dev/mapper/luks-f3303886-beb1-4733-8e6f-5794d430e87e). Of course, the UUID differs depending on whether it is the Fedora I partition or the Fedora II partition. On both the Fedora I and Fedora II root partitions (aka /), there is a file called /etc/fstab, which provides the /, /boot, and /boot/efi UUIDs for the respective partition. For example, one is: UUID=3a404a5a-3d2e-46cd-bf73-8f40e89efed3 / ext4 defaults 1 1 UUID=D0BD-BA39 /boot/efi vfat umask=0077,shortname=winnt 0 2 UUID=e40053cc-4402-478e-9af8-67a218401b33 /boot ext4 defaults 1 1The UUID for the / partition is the same one listed in refind_linux.conf. On both the Fedora I and Fedora II root partitions (aka /), there is a file called /etc/crypttab, which I thought tells Fedora where to look for the LUKS partition. Here, it is: luks-f3303886-beb1-4733-8e6f-5794d430e87e UUID=f3303886-beb1-4733-8e6f-5794d430e87e none luks, where f3303886-beb1-4733-8e6f-5794d430e87e is the UUID of the LUKS wrapper (aka /dev/sda7).Although the setups are identical, the first combo boots and the second does not. What am I missing? Is there some new method to get a newly installed system to recognize that there is an encrypted partition that it needs to read first? What do I need to do to get the second partition combo to recognize that it should be looking at the LUKS partition first, not the root partition?
Dual boot setup with LUKS and rEFInd: Can't Restore Backup to Second Partition
Well, I feel a bit dumb, but I have an answer to my own question. rEFInd shows all partitions it can find by default, and I was selecting the Pop OS /boot partition, rather than the root partition. Posting this follow-up in the hope that it may help someone else in the future.
I recently set up dual boot on a new dell xps 9700, carving off two partitions (/boot and root) for Pop OS (ubuntu-derivative). This was working fine, except Pop OS was taking boots without giving me an option for windows, and I wanted a more sleek boot experience, so I installed rEFInd using the following methodology: sudo apt-add-repository ppa:rodsmith/refind sudo apt-get update sudo apt-get install refindNow I get the rEFInd boot selection screen, and can select and boot into windows just fine. But trying to boot into pop os drops me into initramfs with the message "no root device specified. Boot arguments must include a root= parameter". Sadly I'm out of my depth here, but it seems like there must be a way to point it in the right direction for boot. Can anyone help?
“no root device specified. Boot arguments must include a root= parameter” after installing rEFInd on windows 10 / pop os dual boot
Somewhere in /boot, probably (not sure about Mint), or else on your esp at least, you'll find a file called refind.conf. You'll want to edit to edit that to include the line:timeout -1Sets the timeout period in seconds. If 0, the timeout is disabled—rEFInd waits indefinitely for user input. If -1, rEFInd will normally boot immediately to the default selection; however, if a shortcut key (for instance, W for Windows) is pressed, that system will boot instead. If any other key is pressed, the menu will show with no timeout.rEFInd is extensively documented, by the way. This was a copy-paste from rodsbooks.com, but the comments in that configuration file alone are more than you'll get from most other applications. You should read through it. There's a lot else you might do. If you want to programmatically switch the menu off and on you can do so with any key as noted there, or else set up shortcuts, or else you might just save the config file in its current state to a backup file, modify it, then, if you ever need its behavior to revert for any reason, just move the old one back over it. There's no harm in that.
How to bypass rEFInd boot loader and boot straight to Linux OS straight? Hi Guys, I managed to install rEFind Boot loader and Linux Mint on the old macbook. Whenever macbook turns on, it will go into rEFIND Boot loader screen, if I want it to go straight to Linux OS ( Linux Mint). (Although if I didn't press anything 20sec, it will go straight Linux Mint i previously selected, I just want it go straight even without choosing) How to bypass the rEFInd boot loader and boot straight into Linux OS? (I also want to be able to turn it on again if needed later after able boot straight to linux os)
How to bypass rEFInd boot loader and boot straight to Linux OS straight?
The dont_scan_dirs list is a list of directories to skip when looking for efi files. Excluding a directory does not appear to exclude the entire tree at that point. Directories under an excluded one are still searched, just efi files in that explicitly named directory are ignored. To solve the issue you'll need to include the directories that have the efi files you don't want loaded. In your specific case that means adding EFI/Microsoft/Boot to the dont_scan_dirs list.
I'm dual booting Elementary OS and Windows. I'm seeing two Windows entries though and I'm not sure where refind is finding them. One is shown as Boot Microsoft EFI boot from ESP and the other is Boot bootmgfw.efi from ESP. Selecting either of them boots with Starting from bootmgfw.efi Using load options '' My efi directory looks like /boot/efi/ Boot/ BCD bcd.trunc bootfix.bin boot.sdi bootsect.exe en-us/ Fonts/ Resources/ bootmgfw.efi bootmgr bootmgr.efi EFI/ Boot/ dell/ Microsoft/ Boot/ bootmgfw.efi bootmgr.efi lots of other files Recovery/ BCD BCD.LOG BCD.LOG1 BCD.LOG2 PEBoot/ refind/ tools/ ubuntu/ startup.nshMy refind.conf has the the entry dont_scan_dirs EFI/dell,EFI/PEBoot,EFI/ubuntu,EFI/Boot I've tried adding EFI/Microsoft to dont_scan_dirs but both of them still show up. My disks look like:I've tried setting dont_scan_volumes to WINRETOOLS,Image,DELLSUPPORT but that doesn't keep both entries from showing up. Any ideas on what I can include in my conf file so that only one Windows entry shows up?
Duplicate Windows Entries
Per the rEFInd Documentation, the default_selection option is used to set the default operating system to boot.Sets the default boot OS based on the loader's title, which appears in the main menu beneath the icons when you select the loader.By default, the rEFInd configuration file should be located at either /boot/efi/EFI/Microsoft/Boot/refind.conf, if installed from Windows, or /boot/efi/EFI/refind/refind.conf, if installed from Linux. Alternatively, one can use the following command to locate it: find /boot/efi/EFI/ -name refind.confIf there is no refind.conf in the EFI System Partition (ESP), simply re-install rEFInd manually, cp -r refind /boot/efi/EFI/
I just upgrade Debian from Stretch to Buster. I have a Win 10 installation on another partition but before I was not able to get a Boot menu with both choices so I had to modify the BIOS settings to be able to boot from Windows. With Buster, the situation is better, I have a rEFInd screen where I choose Windows or Debian. The remaining problem is that Windows is selected by default (EDIT: I was wrong, Windows is not selected by default, the latest booted OS is selected by default). I have read few things but I cannot find how to set the default configuration for the boot manager. Here is the output of parted: GNU Parted 3.2 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print all Model: ATA SAMSUNG HD204UI (scsi) Disk /dev/sda: 2000GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 2000GB 2000GB primary ext4Model: ATA Samsung SSD 850 (scsi) Disk /dev/sdb: 500GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 473MB 472MB ntfs Basic data partition hidden, diag 2 473MB 578MB 105MB fat32 EFI system partition boot, esp 3 578MB 595MB 16.8MB Microsoft reserved partition msftres 4 595MB 210GB 209GB ntfs Basic data partition msftdata 5 210GB 210GB 1049kB bios_grub 6 210GB 487GB 278GB ext4 7 487GB 500GB 12.8GB linux-swap(v1)I expected to find a refind.conf in /dev/sdb2 but I didn't find anything. $ tree -L 3 /boot/efi/ /boot/efi/ └── EFI ├── Boot │ └── bootx64.efi ├── Microsoft │ ├── Boot │ ├── bootmgfw.efi │ └── Recovery └── toolsAnother thing to mention is that the output of efibootmgr is unexpected : $ efibootmgr BootCurrent: 0000 No BootOrder is set; firmware will attempt recoveryWhat do I have to do to boot by default to Debian ? EDIT: As said in the text, I thought that Windows was selected by default but it is the latest booted OS that is selected by default. I didn't succeed in changing the configuration of rEFInd but I can live with the default one.
How to boot by default to Debian Buster
Open refind_linux.conf on /boot Add the kernel boot parameter you want, for instance: "Boot with standard options" "root=UUID=bc31044c-8911-481d-8729-xxx ro quiet splash vt.handoff=7 i915.enable_psr=0"Then reboot and check with sudo cat /sys/module/i915/parameters/enable_psr should returns 0 (instead of -1)
I am new to Linux and very confused. I need to change the i915.enable_psr and i915.enable_guc parameters or modules or whatever they are called to prevent my laptop from being in a constant state of agony, but I only recently found out that pop!_os instead of grub uses systemd or refind to boot or something and I genuinely can't find the alternative to the GRUB_CMDLINE_LINUX_DEFAULT from grub, can anyone help me? And could anyone be kind enough to tell me what the difference between systemd or refind is? Or one better, what do they even mean? P.S. In case it matters this whole ordeal started because of this: i915 Atomic update failure on pipe AAnd no, moving to a different os didn't solve the problem. Sincerely, One hell of a confused Linux noob.
how to change kernel boot parameters in systemd or refind
According to https://gparted.org/livehd.php the options string should be quite a bit longer. Something like: options "boot=live config union=overlay username=user components noswap noeject vga=788 ip= net.ifnames=0 live-media-path=/live bootfrom=/dev/sda4 toram=filesystem.squashfs"The error would seem to indicate that /live/vmlinuz is not found. Make sure that your /dev/sda4 filesystem contains a directory named live and that it contains files vmlinuz and initrd.img. If I understand correctly, there should also be a file named filesystem.squashfs in the same directory. The location of the filesystem.squashfs file is given in two pieces: the directory at the live-media-path= option, and the filename in the toram= option. If the vmlinuz and initrd.img files are in some other location, make sure the pathnames on the loaderand initrd lines match the actual pathnames, relative to the root of the filesystem identified by the volume line. Likewise, if the filesystem.squashfs file is in a different location or named differently, adjust the options line to match reality. As a wild guess, if GParted Live's Linux kernel starts up successfully, but fails to find the filesystem.squashfs file, you might try adjusting the bootfrom= part on the options line to bootfrom=LABEL=ARCH_202104. If GParted's kernel detects your disks in a different order, this might or might not help. Because your filesystem type seems to be VFAT, it is supposedly case-insensitive... but rEFInd is using the UEFI firmware's filesystem support, and some UEFI firmware implementations are known to get the case-insensitiveness wrong. If you can see the auto-detected version, use the exact same character case as it does.
I downloaded GParted live archive and extracted it to /dev/sda4. The GParted guide explains installation with grub, but since I'm not using grub I wanted to give it a shot adding a manual entry to rEFInd. This is the pratition tree. NAME MOUNTPOINT LABEL SIZE TYPE FSTYPE sda 111.8G disk ├─sda1 Recovery 499M part ntfs ├─sda2 99M part vfat ├─sda3 16M part ├─sda4 ARCH_202104 16.1G part vfat └─sda5 Data 95.1G part ntfs sdb 931.5G disk ├─sdb1 1M part ├─sdb2 15M part ├─sdb3 Main 833.8G part ntfs └─sdb4 /mnt/ArchData 97.7G part ext4 nvme0n1 931.5G disk ├─nvme0n1p1 16M part ├─nvme0n1p2 Main M.2 433G part ntfs └─nvme0n1p3 / Arch 494.6G part ext4rEFInd is installed on sda2 and GParted is on sda4(ARCH_202104) and in refind.conf I've added an entry like so: menuentry "GParted Live" { icon /EFI/refind/icons/os_linux.png volume "ARCH_202104" loader /live/vmlinuz initrd /live/initrd.img options "root=/dev/sda4 rw add_efi_memmap" }Restarting and booting from that new entry in rEFInd yields the error Invalid loader file. Error not found while loading. And it yanks me back to rEFInd loader. In the end I let rEFInd scan for new entries itself, it adds it correctly and I can boot GParted, but when I add the stanza manually it's not working. I want to know what was the mistake I made?
rEFInd manual stanza for GParted live
The solution in this answer solves this problem. Specifically:By security, I added all the "drivers_x64" folder by doing ./install.sh --alldrivers at the rEFInd installationOn my EFI partition under Yosemite (stored on/dev/disk0s1), I renamed the "refind" folder to "BOOT"Inside that folder, I renamed "refind_x64.efi" to "bootx64.efi"
I have installed refind on it's own dedicated partition on my Macbook Pro so that I can boot Linux, but it takes almost 30 seconds between switching the computer on and seeing the refind menu. Is there any way to speed up the boot process using refind?
Refind Boot Too Slow 30 Seconds
I love explaining this kind of thing through visualization. :-) Think of your SSH connections as tubes. Big tubes. Normally, you'll reach through these tubes to run a shell on a remote computer. The shell runs in a virtual terminal (tty) through that tube. But you know this part already. Think of your tunnel as another tube within a tube. You still have the big SSH connection, but the -L or -R option lets you set up a smaller tube inside it. Your ssh remote shell actually communicates with you using one of these smaller, embedded tubes attached to stdio. Every tube has a beginning and an end. The big tube, your SSH connection, started with your SSH client and ends up at the SSH server you connected to. All the smaller tubes have the same endpoints, except that the role of "start" or "end" is determined by whether you used -L or -R (respectively) to create them. (You haven't said, but I'm going to assume that the "remote" machine you've mentioned, the one behind the firewall, can access the Internet using Network Address Translation (NAT). This is kind of important, so please correct this assumption if it is false.) When you create a tunnel, you specify an address and port on which it will answer (or "bind"), and an address and port to which it will be delivered. The -L option tells the tunnel to bind on the local side of the tunnel (the host running your client). The -R option tells the tunnel to bind on the remote side (the SSH server).So... To be able to SSH from the Internet into a host behind a firewall, you need the target host to open an SSH connection to a host on the outside and include a -R tunnel whose "entry" point is the "remote" side of its connection. Of the two models shown above, you want the one on the right. From the firewalled host: ssh -f -N -T -R22222:localhost:22 yourpublichost.example.comThis tells the client on your target host to establish a tunnel with a -Remote entry point. Anything that attaches to port 22222 on the far end of the tunnel will actually reach "localhost port 22", where "localhost" is from the perspective of the exit point of the tunnel (i.e. your ssh client in this case, on the target host). The other options are:-f tells ssh to background itself after it authenticates, so you don't have to sit around running something like sleep on the remote server for the tunnel to remain alive. -N says that you want an SSH connection, but you don't actually want to run any remote commands. If all you're creating is a tunnel, then including this option saves resources. -T disables pseudo-tty allocation, which is appropriate because you're not trying to create an interactive shell.There will be a password challenge unless you have set up a key for a passwordless login. (Note that if you intend to leave a connection open long term, unattended, possibly having it automatically refresh the connection when it goes down (by parsing ssh -O check <remotehost>), I recommend using a separate, unique SSH key for it that you set up for just this tunnel/customer/server, especially if you are using RemoteForward. Trust no one.) Now that the -R service tunnel is active, you can connect to it from yourpublichost, establish a connection to the firewalled host through the tunnel: ssh -p 22222 username@localhostYou'll get a host key challenge, as you've probably never hit this host before. Then you'll get a password challenge for the username account (unless you've set up keys for passwordless login). If you're going to be accessing this host on a regular basis, you can also simplify access by adding a few lines to your ~/.ssh/config file on yourpublichost: host firewalledhost User firewalleduser Hostname localhost Port 22222Adjust firewalledhost and firewalleduser to suit. The firewalleduser field must match your username on the remote server, but firewalledhost can be any name that suits you, the name doesn't have to match anything resolvable, since your connection is governed by Hostname and Port. Alternately, if you want to reach this from elsewhere on the Internet, you might add the following to your ~/.ssh/config: host firewalledhost ProxyCommand ssh -fWlocalhost:22222 yourpublichost The -W option is used to open a connection to a remote host in order to continue the SSH conversation. It implies -N and -T. See also:Expose the reverse endpoint on a non-localhost IP Tips on using ControlMaster to maintain your tunnel
As I understand this, firewalls (assuming default settings) deny all incoming traffic that has no prior corresponding outgoing traffic. Based on Reversing an ssh connection and SSH Tunneling Made Easy, reverse SSH tunneling can be used to get around pesky firewall restrictions. I would like to execute shell commands on a remote machine. The remote machine has its own firewall and is behind an additional firewall (router). It has an IP address like 192.168.1.126 (or something similar). I am not behind a firewall and I know the remote machine's IP address as seen from the Internet (not the 192.168.1.126 address). Additionally, I can ask someone to execute ssh (something) as root on the remote machine first. Could anyone explain me, step by step, how reverse SSH tunneling works to get around the firewalls (local and remote machines' firewalls and the additional firewall between them)? What is the role of the switches (-R, -f, -L, -N)?
How does reverse SSH tunneling work?
Running an strace on the remote system where xauth is failing will show you what's tripping up xauth. For example $ strace xauth list stat("/home/sam/.Xauthority-c", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 open("/home/sam/.Xauthority-c", O_WRONLY|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists) rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 nanosleep({2, 0}, 0x7fff6c4430e0) = 0 open("/home/sam/.Xauthority-c", O_WRONLY|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists) rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 nanosleep({2, 0}, 0x7fff6c4430e0) = 0 open("/home/sam/.Xauthority-c", O_WRONLY|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists) rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0So xauth is attempting to open a file and it already exists. The culprit file is /home/sam/.Xauthority-c. We can confirm the presence of this file on the remote system: $ ls -l .Xauthority* -rw------- 1 sam sam 55 Jul 12 22:04 .Xauthority -rw------- 1 sam sam 0 Jul 12 22:36 .Xauthority-c -rw------- 1 sam sam 0 Jul 12 22:36 .Xauthority-lThe fix As it turns out. Those files are lock files for .Xauthority, so simply removing them resolves the issue. $ rm -fr .Xauthority-*With the files deleted, exit from the SSH connection and then reconnect. This will allow xauth to re-run successfully. $ ssh -t skinner ssh sam@blackbird Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-44-generic x86_64) * Documentation: https://help.ubuntu.com/Last login: Sun Jul 12 22:37:54 2015 from skinner.bubba.net $Now we're able to run xauth list and X11 applications without issue. $ xauth list blackbird/unix:10 MIT-MAGIC-COOKIE-1 cf01f793d2a5ece0ea58196ab5a7977aThe GUI $ xeyesAlternative method to resolve the issue I came across this post titled: xauth: error in locking authority file .Xauthority [linux, ssh, X11] which mentions the use of xauth -b to break any lock files that may be hanging around. xauth's man page seems to back this up: -b This option indicates that xauth should attempt to break any authority file locks before proceeding. Use this option only to clean up stale locks.ReferencesDealing with xauth “error in locking authority file” errors
While attempting to SSH into a host I received the following message from xauth:/usr/bin/xauth: timeout in locking authority file /home/sam/.XauthorityNOTE: I was trying to remote display an X11 GUI via an SSH connection so I needed xauth to be able to create a $HOME/.Xauthority file successfully, but as that message was indicating, it was clearly not. Attempts to run any X11 based apps, such as xeyes were greeted with this message: $ xeyes X11 connection rejected because of wrong authentication. Error: Can't open display: localhost:10.0How can I resolve this issue?
Why am I getting this message from xauth: "timeout in locking authority file /home/<user>/.Xauthority"?
SummaryAnsible is a DevOps tool that is a powerful replacement for PowerShell RunDeck as a graphical interface is handy Some people run RunDeck+Ansible togetherclusterssh For sending remote commands to several servers, for a beginner, I would recommend clusterssh To install clusterssh in Debian: apt-get install clustersshAnother clusterssh tutorial: ClusterSSH is a Tk/Perl wrapper around standard Linux tools like XTerm and SSH. As such, it'll run on just about any POSIX-compliant OS where the libraries exist — I've run it on Linux, Solaris, and Mac OS X. It requires the Perl libraries Tk (perl-tk on Debian or Ubuntu) and X11::Protocol (libx11-protocol-perl on Debian or Ubuntu), in addition to xterm and OpenSSH.Ansible As for a remote framework for multiple systems administration, Ansible is a very interesting alternative to Puppet. It is more lean, and it does not need dedicated remote agents as it works over SSH (it also has been bought by RedHat) The Playbooks are more elaborate than the command line options. However, to start using Ansible you need a simple installation and to setup the clients list text file. Afterwards, to run a command in all servers, it is as simple as doing: ansible all -m command -a "uptime"The output also is very nicely formatted and separated per rule/server, and while running it in the background can be redirected to a file and consulted later. You can start with simple rules, and Ansible usage will get more interesting as you grow in Linux, and your infra-structure becomes larger. As such it will do so much more than PowerShell. As an example, a very simple Playbook to upgrade Linux servers that I wrote: --- - hosts: all become: yes gather_facts: False tasks: - name: updates a server apt: update_cache=yes - name: upgrade a server apt: upgrade=fullIt also has many modules defined that let you easily write comprehensive policies. Module Index - Ansible Documentation It also has got an interesting official hub/"social" network of repositories to search for already made ansible policies by the community. Ansible Galaxy Ansible is also widely used, and you will find lots of projects in github, like this one from myself for FreeRadius setup. While Ansible is a free open source framework, it also has a paid web panel interface, Ansible Tower although the licensing is rather expensive. Nowadays, after RedHat bought it, tower has also the open source version known as AWX. As a bonus, Ansible also is capable of administering Windows servers, though I have never used it for that. It is also capable of administering networking equipment (routers, switches, and firewall), which make it a very interesting solution as an automation turn key solution. How to install Ansible Rundeck Yet again, for a remote framework easier to use, but not so potent as Ansible, I do recommend Rundeck. It is a very powerful multi-user/login graphical interface where you can automate much of your common day-to-day tasks, and even give watered down views to sysops or helpdesk people. When running the commands, it also gives you windows with the output broken down by server/task. It can run multiple jobs in the background seamlessly, and allows you to see the report and output later on.How to install RunDeck Please note there are people running Ansible+RunDeck as a web interface; not all cases are appropriated for that. It also goes without saying that using Ansible and/or RunDeck can be construed as a form or part of the infra-structure documentation, and over time allows to replicate and improve the actions/recipes/Playbooks. Lastly, talking about a central command server, I would create one just up for the task. Actually the technical term is a jump box. 'Jump boxes' improve security, if you set them up right.
Coming from Windows administration, I want to dig deeper in Linux (Debian). One of my burning questions I could not answer searching the web (didn't find it) is: how can I achieve the so called "one-to-many" remoting like in PowerShell for Windows? To break it down to the basics I would say: My view on Linux: I can ssh into a server and type my command I get the result. For an environment of 10 servers I would have to write a (perl/python?) script sending the command for each of them?My experience from Windows: I type my command and with "invoke-command" I can "send" this to a bunch of servers (maybe from a textfile) to execute simultaneously and get the result back (as an object for further work). I can even establish multiple sessions, the connection is held in the background, and selectively send commands to these sessions, and remote in and out like I need.(I heard of chef, puppet, etc. Is this something like that?)Update 2019: After trying a lot - I suggest Rex (see this comment below) - easy setup (effectively it just needs ssh, nothing else) and use (if you know just a little bit perl it's even better, but it's optional) With Rex(ify) you can do adhoc command and advance it to a real configuration management (...meaning: it is a CM in first place, but nice for adhoc tasks, too) The website seams outdated, but currently (as of 01/2019) it's in active development and the IRC-Channel is also active. With Windows' new openssh there are even more possibilities you can try: rex -u user -p password -H 192.168.1.3 -e 'say run "hostname"'
Linux equivalent to PowerShell's "one-to-many" remoting
It depends what exactly you need and what you are looking for. But in general there exists multiple solutions for "configuration management like:puppet chef cfengine ansible saltetc. I personally would recommend puppet as it has a big community and a lot of external provided recipes. This allows you to configure and manage systems automatically. If you combine this with own repositories and automated updates via e.g. unattended-upgrades you can automatically update the system. Another solution is just to provide your own packages like company-base etc. which automatically depends on the necessary software and can configure your system automatically. You should also look into automates deployments (barebone and virtualized). If you combine this with configuration management or your own repository you can easily automate and reinstall your systems. If you want to get started with automated installation have a look at theforman which supports libvirt as well as bare bone installations and has integrated puppet support. If you want do do it yourself you can look into kickstart (redhat et. al.) or "preseeding" to automatically configure your system. For Debian you can also use something like debootstrap or a wrapper named grml-debootstrap supporting virtualized images. To help providing the VirtualBox images for your developer have a look at vagrant it allows you to automate the creation of virtualized systems with VirtualBox supporting chef, puppet and shell scripts to customize your virtual environment. If you want to use the solution by your existing provider you should ask them how they manage your systems but it will probably be some kind of configuration managment. It may be possible to run their agent on your systems if you can access the configuration server. For google keywords look into devops, configuration management, it automation and server orchestration. In short automate as much as possible and don't even think about doing stuff manual.
Beside our internal IT infrastructure, we've got around 500 Linux machines hosting our services for the on-line world. They are grouped in a bunch of clusters like Database A-n, Product A-n, NFS, Backoffice and so on. Furthermore, they are administered by an external provider, according to our specifications and requirements. However, we face a lot of trouble during (web-) software development, roll-out and deploy - especially because the dev- and staging-environments have almost nothing in common with the live systems (I spare out the nasty details..). Thus, I've tried to create virtual machines, copied the various live-systems as exactly as possible and prepared them to connect to e.g. the development-databases instead of the "real" ones transparently for developers (they aren't root). This works pretty well, but... I was wondering how one could administer those systems remotely and in bulk? Is there some software family I'm not aware of? Or, at least, some techniques or principles one should be familiar with? We would provide every developer with a bunch of images to be run locally (VirtualBox). The QA dept. would get virtual clusters (XEN or Hyper-V). If I need to provide an additional server-module, re-route a new database connection or just want to update everything provided by the package manager... how could I possibly do that without being forced to log on to every system and/or ask my colleagues to download and run some fixture-script? I believe there are plenty of solutions. Well, somehow I'm too stupid to enter the correct keywords into the search engines... Or isn't this issue as trivial as it sounds? For the record:Almost all systems are running Debian GNU/Linux 6.x "squeeze" No developer is forced to use a particular OS at his/her workstation The budget is limited, of course, but not too small to buy proprietary software A solution that would involve our aforementioned provider is preferred
Linux Bulk/Remote Administration
The simplest way to do this would be to overwrite the entire drive with zeros. dd if=/dev/zero of=/dev/sdX bs=1MJust know that once you execute that, there's no going back. As soon as the command finishes, and you get back to a shell prompt, nothing will work and the box will be extremely unhappy. It might also be safer to background that operation by doing dd if=/dev/zero of=/dev/sdX bs=1M &That way if you lose your connection or something, the job doesn't die half way through wiping the drive.
I have a Godaddy dedicated server that I would like to cancel. Before I do that I'd like to do a clean format on the server to make sure that the next person who gets the server isn't able to undelete anything (I don't know how thorough Godaddy is when it comes to reformatting before giving the disk to someone else.) I of course don't have physical access to the machine, so whatever I do I'd have to do via ssh. I'm not really sure what I can actually do.
how do I wipe a server that I don't have physical access to?
That's all comes from quoting. Try this one: ssh [emailprotected] 'sqlite3 /home/aaron/dbname.db "UPDATE data SET \ LastStart = DATETIME('''NOW''') WHERE TaskName = '''taskname'''"'ps. You need to quote NOW, otherwise sqlite will try to find column with such name. But your quotes ' will be eaten by quotes from ssh. You can't escape ', therefore three quotes ''' are used (the first off ssh quote, second it the quote you need to pass to sqlite, and the last one open ssh quote again). pps. Furthermore you can inverse quotes like this: ssh [emailprotected] "sqlite3 /home/aaron/dbname.db \"UPDATE data SET \ LastStart = DATETIME('NOW') WHERE TaskName = 'taskname'\""
If this should be moved to the DBA exchange, I apologize. Feels more like linux than DB to me, so here goes: I've got some machines that run scheduled cron jobs every night and email me the output. I do not want emails for things like this. In general I think the way we use email is broken, but that's another story. So I started thinking that I could keep a central SQLite database that stored information about when the jobs started, and finished, and maybe even the output. Then I could just build a webpage that queries that and let's me know was going on last night. So I came up with a simple schema and can run this command at the beginning of a script. sqlite3 dbname.db "UPDATE data SET LastStart = DATETIME('NOW') WHERE TaskName = 'taskname'"So now I have a record that states that my job started and at what time. Hooray. Then I can run a similar command to put the time that the job ends. So. That works great if the database and the tasks are on the same machine. I go to another machine and need to update the sqlite database.... How can I do that efficiently? I tried this ssh [emailprotected] 'sqlite3 /home/aaron/dbname.db "UPDATE data SET LastStart = DATETIME('NOW') WHERE TaskName = 'taskname'"'But that returns: Error: no such column: NOWI tried some variations but didn't get anywhere. Am I close? Should I be doing something totally different? Am I reinventing the wheel?
perform remote sqlite command
Seriously, if your provider does not offer free (or at least cheap) manual assistance for extreme cases, it's time to switch. Otherwise, I think that you are pretty much OK with your setup. When your system is so broken that fsck can't fix it, there isn't much else to do, other than a complete reinstall. I actually haven't seen this happen unless there was a fatal hardware failure. One thing to note. For a machine like this, choose a stable distribution (Debian, RHEL, SLES), and definitely upgrade only after a suitably long period (new version stabilized for at least 6 months).
Consider a headless server like this: A typical x86 box at a remote location, which you can remotely initialize with a stock - say - Ubuntu image. After it is initialized you only can login via ssh - or remotely reset it, i.e. you can't access the BIOS or the boot manager prompt (say Grub 1). Perhaps some kind of KVM is available, but the use of KVM is very expensive and you have to book it on a hourly basis. Given this scenario, one can get paranoid about boot problems. For example:What if a kernel upgrade fails? what about a fsck-prompt in the early boot process? Probably, ssh is not available yet ...Are there other gotchas to watch out for? For kernel upgrades I configure grub (the legacy one) such that the menu.lst preamble contains default saved fallback 2 # counts from 0and the first entry ends with: savedefault fallbackThe first grub entry is the upgraded kernel, and the third is a known working one. See also the grub manual section on fallback boot. I changed the startup script /etc/rc.local (on a Debian-like system) to the effect that the default-entry setting is reset in case of a successful boot: grub-set-default 0This grub-setup works, but e.g. on Ubuntu this is not the default and one has to manually adjust the menu.lst after each kernel update. I supply panic=60as kernel parameter such that, e.g. in case of a wrong root= parameter or broken kernel, the system automatically reboots in case of an error. About the fsck issue I am not sure what the best way is. On Debian-like systems you can set FSCKFIX=yesin /etc/default/rcS, which tells fsck to auto-repair by default. But if the auto-repair fails, perhaps I still get a prompt I can't access remotely? Alternatively I could just disable fsck-checking via a zero in the sixth column of /etc/fstab - in case of a fs-error would then just re-initialize the system and restore the backups - thus avoiding all the fsck trouble?
How to setup linux server for headless use?
iTALC lets you monitor and control several computers in a classroom environment. It might do what you need. I'm not sure about showing a student's screen on all others, though. There is also LanSchool, Nettop, and NetSupport Assist, all of which are commercial solutions. If none of those are what you're looking for, you might want to take a look at Wikipedia's Comparison of Remote Desktop Software.
In a schoolroom there are 15 machines + 1 the teacher's PC. All have ex.: Ubuntu 10.04 LTS.Are there any softwares that can be used on the teachers machine that can "audit" the students 15 PC? Things needed: - teacher must see the students "display" from his PC. - teacher could show 1 students "display" to all of the other students or his own monitor. - extra: teacher could "control" the students machine remotely (ex.: to show the student the good solution for a given exercise)
"supervisory" software for school rooms
If it is something that needs to happen at regularly scheduled intervals use cron( e.g. you need to check the website once every hour, or once every day, or more or less frequently than that but still not arbitrarily defined). However... You may want to run a command at a cerain later time rather than right now, for that you want to use the at daemon, which allows you to run a command once at a later date/time (like it's 5 o'clock and you want to go home but you've got a 4 hour process that would be best run in the middle of the night, and it's not reoccurring). I will say nohup, screen , tmux have been mentioned, use nohup if you want to run it right now but don't want to reconnnect to that session to check on it later. screen/tmux are for checking on it later.
I'm new to Linux, and I'm probably asking a fairly basic question. How do I run a continuous program on Linux? Basically, I have a program that will continuously check for content on a website. This program will be executing for several days. I do not have administrative privileges on the computer I wish to run this program on, and I do not have exclusive access to this computer either, meaning that other users can log on physically. Moreover, barring some untold disaster, the computer will be running for the entire duration of my program. I know that I can SSH into the machine and run the program. However, this is not desirable as I would need a second machine to do it (which kind of defeats the point of what I'm doing), not to mention timeout issues. Is there a way I can run my program on the computer remotely without establishing a connection of some sort after I get it started?
Running continuous jobs remotely
Performing SSH tunneling can get a bit confusing with all the terminology, but there is a complementary feature to -L, which provides you the ability to "dynamically" assign ports by allocating a socket locally, instead of a single port. From the man page: -D [bind_address:]port Specifies a local ``dynamic'' application-level port forwarding. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server. Only root can forward privileged ports. Dynamic port forwardings can also be specified in the configuration file.By allocating a socket, all the traffic can be funneled through to the remote site, including DNS queries. How to use it For starters you'll need to open up a connection to your LAN (through its public IP address on the internet) like so: $ ssh -D 1234 myserverNOTE: This assumes that you have the ability to SSH into a server that's accessible through your public internet IP address. Once that's setup, in another terminal, you'll want to configure your web browser to make use of this tunnel. NOTE: This type of tunnel is providing you a socket, so to connect to it, you need to tell your web browser to proxy all of its traffic via this socket. This is typically shown as a SOCKS or SOCKS v5 type of connection for your proxy. An example In this example I'll show how you can do it using Chromium, via the CLI: $ ./Chromium --proxy-server="socks5://localhost:1234"Here I'm launching Chromium and pointing it to the SSH tunnel which we earlier configured on our localhost's port 1234. And with this, if I then attempt to visit a URL for a server that's configured on my LAN, I'm directed to it:Proxying with other browsers All the major browsers provide this feature and it's covered pretty extensively on other SE sites such as SuperUser:How can I change the proxy settings for Google Chrome? How to setup proxy settings in firefox?You can even make use of extensions to the various browsers which allow you to selectively proxy only certain traffic, while allowing you to route everything else out over your normal connection to the internet. For example, you can use ProxySwitchy! with Chrome to do exactly that:
I recently setup FreeIPA on an internally accessible system at home. I'd like to manage this web UI from networks that are external to my LAN, but at the same time, I don't want to have to expose this web UI to the public internet. Is there a way I can access it through an SSH tunnel? NOTE: I'm familiar with setting up a tunnel using ssh & it's -L switch like so: $ ssh -L 12345:ipa.local.net:80 mysshserverHowever this approach will not work in this scenario, since accessing FreeIPA requires that you use the actual hostname of the server in addition to being able to access the web UI using both ports 443 and 80. Is there another way to accomplish this beyond ssh -L?
How can I remotely access an intranet website from an external network via an SSH tunnel?
If you're using it as a storage device I would configure it now, turn it on, and share your drive via NFS/SAMBA, etc, then never touch it again. Effecively, you're turning your laptop into a NAS. Something like FreeNAS might be worth looking at. It provides a web-based GUI which should suffice for most tasks, leaving remote/command line work for only very deep stuff (which is typical on any system, and FreeNAS is well-documented and has an active community were you could seek further support). What I would question is now often you really will need to remote into it. You're just sharing storage, so why connect to the box?
My current laptop is falling apart, specifically the screen hinges. Once (or ideally before) they break, I'd like to run the machine as a storage device. I strongly prefer using GUIs over CLI. Any recommendations on a distro/useful tools to install before turning it into a box? Any cautionary tales about running a laptop without a screen? So far I imagine installing Ubuntu (not Server) and running Remmina to remoting in via VNC/etc.
Can I still use a GUI on a headless laptop (used for storage)?
Theoretically, sure. You could theoretically change a Fedora box to Slackware in place, if you cared enough to take the time it would require to do so without destroying something. Generally, it's seen as not worth the effort. You'll notice, after reading the CentOS/SL documentation, that they don't even recommend upgrading between major releases in-place, even interactively at the console. Going from bleeding edge Fedora to, say, CentOS 6, would be even worse, as it's effectively a downgrade, from a features and versions perspective. You may have noticed that it's often a lot more work to downgrade a single RPM than to upgrade one; now realize that you're talking about doing this for around a thousand RPMs for a fairly bare-bones server, more for a system with the Desktop, Workstation, or Everything package sets installed. Best practice is to back up, reinstall the OS from scratch, and restore. If you can do it, try it on a VM first. You might then be able to deploy that VM directly to the hosting provider, once you finalize it. If not, then at least take notes along the way, so you can make the switch-over quickly. Exactly how you go about backing up and restoring is actually a pile of separate questions. For example, the MySQL DB probably should be backed up more intelligently than just stopping the server and copying the raw DB files, since you're likely going to be downgrading the server version along with the OS change. You'd want to do a SQL dump instead. Just one example among several, you'll probably find.
I have a headless Fedora 15 (without GUI) box. With the following partition structure: $ df -T -h Filesystem Type Size Used Avail Use% Mounted on rootfs rootfs 49G 2.8G 46G 6% / udev devtmpfs 1.7G 4.0K 1.7G 1% /dev tmpfs tmpfs 1.7G 0 1.7G 0% /dev/shm tmpfs tmpfs 1.7G 604K 1.7G 1% /run /dev/sda1 ext4 49G 2.8G 46G 6% / tmpfs tmpfs 1.7G 0 1.7G 0% /sys/fs/cgroup tmpfs tmpfs 1.7G 0 1.7G 0% /media /dev/sda5 ext4 388G 35G 334G 10% /var /dev/sda2 ext4 28G 1.7G 25G 7% /homeI am tired of Fedora Project's policy of 12-14 month support cycle (they may have their reasons) and intend to migrate to something more stable like Scientific Linux or CentOS. Most of my data is in /var (MySQL, Redis & Apache Docroot) and /home. Is it possible that I can migrate from fedora to other RH family distro by preserving the directories /var and /home and do so remotely? (Under dire circumstances I am willing to carry a monitor and keyboard to it.) If yes, then what are the steps for the same?
Changing linux distro remotely while preserving data
Install etckeeper. On Ubuntu, that's the etckeeper package . Choose your favorite version control system (amongst Bazaar, Darcs, Git and Mercury). Run etckeeper init. Now, every time you modify a configuration file, run sudo bzr commit from /etc (or sudo git commit or whatever). Also, every time you install, upgrade or remove a package, changes in /etc will be automatically committed to version control (with a generic message, so it's best to commit manually with a meaningful message). To revert to an earlier version, use bzr revert (or …).
I want to setup froxlor on not fresh install remote server (Ubuntu 10.04.2). I take care of admin the server since two month. Before I start, the previous guy installed and config some services and files. I don't know what he exactly does, I can only view what he installed (by the history) but not what he edit. I want to install the Server-Management-Panel 'Froxlor' to administrate the whole stuff with it and not doing it manually by ssh. My cousin (he rent the server) should also be able to config some stuff with the browser. These services already installed and configured and usedapache 2 + php 5 + mysql 5.1 proftp 1.3 postfix 2.7 + courier 0.62The tutorials I found, are based on fresh install system. I already installed froxlor, but for using it I have to execute some scripts and change/overwrite the config files of the services. But if I do it, the current configurations will be lost. What's the best practice to backup the configs as simple as possible (with less effort and problems) and configure froxlor and then merge the backuped files. Which data / config files I have to backup?
Best practice to backup /etc config files
It's easy:[execute from office machine] Setup connection Office -> Home (as Home has public IP). This will setup reverse tunnel from your office machine to home. ssh -CNR 19999:localhost:22 homeuser@home [execute from home machine] Connect to your office from home. This will use tunnel from the step 1. ssh -p 19999 officeuser@homePlease ensure, that ssh tunneling is not against your company policies, cause sometimes you can get fired for such connection schema (e.g. my employer will fire me for that). ps. In the first step you may want to use autossh or something like that, so your tunnel connection will be automatically restored in case of unstable network.
My office has one default gateway and behind that is a local network with locally assigned IP addresses to all computers including mine. I hold admin in my Ubuntu installed office PC and is it essential that I access the computer during weekends through SSH. At office, I do not have a public IP but I always get the same local IP from the DHCP. I'm free to set up any software I like in my pc although I cannot set up port forwarding in the main firewall. I get a public IP to my home computer which also runs Linux. please note I cannot install Team Viewer-like software. How can I solve my problem?
SSH PC at office in local network from home
I would use the application Vinagre.You invoke it from the command line like so: $ vinagreThere is also a applet that should be available when you install it so that you can just pick machines that you've bookmarked with it form a pulldown when you add the applet to your toolbar.
I have a few different Desktop versions of Ubuntus (13.04, 12.04, Kubuntu,..) on different computers. I would like to manage all of them on a single computer via remote connection and be able to use GUI programs on the remote computer as team viewer allows. But, team viewer provides a limited connection time for the free versions. Therefore, I am looking for a substitute that it is easy to install, use, and works fine on different versions of Ubuntu desktops, and freeware. What would be your suggestion?
remote desktop connection - similar to team viewer
I know some tools for that, but the easiest is Fabric. Take a look and tell me what do you think.
I want to execute a process on multiple servers. I am using the following wrapper script. The script moves to servers one at a time. I would like to change it so it can execute on multiple servers. Is there way to do it? #!/bin/bash for ip in $(<ALL_SERVERS_IP); do # Tell the remote server to start bash, but since its # standard input is not a TTY it will start bash in # noninteractive mode. ssh -q "$ip" bash <<-'EOF' printf "%s\n" ================== "$(hostname) ::: Current date : $(date)" \ ================== ./remote EOF done
Running commands on multiple servers [duplicate]
I'd recommend you install procmail or some other mail processor. You can configure it so everything from you, with a subject line of a certain magical password that only you know will pass the contents to a script (which you could then execute). But... you're opening a huge security hole so it's unwise to do this as it's an unencrypted form of remote access to your server.
I administer a home server, and sometimes when I'm out, I need to execute some simple commands on the server. 3G + SSH is not an option because it's too expensive from my phone (here in Argentina). It is easier to send an SMS to my mail account. I want to fetch the mails I send to my server, and process the text surrounded by ** as bash commands. What approach would you recommend?
How to fetch and process mail in order to execute commands?
You could build the described system using iptables, ipset and pam_exec. The idea is following: There is a separate chain containing rules to allow incoming traffic to these higher ports. Iptables INPUT chain contains an ipset rule matching your logged in hosts, jumping to the separate chain. On successful log in, a pam_exec runs a script (at PAM session open) adding the remote host's IP address to the ipset set, and similarly removes it when PAM session is closed. Configuring IPTABLES and IPSET Create a set for user's IP addresses. Since ipsets are not persistent, so you need to configure the set to be created on boot before iptables are restored. ipset -N users hash:ipConfigure iptables. A new INPUT-users chain which will contain the rules to allow traffic for logged in users. iptables -N INPUT-usersIf the source address is in users set, jump to INPUT-users chain. iptables -A INPUT -m set --match-set users src -j INPUT-usersAdd relevant rules to INPUT-users chain. These rules will be used for traffic with source address matching your user's. For example to allow tcp port 16384: iptables -A INPUT-users -p tcp --dport 16384Configuring PAM Create following scripts to be executed on pam session open/close. The IP address will be in PAM_RHOST environmental variable set by pam_exec. /etc/security/pam_exec-session_open: #!/bin/sh ipset --exist --add users "$PAM_RHOST"/etc/security/pam_exec-session_close: #!/bin/sh ipset --del users "$PAM_RHOST"Then configure pam to use them for ssh sessions. Append to /etc/pam.d/sshd: session optional pam_exec.so type=open_session /etc/security/pam_exec-session_open session optional pam_exec.so type=close_session /etc/security/pam_exec-session_closePitfallsIf your user has multiple ssh sessions open, closing any of them will remove the IP address from the ipset. To avoid this, you need to write some check for the session_close script to remove the IP address only if it is the last session remaining for the user. Should your user connect behind NAT, after connecting anyone behind the same NAT will match the ipset rule (allowed access).
We have a VPS running on AWS, although generic solution is expected regardless of hosting vendor. This VPS is acting as a Jump Box (running CentOS 6) for various other internal server such as SSH access to various other boxes (which are connected to the Jump Box thru reverse SSH). The Jump Box exposes random higher port for each service. Is there a possibility to expose these higher ports only to the IP address which is currently SSH'ed into the Jump Box? I was thinking about scanning output of who -a to filter the IP address and update the IPTABLES using a cronjob or maybe update the security group of AWS using API. But this approach seems sketchy. Any suggestions?
Expose public ports only to the sshed user
You can either setup a management agent on the OS - or setup some tool that can manage your system over SSH. In terms of maturity and ease of use - I'd say go for Webmin or one of the alternatives. Here are some other examples, in order of increasing complexity: WebminWebmin is a web-based interface for system administration for Unix. Using any modern web browser you can manage a system from the console or remotely. Webmin can also be setup to manage remote systems, as described in The Cluster Webmin Configuration module Usermin can be used by non-root users and and Virtualmin can be used to manage virtual domains and such.A few notes on security:Using SSL with Webmin or using STunnel Security Webmin SANS: Securing Webmin with Tcp Wrappers and SSH Port Forwarding As always, keep your server and webmin up to date and follow security advisories. Setup a firewall and ensure access to webmin is permitted only from trusted IPs.ISPConfigManage one or more servers from one control panel; Open Source and supports SuSE among other distributions; Take a look at the Online Demo to see if it does what you want;Rundeck - runbook automationCreate jobs, track and manage jobs from a Web interface Requires scriptingPuppet, Chef, Salt, Rex or Ansible - Configuration Management Different approach to administration - with configuration management.Most come with an official WebUI Alternative GUI options exist: Puppet web GUI, Chef Server WebUI Other options:Anything that can connect over SSH or run an agent can get the job done. For example, you could even use Jenkins to manage your system. List of web management software: http://alternativeto.net/software/webmin/ http://www.tecmint.com/web-control-panels-to-manage-linux-servers/ You could even manage a SuSE system from Microsoft Systems Center... to some extent.
I am running an openSUSE server without any GUI components (for the classical reasons: performance, security, patching, etc.). Are there Linux related graphical tools that I can run on my local (Windows) machines (alternatively local Linux VMs) that allow me to control/administer the remote server? Basically tools that connect and read out the current configs (e.g. networking, partitions, etc.) and allow me to make changes on the local GUI that are then via commands over SSH (or some other protocol) automatically transferred back to the openSUSE server to actually change the settings there? All the options that I was able to find so far are approaches that require GUI elements on the server such as X11Forwarding or VNC access, for example this question. Is this the only available way?
Local graphical tools to control remote non-GUI server
You'll need the remote hands to get into the system via the console and run telinit 3 or telinit 5 if either of those were the runlevels you were using previously.
I have a linux machine that I was accessing remotely and I made the mistake of doing #init 1 which turned off networking on the machine. What is the easiest way to turn networking back on and/or get the machine out of single user mode? I do have personnel that can access the machine locally if necessary.
How to turn off single user mode on a remote machine?
I've did the exact same thing recently to connect to IoT devices connected on the Internet with mobile network and therefore under NAT. My solution is based on a micro-instance on Google Cloud. Its IP must be permanent, let's call it server_ip. No firewall rules seem needed. On your local device, that one that you'd like to connect remotely, run: ssh -N -R 5757:localhost:22 <server_ip>where 5757 is the listening port that will be opened on the server (it could be anything but grater than 1023). This instruct the server to On the end-device, e.g. on your laptop when you're away from home, run: ssh -J <server_ip> -p 5757 localhostthis will connect you via jump host, routing the ssh connection directly to the opened connection from your home device. To make everything more secure and smoother, I suggest you to use SSH key-based authentications, both in the server and in your home device. If you need further assistance, please comment.As a final note, the first command (ssh -N -R 5757:localhost:22 <server_ip>) must not be quit, therefore you have to run it with nohup or through a service. The latter solution is that one that I prefer, here is my service file: [Unit] Description=Reverse SSH to GCL on port 5757 After=network.target[Service] Type=simple User=flynn ExecStart=/usr/bin/ssh -N -R 5757:localhost:22 <server_ip> Restart=always StartLimitInterval=30[Install] WantedBy=multi-user.target
My ISP gives me a 192.168.* IP to my home router. Only the main company router in the building gets a real IPv4 IP but all of the tenants in the building share that. They don't do IP forwarding so I can't request port 22 to be forwarded just to me or anything like that. Using Tor, I can open a route to the Tor network and ssh in from the outside. However, it is very laggy as you can image. Similarly, my Synology NAS opens a route to a remote server at Synology and I can connect to it remotely. I would like to know what this transport system is called and how I can use it to connect my home machine to a VPS server that I already lease (aka my bastion host) so that I can ssh in remotely, via the bastion host, without needing to go through Tor. I love Tor, but the lag over ssh makes me crazy.
Setting up a bastion host to access local machine
You can prepare a minimal install inside a qemu KVM instance and then transfer the image to the remote system. For example to install a RAID-1 Centos 7 system: On you local workstation: $ truncate --size 5G disk1.img $ truncate --size 5G disk2.img $ qemu-system-x86_64 \ -cdrom CentOS-7.0-1406-x86_64-DVD/CentOS-7.0-1406-x86_64-DVD.iso \ -hda disk1.img -hdb disk2.img -m 2G -boot d -enable-kvm \ -net user,hostfwd=tcp::10022-:22 -net nic # enable net, ssh portforwardingInside the qemu instance, you can install CentOS 7 using the offical recommended installer - i.e. select the 2 disks, manual partitioning, automatically create partitions, select raid1 for the / volume group, select raid1 in the /boot device-type settings, etc. After the install is finished, you can even configure comfortably some basic stuff, e.g. update the system via yum update, accept the systems GPG keys, configure network (with the MAC-address of the target system), ssh keys etc. For later resizing it is important that you disable the RAID 1 write intent bitmap (inside the vm): # mdadm --grow /dev/md/*pv00 --bitmap noneTo transfer the image, i.e. the left leg of the mirror (from the workstation to the server): $ gzip -c disk1.img | ssh example.org "gzip -d | dd of=/dev/sda bs=128K"An minimal image should compress with a very good ratio - in my experiment compressed size was about ~ 230 MiB. For the right leg only the grub2 part is necessary: $ dd if=disk2.img bs=512 count=2048 | gzip -c \ | ssh example.org "zip -d | dd of=/dev/sdb bs=128K"On the server (inside the booted rescue system) you enlarge the root volume group: # partx -v --add /dev/sda # mdadm --stop /dev/md/*boot --stop /dev/md/*pv00 # echo -e 'd\n2\nn\np\n2\n\n\nt\nfd\nw\n' | fdisk /dev/sda # mdadm --run /dev/md/*boot --run /dev/*pv00 # mdadm --grow /dev/md/*pv00 --size max # pvresize /dev/md/*pv00 # lvchange --activate y centos/root # lvresize --resizefs --extents +100%FREE centos/root # echo -e 'd\n2\nn\np\n2\n\n\nt\nfd\nw\n' | fdisk /dev/sdb # mdadm --add /dev/md/*boot /dev/sdb1 # mdadm --add /dev/md/*pv00 /dev/sdb2 # mdadm --wait /dev/md/*pv00 # mdadm --grow /dev/md/*pv00 --bitmap internal # mdadm --wait /dev/md/*pv00 # shutdown -r nowAdvanced stuff When you want to use this method to install several bare metal machines from a base image you have to use some init scripts that adjust the base image. Besides the obvious stuff (e.g. hostname, network configuration etc.) you have to change all UUIDs in the systems. This includes UUIDs of:RAID devices LVM PVs and VGs Filesystems Swap Network configuration scripts under (/etc/sysconfig/network-scripts)And then, of course, you have to change all configuration files that use those UUIDS:/etc/default/grub (call grub2->mkconfig then ...) /etc/mdadm.conf /etc/fstabCaveats The process gets a little bit more complicated if the client/target system use different physical sector sizes. For example, when the target system uses 4k sectors (instead of 512 bytes). Then you have to configure qemu such that it also uses/emulates 4k physical sectors (which qemu is able to do). Another thing to watch out is whether the target system only support UEFI boot. In that case you would also have to make sure that qemu emulates UEFI as well. Conclusion Using a qemu kvm instance and then transplanting the resulting install to remote machine is a relatively straight-forward process.
Assuming a remote machine where you can PXE boot into a GRML image that also provides ssh access. Now the question is how to install CentOS in such an environment. Something like KVM access is not available. A few years ago I used debootstrap with success to install Debian in a similar environment. Is there is something similar for CentOS/RHEL? What is the state of the art method to install CentOS/RHEL in such an environment?
How to remote install CentOS/RHEL 7 using a rescue image like GRML?
It sounds like you currently have a default ssh connection between the laptop and server: Kubuntu_laptop--->nat_fw--->Debian_Server Modify the parameters to the ssh connection so you have -fNL [localIP:]localPort:remoteIP:remotePort For example: -fNL 5900:localhost:1234 If your laptop used VNC on the default port of 5900 then you would tell your laptop to vnc to localhost which would then send the VNC traffic on port 5900 to the server on port 1234. Next you need to catch the traffic arriving on port 1234 server side and forward that to the desktop: Debian_Server<--nat_fw<--Kubuntu_desktop Modify the parameters to the desktop ssh connection to include -fNR [remoteIP:]remotePort:localIP:localPortFor example: -fNR 1234:localhost:5900All traffic sent to port 1234 on the localhost of the server will now be transported to the desktop and arrive on port 5900 where the VNC server is hopefully listening. Change port 5900 to be appropriate for the protocol you are using. Could be 3389 for RDP or 5901 for VNC since 5900 might be in use. Also, I just picked port 1234 randomly for use on the server. *Some notes in response to your updated question:the default port for ssh is 22, so the -p 22 is redundant since it overrides the default and sets it to 22 the settings that look like localPort:remoteIP:remotePort have nothing to do with the port that ssh is using for the tunnel which is still 22 unless you override it on the client with a -p and override the port on the ssh server as well. So all of the previously mentioned ssh commands are using port 22 and you can confirm this by looking at your listening and established network connections. You will not need to open any additional ports on a firewall. The previous commands were correct. based on what you added in the update, the command for the desktop should be autossh -M 5234 -fNR 1234:localhost:5900 [emailprotected] sorry, I have no suggestions as far as a VNC client is concerned. You'll have to open a separate question for that, however I'm guessing it will be down-voted since it is an opinion question.
I want to replace TeamViewer with a FOSS solution. I need to support some remote computers. I have a working SSH tunnel set up between two computers using a middleman server like this: Kubuntu_laptop--->nat_fw--->Debian_Server<--nat_fw<--Kubuntu_desktopThis SSH tunnel is working now. Next I want to connect to the desktop on "Kubuntu_desktop" from "Kubuntu_laptop" using the SSH tunnel. Regarding the connection for this leg: Debian_Server<--nat_fw<--Kubuntu_desktopHere is how it is established: autossh -M 5234 -N -f -R 1234:localhost:22 [emailprotected] -p 22I cannot change the existing monitoring port (5234) or the remote (- R) port number (1234 in this example). Can vnc tunnel over this existing SSH connection? UPDATE: the answer is no; I need to set up a new SSH tunnel for use with vnc as described here. Regarding the connection for this leg: Kubuntu_laptop--->nat_fw--->Debian_ServerI can use any SSH parameters required. I cannot open up any ports on the routers/firewalls. x11vnc server was recommended to me, so I'm testing with that. It is running on the desktop and listening on port 5900. However, I did not use any command line options when starting x11vnc, so it probably isn't configured correctly yet. Will vnc work over this existing SSH connection? Notice that there are no ports 5900 defined. And note that I cannot change the port number for the -R option as I mentioned above. I have a lot of questions about how to get this working, but one is whether vnc can listen on the existing port (-R 1234 in the example above). And if so, can I still ssh into that box as I do now? Here's what I tried so far: On remote desktop (where x11vnc server is installed): tester@Kubuntu_desktop:~> autossh -M 5234 -i ~/.ssh/my_id_rsa -fNR 1234:localhost:5901 [emailprotected]make sure x11vnc server is running on port 5901: tester@Kubuntu_desktop:~> x11vnc -autoport 5901On my laptop: sudo ssh -NL 5901:localhost:1234 -i ~/.ssh/admin_id_rsa [emailprotected]connect local vnc client to localhost port 5901 Open KRDC in Kubuntu_laptop and connect to (vnc) localhost:5901I'm getting a failed connection - server not found.
Remote support: routing RDP over ssh tunnel?
You can disable the yes checking with the -f option to ssh-copy-id. The password should probably not be part of that script, assuming that script ends up somewhere that might be readable by others. Instead, I'd recommend writing a script like this: #!/bin/sh # Usage: myscript user passwordRMTUSER=$1 PASSWORD=$2 # just an example, but to highlight you can use brace expansions. hosts=("172.24.168.47" "172.24.168.48" 172.24.168.{200..213})for host in ${hosts[@]}; do runuser -u "${RMTUSER}" -- sshpass "-p${PASSWORD}" ssh-copy-id -f "root@${host}" done
I'm trying to copy a bunch of RSA keys to multiple servers for a specific user. Whenever I issue the ssh-copy-id command it asks me to confirm by typing "yes", then asks me for the password. I wanted to avoid wearing out my arms and fingers, so, I decided to create a script for this task, something like this: #!/bin/bash runuser -u $RMTUSER -- ssh-copy-id [emailprotected] runuser -u $RMTUSER -- ssh-copy-id [emailprotected] (...) runuser -u $RMTUSER -- ssh-copy-id [emailprotected] runuser -u $RMTUSER -- ssh-copy-id [emailprotected]I can't seem to find a good way to automate that task. Nothing seems to work. How can I input "yes" and the password automatically?I've realized my initial question was quite lackluster. I'm sorry for that... it remains above, though. I've improved the script to something similar to what Marcus proposed. I'm stuck at the "for" loop wondering how to pass that password for different server arrays. My host sets are all static and there's much more. #!/bin/bashLOCUSER="$1" # USER FOR REMOTE ACCESS RMTUSER="$2" # REMOTE USER PASSWD="$3" # SITE PASSWORD SITE="$4" # SERV SITEfunction uras() { for IP in "$@"; do runuser -u "${LOCUSER}" -- sshpass "-p${PASSWD}" ssh-copy-id "${RMTUSER}@${IP}" [ "$?" -eq "0" ] && echo "OK - $IP" || echo "FAIL! - $IP" done }case $SITE in "sa") ARRAY_A=( $(cat ./serv_a.txt) ) uras "${ARRAY_A[@]}" ;; "sb") ARRAY_B=( $(cat ./serv_b.txt) ) uras "${ARRAY_B[@]}" ;; "sc") ARRAY_C=( $(cat ./serv_c.txt) ) uras "${ARRAY_C[@]}" ;; *) echo "INVALID SITE" ;; esacStill, the script fails for every host. # ./auto_ssh_copy.sh [user] root [pass] [site] /bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/zabbix/.ssh/id_rsa.pub" FAIL! - 172.24.168.48 /bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/zabbix/.ssh/id_rsa.pub" FAIL! - 172.24.168.49 /bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/zabbix/.ssh/id_rsa.pub" FAIL! - 172.24.168.50 (...)I tried using "-f" as well, but the result is the same. I agree that using something robust like Ansible might be a better tool for the job, but unfortunately it is just not available in my working set for now. This is what I came up with so far.Finally I managed to copy all keys. The script above was missing option -o StrictHostKeyChecking=no, thus sshpass was returning exit code 6. The resulting command is this: runuser -u ${LOCUSER} -- sshpass -v -p${PASSWD} ssh-copy-id -o StrictHostKeyChecking=no ${RMTUSER}@${IP}Marcus awnser help a lot. Thanks everybody.
Automatic SSH prompt input
Your connection is encrypted. The "problem" is that the certificate is not trusted by Chrome because it is not signed by a trusted certification authority which makes sense because it was created by Cockpit and self signed. You can either ignore this (especially if you are connecting only from a private network) or get a certificate from a certification authority like Let's Encrypt. Cockpit with Let's Encrypt howto: https://github.com/cockpit-project/cockpit/wiki/Cockpit-with-LetsEncrypt
I've just installed cockpit on my CentOS 8 box: dnf install cockpitsystemctl start cockpit.socket systemctl enable cockpit.socketOnce I'd let it through the firewall, I can get it up on a.b.c.d:9090 in my browser. But Chrome is saying Not secure, with https crossed out in the address bar. When I click on the warning and then Certiciate (invalid) it tells me Windows does not have enough information to verify this certificate. It says the certificate was issued by myhostname, to myhostname, and that it's valid from today until 2031. If I go to Certification paththenCertificate statusit saysThe issuer of this certificate could not be found.` I'm unclear whether my connection IS encrypted or not. Is Chrome just saying it doesn't like the certificate, or is it actively not using it and forcing http? I've checked the guide at https://cockpit-project.org/guide/latest/https.html and running remotectl certificate I can confirm that the file is there and is apparently being used. How can I fix this? Thank you!
How can I fix broken https on Cockpit?
Up until a few years ago, ipmitool was undergoing rapid development. On some Linux distributions from around that time, the man page may not describe all the commands supported by the executable. In your case, setting Dell DRAC and iDRAC parameters is supported by ipmitool 1.8.11, and is done using the ipmitool delloem command. So you could use these commands: ipmitool delloem lan get ipmitool delloem lan set dedicated
I have a DELL server R610, on this server there is a RHEL 6.4 This server has an idrac entreprise. I would like to configure the idrac from command line, avoiding reboot. I read on the man page of ipmitool that I can use a command like : #ipmitool lan set 1 mode dedicatedbut the command return man page : usage: lan set <channel> <command> <parameter>I check another command from the man page, which is not existing on my server neither : #ipmitool lan get Others commands are working without issue like : #ipmitool lan printI am running ipmitool : ipmitool-1.8.11-13.el6.1.x86_64 I am wondering why I don't have all of the command available from man page ? Any idea ?
ipmitool set idrac mode
apt-get -qy update > /dev/null apt-get -qy dist-upgrade >> /var/log/apt/scripted-upgrades.logYou can send them both to /dev/null if you want-- but once its gone you can never look at what went wrong after issuing the command. Also if your /etc/apt/sources.list is in bad shape, running a plain interactive apt-get updateshould clue you in. The other guy has it right for scheduling updates for the system. This is for when I am calling a setup script once when I'm configuring a new server-- only you will know which one is appropriate for your needs.
Ubuntu : sudo DEBIAN_FRONTEND=noninteractive apt-get -y update sudo DEBIAN_FRONTEND=noninteractive apt-get -y upgrade sudo rebootScript is always interrupted after upgrade and then it will stay on the command line, it will never reboots. How to run non-interactive shell scripts correctly, is there a way ?
Why is my shell script hanging on `apt-get -y upgrade`?
Release a Window's PC's IP (Rephrased Question) You might be able to use the tool winexe to do this. $ winexe -U DOM/USER_NAME //remotePC "ipconfig /release"Release my IP (original question) The command is ifconfig <interface> on Linux. $ sudo ifconfig eth0 downWill bring down the interface. To release you can use dhclient <interface> to release the DHCP lease. $ sudo dhclient -r eth0
I'm working on BackTrack and I want to give a fake IP from my DHCP server to another PC. I'm trying to make that Windows PC run the command: ipconfig /release, but without remote access. I don't want to have to remote into the Windows PC and run ipconfig /release manually. I'd like to run this command remotely from my Linux box. I tried to send DHCP RELEASE packets with the application Yersinia... but it did not work. Any ideas?
How to force PC to release IP?
Q: "How could the password be requested for each play?" A: Use the variable ansible_password. For example, put the variable into the playbooks' vars - hosts: vms1 vars: ansible_password: connection passwd for vms1 tasks: - name: Copy ssh pub key to remote host ...- hosts: vms2 vars: ansible_password: connection passwd for vms2 tasks: - name: Copy ssh pub key to remote host ...See details shell> ansible-doc -t connection sshRead the passwords in the first play and use them later. For example, given the inventory shell> cat hosts [vms1] 192.168.7.211 192.168.7.212 192.168.7.213[vms2] 192.168.7.21 192.168.7.22 192.168.7.23[vms3] 192.168.7.111 192.168.7.112 192.168.7.113The playbook below shell> cat pb.yml - hosts: all gather_facts: false tasks: - block: - pause: prompt: "Password for {{ item }}" register: out loop: "{{ groups|difference(['all', 'ungrouped']) }}" - set_fact: passwords: "{{ dict(out.results|json_query('[].[item, user_input]')) }}" - debug: var: passwords run_once: true- hosts: vms1 gather_facts: false vars: ansible_password: "{{ passwords.vms1 }}" tasks: - debug: msg: "Copy ssh pub key to remote host by '{{ ansible_password }}'" run_once: true- hosts: vms2 gather_facts: false vars: ansible_password: "{{ passwords.vms2 }}" tasks: - debug: msg: "Copy ssh pub key to remote host by '{{ ansible_password }}'" run_once: true- hosts: vms3 gather_facts: false vars: ansible_password: "{{ passwords.vms3 }}" tasks: - debug: msg: "Copy ssh pub key to remote host by '{{ ansible_password }}'" run_once: trueprompts the user for the passwords in the first play and uses them later shell> ansible-playbook -i hosts pb.yml PLAY [all] ***********************************************************************************TASK [pause] ********************************************************************************* [pause] Password for vms1: passwd for vms1^Mok: [192.168.7.211] => (item=vms1) [pause] Password for vms2: passwd for vms2^Mok: [192.168.7.211] => (item=vms2) [pause] Password for vms3: passwd for vms3^Mok: [192.168.7.211] => (item=vms3)TASK [set_fact] ****************************************************************************** ok: [192.168.7.211]TASK [debug] ********************************************************************************* ok: [192.168.7.211] => passwords: vms1: passwd for vms1 vms2: passwd for vms2 vms3: passwd for vms3PLAY [vms1] **********************************************************************************TASK [debug] ********************************************************************************* ok: [192.168.7.211] => msg: Copy ssh pub key to remote host by 'passwd for vms1'PLAY [vms2] **********************************************************************************TASK [debug] ********************************************************************************* ok: [192.168.7.21] => msg: Copy ssh pub key to remote host by 'passwd for vms2'PLAY [vms3] **********************************************************************************TASK [debug] ********************************************************************************* ok: [192.168.7.111] => msg: Copy ssh pub key to remote host by 'passwd for vms3'PLAY RECAP *********************************************************************************** 192.168.7.111: ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 192.168.7.21: ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 192.168.7.211: ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
I want to push a new user's public key to a host invetory using Ansible. For that, a playbook was created like the following example. --- - name: vms1 - Authorize hosts with pub key hosts: vms1 tasks: - name: Copy ssh pub key to remote host ansible.posix.authorized_key: user: user1 state: present key: "{{ lookup('file', '/home/controluser/.ssh/id_rsa.pub') }}"- name: vms2 - Authorize hosts with pub key hosts: vms2 tasks: - name: Copy ssh pub key to remote host ansible.posix.authorized_key: user: user2 state: present key: "{{ lookup('file', '/home/controluser/.ssh/id_rsa.pub') }}"- name: vms3 - Authorize hosts with pub key hosts: vms3 tasks: - name: Copy ssh pub key to remote host ansible.posix.authorized_key: user: user3 state: present key: "{{ lookup('file', '/home/controluser/.ssh/id_rsa.pub') }}"The inventory goes like this. (with many more hosts) [vms1] 192.168.7.211 192.168.7.212 192.168.7.213[vms2] 192.168.7.21 192.168.7.22 192.168.7.23[vms3] 192.168.7.111 192.168.7.112 192.168.7.113Each play has its own host group and its own user. The playbook can be started with the following command. ansible-playbook -k -i inventory playbook.ymlWhen using -k option, it only asks the SSH password once. The issue I have is that the password is different for each group. Therefore, I would like to input the password for each play. How could the password be requested for each play?
Ansible - Push authorized key to multiple host groups with different passwords
Yes, you can. According to their sourceforge summary :As a modern web interface, it allows you to access and control remote VirtualBox instances.You will need :one server with Apache/PHP for running phpVirtualBox, one or multiple server running as host with VirtualBox web services each of these host supporting one or multiple guests. But as communication between them is based on an unencrypted SOAP protocol it's recommended to install all components on the same machine. For more information read:Manage VirtualBox over Web Interface from the FirstDigest Technology Blog, phpVirtualBox from the ArchLinux wikiFrom config.php-example // Multiple servers example config. Uncomment (remove /* and */) to use. // Add ALL the servers you want to use. Even if you have the server set // above. The default server will be the first one in the list. /* var $servers = array( array( 'name' => 'London', 'username' => 'user', 'password' => 'pass', 'location' => 'http://192.168.1.1:18083/', 'authMaster' => true // Use this server for authentication ), array( 'name' => 'New York', 'username' => 'user2', 'password' => 'pass2', 'location' => 'http://192.168.1.2:18083/' ), ); */
Not sure if this is possible, all my google results come up with RDP stuff, or just basic, how to install phpVirtualBox. I was wondering If I can set up a Central phpVirtualBox and connect it to multiple VirtualBox servers? This way I can have centralized management of all my VM's from the same GUI. Update : It is possible! PHPVirtualBox with Mulitple Servers But I am still struggeling with the concept in simple ways. Lets say you have a Server and a PHPHost. Does apache need to be on the Server? Does PHPVirtualBox need to be on the Server? Does VirtualBox need to be on the PHPHost? Ideally, id like to not have PHPVirtualBox on the server and just run On Server : configure >> /etc/default/virtualbox /etc/init.d/vboxweb-service startOn PHPHost : Install PHPVirtualBox + Apache Configure /var/www/html/phpvirtualbox/config.php Am I getting this wrong, or does VBox + PHPVirtualBox combo need to be on all servers?
phpVirtualBox - Control Remote Servers - Central Management
No. Nor do they need to be; eject is used for opening optical drives, where one cannot pull the media from directly. Unmounting is sufficient for USB/eSATA/etc. storage devices.
I know that the eject command can be used to eject almost any hardware component attached, but can it be used to eject USB drives? Is it possible to eject USB drives and external HDD's with the eject command?
Eject USB drives / eject command
The dd does not bypass the kernel disk caches when it writes to a device, so some part of data may be not written yet to the USB stick upon dd completion. If you unplug your USB stick at that moment, the content on the USB stick would be inconsistent. Thus, your system could even fail to boot from this USB stick. Sync flushes any still-in-cache data to the device. Instead of invoking sync you could use fdatasync dd's conversion option:fdatasync physically write output file data before finishingIn your case, the command would be: tar -xzOf archlinux-2016-09-03-dual.iso | \ dd of=/dev/disk2 bs=4M status=progress conv=fdatasyncThe conv=fdatasync makes dd effectively call fdatasync() system call at the end of transfer just before dd exits (I checked this with dd's sources). This confirms that dd would not bypass nor flush the caches unless explicitly instructed to do so.
From the Arch Linux Wiki: https://wiki.archlinux.org/index.php/USB_flash_installation_media# dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync [...] Do not miss sync to complete before pulling the USB drive.I would like to knowWhat does it do? What consequences are there if left out?Notes dd command used with optional status=progress: tar -xzOf archlinux-2016-09-03-dual.iso | dd of=/dev/disk2 bs=4M status=progress && syncOr using pv for progress tar -xzOf archlinux-2016-09-03-dual.iso | pv | dd of=/dev/disk2 bs=4M && sync
Why is sync so important when making a bootable linux usb stick?
I recommend visiting the Filesystem Hierarchy Standard./media is mount point for removable media. In other words, where system mounts removable media. This directory contains sub-directories used for mounting removable media such as CD-ROMs, floppy disks, etc. /mnt is for temporary mounting. In other words, where user can mount things. This directory is generally used for mounting filessytems temporarily when needed.Ref: http://www.pathname.com/fhs/pub/fhs-2.3.html#MEDIAMOUNTPOINT http://www.pathname.com/fhs/pub/fhs-2.3.html#MNTMOUNTPOINTFORATEMPORARILYMOUNT
What is the purpose of having both? Aren't they both used for mounting drives?
What's the difference between mnt vs media? [duplicate]
I found the answer. 64-bit Linux maintains a large write buffer (20% of available memory!) by default. (Interestingly, 32-bit Linux limits itself to at most 180MB) To change the dirty buffer size to e.g. 200MB, one can use echo 200000000 > /proc/sys/vm/dirty_bytesOR to use a percentage of RAM, e.g. 1%: echo 1 > /proc/sys/vm/dirty_ratioMore information: https://lwn.net/Articles/572911/
When writing content to removable devices on Linux (USB sticks/HDDs, SD cards, etc), I often see incredible write speeds in the first few seconds, sometimes in the order of GB/s (filling of the write buffer) followed by several minutes of quiet (buffer actually being written to the device). It's misleading. It makes it hard to judge the actual write speed. It's annoying (can't interrupt a program while it's flushing buffers). It can cause FS damage, and at the very least unwritten content when the device is unplugged while it's still being written. The write buffer appears to be over a GB in my case. Is there a way to control it? I'd like to reduce it to a more sensible value. Note: This is not about filesystem cache, this effect also appears on raw devices Note: I do not want to disable write buffers entirely Thanks!
How to reduce Linux' write buffer for removable devices?
You can use cd-info from the libcdio project. This will list all your CD’s tracks, and for each one, give you information about its contents: CD-DA (red book), Photo CD (beige), Video CD (white), etc.
I have put a CD into my drive. How can I find the rainbow book color on Linux (Red book/Yellow book/Blue book/...)?
How can I determine the rainbow book color of a CD on Linux?
Have a look under the /sys/ directory. In particular, /sys/block/ contains symlinks to block devices in /sys/devices/. /sys/block/sdX/removable looks like it will read as 1 for a removable device, and 0 otherwise. This gives you a basic check for removability. I'm not sure if there's a better way to check if it's a USB device, but readlink /sys/block/sde will spit out something like ../devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1.2/6-1.2:1.0/host7/target7:0:0/7:0:0:0/block/sde. Checking if that contains a usb* folder might work as a simple check. You can get other device details like vendor and model from /sys/block/sdX/device/, which might also come in handy.
Context I'm automating SD card imaging from an existing dd factory image. The SD card is always connected through an external USB card reader and thus appears in the system as a SCSI block device /dev/sd*. Currently the syntax of my command is: write-image DEVICE where DEVICE is the SD card block device, eg. /dev/sdd. Problem I'm already doing a basic check on DEVICE to verify it is of the form /dev/sd* but this is not enough: I fear the users (production people not used to Linux) make a mistake and specify another seemingly valid device, eg. /dev/sda. You can see the looming catastrophe, especially since my imaging script needs root privileges (not to write the image itself, mind you, but to modify the SD card afterwards, including adjusting a partition's size depending on the SD card's real size)... Question I would like to verify that the specified device actually is some USB mass storage (or at the very least a removable device) so that I can protect the system disks from being trashed accidentally. How can I do that? I found nothing relevant in /proc or on the web, I'm quite at loss now.
Find out if a specific device is an USB mass storage
In order to specify automount options across any DE you can specify this with udisks configuration: https://wiki.archlinux.org/index.php/Udisks#Udisks Something such as: udisks --mount /dev/sda1 --mount-options options autofs also works: https://wiki.archlinux.org/index.php/Autofs
I have quite a bit of removable media (flash drives, external hard drives, etc) that I want to adjust auto mount options for. How does one do this? Is there something similar to /etc/fstab?
How to set default auto mount options for removable media?
All block devices have a removable attribute, among other block device attributes. These attributes can be read from userland in sysfs at /sys/block/DEVICE/ATTRIBUTE, e.g. /sys/block/sdb/removable. You can query this attribute from a udev rule, with ATTR{removable}=="0" or ATTR{removable}=="1". Note that removable (the device keeps existing but may have no media) isn't the same thing as hotpluggable (the device can come and go). For example, CD drives are removable but often not hotpluggable. USB flash drives are both, but hard disks in external enclosures are typically hotpluggable but not removable. If you want to find out the nitty-gritty of when a device is considered removable, you'll have to dig into the kernel source. Search for removable — there aren't too many spurious hits. For SCSI devices, the removable bit is read from the device in scsi_add_lun with a SCSI INQUIRY command.
In DMESG I see: [sdb] Attached SCSI removable diskHow does Linux decide what is removable and not removable? Is there a way I can look up if a device is "removable" or not other than the log, for example somehwere in /sys or /proc?
How to tell if a SCSI device is removable?
The locate database is generally configured to omit files on removable disks, since they can't be assumed to be there later. It can be configured through a file such as /etc/updatedb.conf (the location depends on which of the several locate programs you use and how it is configured by your distribution). For a removable disk, it is probably better to keep the database in a separate file. Run updatedb --localpaths=/media/my_removable_disk --output=/var/cache/locate/my_removable_disk.locatedb to update the database. Add /var/cache/locate/my_removable_disk.locatedb to the environment variable LOCATE_PATH; for reasonably recent versions of GNU locate, an empty path component stands for the default path, so you can use export LOCATE_PATH=:/var/cache/locate/my_removable_disk.locatedbIf you want to keep the locate database on the removable disk, don't add the path to LOCATE_PATH, because locate stops looking if one of the database files is missing. A wrapper script would be better: locates () { locate "$@" for d in /media/*; do locate -d "$d/.locatedb" "$@" done }
If I understand correctly, the database locate relies on is just for files on partitions of internal HDDs. I wonder if it is possible to use locate on external HDDs?
Make `locate` able to search files on external HDD
LVM is not overkill if you have 17 partitions. (IMHO) As for the partition limit, it just happens to be the default. Probably no one expected that many partitions on a device that used to have only a few megs. /usr/src/linux/Documentation/devices.txt: 179 block MMC block devices 0 = /dev/mmcblk0 First SD/MMC card 1 = /dev/mmcblk0p1 First partition on first MMC card 8 = /dev/mmcblk1 Second SD/MMC card ... The start of next SD/MMC card can be configured with CONFIG_MMC_BLOCK_MINORS, or overridden at boot/modprobe time using the mmcblk.perdev_minors option. That would bump the offset between each card to be the configured value instead of the default 8.So it might work if you recompile your kernel with CONFIG_MMC_BLOCK_MINORS=18 or with the mmcblk.perdev_minors=18 kernel parameter. (Or 32 in case it has to be a power of 2). Doing so will reduce the total number of mmcblkX you may have in your system. Personally I'd rather lower the number of partitions so it will work everywhere and not just your customized system.
I've just mounted a microSD card which has 17 partitions in my laptop and I'm getting the following error in the YaST partitioner: Your disk /dev/mmcblk0 contains 17 partitions. The maximum number of partitions that the kernel driver of the disk can handle is 7. Partitions above 7 cannot be accessedand indeed - I have only /dev/mmcblkp0...7. Well, actually I have only 3 partitions because an extended partition starts at partition number 5, so it's p0, p5, p6, p7. I've formatted this card using a card reader in a printer on another PC which was exposing the microSD card as /dev/sdxY and allowed me to create 17 partitions. Now I've put it into a laptop with a built-in card reader and it gives the above error. Why is that? It's suggesting to use LVM but come on, LVM on microSD is overkill and inconvenient as hell for removable storage.
/dev/mmcblk0 partitions limit
USB removable storage selector: USBKeyChooser Rewrited 2022-01-05: USBKEYS=() while read _{,,,,,,} dev _ rdev;do [[ $rdev == */usb[0-9]* ]] && grep -q '^DRIVER=sd$' /sys/block/$dev/device/uevent && (( $(</sys/block/$dev/size) )) && (( $(</sys/block/$dev/removable) )) && USBKEYS+=($dev) done < <(/bin/ls --color=never -g /sys/block)Rewind: In this IEnsure this is USBEnsure device is removableEnsure this work as an hard drive (not a CD-Rom)Ensure they have size greater than 0 (not an empty Card reader)In fine: usbKeyChooser There is the final version of usbKeyChooser subroutine in my live installer: #!/bin/bash DIALOG=whiptailusbKeyChoose() { while [ ! -b /dev/$STICK ] ;do USBKEYS=() while read _{,,,,,,} dev _ rdev;do [[ $rdev == */usb[0-9]* ]] && grep -q '^DRIVER=sd$' /sys/block/$dev/device/uevent && (( $(</sys/block/$dev/size) )) && (( $(</sys/block/$dev/removable) )) && USBKEYS+=($dev) done < <(/bin/ls --color=never -g /sys/block) (( ${#USBKEYS[@]} )) && title="Choose wich USB stick have to be installed" || title="No key found" menu=(R "Re scan devices") for dev in ${USBKEYS[@]} ;do read model </sys/block/$dev/device/model menu+=($dev "$model") done ans=$($DIALOG --menu "$title" 21 72 14 "${menu[@]}" 2>&1 >/dev/tty) if [ ! "$ans" ]; then echo "User aborted."; return 1; fi [[ $ans == R ]] || STICK=$ans done } usbKeyChoose [[ $0 == "$BASH_SOURCE" ]] && [[ $STICK ]] && echo $STICK trueI like this looping solution because theylet insert many keys, wait for kernel registration, valid the choice, default to nothing and permit user abort.Anyway, even if user did wrong ok choice, next screen is another choice asking user for which image have to be written on key defaulting to create new image wich is a very long process where user could hit Ctrl+c
In my question Bash script to output path to USB flash memory stick I got stuck on a problem nobody else seems to be having. (The issue also impedes my desire to use this answer.) So I made that specific problem into this new question. Apparently removable devices listed in /sys/block end with 1. It is stated here and several other places in this site and this principle is used in the answers I referenced above. My removable device, a Sandisk 64GB flash memory stick, is listed as: /sys/block/sdl/removable:0Apparently, removable devices should end in 1 (and my others do). Why does my USB memory stick not follow the rule? It was automounted by Dolphin. I'm running Kubuntu 12.04. Dolphin shows it as "59.6GiB Removable Media". And it is mounted (automatically) at /media/me/70E8-1567 sudo blkid shows it as: /dev/sdl1: UUID="70E8-1567" TYPE="vfat".lsblk -do name,rm shows: sdl 0And lsusb -vv shows: Bus 001 Device 008: ID 0781:5530 SanDisk Corp. Cruzer Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0781 SanDisk Corp. idProduct 0x5530 Cruzer bcdDevice 2.01 iManufacturer 1 iProduct 2 iSerial 3 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 32 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 200mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1
Removable USB stick listed as non-removable in /sys/block?
Turns out you have to install gvfs and polkit-gnome to make this work. After logging out and in again Thunar supports mounting USB devices.
After installing and configuring Thunar Volume Manager for Arch Linux it doesn't mount any USB devices automatically: $ thunar thunar-volman: Unsupported USB device type. thunar-volman: Unsupported USB device type. thunar-volman: Could not detect the volume corresponding to the device. thunar-volman: Could not detect the volume corresponding to the device.(Both messages are printed twice when inserting a single USB drive.) Polkit seems to be running as expected: $ loginctl show-session $XDG_SESSION_ID Id=c1 Timestamp=Tue 2013-11-19 20:54:41 GMT TimestampMonotonic=33281762 VTNr=7 Display=:0.0 Remote=no RemoteUser=root Service=slim Scope=session-c1.scope Leader=308 Audit=0 Type=x11 Class=user Active=yes State=active IdleHint=no IdleSinceHint=0 IdleSinceHintMonotonic=0 Name=usernameThere are a bunch of random tips in this thread, but at least some of them seem at odds with the wiki: gvfs is mentioned, although the wiki only mentions it as a requirement for browsing remote locations. Manual mounting works fine: $ sudo mount /dev/sde1 /media/foo $ mount | grep sde1 /dev/sde1 on /media/foo type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
Thunar doesn't auto-mount USB devices with default setup
There are many ways to format a USB Command line Type this command in the terminal which will help you identify the USB name i.e: sdb,sdc,etc...sudo fdisk -lMake sure the USB is not mounted, if yes then you need to unmount it:umount /dev/sdXReplace sdX with your device name Delete any existing partitions (from the SD card only). Enter the following on the command line (replacing x with the letter identified in step sudo fdisk /dev/sdxlist the existing partitions by typing p. delete them by issuing the d command (repeat as needed until all partitions have been removed).Create a new partition.Type n to create a new partition.Type p to create a primary partition. Type 8192 to select the sector. (See note) Press enter to select the default last sector. Type t to change the type of the partition. Type b to select the FAT32 type. Type w to save (write the changes to disk).Format the new partition Now to format the USB using FAT32,mkfs.vfat16 /dev/sdXTo format it using FAT16mkfs.vfat32 /dev/sdXAfter this reboot and check if you can see your USB in windows.Disk Uility To install Disk Utility if it is not installed:sudo apt-get install gnome-disk-utilityAfter opening the app, click on the rectangle icon to unmount the USBThen as in the picture click on "Format"Gparted NOTE: This method doesn't work for you since you have a problem with detecting your USB, but I have included it for others in the future To install Gparted if it is not installed:sudo apt-get install gpartedAn advantage when using Gparted is that you can identify the USB name easily, as you can see from the picture below. My USB is mounted with the name sdbThen you can click on "Format To"
I have a memory stick that is not mounted in Ubuntu and it doesn't works in Windows. I can check is connected using Bus 003 Device 011: ID 05e3:0727 Genesys Logic, Inc. microSD Reader/WriterBut I cannot mount it. I want to try formatting it to check if is detected again in Windows and Linux. How could I do without mount it?
How to format a USB storage not detected in Ubuntu?
Most “live CD” distributions can be installed on a pen drive instead of a CD. Then you can use the rest of the pen drive (if it's large enough) as storage. For example, for Ubuntu, prepare a “live CD” on a USB pen drive. The pen drive creator utility will let you choose how much space to devote to storage. Alternatively, just do a normal installation that happens to be on a pen drive rather than an internal hard disk. That way, you'll be able to choose exactly what packages to install. The downside of this approach is that more files will be saved on the USB drive (the live CD doesn't store any transient data on the drive, only your documents and customizations) since the system will be running directly off the drive. Therefore the system will be slower (not necessarily noticeably) and the pen drive's lifetime will be shortened (not necessarily noticeably). On the upside, this way requires less RAM.
Terms regarding the OS:Must be installed on pendrive It must contain software for office use Need to save files, GUI settings on it (auto)So I'm not searching for a LiveCD. What could be the best choice?
Linux on pendrive? Which distro to use? [closed]
/media is intended for removable media, which is why your desktop environment shows the mountpoint as removable. To avoid that, mount your file system somewhere else, e.g. /mnt/ramdisk.
I've added the following line to my /etc/fstab to mount a ramdisk. none /media/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=2048M 0 0It shows up in my desktop as a removable drive, and it is shown as such in the status bar and in the dock, as shown below.How can I disable this? Should I mount it with different options? Do I have to tweak some desktop settings? I know that I could solve this by disabling the relative extensions, but I want "true" removable drives to show up there. I don't think its related, but I'm using GNOME 44 on Fedora 38.
Mount drive not as removable drive
Filesystems designed for unix, such as ext4, track the user via a number, the user ID. The user name is not recorded. You can see your own user ID with the command id -u. You can see the user ID who owns a file with ls -ln /path/to/file. If you take an ext4 filesystem to a different machine, the files will still have the same permissions, and they will have the same user ID. This may or may not be the right user. In general, different machines don't have the same user IDs for the same users unless this requirement was taken into account when creating the user or the machines pool from the same user database. Permissions on a file only protect that file inside one system. Permissions on a removable drive have no effect for someone who pops the drive into their own computer. If you want to exchange files via USB, FAT32 is usually the filesystem of choice. It's what most flash drives are formatted for when they're sold. If you need to store files with names or attributes that FAT32 doesn't support, create an archive (e.g. .tar.gz).
I have a USB flash drive with ext4 file system and its files are owned by my user on my local machine, for example by myuser@myhost with 700 permissions. If I unplug my flash drive and plug it in other Linux machine, can users of that machine have access to files in the flash drive? What if there is also a user named myuser, can he access those files?
Permissions on an ext4 filesystem on a removable drive used in different machines
Unfortunately, there's not much you can do, other than replace the hard disk or get an external disk. You can, of course, try to reduce the amount of disk space you're using, but most modern Linux distros will eat 20 gigs pretty quick. That means you either trim out everything you don't need, or possibly change distributions to one that's a bit more trim (which will mean less functionality). I don't know what your needs are, so I can't really recommend any more than that. The only thing I work with personally that I'd label "trim" is OpenBSD, but I doubt you'll want to go that direction; there will be a steep learning curve. You've got a 20GB disk in there. I doubt it's original; the spec sheet from Dell lists the smallest drive offered at 40GB. The good news is that it appears to be SATA - I'm not sure what the maximum size the BIOS supports on that machine, but as long as you don't go crazy it should be fine. Pull it out first to make sure - if it has a bunch of little pins (around 44 or so of them), it's parallel ATA and will be harder to replace. SATA will have two tabs with metal contacts on them. A google search will show you the difference. You should be able to pick up a larger drive used locally by asking around your more geeky friends. Otherwise, a computer shop might have one in the hardware bin - it's worth checking out. New ones can be had fairly cheap - but like I said, don't try to stuff a terabyte drive into that; I doubt it would work. Make sure it's a laptop drive; desktops have physically larger drives that won't fit. Search "dell latitude d620 hard drive" on youtube and you'll see videos on how to remove and replace the drive.
I keep getting low storage space warnings, I want to increase my total storage space, I was hoping to do that via terminal command, how would I go about doing that? I put in df -h and got: Filesystem Size Used Avail Use% Mounted onudev 484M 4.0K 484M 1% /dev tmpfs 100M 1.3M 99M 2% /run /dev/sda1 18G 16G 564M 97% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 498M 1.3M 496M 1% /run/shm none 100M 12K 100M 1% /run/userI put in mount and got: /dev/sda1 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/cgroup type tmpfs (rw) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755) none on /sys/fs/pstore type pstore (rw) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc rw,noexec,nosuid,nodev) systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd) gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=dejel)I Used parted -l And Got: Model: ATA HTS541020G9SA00 (scsi) Disk /dev/sda: 20.0GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 1049kB 18.9GB 18.9GB primary ext4 boot 2 18.9GB 20.0GB 1062MB extended 5 18.9GB 20.0GB 1062MB logical linux-swap(v1)I used fdisk -l and got: Disk /dev/sda: 20.0 GB, 20003880960 bytes 255 heads, 63 sectors/track, 2432 cylinders, total 39070080 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000a8ced Device Boot Start End Blocks Id System /dev/sda1 * 2048 36993023 18495488 83 Linux /dev/sda2 36995070 39069695 1037313 5 Extended /dev/sda5 36995072 39069695 1037312 82 Linux swap / Solaris
low remaining storage space, how do I increase it?
You can fix it (each time it happens) with this command:find local_directory_name -depth -exec sh -c 'dir="$(dirname "$0")"; FILE="$(basename "$0")"; lowfile="$(echo "$FILE" | tr "A-Z" "a-z")"; if [ "$lowfile" != "$FILE" ]; then mv "$0" "$dir/$lowfile"; fi' {} ";"Type this all as one line (replacing local_directory_name with the name of the directory to which you copied the files). You can break it into multiple lines by inserting backslashes. Or you can put the part after sh -c into a script file. This enumerates all the files in the directory (including subdirectories, recursively) and executes the given commands on each one. -depth makes it work "bottom-up", so it processes all the entries in a directory before it processes (renames) the directory itself. Each filename (relative path starting from local_directory_name) is broken down into a directory portion and a plain filename (just the bottom component). Then the filename is converted from upper case to lower case. If this is different from the existing filename, it renames the file to the lower-case name. I added this check to prevent the diagnostic messages you would otherwise get from trying to rename a file to itself, which would happen if you had a file whose name contained no letters (i.e., was numerals and special characters only). Or, for that matter, if you had a file whose name contained no capital letters. Afterthought: another way to avoid mv 123 123 errors is to add -name "*[A-Z]*" after -depth, which tells find to process only names that contain at least one capital letter.
I am currently using OpenBSD 5.5-release. Whenever I copy files or directories from my USB device to the local HDD, the names of the copied files have all become uppercase. What causes it? How do I fix it?
Names of copied files from USB device to HDD have all become uppercase. How to fix it?
I believe you can use pmount instead. It's in the Debian 7.7 repos. $ apt-cache search pmount libpmount-dev - portable mount library - development files libpmount0.0 - portable mount library - shared library pmount - mount removable devices as normal userUsage $ pmount -h Usage:pmount [options] <device> [<label>] Mount <device> to a directory below /media/ if policy requirements are met (see pmount(1) for details). If <label> is given, the mount point will be /media/<label>, otherwise it will be /media/<device>. If the mount point does not exist, it will be created.pmount --lock <device> <pid> Prevent further pmounts of <device> until it is unlocked again. <pid> specifies the process id the lock holds for. This allows to lock a device by several independent processes and avoids indefinite locks of crashed processes (nonexistant pids are cleaned before attempting a mount).pmount --unlock <device> <pid> Remove the lock on <device> for process <pid> again.Options: -r : force <device> to be mounted read-only -w : force <device> to be mounted read-write -s, --sync : mount <device> with the 'sync' option (default: 'async') -A, --noatime mount <device> with the 'noatime' option (default: 'atime') -e, --exec : mount <device> with the 'exec' option (default: 'noexec') -t <fs> : mount as file system type <fs> (default: autodetected) -c <charset>: use given I/O character set (default: 'utf8' if called in an UTF-8 locale, otherwise mount default) -u <umask> : use specified umask instead of the default (only for file sytems which actually support umask setting) --fmask <fmask> use specified fmask --dmask <dmask> use specified dmask -p <file>, --passphrase <file> read passphrase from file instead of the terminal (only for LUKS encrypted devices) -d, --debug : enable debug output (very verbose) -h, --help : print this help message and exit successfuly -V, --version print version number and exit successfullyExample To mount a device: $ pmount /dev/sdb1To unmount $ pumount /dev/sdb1
I have a backup script which mounts and unmounts a USB harddrive. In Ubuntu I used the command udisksctl but it is not included in the Debian 7.7 repository. Is there a similar command in Debian to mount and unmount USB devices as a normal user?
Mounting and unmounting USB storage from the command line
A udev rule, /etc/udev/rules.d/99-adjust-writeback-cache.rules: ACTION=="add", KERNEL=="sd?", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", \ RUN+="/usr/local/lib/adjust-writeback-cache.sh $major $minor"cat /usr/local/lib/adjust-writeback-cache.sh #! /bin/bashdevroot=/sys/class/bdi max_bytes=134217728 # must be divisible by 4096 dev=$1:$2logme="logger --tag `basename $0`" test "$TERM" = "xterm-256color" && logme=echotest "$UID" -ne "0" && $logme "Must be run under root" && exit 1 test -z "$2" && $logme "Need two arguments: major minor" && exit 2$logme "Adjusting writeback cache for the device [$dev] to $max_bytes bytes ..." test ! -d "$devroot/$dev" && $logme "The device [$dev] is not found in $devroot. Bailing out!" && exit 3echo $max_bytes > "$devroot/$dev/max_bytes" res=`cat "$devroot/$dev/max_bytes"` test "$res" = "$max_bytes" && $logme "All good!" || $logme "The operation has failed."Don't forget to make it executable, e.g. sudo chmod 755 /usr/local/lib/adjust-writeback-cache.sh
Sadly the issue reported and described here: Pernicious USB-stick stall problem. Reverting workaround fix? and Is "writeback throttling" a solution to the "USB-stick stall problem"? continues to be unresolved in modern Linux distros as of 2024 despite the availability of the BDI interface introduced in Linux 6.2 released in February 2023. This can be addressed by a simple udev rule invoking a script which sets sane writeback cache values for USB mass storage devices.
Solving the USB drive/mass storage stall issue
Maybe you can fix this with the quirks mode of the usb_storage driver for this specific device, see https://askubuntu.com/a/1088434 If you have to use the quirks mode this probably means that the Compact Flash card's behavior differs from (most) other CF cards.
I am having a version strange problem with a 4GB ATP Industrial Grade Compact Flash Card. I am trying to use it as the boot storage for a ALIX single board PC. When I insert it into another Linux machine I see: [ 421.320908] scsi 3:0:0:0: Direct-Access eUSB Compact Flash 5.06 PQ: 0 ANSI: 2 [ 421.331377] sd 3:0:0:0: Attached scsi generic sg2 type 0 [ 422.670588] sd 3:0:0:0: [sdb] 7847280 512-byte logical blocks: (4.01 GB/3.74 GiB) [ 422.700420] sd 3:0:0:0: [sdb] Write Protect is on [ 422.700424] sd 3:0:0:0: [sdb] Mode Sense: 00 77 bd 6fThen when I try any kind of write operation with it, I get: dd: failed to open ‘/dev/sdb’: Read-only file systemThings I have tried so far:There doesn't appear to be any kind of physical write-protect switch on it I am able reformat it, write files, read them back on a Mac I have successfully zeroed the whole card on my Mac (dd if=/dev/zero of=/dev/disk1 bs=10m) I have tried using hdparm to disable read-only mode (hdparm -r0 /dev/sdb), which doesn't error but doesn't disable write-protect either. I don't have any of these problems with other compact flash cards - but I want to use this one because it is much larger - and should be better because it is industrial grade.On my main Linux machine, I am using Debian 8 (Jessie) with Linux kernel version 3.16.0-7-amd64. It feels like there is some kind of soft write-protect lock applied to the compact flash, that only Linux seems to understand. Does anyone have any other ideas of what to try, or what might be wrong?
Linux specific problem with Write Protected Compact Flash
Look for mimeapps.list. It can be $HOME/.local/share/applications/mimeapps.list or, if not, look in $HOME/.config. Edit the section [Added Associations]. To add an application in the pop-up list for inserted CD, add this line: x-content/audio-cdda=name_of_application.desktopTo add an application in the pop-up list for inserted DVD, add this line: x-content/video-dvd=name_of_application.desktopTo remove some of those comment the lines related to them (add # in front of the line) Then do update-mime-database .local/share/mime/ or log out and in. (Mpv player can play dvds but for that you'll have to create a new 'desktop' file in $HOME/local/share/applications containing the line Exec=mpv dvd:// - more details here.)
The file manager PCManFM has an option (enabled by default) to ask what to do with inserted/mounted volumes (cd, dvds, iso files etc) which is lacking in elementry OS' file manager. That's why I m using PCManFM for this purpose.When connecting an external HDD:When inserting a DVD or mounting an iso-dvd:When inserting a CD:But can that list be edited somehow in order to add or remove items?Update after answer: /.local/share/applications/mimeapps.list contains this: [Default Applications] x-scheme-handler/apt=apturl.desktop xdg-mime default org.pantheon.appcenter.desktop x-scheme-handler/aptNo [Added Associations] , nor x-content/audio-cdda. Possibly an elementary-os-specific issue?
PCManFM: edit the list of applications available on auto-mount
I would suggest to wipe it using a live USB with a distro of your choice. Just make sure you don't mount neither the infected thumb drive nor any of disks that you have on your machine. As thumb drive is actually an empty system without any valuable data on it, there is nothing to corrupt. Also the live distro is loaded into your RAM that won't save any data when you power off your machine. That's the way to go.
I want to format an USB device i suspect to be infected with virus/es to make it safe for use again using my linux machine. If the device is never mounted is there still a risk of a virus or maleware of any time to be able to execute somehow and infect my machine? Do you have any alternatives on how to safely cleaning the device?
Is there a risk to get infected from unmounted USB storage device
If you want to use fdisk, with only one partition, with all blocks used, this will suffice: echo -e "n\np\n1\n\n\nw\n"| fdisk /dev/<target disk> && mkfs.ext4 /dev/<target disk>Change mkfs.ext4 to whatever filesystem type you want it to use. If you just want to delete data, your dd command should be fine.
It's for a bash script. Basically, I want to format, or erase a USB (or SD) storage device; with a single command line. I was going to use fdisk, but it seems to require user interaction where I want automation. So then I decided to try zeroing it out with: dd if=/dev/zero of=/dev/<target disk>; but it only seems to zero 2.0 GB of vacant, or unused disk space.root@linux:~# dd if=/dev/zero of=/dev/mmcblk0 dd: writing to '/dev/mmcblk0': No space left on device 3842249+0 records in 3842249+0 records out 1967230976 bytes (2.0 GB, 1.8 GiB) copied, 2.9054 s, 677 MB/sIdeally, I'm talking about re-formatting a removable storage device, and prepping it to be imaged with an .iso image file (via dd). Re-formatting won't always be required, but it also erases data; and clearing the device of any stored data probably ought to be the default behaviour / standard procedure, for this kind of thing anyway.
What's the quickest way to format a disk?