Skip to content

RFC 3092

Etymology of "Foo"

  • The RFC 3092
  • Projects
    • avelsieve
    • check_process_runtime
    • CloudPress
  • About

Category: Linux

Too Many Open Files Foo With Chrome On Ubuntu 13.10

Posted on May 19, 2014 by peter

The last Chrome update and one of the last Thunderbird updates caused some strange crashes of either on of them on my Ubuntu 13.10. All is fine, it runs great and all of a sudden *boom*, browser window gone, or email client gone.

Luckily .xsession-errors exists and there I could find some entries like this:

[3827:4038:0518/230904:ERROR:shared_memory_posix.cc(226)] Creating shared memory in /dev/shm/.com.google.Chrome.12UDei failed: Too many open files

Not good. But there is help. For MyEclipse I had the same issue in the past. But it didn’t seem necessary anymore since 13.10. But I also haven’t used it in a while. Anywhoo, here is what has to be done. And before I forget it, all these changes have to be done as root.

First check the setting for file-max with the following command

cat /proc/sys/fs/file-max

In my case this value seems fine, as it is well beyond the 200,000 that they recommend.

peter@majestix:~$ cat /proc/sys/fs/file-max
1627431

If that is below 200,000 you can set by adding the following line to /etc/sysctl.conf

fs.file-max=200000

The next is the ulimit setting for open files. You can check it with the following command

ulimit -n

This one was set to 1024 in my case and that can be a little bit low. At MyEclipse they recommend setting it to 65535 and that’s what I did. Just add the following lines to /etc/security/limits.conf

* hard nofile 65535
* soft nofile 65535

Afterwards restart your machine and all should be fine. If you only have to change the sysctl.conf setting then you can activate that change with the following command

service procps start

Posted in Foo, Linux, Ubuntu

PS3 Media Server And Ubuntu Foo… Again

Posted on March 21, 2014 by peter

It feels like Groundhog Day all over again. After finding a relatively painless way of installing the PS3 Media Server on Ubuntu (PS3 Media Server And Ubuntu Foo), I found an easy way with a PPA (PS3 Media Server made easy) and I thought all will be good when I do the re-install of my server with Saucy. I couldn’t be more wrong. The latest Ubuntu version that is supported by the PPA is Raring and it seems it stopped at version 1.81.0 of the PS3 Media Server. A quick check of the home page and the current version is 1.90.1.

After some thought, I checked my old blog post and the configuration files from the PPA. So, this is a chimera of all these components and most importantly, it works. I can now feed media to my devices that don’t support the Plex Media Server.

So, lets get started. Oh, before I forget it. All these steps need to be done as root!

Dependencies/Repositories

The good thing is, that nowadays most of the media related packages are already part of Ubuntu. So, we can simply pull most dependencies directly from Ubuntu’s repository and don’t have to add tons of PPA’s.

First and foremost you need Java. I prefer for some unrelated reasons to use the Oracle JDK. I know JDK 8 was just released but 7 will do for the moment. And as far as I know PMS (yes, I use the abbreviation again) works fine with the OpenJDK. So this first step is kinda optional.

add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-installer

And if you want to try OpenJDK, you do the following

apt-get install openjdk-7-jdk

Now we need the media related dependencies. All the encoders, decoders, muxers, etc. Most of it is already in Ubuntu and you might not need all of it (like dcraw). But I think it is better to have it installed and ready use, then be surprised when a feature, you never used before, doesn’t work. So here we go.

apt-get install mplayer mencoder mediainfo ffmpeg imagemagick vlc flac dcraw

tsMuxeR is the only one missing in this list. Luckily Robert Tari created a PPA. Lets just add it:

add-apt-repository ppa:robert-tari/main
apt-get update
apt-get install tsmuxer

Get PS3 Media Server

The project switched from Google Code to SourceForge but has its source code at GitHub. Confused? Well, so am I, but they must have their reasons and I don’t question it. Anywhoo, you can download the latest version (currently 1.90.1) from here:

