Posts Tagged Linux
If you’re thinking of running a virtual machine, you should check first to see if your processor supports the VT extension. To do so, run the following command in a terminal.
cat /proc/cpuinfo | egrep '(vmx|svm)'
Having the VT extension allows improved virtual machine performance, as well as the ability to run 64-bit virtual machines. Note that some manufacturers have an option to enable/disable VT in the BIOS (which is usually set to disabled), so if you have VT extensions, you may want to check to make sure it’s enabled.
Further Reading: Linux Tip: How to Tell if Your Processor Supports VT
Sorry for the brief post, but it’s late and I’m just making a quick note of this. Note that this works in just about any Linux distro, not just Ubuntu.
If you’re converting a single file, http://media.io/ is a great online tool. However, for batch conversion, you’ll want to look at one or more of the following tools:
dbPowerAmp is a great conversion utility http://www.dbpoweramp.com/dmc.htm
While dbPowerAmp says Linux is supported through Wine, I’ve found that soundconverter works wonderfully. To install it:
sudo apt-get install soundconverter
Next, just run it. You can select your input files and directories in the GUI. By default, soundconverter produces .ogg output. If you want mp3, simply select it in Edit > Preferences
A friend of mine accidentally formatted her 2TB backup drive and brought it to me to see what I could do. PhotoRec was the only tool that would give more than a hint of recoverable data from my Linux-based laptop. After letting it run for several hours, I had a mess: PhotoRec recovered over 230,000 files, and spread them out over 430 directories!
Finding and sorting them by hand was obviously out of the question as it would take way too long. I took a hint from another recovery program I had [unsuccessfully] tried, and thought of sorting them into directories based on their file extensions. I.e. .jpg into ‘jpg’, .doc into ‘doc’, etc.
However, since I was working with the large number of files and directories, I had to take this a bit further. This will sort files into directory names like ‘jpg.1’, ‘jpg.2’, etc. These are numbered to prevent putting too many files in a single directory and killing system performance :)
I came up with the following bash script for use on Linux systems. A word of caution is due: This script does very little error checking, though the commands are quite sensible and I ran it as-is with fine results. I’m not responsible for unanticipated results.
UPDATE: This has moved to github, here.
Questions, comments, and feedback are welcome. Please leave them in the comments section below. Thank you!
If you want to monitor your headphone feed, either for streaming it to the output or for mixing purposes, you’ll need to know your audio device names. Start with reading the latter half of this post to find your device names. Once you have the input and output device names, substitute them in the following command:
pacat -r --latency-msec=1 -d alsa_input.pci-0000_00_1b.0.analog-stereo | pacat -p --latency-msec=1 -d alsa_output.pci-0000_00_1b.0.analog-stereo
Note that the
.monitor part has been removed from the playback device. Not much explanation to go on here, but it does the job and I’m writing this in a hurry.
The following is (I hope) an adequately-documented procedure to stream desktop audio capture via icecast2.
What you will need:
- Basic audio hardware
- An Internet connection
- Ability to accept inbound connections on a port (default 8000)
- Some basic idea of what you’re doing :)
Setting up the icecast2 server
Icecast2 is a free server for streaming multimedia similar to SHOUTcast. I won’t go in to all of the differences here — you can easily Google them or visit the respective websites and do some light reading. What I will actually explain here is how to get the server actually running.
Install icecast2 from either Synaptic or command line.
sudo apt-get install icecast2
By default, the icecast2 server’s logging configuration is set up in a way that might deeply frustrate the amateur user. This is because it is set up to log to /var/log/icecast2, which is set up with the following permissions:
drwxr-xr-x 2 icecast2 icecast 4096 2011-06-27 23:45 icecast2
That’s 0755 for user icecast2 and group icecast. Fortunately that user and group account are already created for us, but the configuration file isn’t set to change the running process id (it’s commented out) and the entered defaults are for user nobody. No worries. Read on.
Now edit the /etc/icecast2/icecast.xml config file using your favorite text editor. If you don’t mind my recommendation, and you’re doing this on a machine running Gnome or Unity, gedit is excellent. Make sure to edit the file as root.
sudo gedit /etc/icecast2/icecast.xml
Edit the file to your preference.
The next settings change depends on whether you’re running Ubuntu Desktop or Server. Find the section below that applies to you.
Ubuntu Desktop: Make sure to head down to the bottom and make the important change to set the correct user/group combination. Find the
section and uncomment (remove the
--> marks) from around the
to icecast2 and
to icecast, like so:
Now start the icecast2 server
sudo icecast2 -c /etc/icecast2/icecast.xml
You should see messages similar to the following:
Changed groupid to 125. Changed userid to 115.
… and then the program will not produce any more output, but remains running (does not drop back to a prompt). Congratulations, your icecast2 server is running. If it produced an error message, or dropped back to a prompt, investigate the configuration file for any problems, and make sure the port you have icecast2 set to isn’t being used by another process.
To stop the server, hold ctrl and press c (CTRL-c). It does take a few seconds after the keypress to completely halt.
Ubuntu Server: Edit the /etc/default/icecast2 file. The uid and gid should already be set correctly. Verify they are set as follows:
# Name or ID of the user and group the daemon should run under USERID=icecast2 GROUPID=icecast
Next, follow the instructions on the last 3 lines:
# Edit /etc/icecast2/icecast.xml and change at least the passwords. # Change this to true when done to enable the init.d script ENABLE=true
Now start the service
You should get the following output:
Starting icecast2 Detaching from the console icecast2.
Finding your audio device for streaming
I tried using various programs to set up my audio stream, such as the SHOUTcast Transcoder (sc_trans), darkice, and a few others that I don’t even recall — but none worked correctly for my case. The reason? I either couldn’t figure out what audio device to use, or it wouldn’t work with the audio device I gave it.
As it turns out, Linux machines primarily use PulseAudio as a sound system and many of these utilities expect or are designed to work with an ALSA sound system. I tried /dev/dsp and /dev/audio as input devices but neither existed on my system. I tried padsp with darkice configured to use /dev/dsp but that didn’t work either. I found Alexandru Csete’s GStreamer article and a few other posts and figured gst-launch-0.10 would be the answer that I needed. As it turns out, that was completely correct.
With all credit to Alexandru Csete, here are the steps to find the correct PulseAudio device name for your scenario.
Run the following command:
pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2
You should get output similiar to the following:
alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor alsa_output.pci-0000_00_1b.0.analog-stereo.monitor alsa_input.pci-0000_00_1b.0.analog-stereo
These output ‘monitor’ sources feed your devices entire playback stream — effectively ‘what you hear’. The input sources are a microphone or other line-in device. Select the device appropriate for your scenario. If you are trying to capture a webcam microphone or other removable device, generate this list with your device plugged and then unplugged and then compare the lists to find your device.
Once you have your device name, it’s time to…
Set up your audio stream
gst-launch-0.10 pulsesrc device=DEVICE ! audioconvert ! vorbisenc bitrate=BITRATE ! oggmux ! shout2send ip=IP port=PORT password=PASSWORD mount=MOUNT
An explanation of the options:
- DEVICE: Your audio device (from above)
- IP and PORT: The IP address and PORT number of your Icecast2 server
- PASSWORD: The password to your icecast2 server
- MOUNT: The mount point of your stream.
- BITRATE: The bitrate you want your audio to be (see examples below)
In my case the audio device I wanted to use was:
So my line was:
gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! vorbisenc bitrate=32000 ! oggmux ! shout2send ip=localhost port=8000 password=XXXXXX mount=stream
The above produces an OGG stream. This works pretty well, but some Windows users report issues with OGG streaming. If you want MP3 streaming instead, try this:
gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! lame bitrate=32 ! shout2send ip=localhost port=8000 password=XXXXXX mount=stream
Note that if you are streaming to a SHOUTcast server (as opposed to an Icecast2 server), change the command as follows:
mount= and replace it with
protocol=2. Make sure you are connecting on the port specified in sc_serv.conf and not the +1 port. Example:
gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! lame bitrate=32 ! shout2send ip=localhost port=8000 password=XXXXXX protocol=2
Running this produces output similar to the following:
Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstAudioSrcClock
If you get some sort of error investigate your shout2cast settings.
Again, CTRL-c stops the streaming.
At this point, you should have a working icecast2 server and a working stream (via gst-launch-0.10). Congratulations!
I’m sure this guide is far from perfect, so please feel free to share any feedback you may have in the comment sections below. Thank you!
Here’s a quick run-down of the steps that I took when setting up Guild Wars on a friends Ubuntu machine under PlayOnLinux.
We chose PlayOnLinux because of the ability to use Wine prefixes, so we could customize the Guild Wars prefix for best play experience and no interfere with other configured Wine software. It also gave the easiest installation experience. We also chose PlayOnLinux as a free alternative to commercial programs like CrossOver Games.
Your experience may vary but this is what worked for us.
First, install PlayOnLinux either from Synaptic or the command line.
sudo apt-get install playonlinux
PlayOnLinux will be found under Applications > Games > PlayOnLinux (Gnome) or can be searched for in Unity.
Next, install Guild Wars
After starting PlayOnLinux, click the Install button, then click Games in the left column, and locate Guild Wars on the right side. Click Apply. Follow the on-screen dialogs to complete the installation of Guild Wars.
Once Guild Wars is installed, it’s time to tune it for performance. Note that much of the following is subjective, and may not be needed under certain circumstances.
— Tune the Guild Wars wine configuration
Once Guild Wars is installed, locate it’s entry in PlayOnLinux and click it, then click Configure this application. The application configurator will open. Click Forward and choose Configure Wine, then Forward again to launch the Wine configuration utility.
Once the Wine configuration utility is open, click the audio tab. If you get a dialog message stating that the audio driver was auto-detected. That’s fine. Set the DirectSound Hardware Acceleration mode to Emulation. Next choose the Graphics tab and under Direct3D, uncheck Allow Pixel Shader.
— Force Guild Wars to start in windowed mode.
Guild Wars will inititally start in full-screen mode. If this causes the client to crash or causes strange graphics issues, you may force it to start in windowed mode using the following terminal command:
WINEPREFIX=~/.PlayOnLinux/wineprefix/GuildWars/ WINEDEBUG=-all wine "C:GWGw.exe" -windowed
This will start Guild Wars in a window.
— Further registry tweaks
Locate the Guild Wars entry in PlayOnLinux and click it, then click Configure this application. The application configurator will open. Click Forward and choose Registry Editor, then Forward again to launch the Wine configuration utility.
Navigate the registry to
(If the Direct3D key does not exist, right-click on Wine and choose New > Key and name it Direct3D)
Right-click and choose New > String value. Call it UseGLSL. Double-click on UseGLSL and set Value data to “disabled” without quotes.
This will explain how to create an ISO image from a CD/DVD using Brasero in Linux.
First, insert the disc from which you want to make an ISO image. Wait until, and make sure, an icon for the disc appears on your desktop, indicating the disc has been read and mounted.
Next, open Brasero and select the Disc Copy function.
On the Copy CD/DVD dialog, change Select a disc to write to to ISO by clicking on the drop-down itself (not the properties button) and choosing Image file.
Click the Properties button and choose a name and location for the output ISO image and then click Close.
Verify your settings and then click Start copy.
Brasero will start creating your disc image, which will be quite large — up to the full capacity of your media (4.7GB for single-layer DVDs, 8.5GB for dual-layer).
So I was browsing for something today via google Images and I happened upon a malicious web page.
The web page tried to convince me to install an “Anti-Virus” program, on the premise that “Chrome Security” had found viruses on my computer.
Back in 2010, Google themselves issued a warning about these very same “fake antivirus” attacks:
“Constant improvements are being made on the fake anti-virus software with sophisticated tactics designed to trick the computer users in downloading and installing the software which is meant to create malicious code in your computer.” — Source: techgenie.com
Take a careful look at the below screenshots I captured and see firsthand how an attack like this works. The key here is that the website detects your browser and displays a message that matches the browser to make it more believable.
The website first gives you a simple dialog. Clicking OK here begins the following series of screens. The safest thing to do once you get a dialog like this is to click the X and then close the window. Notice that the dialog message contains a vital “tell”: the website is displaying the message, not your browser.
This screen shows the fake “scan”, which is likely just a flash video (I didn’t actually check). The safest thing here is to close the tab/window immediately.
The “result” screen. Notice that it’s tried to download an .exe file, no doubt the fake antivirus software itself. The fake antivirus software would actually be the trojan — the web page itself is mostly harmless, minus the persuasion to install the payload. The safest thing here to is to close the tab/window immediately.
So in this case I can report the site to Google by clicking wrench icon > Tools > Report an issue.
The take-away lessons from this are:
- Your browser doesn’t have any tools within it to detect viruses
- Any notice about viruses should display as being from your antivirus program, not your web browser
- Close web page prompts and pop-ups using the X rather than hitting any OK or other buttons
Also, I’m running Linux, and therefore none of the above “viruses” could have actually been detected, not to mention the exe couldn’t have done anything to me. :)
If you’re using DD-WRT on your router you may find that certain wireless configurations cause the wireless clients to either be unable to connect or drop connection. This seems to be the most noticeable on Windows 7 systems, but likely happens on other systems as well. Note that I did not observe this at all on a Linux-based system and I’m completely unable to explain why. Perhaps a difference in the wireless stacks between Windows and Linux highlights this issue.
Issues related to this include not being able to connect to the wireless AP, instead receiving a message such as “The access point did not allow the connection” or something similar (Apologies, I don’t have the exact error message.), and losing wireless connection to the network or AP, even though it is still shown in the list of wireless networks.
This appears to be related to the wireless security settings, specifically the settings for security mode and WPA algorithm. See the following screenshot:
Having the security mode set to WPA2 Personal Mixed and the algorithm set to TKIP+AES appears to cause the problem.
According to the DD-WRT help:
This mode allows for mixing WPA2 and WPA clients. If only some of your clients support WPA2 mode, then you should choose WPA2 Mixed. For maximum interoperability, you should choose WPA2 Mixed/TKIP+AES.
So, according to this, it should work — but it doesn’t seem to work quite as advertised. Instead, this is the recommended setup as long as all your wireless clients support WPA2:
Security mode set to WPA2 Personal and algorithm set to AES only appeared to completely solve the problem.
For the curious, this is DD-WRT v24-sp2 (08/12/10) mega (SVN revision 14929), the current recommended build.
Systems with i3/i5/i7 chipsets and nVidia video may experience Ubuntu not booting, and instead getting a blank screen with a flashing cursor or corrupt video display.
This seems to be an issue with some combination of kernel, video card, and nouveau driver, and appears to stem from the fact that the system technically has two sets of video hardware: that on the Intel CPU and the nVidia GPU.. While the Ubuntu developers work to get this corrected, there is a workaround to get you going.
When your system starts to boot up, hold the shift key to get to the GRUB menu, then press ‘e’ to edit the command line. Go to the kernel line (the line that starts with
linux and has
quiet splash in it) and press the ‘end’ key to scroll to the end of the line. Add
nouveau.modeset=0 to the end of the line, then press F10 to boot.
After booting up, you can install the nVidia proprietary drivers and reboot and graphics will work great for you.
You can also permanently disable the nouveau module by running the following:
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf sudo update-initramfs -u
You may experience a low-resolution splash or login screen. See my post nVidia proprietary drivers and low-resolution Plymouth splash screen for a solution to this.