Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Friday, July 19, 2013

Play audio output to multiple devices via pulse audio, or more pulse audio woes.

I've since moved past Ubuntu 12.04 to 13.04 and have run into more troubles with pulseaudio. This is unrelated to my previous issues.

Admittedly this is a fairly fringe case that most people would not run into but that seems to be my experience with Linux in general. Usually a quick google search fixes me up, but this one was a bit trickier.

I have a media center setup with xbmc on a full desktop install of Ubuntu 13.04. It works great, I use the desktop for various things that xbmc has yet to integrate with  or doesn't yet have a great experience with. (e.g. Google Play Music, songza, youtube), and use xbmc to play my movie and TV content.

From my media center to my PC since I'm often playing high quality content I tend to prefer using HDMI to connect the two. It is easy and provides a very high level of quality. Unfortunately for me (and apparently for most modern receivers) my receiver will only output analog audio to my speakers on my patio (Zone 2) and HDMI is a digital signal. And thanks to the copyright issues with converting a digital HDMI signal (hard to copy) to an analog signal (easy to copy) the capability to convert to analog is stripped out of the HDMI connections.

So what this means practically is I have to connect an analog cable from my media center to my receiver as well as the digital HDMI connection. This gives me the best of both worlds, the reciever basically selects the highest quality signal that it can deliver. The trick is that I have to broadcast the signal to more than one device, which is not something pulse audio is setup to do out of the box in Ubuntu 13.04.

What is the fix? I did some googling and found a suggestion to use the paprefs package to control the Pulse Audio Preferences. Unfortunately for me this didn't work, despite an indication that it should from the information in paprefs. Essentially you enable simultaneous output and pulse audio is supposed to broadcast the signal to all your output devices. It never output to my analog out.

Back to google and I found this info: https://wiki.archlinux.org/index.php/PulseAudio/Examples#Simultaneous_HDMI_and_Analog_Output

Relevant sections copy/pasted below.
<snip>

Simultaneous HDMI and Analog Output