http://sourceforge.net/projects/ps3mediaserver/

Installation

After downloading you can install PMS into /opt or any other directory you think might be useful (/usr/local, etc.). I personally prefer /opt. Here we go:

tar xzvf pms-1.90.1-generic-linux-unix.tar.gz -C /opt/
ln -s /opt/pms-1.90.1/ /opt/pms

Creating the symlink in the second step makes life easier for later updates. All the configuration and start/stop scripts just look for /opt/pms. Updating should be as easy, as extracting the package into /opt and recreating the symlink.

Start Script

I based my scripts on the scripts from the PPA from Happy-Neko. Currently I did just some path corrections but I am planning on moving more configuration options to the configuration in /etc/default/.

Here are the steps to get the Upstart script, service configuration file and set the legacy link.

wget http://www.rfc3092.net/wp-content/uploads/2014/03/ps3mediaserver.conf_.gz
gunzip ps3mediaserver.conf_.gz
mv ps3mediaserver.conf_ /etc/init
wget http://www.rfc3092.net/wp-content/uploads/2014/03/ps3mediaserver.gz
gunzip ps3mediaserver.gz
mv ps3mediaserver /etc/default
cd /etc/init.d/
ln -s /lib/init/upstart-job ps3mediaserver
initctl reload-configuration

The last two steps set the legacy link, so that you can start the service using the old /etc/init.d mechanism. And the second is to tell Upstart, to scan for new services.

Please check /etc/default/ps3mediaserver, if it fits your needs. For instance, not everybody wants to run PMS as root. So take a minute and clean that up.

Configuration

The configuration for PMS with this setup in the configuration area for the user root.

/root/.config/ps3mediaserver

You can change this in /etc/default/ps3mediaserver. Here is how you get a basic configuration going.

wget http://www.rfc3092.net/wp-content/uploads/2014/03/PMS.conf_.gz
gunzip PMS.conf_.gz
mkdir -p /root/.config/ps3mediaserver
mv PMS.conf_ /root/.config/ps3mediaserver

The configuration file is already updated to reflect the paths for all external tools. It does not contain a UUID for the server, because that is created automatically when you fire up the server for the first time.

You should take a look at the following settings (see also my blog post PS3 Media Server And Ubuntu Foo for tips):

  • folders
  • name
  • network_interface
  • hostname

folders is the only one out of these that you definitely want to set to reflect your setup. The server is running as a service and therefor headless. Just put a comma separated list of directories in there. Something like

folders = /src/videos,/srv/music

name on the other hand is just a cosmetic thing and defines with which name the server shows up on the client.

Yet, the default for network_interfaces can sometimes cause some grieve. You might have to bind the server to a specific interface if some virtual interface seems to be more attractive to PMS.

hostname is similar to network_interfaces. Usually it should not be needed but if you have multiple IP’s on a device you might want to specify which IP it binds itself to.

Service Start

Now that everything is set up you can start the service.

service ps3mediaserver start

The service should fire up without any errors. And if you encounter errors you will find the logs in /var/log/ps3mediaserver/root/.

Happy Streaming!

Final Thoughts

I think it is pretty straight forward to get PMS to work on Ubuntu. If I find some time… did I just write that?! Well, if I find some time, I will create a PPA with the latest version and I will try to keep it up to date.

Posted in DLNA, Foo, Linux, PS3, Ubuntu, UPnP

BIND Journal Foo

Posted on March 8, 2014 by peter

After doing some updates to my DNS set up I ran some standard checks. And it took me a while to realize that for some reason my zone didn’t load correctly and the secondary server was used.

So I dove into the logs and low and behold I saw this:

zone dusares.com/IN: journal rollforward failed: journal out of sync with zone
zone dusares.com/IN: not loaded due to errors.

And it dawned on me. I am currently implementing my own little dynamic DNS updater and all the updates are stored in a journal. Fine, I can re-run my tests and simply remove that journal (.jnl files. In Debian based distributions they are in /var/lib/bind) before restarting BIND.

