Posts Tagged Unity
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.
Checking your hard drive’s SMART status is a good idea if you’re running into issues that make you think the hard drive may be bad. In this scenario, I’ll be showing you how to use a Ubuntu Live CD to check the hard drive’s SMART status. This is good for situations where you either boot to the installed OS, cannot reliably install an OS, or cannot install a program on the installed OS to check it yourself.
This walkthough uses the Ubuntu 10.10 Desktop 32-bit CD to prevent issues that may arise from Unity. Download links: old-releases.ubuntu.com, .
Assuming you follow only the instructions in this guide, the data on your hard drive won’t be affected by this check. However, if your drive is catastrophically failing, i.e. head crash, any disk activity may lead to further data loss.
First, boot off the CD.
Select your language with the arrow keys, press enter.
Select Try Ubuntu without installing
After a moment or two you will be at the GNOME desktop (Menu bar at the top and taskbar at the bottom). Don’t worry if it’s slow, it’s to be expected — you’re working off a Live CD.
From the System menu, select Administration then Disk Utility.
The Disk Utility window appears. On the left pane, locate and click your system’s hard drive.
On the right page, locate the field that says “SMART Status” — your drives status will appear.
If it says “Not Supported”, your drive (or host controller) doesn’t support the SMART protocol and can’t give you any information. However, it may take a few moments to refresh. You can always run the SMART tests to force it to check the drive again.
Once you’re finished checking the SMART status, shut down by clicking the power icon in the very top-right corner of your screen, or simply hold the power button on your PC for 4 seconds. Eject the disk and your PC will boot to the hard drive.
Questions or comments about using the Ubuntu Disk Utility to check SMART status are welcome in the comments.
Reporting Ubuntu bugs isn’t difficult, and it’s the single biggest step you can take towards helping those bugs get resolved.
For Canonical-supported applications, an easy-to-find menu link has already been provided for you to report issues with the application. It’s in the Help menu:
Clicking the Report a Problem menu entry automatically gathers up information on the application and your Ubuntu version, and opens a web page to Launchpad where you can provide more detailed information on the issue you were experiencing. You’ll need to have a free launchpad.net account (get one now) to complete the process of submitting the final bug report, but it only takes a few minutes and a few steps.
If you want to report a bug against the Unity interface, enter this in a terminal:
If you notice an issue in a Ubuntu application, take the time to report it. It’s what makes the OS better.
Questions, comments, and feedback regarding bug reporting are appreciated. Thank you!
It’s day two with Ubuntu Natty, and while I’m impressed, I’m also somewhat annoyed. The sum of changes that came down in 11.04 have me asking “Why?” Here’s a list of some of the pros and cons I’ve seen so far in Ubuntu Natty with Unity:
- The Unity Launcher has ‘keep in launcher’, which can be good for apps that you want 1-click access to.
- It seems that Unity has a great deal of respect for screen space: moving all the menu bars to a single location, making the notification area smaller, and auto-hiding the Unity launcher all help you get the last bit out of your screen real estate.
- Holding the Windows key shows keyboard shortcuts for the items in the launcher, allowing hot-key access to them.
- Navigation can be cumbersome. Things are not where you expect them to be, and in some cases, are simply not there anymore.
- The context-sensitive menu bar puts menus out-of-reach on larger monitors, and potentially on multi-monitor setups.
- Navigation seems less intuitive than Gnome 2.
- Any 1-click ‘view desktop’ / minimize all windows functionality is gone.
- Adding too many items to the launcher can cause it to scroll.
- There’s no way, that I can see right now, to edit the “shortcuts” that appear in the ‘dash’.
- Some programs do not iconify to the launcher correctly.
I’m also seeing a handful of mixed bugs in Synaptic Package Manager, Empathy, and the Unity launcher itself.
The release of Ubuntu with Unity and Firefox 4 (which causes regressions in several websites) leads me to the opinion that this is perhaps the most drastic change with the most negative user-facing experience that I’ve seen to-date with Ubuntu. I’m confident that the Ubuntu developers will work quickly to resolve these issues, but I think a lot of these issues should have been fixed prior to release.
As an alternative, the GNOME interface is still available. If you want to use the GNOME interface, you have to make a settings change at the log in screen. After selecting your user name, and before entering your password, change “Ubuntu” to “Ubuntu Classic” using the session changer at the bottom of the screen.
Also, Windows users just got Firefox 4.0.1 which includes a lot of security fixes. While some of them are Windows-specific, Firefox 4.0.1 is still not yet available for Ubuntu Natty. This is something I think should be made available as quickly as possible. UPDATE: To Ubuntu’s credit, Firefox 4.0.1 came down today via update manager. :)
These are a few of the issues and annoyances I’m having with the Unity interface. Do you have any to share?
In part 1, I explained how to generate and manage your encryption keys in GNOME. Now I’ll explain how to use your keys to easily encrypt your email. I’m going to only address doing this in Evolution (the default email manager in GNOME). You can access the Evolution email account settings by going to System > Preferences > Email settings [Natty/Unity: System Settings > Email], and I’ll assume that Evolution is already set up for your email account.
Integration into Evolution is painlessly simple: You just need the Key ID of your key.
Go to System > Preferences > Passwords and Encryption Keys and look in the column under Key ID. The Key ID is hex, so it only uses the characters 0-9 and A-F.
Once you have the Key ID, start Evolution and go to Edit > Preferences > Mail Accounts and click your mail account and click edit. Then, go to the Security tab and enter your Key ID in the PGP/GPG Key ID field.
That’s it. Now whenever you compose a message, you’ll see the PGP menu which will allow you to sign and/or encrypt your email messages, and in the reading pane you will see the status of signed/encrypted messages sent to you.
Questions, comments, and feedback to this are welcome, as always.
For the security-minded, or anyone who simply wants to be able to exchange secure, encrypted email quickly and easily, GNOME offers a really user-friendly way to generate and manage PGP/GPG keys. This program is located at System > Preferences > Passwords and Encryption Keys. [Natty/Unity: System Settings > Passwords and Encryption Keys]
You can make a new key by going to File > New… > PGP Key. This guide explains some of the basic key management functions in this application.
Fill in the name, email, and an optional comment. PGP is considered a network of trust, so etiquette states you should use your common legal name (shortened versions are ok) and your primary email address (unless you have a reason to do otherwise). If you frequently go by a nickname, enter that in the comment field.
If you’re interested in the advanced options, you can change them by dropping down “Advanced Key Options.” I’m not going to go too much in to what the various options are, but here’s a quick run-down:
Encryption Type: RSA is generally considered stronger and overall a better choice than DSA. Choose “sign only” if you’re using this as a signing key, and not an encryption key. Only select that option if you know what you’re doing.
Key Strength (bits): The higher the number, the stronger the encryption, but the longer it takes.
Expiration Date: Set this if you want your key to expire at a predefined date/time, or set to never expire. Expiration keys can still decrypt messages, but no new messages can be encrypted to them.
After choosing your options, you’ll be prompted to enter your key pass phrase. DO NOT FORGET IT! Your key will be completely unusable (and you will be unable to revoke it) if you forget the pass phrase. On the same token, avoid making it too easy or guessable.
Next, the key will be generated. This could take a while depending on the key size and the speed of your computer.
Once your key is generated, your public keyring and private keyring will be stored in
~/.gnupg — NEVER distribute your private keyring (
secring.pgp). This is the decryption segment of your keyring.
Next, some more exploration through the Passwords and Encryption Keys application.
Right-clicking on a key gives you the following options, which I’ll explain briefly.
Properties: Here is where you can change your passphrase, add a photo, view your key’s fingerprint, and edit the expiration date and trust level.
Export: This is where you can export your public key for distribution to others (this is the portion of the key that you DO share). By selecting export, you will export an “ASCII-armored” file that can be pasted in email, etc.
Copy: Similiar to export, Copy copies your “ASCII-armored” public key to the clipboard. Makes it easier to post in email, web page, etc.
Delete: This deletes the key. Make sure this is what you want to do!
Sign Key: This is a core part of the key-sharing portion of PGP/GPG. This “signs” the key, using your key. This applies your signature to the key, explicitly stating that you trust the key to some degree. Once you’ve signed the key, you should export the key and send it back to the originator so they can begin distributing it with your signature attached.
So how do you sign a friend’s key?
First, have them export it and send it to you. Next, drag-and-drop the file into the Passwords and Encryption Keys window. It will appear under the Other Keys tab. Once the key has appeared, just right-click on it and click ‘Sign…’ Follow the prompts. Don’t forget to export the key and return it to the sender after you’ve signed it! Work this process in reverse for getting a friend to sign your key. Drag/drop the updated keys back into your key manager to add the new signatures. To verify signatures are present, double-click on the key and look at the Names and Signatures tab.
That’s a quick run-down of the key management functions.
Questions, comments, and feedback about key management are welcome and appreciated. Note that key management may be different in the Unity interface, which is shipped with Ubuntu Natty.
This was written more specifically for Ubuntu Maverick and previous, though Natty is just around the corner.
Previous Ubuntu versions, by defafult, had the key sequence CTRL-ALT-BKSP (Control-Alt-Backspace) enabled as a way to kill the X server in case a full-screen program was frozen beyond recovery. This key combination was turned off in Lucid, but can be re-enabled.
To re-enable, go to:
System > Preferences > Keyboard > Layout > Options [Natty/Unity: System Settings > Keyboard]
Drop down “Key sequence to kill the X server” and check the box next to Control + Alt + Backspace
That’s it! The key sequence is now re-enabled.
Questions, comments, and feedback is appreciated, as always.
With recent Linux distributions (based on the 2.6.28 kernel) the Ext4 file system is considered stable and provides many improvements over Ext3.
Ubuntu systems running 9.04 (Jaunty Jackalope) had the option to format Ext4 during install time, but Ext3 was the default until 10.04 (Lucid Lynx). However, it’s possible (and fairly easy) to upgrade Ext3 to Ext4 in-place and without reformatting or reinstalling. Nice, huh?
The following guide is based heavily off the Ubuntu documentation, which some added steps and clarification. If you’re going to do this, use your head and make sure you have backups of your important data before you start, just in case. Also, don’t skip any steps, and double-check yourself along the way. A typo could ruin your day.
Zero – Before you start
Verify your kernel version by running
uname -r. Make sure it is 2.6.28 or higher. If it is not, STOP. Upgrade your kernel before attempting to proceed.
Also, check that you’re currently using Ext3 — this would be pointless if you’re already running ext4 — by using the mount command. You should see something like the following:
/dev/sda1 on / type ext3
This shows ext3 as the current filesystem type.
One – Turn off any automatic updating
Go to System > Administration > Update Manager. Click Settings and set Automatic Updates to Only notify about available updates. You want to make sure that the system doesn’t start applying an update halfway through this and give you the potential worst-case of an unbootable system.
Two – Prepare to load the Ext4 driver
Ext4 is backwards compatible with Ext3, which makes this update process as easy as it is. We’ll start by telling the system to load the Ext4 driver instead of the Ext3 driver at boot. This will allow the system to boot and run normally for the steps that follow.
Edit the file /etc/fstab in your favorite text editor.
gksu gedit /etc/fstab will do fine. Change any references for disks that you plan to convert from Ext3 to Ext4. Take a look at the example:
# /etc/fstab: static file system information. # # proc /proc proc defaults 0 0 # /dev/sda1 UUID=327c1819-14e1-4b96-b9d2-d5e55e50f1ae / ext3 defaults,errors=remount-ro,relatime 0 1 # /dev/sda5 UUID=900e39f2-ad49-42ee-a7f5-8e6807d6b35b none swap sw 0 0 /dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
The above example shows an Ext3 filesystem on
/dev/sda1. I’ll use
/dev/sda1 as the file system for the rest of the guide for clarity. So, change
ext4 in the above file and save it.
shutdown -r now )
Three – Update the filesystem options
After rebooting, the kernel will be using the Ext4 filesystem driver, even though your filesystem on disk is still natively ext3. That’s what you want, you’ll be making the actual changes to the filesystem soon.
Now, run the following command to make the changes to your filesystem that adds the Ext4 features:
sudo tune2fs -O extents,uninit_bg,dir_index /dev/sda1
Note: There’s no spaces after the comma-separated options. Copy/paste if you’re not sure.
/dev/sda1, like I stated above. Change it if it’s not correct for you, or if you’re doing multiple filesystems, run it for each one.
Reboot again (
shutdown -r now )
Four – Take a deep breath
Due to the changes that tune2fs made on your filesystem, when you reboot you’re going to get the message
“Errors were detected on your filesystem, press ‘F’ to fix…” or something similiar. Press F and let it do it’s thing.
You may get the following error as well (I did):
The disk drive for for /tmp is not ready yet or not present. Continue to wait or ...
Just wait patiently. You’re waiting for the changes to finish on the currently-processing filesystem, and it’s just telling you that it’s trying to mount or access /tmp and it’s having trouble, due to the currently-running process.
After a few minutes (depending on the size of your partitions and the amount of data on them), everything will go back to normal and you’ll be able to log in again.
There’s just a few more steps.
Five – Reinstall grub
Run the following command to reinstall grub. Note that the partition number is omitted from the device path — this is intentional and correct.
sudo grub-install /dev/sda
You should get a message indicating the operation was successful.
If you are upgrading from 8.04 LTS to 10.04 LTS, you will need to install grub2 as soon as possible, as grub1 is not Ext4-aware. (Users running 9.04 are not affected by this.)
sudo apt-get install grub2
Once it’s done, no more reboots are really necessary, though you can always reboot to make sure grub actually reinstalled correctly. Files written from now on will be written with full Ext4 structures. You can also turn automatic updates back on at this point.
You can verify all the filesystem features are set by running:
sudo tune2fs -l /dev/sda | grep features
This is the list of ext4 features you should have set:
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent sparse_super large_file uninit_bg
If you’re missing one or more features, go back to step three above and check that you entered the command correctly.
Questions, comments, and feedback are welcome, as always.
Multiple Boot Systems Time Conflicts
From The Ubuntu Community:
Operating systems store and retrieve the time in the hardware clock located on your motherboard so that it can keep track of the time even when the system does not have power. Most operating systems (Linux/Unix/Mac) store the time on the hardware clock as UTC by default, though some systems (notably Microsoft Windows) store the time on the hardware clock as the ‘local’ time. This causes problems in a dual boot system if both systems view the hardware clock differently.
The advantage of having the hardware clock as UTC is that you don’t need to change the hardware clock when moving between timezones or when Daylight Savings Time (DST) begins or ends as UTC does not have DST or timezone offsets.
Changing Linux to use local time is easier and more reliable than changing Windows to use UTC, so dual-boot Linux/Windows systems tend to use local time.
Since Ubuntu Intrepid (8.10), the hardware clock is set to UTC by default.
Make Windows use UTC
Note: This method was not initially supported on Windows Vista and Server 2008, but came back with Vista SP2, Windows 7 and Server 2008 R2.
To make MS Windows calculate the time from the hardware clock as UTC.
Run regedit and navigate to
Right-click in the right-side panel and select New > DWORD Value. Create the key named
RealTimeIsUniversal and give it a value of 1.
Using a registry file
Create a file named WindowsTimeFixUTC.reg with the following contents and then double click on it to merge the contents with the registry:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] "RealTimeIsUniversal"=dword:00000001
Make Linux use ‘Local’ time
To tell your Ubuntu system that the hardware clock is set to ‘local’ time:
1. edit /etc/default/rcS
UTC=yes if your hardware clock is set to UTC (GMT), or
UTC=no to have the hardware clock set to local time.
It’s come to my attention that this issue also affects Macs which dual boot via bootcamp or other methods.
Questions, comments, and feedback is welcome and appreciated.