PulseAudio allows for simultaneous output to multiple sources. In this example, some applications are configured to use HDMI while others are configured to use analog. Multiple applications are able to receive audio at the same time.
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC889A Analog [ALC889A Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC889A Digital [ALC889A Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
The key to a configuration like this is to understand that whatever is selected in pavucontrol under Configuration>Internal AUdio is the default device. Load pavucontrol>Configuration and select HDMI as the profile.
Add the following to /etc/pulse/default.pa to setup the analog as a secondary source:
### Load analog device
load-module module-alsa-sink device=hw:0,0
load-module module-combine-sink sink_name=combined
set-default-sink combined
Restart PulseAudio, run pavucontrol and select the "Output Devices" tab. Three settings should be displayed:
  1. Internal Audio Digital Stereo (HDMI)
  2. Internal Audio
  3. Simultaneous output to Internal Audio Digital Stereo (HDMI), Internal Audio
Now start a program that will use pulseaudio such as mplayer, vlc, mpd, etc. and switch to the "Playback" tab. A pulldown should be available for the running program to select one of the three sources.
</snip>
This did work! YAY, now I'm able to listen to audio on my patio without much trouble. Rad!

Tuesday, March 19, 2013

Pulseaudio woes

I have an ASRock 890FX Delux4 motherboard that I was having a damned of a time getting the audio to work on in Ubuntu 12.10.

The solution turned out to be that pulseaudio didn't have the device selected as the output, but that was completely not discoverable via the UI.

I had to install an extra program to tell pulse to use an output channel other then what it was using by default.

sudo apt-get install pavucontrol

 This was the ticket I needed, selected the correct output for sound and viola! magic.

Saturday, March 2, 2013

Percona database won't start

I just finished a long hair pulling session trying to get Percona 5.5 installed on Ubuntu 12.10. What was happening is I would install from the percona repositories and everything would seem to go fine. I would attempt to move the data and log files away from the default location so that I could serve them from my ZFS pool and when I would put in the change into the my.cnf file the database would no longer come back up. It seemed like it was still starting, as I was seeing process running, but just one when I should have seen 12 or so.

This case was particularly frustrating because the my.cnf file I was using was generated by the Percona Configuration Wizard (https://tools.percona.com/wizard). The Configuration Wizard is a really great tool that takes some input from you about your server and intended use and outputs a config file for Percona. I assumed the configs generated from here would just work, but they don't.

What I figured out in the end is the /etc/init.d/mysql script uses the /etc/mysql/debian.cnf file settings to check if the mysqld server is up or not by pinging on the socket located at /var/run/mysqld/mysqld.sock the config file puts the socket by default into your data directory (on my zfs pool).

Two possible solutions, one verified, one should work in theory:

  1. Change the config generated from the wizzard to put the socket at the location that debian.cnf expects it. (/var/run/mysqld/mysqld.sock). This is what I ended up doing and it worked very well. 
  2. create a symbolic link between where you socket is, and where the startup script thinks it should be. e.g. sudo ln -s /path/to/your/actual/file/mysqld.sock /var/run/mysqld . This should work in theory and the reason I didn't do it this way is I'm not sure if there is special syntax for creating a symlink to a socket, or if there were any special considerations for reboot scenarios. 

Monday, August 23, 2010

OpenLDAP + SAMBA PDC on Ubuntu 10.04 HOWTO

I've been trying to find a good guide on creating an OpenLDAP + SAMBA pdc installation and I think this guy has finally figured it out.

I'm tagging this for future reference.

http://tuxnetworks.blogspot.com/2010/07/howto-samba-ldap-on-1004-lucid-short.html

Monday, August 31, 2009

Why you should care about open source software!

Occasionally people ask me why I use Ubuntu?

The simple and fairly complete answer is choice. The thing that really appeals to me about the open source software movement is the fact that if I don't like the direction my distribution is moving, I can change to another without loosing out on much functionality. If you don't like the way your IM app works, try another one, or write your own. If you don't like something you are free to change it.

I was reading a posting on the infamous slash dot on a comparison between Snow Leopard, Windows 7, and Ubuntu 9.10 (http://tech.slashdot.org/story/09/08/31/1916238/OS-Performance-mdash-Snow-Leopard-Windows-7-and-Ubuntu-910) and came across a great comment from user KingSkippus (http://slashdot.org/~KingSkippus) which nails the issue for me, I've posted the whole comment because finding it over there might be challenging, and it really is a great post from that site.

99.997% of the people using these computers don't care.


First of all, I think that number is way too high. While it may seem that way sometimes, people do care. Maybe not even a majority of them, but enough that it does make a difference.

Second of all, those who in theory don't care, when explained why it's important, start to care. When you add up the cost of upgrading from Windows 95 to Windows XP to Windows Vista to Windows 7, along with all of its associated applications (I'm looking at you, Microsoft Office), versus the cost of upgrading through the various versions of Ubuntu or any of the other popular distributions and their associated applications, people really start to notice. One of my favorite things to do when I'm showing off Ubuntu to people is to open the package manager application. I tell them it's like the "Add or Remove Programs" applet, except that you can actually add programs. "All this stuff is available to you for no cost. Just click it, and you're good to go."

When you explain to these people how there is absolutely zero technical reason why they can't have a movie or song play on the DVD player in their living room, their iPod, their computer, and anywhere else (and anyway else) they want to play it, but that thanks to DRM systems incorporated into Windows 7 and Mac OS X, they are artificially restricted from doing so because some third party has decided to "manage their digital rights" for them, it definitely gets their attention.

When you explain to these people how honest competition from really smart people doing really smart things just because they can and because they feel that others should benefit from their collective knowledge is one of the reasons why a lot of commercial closed-source software these days that might otherwise cost hundreds or thousands of dollars is sold for really low cost or given away for free because of how hard it is to compete with volunteer work, it also gets their attention.

When I show people my web browser (Firefox with AdBlock) and how I don't see particularly onerous ads on web sites because the person who wrote my browser isn't beholden to financial interest or corporate mandates, it has raised a lot of eyebrows.

I could go on, but hopefully you see my point. Free and open source software benefits everyone, even people who don't otherwise care, even people who shun it in favor of commercial and/or closed-source options. And sitting back and saying that people don't care isn't very productive. It's in our best interest to actually educate people so that they will care.

Thursday, May 14, 2009

Out with the Amarok in with the Listen

It happened one too many times, Amarok (Amarok) stopped playing my music. No good reason, just "too many errors". One last time it refused to play the one song I needed to hear right then. So it was time to switch. Pst... Listen (Listen), that is your queue.

I'm giving up form for function, the aesthetic for the operational. Its a tough choice, I've really loved Amarok, it was one of the first music players I scrobbled (My Last.fm profile) with. Now you can pick up scrobble integrated players at every turn.

First impressions, Listen just feels more like a Gnome app, which is not a surprise since Amarok has its roots so deep in the KDE world, and Listen is written in Python, which in my hobby coder world is my language of choice. We will have to see how things work out, I'm still hoping for something simple and elegant like foobar2000 (my all time favorite music player) or Songbird, and while I know I can run these via WINE, I'd rather support a native Linux option if I can.

Tuesday, December 23, 2008

You Might Be Elitist #2

If you do things the hard way just on principal... you might be an elitist.

Example: I'm in the process of some infrastructure shifting for a small business. They currently use Microsoft Small Business Server 2003 RC2 using Windows XP SP3 workstations.

In order to simplify things they are moving to a more homogeneous environment (all workstations will be exactly the same, there are only 4 so its not as big of a deal as it sounds).

Now I COULD stick with the SBS2003 installation, but there are a lot of things that I don't like about it. It DOES work pretty well, most of the time. Here is a list of things that I wish I could change:
  • Remote management WITHOUT having IE

    SBS2003 uses the RWW (Remote Web Workplace) in order to allow you to connect to a secure website and do things like check email (Outlook Web Access), Run Reports (status/use reports for server) and connect to the server & desktops. Most people look at the RWW as the strongest feature you get in SBS that you DON'T get in other Server environments (Either Microsoft server or any other server installation). For me it is a hindrance. I don't run IE, because I use Ubuntu for my OS. If I need to remotely administer or remotely connect to any of the computers at this location I have to start my XP virtual machine and connect from within there. It is the last "gotta have windows for this" thing in my migration from Windows to Linux.

  • Expensive client licensing

    Small Business Server 2003 Standard costs $639.99 according to Newegg.com. That includes a whole 5 CAL license. What does that mean? It means 2 things: 1. you have to choose user/machine licensing scheme. 2. you can only have 5 connected to the server at one time. This is pretty limiting. If you want 6 computers you need to spend an additional $349.99 according to Newegg.com This very quickly drives the cost of the server up, this is completely exclusive of any desktop costs. Oh yea... if you want to include SQL in the package the cost goes up more. Though at some point around the 15 user mark the cost of cal's becomes more then the cost of the server, even with SQL, so the more people you have the less it matters.

  • Unused services

    This is not as big of an issue for me as the other two items previously mentioned, but it is still something I would like to see addressed. Something I realized, running your own mail server is stressful. A lot of a business' ability to function hinges on access to email and telephone. Even if things are critical in other areas of the infrastructure if you have access to email and telephones you can hobble along. This is the primary reason we moved our main mail services from Exchange over to Gmail. The $50/user/year cost was acceptable to us in order to ensure that critical part of our infrastructure was operational. Once we had transitioned from exchange TO Gmail there was no "clean" way to remove exchange from our environment. In fact if there is no good way to not install exchange. The SBS components are SO tightly integrated that things begin to break down once you remove one part of it, even if it is not completely necessary. There are a bevy of things that are similarly required arbitrarily. Updating, backup, firewall, faxing.

  • Backup Solution

    SBS2003 does backups, but it misses the last critical step. Firstly it favors setting up full system backups, and the reading materials strongly suggest a daily schedule. In my sittuation that means a daily single file of about 30-40 GB. Now that excludes a few folders like the updated service packs etc that are easily accessible online and are not "installed apps" per-se. I have a drive on the server that I use to backup the server to, which is a sub-optimal solution. The real trick... and the killer for most backup scenarios is where is/are the off site options? My solution is not great, but it works ok. We purchased 2 500GB external hard drives that connect to the LAN. These are switched out weekly. We keep 2 weeks of daily full system backups (10 x30-40) plus as many weekly full system backups that will fit on each of the drives. In this sittuation the most we would ever lose is 1 week of data if the building burned to the ground on a friday. This scenario works ok, in theory, but all of the scripting/logic that is used to copy the large files over the network is coded by hand... by me, and I am not a coder. So it fails on occasion, and that is bad for a backup scenario. What would be better would be Weekly full backups and daily (or a few times a day) incremental backups directly to the NAS. This is NOT possible without the purchase of more software.


There are plenty of things that I like about SBS2003, but they are all things that are central to Microsoft's polcy of non-interoperability vs the fact that Microsoft has an inherently better product. They certainly do seem to be backing down from that stance with the release of some API's that make the ability of projects like SAMBA to interact more successfully with Windows.

So what is my alternative? Well I have two that I am actively pursuing, both of them Linux solutions to this common "Small Business Server" problem.
  • SME Server

    this is a prepackaged Cent-OS distribution that takes most of the hard parts of setting up a small business network out of the equation. It supports things like Roaming Profiles, User Startup scripts, mail, vpn, backup etc. It is a great package that brings it all together pretty well.

  • Do what Linux does best

    And that is to provide a customized solution to my specific problem. I found a few tutorials online that have helped me to get to the point where I can have users logging on to my Domain, hosted on a Linux domain controller. I can install/configure/uninstall any of the components in the SBS equation that I do not need, and switch out the ones that are present for something that fits my needs much better. It comes at a great cost however, and that is time. The amount of time it is going to take me to setup and get working the way I want is several factors more this way, but the solution is exactly what I want... in so far as the technology allows for.


So as you can probably guess, I'm opting for the fully customized Linux alternative. I'm still in the testing phase at the moment, configuring a virtual lab of computers that are acting as server and clients (both Linux and Windows) in order to hammer out my plan of attack. This is not to say that I am 100% set with this option, but the main advantage of testing the most desirable/most difficult solution first is that if it ends up not working, you will usually be pleasantly surprised at how little time it can take to implement one of the other solutions.

I'll try and keep this blog updated on my progress, so far I am impressed with how cool learning about this stuff has been.