That works of course but should not the way how you should handle things. Especially not, if you need the content of the journal. So here is the correct way of doing it:

  1. rndc freeze dusares.com
  2. apply changes to zone file
  3. rndc reload dusares.com
  4. rndc thaw dusares.com
Posted in BIND, Foo, Linux

Re-Assign Host Access Permission For User In MySQL Foo

Posted on February 26, 2014 by peter

Changing the configuration of a VPN can have interesting side effects. In my case I had to open up the host permissions for my MySQL users and databases from a /24 to a /16 network. Should be easy… and it actually is. Here are the SQL commands you have to execute to perform such an update:


update mysql.user set host = '10.42.%' where host = '10.42.42.%;
update mysql.db set host = '10.42.%' where host = '10.42.42.%;
flush privileges;

You can of course go crazy in the where clause and in- or exclude everything you want.

Happy SQL-ing.

Posted in Foo, Linux, MySQL

Wicd On Ubuntu Fails To Start Foo

Posted on February 10, 2014 by peter

Running Ubuntu, like most mainstream Linux distribution, means nowadays automatically that your computer gets exposed to the NetworkManager and its sideeffects. Maybe this tool might work for some desktop users, but it definitely never worked for me. It is cumbersome to configure, doesn’t like if an interface is managed manually or you want to change it back to automatic. It has major problems with similar IP ranges for different locations…

Anyways, I digress. I tried a lot of versions of the NetworkManager and it actually got worse and worse. Switching back to manually editing /etc/network/interfaces is not really spouse compatible either. The decision was made, lets install an alternative: wicd.

I think there is enough on the internet on how to transition from NetworkManager to wicd, like this official one here from Ubuntu’s own help pages.

After all is set and done you should have wicd running and you should be able to use the widget of your favorite desktop environment to configure it. But not so in my case. All I saw was that wicd failed to start. And a lot of digging unvealed finally a bug and it is even filed (Launchpad Bug Report).

In short, it is a problem with how the symlinks for resolv.conf are set up. So here is the quick workaround to get wicd to work:


rm /etc/resolv.conf
ln -s /run/resolvconf/resolv.conf
rm /var/lib/wicd/resolv.conf.orig
ln -s /run/resolvconf/resolv.conf /var/lib/wicd/resolv.conf.orig

After that sequence you should be able to start wicd. Happy networking.

Posted in Foo, Linux, Ubuntu

Netgear PS121v2 Print Server Linux Foo

Posted on January 15, 2014 - January 15, 2014 by peter

It is always fun to re-activate some old hardware. We had this HP laser printer sitting there with a Netgear PS121 (v2!) and it was just begging me to use it. So I thought, that is a quick and easy set up. Well it would’ve been if it didn’t have some nice surprises for me.

We had some other machines using that printer and it was an easy thing to get the configuration details from Windows. They all printed to a raw queue on port 9100. That sounds great. So I quickly set up the printer in a similar way using the PCL3 driver for the good old HP. The printer received data and started printing the test page. And it did a good job in starting it, but it printed only half the page. Afterwards the printer seemed dead. When I took a look at the print server I could see that it was switched off. Which is odd, because the print server does not have a power switch.

Anywhoo, I tried it again after restarting the print server. And I got the same result: Half a page printed and a switched off print server. A little bit digging on the internet revealed that I am not alone with that problem and that nobody knows how to fix it.

So I went with plan B and checked what ports are open so that I can try other options. Here is what nmap gave me:

Host is up (0.0078s latency).
Not shown: 993 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
23/tcp   open  telnet
80/tcp   open  http
139/tcp  open  netbios-ssn
515/tcp  open  printer
631/tcp  open  ipp
9100/tcp open  jetdirect

Nmap done: 1 IP address (1 host up) scanned in 0.17 seconds

That looked promising and seeing ports 631 and 515 made me happy. But I knew out of experience that IPP will be most likely a pain in the behind to set up. So I went with LPD, but I needed the queue. So lets get into the web interface and read the queue information.

If I would’ve remembered the password for the print server web interface this would’ve been an easy task. Brute force password guessing gave me, after a lot of swearing, finally access to the server’s interface.

In the Server Status page you can find the queue name in the field Default Name in the form of PS******. Now comes the part that is important to know. You have to add a _P1, the port number, at the end in order to get the full queue name. This is of course not mentioned anywhere in the user manual and without it, it won’t print.

So your URI for the print server will look something like this:

lpd://host.domain.or.ip/PS******_P1

Happy printing and don’t forget this applies only to v2 of the print server. The older v1 is supposedly a different piece of hardware with most likely different problems.

Posted in Foo, Hardware, Linux

Ubuntu Sleep Foo Resolved… Finally…

Posted on January 13, 2014 - January 13, 2014 by peter

The deed is done!

Finally!

If you don’t know what I am talking about, please read here, here and here.

I finally had the time to get down and dirty (literally!) and change the power supply. Well, the old one died on me and I had to replace it. Now the old 650W rests in peace while a brand new 850W does the job. And guess what, I was right. Replacing the power supply solved the “random” sleep problems of my server.

Finally I can watch TV, leave the office and do other stuff without having to fear that my server is in stand by.

And now to the next step. Get the OS moved to the new SSD. Not only a non-sleeping server, but also a fast one.

Although… my wife most likely to first clean the carpet…

Posted in Foo, Hardware, Linux

Harddisk Foo

Posted on October 15, 2013 by peter

I had my fair share of harddisk failures in the past and last night I got hit again. If anybody had problems accessing my site, then please accept my apologies. One of the hard drives in my server failed, which in itself is covered by the software RAID. But for an unknown reason the MySQL server had some issues coming back to life. The InnoDB structures were destroyed and I had to recover all databases from backup.

All is back up and running now, except of course for the failed drive. And I am working on moving everything to a different machine as soon as possible.

I’ll keep you posted.

Posted in Foo, Hardware, Linux

R.I.P. Medibuntu

Posted on October 10, 2013 by peter

While trying to update my desktop box, which is still running Quantal, I saw these nice error messages:

W: Failed to fetch http://packages.medibuntu.org/dists/quantal/free/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://packages.medibuntu.org/dists/quantal/non-free/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://packages.medibuntu.org/dists/quantal/free/binary-i386/Packages  404  Not Found

W: Failed to fetch http://packages.medibuntu.org/dists/quantal/non-free/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

If course I first suspected my flaky TWC internet connection to be the issue here. But after trying to access the URL’s in /etc/apt/sources.list.d/ I saw… nothing.

Long story, short, medibuntu reached it’s end of life and after all, it is not needed anymore. All but good ol’ libdvdcss is part of the standard Ubuntu repository now. Here is the official blog post from Medibuntu’s maintainer Gauvain Pocentek: The end of Medibuntu.

Please refer to Jonathan Ridell’s blog post Medibuntu to Disappear, libdvdcss now direct from VideoLan on how to get libdvdcss to work on Ubuntu from now on.

Posted in Foo, Linux, Medibuntu

Missing modules for paramiko and gio in duplicity foo

Posted on September 26, 2013 by peter

Since I upgraded some of my servers to the latest LTS of Ubuntu, I saw nice warning messages in my duplicity backup reports. I know, these are just warnings and no errors, but I don’t like to see any warning in a backup report of mine. Here is a sample:

Import of duplicity.backends.giobackend Failed: No module named gio
Import of duplicity.backends.sshbackend Failed: No module named paramiko

The paramiko problem was resolved easily by installing the python-paramiko package. The gio warning was not so easy to find. But after some digging I found the culprit in python-gobject-2. The following command line fixes the above warnings on a Debian based distribution:

apt-get install python-paramiko python-gobject-2
Posted in Foo, Linux

Posts navigation

Older posts
Newer posts
Proudly powered by WordPress | Theme: micro, developed by DevriX.