Tag Archives: Red Hat

Upgrading the MTP Support on CentOS 6

Introduction

The Media Transfer Protocol (MTP) provides us direct file access to devices such as our smart phones and other devices that choose to use the protocol. In my case, my Nexus 4 couldn’t correctly attach itself to my system. From my Google results; it seemed to be due to the version of libmtp I was running. You see, CentOS/RHEL ships with libmtp v1.0 and most of the support for cell phones that came out within the last 2 years isn’t available until v1.1. libmtp v1.1 additionally builds against most peoples FUSE implementations such as MTPfs, jmtpfs and simple-mtpfs. It’s through these FUSE/MTP implementations that we can easily mount and directly access the content on our smart phones and tablets that use the MTP protocol.

So upgrade libmtp already; why are you blogging about it?

Oh boy… well here are all the problems I faced:

  • VLC Media Player is built against this same library. Upgrading it means looking after this dependency too; or go without it (no, not going to happen).
  • Rhythmbox is also built against this same library (libmtp). Upgrading it means looking after this dependency too; or go without it (again… not going to happen).

Then the second problem… we’ve only tackled the upgrade of libmtp above if we go through with this… we still haven’t even tackled the FUSE implementation. Here are the results I had testing some of them:

  • MTPfs: At the time of this blog, the last update for this software was on February 4th, 2010. I got the software to compile by simply using the version that ships with Fedora 18 (1.1-0.3.svn20120510) but when I tried to use it, it just hung as a normal user. If I tried mounting the device as root it would fail (see below):
    $ mkdir media
    $ # As myself (non-root)
    $ mtpfs media/
    Listing raw device(s)
    Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics/Samsung) Nexus 4/10 (MTP).
       Found 1 device(s):
       Google Inc (for LG Electronics/Samsung): Nexus 4/10 (MTP) (18d1:4ee1) @ bus 2, dev 89
    Attempting to connect device
    libusb_open() failed!: Permission denied
    LIBMTP PANIC: Unable to initialize device
    Unable to open raw device 0
    
    $ # As root (superuser)
    $ sudo mtpfs media
    Listing raw device(s)
    Device 0 (VID=18d1 and PID=4ee2) is a Google Inc (for LG Electronics/Samsung) Nexus 4/10 (MTP+ADB).
       Found 1 device(s):
       Google Inc (for LG Electronics/Samsung): Nexus 4/10 (MTP+ADB) (18d1:4ee2) @ bus 2, dev 73
    Attempting to connect device
    Android device detected, assigning default bug flags
    Error 1: Get Storage information failed.
    Error 2: PTP Layer error 02fe: get_handles_recursively(): could not get object handles.
    Error 2: Error 02fe: PTP: Protocol error, data expected
    Listing File Information on Device with name: (NULL)
    LIBMTP_Get_Storage() failed:-1

    Now I don’t want to give MTPfs a bad name. It’s quite possible that it works really well but just not for my personal purposes. In fact it compiles perfectly in CentOS/RHEL 6 right out of the box without any modifications. Therefore just because it didn’t work for me doesn’t mean it won’t necessarily work for you. For this reason and the fact it was once maintained (up to Fedora 18) I’ll include my results with it here too.

  • jmtpfs worked the best for me. The only problems I ran into with this software was that it wasn’t already packaged for CentOS/RHEL. The only thing I had to work with for packaging it myself was a very long set of comments (see the link back to it’s official site to see what I’m talking about). That all said; the software works fantastic right out of the box. Kudos to the great work of the developer and his online support.
  • simple-mtpfs works well too but required some tweaking to make it possible. You see, simple-mtpfs relies on the new C++11 compiling features and standards (which truly are amazing BTW) but weren’t available during the release of CentOS/RHEL 6. Making these standards available by upgrading the glib core library to a newer version would be just crazy. In fact, you could seriously risk jeopardizing the stability of the OS itself since everything else would have been compiled against the old version. So, to work around this, I wrote a small patch file for portions of the simple-mtpfs code mimicking the old behavior prior to the C++11 standards.

Just hand over everything

Of course… and as always; I planned on it. Hopefully you’ll find the packages useful! Like my other blogs, the installation instructions will be near the bottom of this blog, along with the ‘do it yourself’ for those who don’t trust the sources.

First thing is first; this is what makes everything else tick:

Here are the dependencies you may or may not need to get out of the way. Note that I just went ahead and upgraded VLC to 2.0.6 (from the stock version 1.1). There may be other dependencies of libmtp you find that I didn’t simply because I didn’t use those packages. You can just assume that all of the binary packages listed below have been compiled against libmtp v1.1 (shared above).

After you’ve got libmtp correctly installed and your system appears to be right back in the state it was previously, we can now move on to adding one of the excellent FUSE/MTP packages some incredible developers have put together for us.

  • jmtpfs-0.4-1.el6.x86_64.rpm
    Author: Jason Ferrara (Website)
    Source: jmtpfs-0.4-1.el6.src.rpm
    Compilation Details: I made 1 small patch file (see here) introducing some of the nice idea’s his followers of his blog suggested for auto-mounting. I additionally had to make one small change so that his code could compile against the version of FUSE currently shipped with CentOS/RHEL 6. The only other thing I can take credit for is the rpm packaging itself; the rest of the work was that of the hard working developer who made this application possible. The spec file I wrote can be seen here.
  • simple-mtpfs-0.1-8.el6.x86_64.rpm
    Author: Peter Hatina (Website)
    Source: simple-mtpfs-0.1-8.el6.src.rpm
    Compilation Details: I created 2 separate patch files for this to properly compile in CentOS/RHEL. The first patch rolls back the C++11 coding styles to the older way of doing it (so it can compile against our existing libraries). The second patch introduces the auto-mounting for our environment (exactly how It was done in my patch for jmtpfs). To accommodate these patch files I needed to additionally update the spec file which you can view here.
  • mtpfs-1.1-0.3.svn20120510.el6.x86_64.rpm
    Author: Chris Debenham (Website)
    Source: mtpfs-1.1-0.3.svn20120510.el6.src.rpm
    Compilation Details: No magic went on here; I just grabbed the packaged code from a Fedora 18 release on pkgs.org and it compiled without any problems. Note: It appears the support for this package was dropped after Fedora 18 since it isn’t available for either Fedora 19 or 20.

Here are the source packages for those who are interested:

Show me what you did; I’m not using your stuff

In some cases you’ll need to use what I’ve done (patch wise); but to be as transparent as possible, I’ll show you how you can easily build everything and review all of what is going on before committing to using it. Now keep in mind also; there is A LOT of stuff covered here. There is libmtp itself, the dependencies issues and then finally the choice of FUSE/MTP implementation. I’ll cover the dependencies last since not everyone will have this issue.

First I set up a mock environment to work in; this allows us to do compiling outside of our native environment and means we don’t need to ever install any development libraries.

First prepare our development environment with mock if you haven’t already:

# Install 'mock' into your environment if you don't have it already
# This step will require you to be the superuser (root) in your native
# environment.
yum install -y mock

# Grant your normal every day user account access to the mock group
# This step will also require you to be the root user.
usermod -a -G mock YourNonRootUsername

At this point we can get away from the root user and build using our own user we created for our system.

Now we’ll cover libmtp v1.1 as everything revolves around this library.

# Fetch the latest copy (already packaged) of libmtp
wget http://dl.fedoraproject.org/pub/fedora/linux/development/20/source/SRPMS/l/libmtp-1.1.6-2.fc20.src.rpm
# As time goes on, this rpm may not be available, but
# you should be able to just get away with grabbing the latest
# copy of libmtp from http://pkgs.org

# Now we just rebuild it against our own environment
mock -v -r epel-6-x86_64 --resultdir=$(pwd)/results 
       --rebuild libmtp-1.1.6-2.fc20.src.rpm

# Now all our built RPMs will be in a directory
# entitled 'results' to make things easier, we'll just
# move it all into the directory we're working in now
find results -name '*.rpm' -exec mv {} . ;

# We can eliminate the results directory now
rm -rf results

Everything from this point forward assumes we have a built copy of libmtp to work with. Now we’ll focus on the FUSE/MTP options.

  • Option 1: simple-mtpfs
    # Fetch our source
    wget --output-document=simple-mtpfs-0.1-8.el6.src.rpm https://www.dropbox.com/sh/9dt7klam6ex1kpp/KEU68ZzLIv/20131015/mtp/simple-mtpfs-0.1-8.el6.src.rpm?dl=1
    
    # Initialize our Environment
    mock -v -r epel-6-x86_64 --init
    
    # Now install the nessisary dependencies for simple-mtpfs
    # which we must additionally include the libmtp package we
    # just built
    mock -v -r epel-6-x86_64 --install libmtp-1.1.6-2.el6.x86_64.rpm 
                                       libmtp-devel-1.1.6-2.el6.x86_64.rpm 
                                       fuse-devel
    
    # Now if you don't have any insecurities with source rpms you
    # can finish with the next command... or you can skip it and
    # extract all of it's content for inspection before building.
    # all of the results will appear in the 'results' directory.
    # Note: You'll want to skip this step and move to the next if
    # you have any insecurities at all.
    mock -v -r epel-6-x86_64 --no-clean 
                             --resultdir=$(pwd)/results 
                             --rebuild simple-mtpfs-0.1-8.el6.src.rpm
    
    # For those really insecure can keep reading and perform
    # the following steps instead of the single command above
    # Copy our source into the mock building environment
    mock -v -r epel-6-x86_64 --copyin simple-mtpfs-0.1-8.el6.src.rpm /builddir/build
    
    # Shell into our environment now
    mock -v -r epel-6-x86_64 --shell
    
    # Change to the build directory
    cd builddir/build
    
    # Install the source package (which will deploy within
    # the mock environment only)
    rpm -Uhi simple-mtpfs-0.1-8.el6.src.rpm
    
    # Now we can safely prepare the source for inspection.
    # - the spec file will be in the SPECS/* directory
    # - all patch files and source code will be in SOURCES/*
    #
    # Once your satisfied I'm not out to get you, you can build
    # the package:
    rpmbuild -ba SPECS/simple-mtpfs.spec
    
    # we're now done with our mock environment for now; Press Ctrl-D to
    # exit or simply type exit on the command line of our virtual
    # environment
    exit
    
    # We'll return to the directory we were previously in.  We can copy
    # out the packages we just built at this point. Ignore the warning
    # about SELinux if you get one because it doesn't impact our goals.
    mock -v -r epel-6-x86_64 --copyout /builddir/build/SRPMS/simple-mtpfs-0.1-8.el6.src.rpm .
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/simple-mtpfs-0.1-8.el6.x86_64.rpm .
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/simple-mtpfs-debuginfo-0.1-8.el6.x86_64.rpm .
    
  • Option 2: jmtpfs
    # Fetch our source
    wget --output-document=jmtpfs-0.4-1.el6.src.rpm https://www.dropbox.com/sh/9dt7klam6ex1kpp/KH6b9pmCRZ/20131015/mtp/jmtpfs-0.4-1.el6.src.rpm?dl=1
    
    # Initialize our Environment
    mock -v -r epel-6-x86_64 --init
    
    # Now install the necessary dependencies for jmtpfs
    # which we must additionally include the libmtp package we
    # just built
    mock -v -r epel-6-x86_64 --install libmtp-1.1.6-2.el6.x86_64.rpm 
                                       libmtp-devel-1.1.6-2.el6.x86_64.rpm 
                                       fuse-devel 
                                       file-devel
    
    # Now if you don't have any insecurities with source rpms you
    # can finish with the next command... or you can skip it and
    # extract all of it's content for inspection before building.
    # all of the results will appear in the 'results' directory.
    # Note: You'll want to skip this step and move to the next if
    # you have any insecurities at all.
    mock -v -r epel-6-x86_64 --no-clean 
                             --resultdir=$(pwd)/results 
                             --rebuild jmtpfs-0.4-1.el6.src.rpm
    
    # For those really insecure can keep reading and perform
    # the following steps instead of the single command above
    # Copy our source into the mock building environment
    mock -v -r epel-6-x86_64 --copyin jmtpfs-0.4-1.el6.src.rpm /builddir/build
    
    # Shell into our environment now
    mock -v -r epel-6-x86_64 --shell
    
    # Change to the build directory
    cd builddir/build
    
    # Install the source package (which will deploy within
    # the mock environment only)
    rpm -Uhi jmtpfs-0.4-1.el6.src.rpm
    
    # Now we can safely prepare the source for inspection.
    # - the spec file will be in the SPECS/* directory
    # - all patch files and source code will be in SOURCES/*
    #
    # Once your satisfied I'm not out to get you, you can build
    # the package:
    rpmbuild -ba SPECS/jmtpfs.spec
    
    # we're now done with our mock environment for now; Press Ctrl-D to
    # exit or simply type exit on the command line of our virtual
    # environment
    exit
    
    # We'll return to the directory we were previously in.  We can copy
    # out the packages we just built at this point. Ignore the warning
    # about SELinux if you get one because it doesn't impact our goals.
    mock -v -r epel-6-x86_64 --copyout /builddir/build/SRPMS/jmtpfs-0.4-1.el6.src.rpm .
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/jmtpfs-0.4-1.el6.x86_64.rpm .
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/jmtpfs-debuginfo-0.4-1.el6.x86_64.rpm .
    
  • Option 3: mtpfs
    # Fetch our source from pkgs.org
    wget http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Everything/source/SRPMS/m/mtpfs-1.1-0.3.svn20120510.fc18.src.rpm
    
    # Initialize our Environment
    mock -v -r epel-6-x86_64 --init
    
    # Now install the necessary dependencies for mtpfs
    # which we must additionally include the libmtp package we
    # just built
    mock -v -r epel-6-x86_64 --install libmtp-1.1.6-2.el6.x86_64.rpm 
                                       libmtp-devel-1.1.6-2.el6.x86_64.rpm 
                                       autoconf automake libid3tag-devel 
                                       glib2-devel fuse-devel
    
    # If you have insecurities at this point, you'll need to
    # take them up with someone else since I didn't make any
    # modifications to this FUSE/MTP option at all. So we
    # just need to build from source at this point.
    mock -v -r epel-6-x86_64 --no-clean 
                             --resultdir=$(pwd)/result 
                             --rebuild mtpfs-1.1-0.3.svn20120510.fc18.src.rpm
    
    

Finally our libmtp dependency issues (if you have them).

  • Rhythmbox
    # Fetch our source from pkgs.org
    wget http://vault.centos.org/6.4/os/Source/SPackages/rhythmbox-0.12.8-1.el6.src.rpm
    
    # Initialize our Environment
    mock -v -r epel-6-x86_64 --init
    
    # Now install the necessary dependencies for Rhythmbox
    # which we must additionally include the libmtp package we
    # just built
    mock -v -r epel-6-x86_64 --install libmtp-1.1.6-2.el6.x86_64.rpm 
                                       libmtp-devel-1.1.6-2.el6.x86_64.rpm
    
    # Now we just rebuild from source using the new library
    mock -v -r epel-6-x86_64 --no-clean 
                             --resultdir=$(pwd)/results 
                             --rebuild rhythmbox-0.12.8-1.el6.src.rpm
    
    # Your rpm's will appear in the 'results' directory.
    
  • VLC
    # The catch with VLC is it's development isn't frozen with
    # the version of CentOS/RHEL like Rhythmbox does. This is because
    # if your running this, you've already chosen to link to other
    # repositories like RPMForge, ATrpms, LinuxTECH, etc.
    
    # Mock however (out of the box) does not link to these locations
    # at all. The quickest (and dirty) work around to this fix is to
    # simply install 'yum' into the mock environment which we can
    # use to fetch all of our dependencies (the best way is to actually)
    # create a new mock configuration that just includes them. But
    # everyone uses to many different alternatives; so we'll do it
    # my way :)
    
    # Fetch VLC source from the repository you use. You can do this
    # using yum if you have the --download-only rpm addon. Otherwise
    # just utilize pkgs.org and get the package:
    # http://pkgs.org/search/?keyword=vlc&search_on=name&distro=82&exact=1
    # At the time v2.0.6-1 was the version available to me.
    # You may need to adjust the below commands depending on which
    # package you get; I'll use a variable so you can set it to
    # whatever you get at the time.
    
    # If you are comfortable just using the version I have; you can
    # download it here:
    wget --output-document=vlc-2.0.6-1.el6.src.rpm https://www.dropbox.com/sh/9dt7klam6ex1kpp/pm7MCGHa9K/20131015/mtp/vlc-2.0.6-1.el6.src.rpm?dl=1
    
    # Set this variable to something else if you fetched a different
    # version
    VLCVER=2.0.6-1
    # Store our original source RPM Name; we do it this way
    # because some people might use different packages that
    # have the ending f20 (Fedora), atr (ATrpms), rf (RPMForge), etc
    # This way we're working with the same file regardless of
    # the version you picked
    VLCSRPM=$(find -name "vlc-$VLCVER.*.src.rpm" 2>/dev/null)
    
    # Make sure we found your rpm at this point
    # The following should output a file that exists
    echo $VLCSRPM
    
    # Initialize our Environment
    mock -v -r epel-6-x86_64 --init
    
    # Now install the nessisary dependencies for vlc which we must
    # additionally include the libmtp package we just built
    # including 'yum' so we'll fill all the dependencies
    mock -v -r epel-6-x86_64 --install libmtp-1.1.6-2.el6.x86_64.rpm 
                                       libmtp-devel-1.1.6-2.el6.x86_64.rpm 
                                       yum
    
    # Now this is the dirty trick I was telling you about; we'll
    # just install your current yum repositories into your mock
    # environment. This will make it really easy to fill our
    # dependency problems:
    find /etc/yum.repos.d/ -maxdepth 1 -mindepth 1 
                           -type f -name '*.repo' 
                           -exec mock -v -r epel-6-x86_64 
                                  --copyin {} /etc/yum.repos.d/ ;
    
    # Now we want to copy our VLC Source into the environment
    mock -v -r epel-6-x86_64 --copyin $VLCSRPM /builddir/build
    
    # Shell into our mock environment
    mock -v -r epel-6-x86_64 --shell
    
    # Change to our building directory
    cd /builddir/build
    
    # Install all our dependencies including our source
    yum install $(rpm -qp --requires vlc*.src.rpm | cut -d' ' -f1)
    
    # Install our source RPM
    rpm -Uhi vlc*.src.rpm
    
    # There is a chance this failed for you... if so
    # you can use the collection of rpms I built manually
    # to make it possible for me; just visit here:
    # https://www.dropbox.com/sh/9dt7klam6ex1kpp/_pczPoH-Wx/20131015/mtp/dep.vlc2.0
    # You can exit the shell (Ctrl-D) or type exit and by now
    # you should have enough info as to how you can install these
    # rpms into your mock environment using mock and --install
    
    # Now build your RPM (this can take some time):
    rpmbuild -ba SPECS/*.spec
    
    # We're now done with our mock environment for now; Press
    # Ctrl-D to exit or simply type exit on the command line
    # of our virtual environment
    exit
    
    Now just copy out our packages:
    mock -v -r epel-6-x86_64 --copyout /builddir/build/SRPMS/vlc-$VLCVER.el6.src.rpm .
    
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/vlc-$VLCVER.el6.x86_64.rpm .
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/vlc-core-$VLCVER.el6.x86_64.rpm .
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/vlc-extras-$VLCVER.el6.x86_64.rpm .
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/vlc-plugin-jack-$VLCVER.el6.x86_64.rpm
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/vlc-devel-$VLCVER.el6.x86_64.rpm
    mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/vlc-debuginfo-$VLCVER.el6.x86_64.rpm
    
    # You're done now! Phewf...
    

Installation

The installation will vary depending on your environment. If you are using either VLC or Rhythmbox, your life might be easier if you uninstall them now (knowing your going to re-install them again shortly).

yum remove rhythmbox vlc

Now you can install libmtp and your choice of FUSE/MTP implimentation (as root):

  • Option 1: simple-mtpfs
    yum localinstall libmtp-1.1.6-2.el6.x86_64.rpm simple-mtpfs-0.1-8.el6.x86_64.rpm
    
  • Option 2: jmtpfs
    yum localinstall libmtp-1.1.6-2.el6.x86_64.rpm jmtpfs-0.4-1.el6.x86_64.rpm
    
  • Option 3: mtpfs
    yum localinstall libmtp-1.1.6-2.el6.x86_64.rpm mtpfs-1.1-0.3.svn20120510.el6.x86_64.rpm
    

It’s important to note that you can go ahead and install all 3 options if you really wanted to (but it’s not really worth it). Pick one… if it doesn’t work well for you, try another.

Feel free to reinstall any other packaging you were using:

# VLC v2.0
yum localinstall vlc-core-2.0.6-1.el6.x86_64.rpm vlc-2.0.6-1.el6.x86_64.rpm

# Rythmbox v0.12.8
yum localinstall rhythmbox-upnp-0.12.8-1.el6.x86_64.rpm
Enable USB Debugging Mode
Enable USB Debugging Mode

It still isn’t mounting for me:

Some phones/tablets may require you to toggle the USB debugging mode of your phone and/or tablet for things to work smoothly for you. If you already have it enabled, then try disabling it. This is what I had to do with my Nexus 4 anyway; it worked beautifully for me after I toggled this option. I think this may be a bug with the current MTP v1.1 libraries that don’t seem to correctly handle the mounting of the device when being first connected. But whatever handshaking goes on, through the toggling of this option corrects the problem. I’m sure we will see this resolved in future builds.

Other MTP Alternatives

There are other alternatives; but this blog was going to be long enough just trying to share the ones I chose already.

  • FUSE Binding for Go is another alternative I didn’t test which seems to have a lot of active development on it as well. For those who aren’t familiar with The Go Programming Language, it is basically a fairly new language that is catching on with a lot of developers.
  • Gnome MTP is designed to be a simple MP3 player client for MTP based devices.

Credit

Please note that this information took me several days to put together and test thoroughly. I may not blog often; but I want to re-assure the stability and testing I put into everything I intend share.

If you like what you see and wish to copy and paste this HOWTO, please reference back to this blog post at the very least. It’s really all I ask.

Sources:

Offline Blogging Solutions with CentOS 6

Introduction

BloGTK v2.0
BloGTK v2.0

Offline Blogging in Linux doesn’t offer us a wide selection of free (open source) choices. Of the choices we do have at our disposal each have their own pros and cons which are really just bias opinions we’ll all carry with each other. This blog isn’t going to tell you which product is better and which one isn’t. It will provide you some alternatives to what’s already available and allow you to choose on your own. I also make additionally options available to you here as well should you choose to try them.

Keep in mind I run CentOS 6 as my primary OS (currently), so I focus primarily on making these products work on this distribution. But this doesn’t mean that all of the source RPMs I provided won’t compile for you in another distribution.

Drivel v3.0.0 Login Screen
Drivel v3.0.0 Login Screen

Open Source Offline Blogging Choices

The below outline some of the choices I found to be worth of digging further in:

I’m not sure what the status is on all of these project themselves. At this current time, I have to assume that both Drivel and BloGTK are some what dead since the last update to either of them

Gnome Blog v0.9.2
Gnome Blog v0.9.2

was back in late 2009. Meanwhile the last update made to Gnome Blog was in early 2010.

It is said that beggars can’t be choosers. So rolling with that in mind and the Open Source solutions available to us, we’ll accept what is offered and move on.

Hand over your work

With pleasure; it really didn’t take any time at all to package these properly.

Drivel (v3.0.0) took the most time to package; but even that didn’t take much effort. Drop Line provided a spec file of their own which didn’t work out of the box. It also didn’t include all the necessary dependencies. For this reason I just spun my own version of it. Have a look here if you want to see the spec file I generated.

BlogGTK v2.0 didn’t take me hardly any time at all. They didn’t change the installation that much from v1.1. The fact that it’s python based; there really isn’t a whole lot too it. You can view the spec for yourself if you’re interested.

Alternatively you can just fetch bloGTK from Pkgs.org which does such a great job organizing packages other people have put together. It’ll probably be an older version (as it was for me). At the time I wrote this blog it was BloGTK v1.1 on Pkgs.org hosted by RPMForge. It might be different when you try.

Gnome Blog was another one that actually packaged it’s own spec file within the official packaging. But the file was drastically missing dependencies and would not work out of the box at all. I had to massage it quite a bit; you can view the spec file here if you feel the need.

I will never trust you; I’ll build it for myself

Still feeling that way? No problem; here is how you can do it:

First off, I’m not a big fan of compiling code as the root user on the system I work with daily.   I am however a big fan of a tool called ‘mock‘ which allows us to develop software as root except within a safe virtual environment instead of our native one. I am also a big fan of package management; whether its a .DEB (Debian Package) or .RPM (Red Hat Package) for obvious reasons. For this tutorial; I’ll stick with RPMs since it’s what CentOS uses. We’ll prepare the RPMs and preform all our compilations within the mock environment.

# Install 'mock' into your environment if you don't have it already
# This step will require you to be the superuser (root) in your native
# environment.
yum install -y mock

# Grant your normal every day user account access to the mock group
# This step will also require you to be the root user.
usermod -a -G mock YourNonRootUsername

At this point it’s safe to change from the ‘root‘ user back to the user account you granted the mock group privileges to in the step above.  We won’t need the root user again until the end of this tutorial when we install our built RPM.

# Optionally fetch bloGTK v2.0
wget https://launchpad.net/blogtk/2.0/2.0/+download/blogtk-2.0.tar.gz
wget --output-document=blogtk.spec https://www.dropbox.com/sh/9dt7klam6ex1kpp/GR0uXU6PaC/20131008/blogtk.spec?dl=1

# Optionally fetch Drivel 3.0.0
wget --output-document=drivel-3.0.0.tar.bz2 http://prdownloads.sourceforge.net/drivel/drivel-3.0.0.tar.bz2?download
wget --output-document=drivel.spec https://www.dropbox.com/sh/9dt7klam6ex1kpp/MKD34uuBMs/20131008/drivel.spec?dl=1

# Optionally fetch gnome-blog v0.9.2
wget http://ftp.gnome.org/pub/GNOME/sources/gnome-blog/0.9/gnome-blog-0.9.2.tar.gz
wget --output-document=gnome-blog.spec https://www.dropbox.com/sh/9dt7klam6ex1kpp/O9nJdxoJMZ/20131008/gnome-blog.spec?dl=1

# Initialize Mock Environment
mock -v -r epel-6-x86_64 --init

# bloGTK dependencies
mock -v -r epel-6-x86_64 --install 
  python pygtk2 pygtk2-libglade desktop-file-utils

# Drivel dependencies
mock -v -r epel-6-x86_64 --install 
  gnome-doc-utils intltool gtk2 gtkspell-devel 
  glib-devel gtk2-devel GConf2-devel 
  gnome-vfs2-devel gtksourceview2-devel 
  libsoup-devel libxml2-devel

# gnome-blog dependencies
mock -v -r epel-6-x86_64 --install 
  pygtk2-devel gettext intltool 
  desktop-file-utils GConf2-devel 
  python-devel

mock -v -r epel-6-x86_64 --copyin blogtk.spec /builddir/build/SPECS
mock -v -r epel-6-x86_64 --copyin gnome-blog.spec /builddir/build/SPECS
mock -v -r epel-6-x86_64 --copyin drivel.spec /builddir/build/SPECS

mock -v -r epel-6-x86_64 --copyin drivel-3.0.0.tar.bz2 /builddir/build/SOURCES
mock -v -r epel-6-x86_64 --copyin gnome-blog-0.9.2.tar.gz /builddir/build/SOURCES
mock -v -r epel-6-x86_64 --copyin blogtk-2.0.tar.gz /builddir/build/SOURCES
mock -v -r epel-6-x86_64 --shell

# Within Shell Environment, Build the Desired RPM
rpmbuild -ba builddir/build/SPECS/drivel.spec
rpmbuild -ba builddir/build/SPECS/blogtk.spec
rpmbuild -ba builddir/build/SPECS/gnome-blog.spec

# exit shell (or press Cntrl-D)
exit

# Copy out your blogger of interest
mock -v -r epel-6-x86_64 --copyout /builddir/build/SRPMS/drivel-3.0.0-1.el6.src.rpm .
mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/drivel-debuginfo-3.0.0-1.el6.x86_64.rpm .
mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/drivel-3.0.0-1.el6.x86_64.rpm .

mock -v -r epel-6-x86_64 --copyout /builddir/build/SRPMS/blogtk-2.0-1.el6.src.rpm .
mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/blogtk-2.0-1.el6.noarch.rpm .

mock -v -r epel-6-x86_64 --copyout /builddir/build/SRPMS/gnome-blog-0.9.2-1.src.rpm .
mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/gnome-blog-0.9.2-1.x86_64.rpm .
mock -v -r epel-6-x86_64 --copyout /builddir/build/RPMS/gnome-blog-debuginfo-0.9.2-1.x86_64.rpm .

# Install your blogger of choice; you'll need to be root or
# have sudoers permission to do this:
yum localinstall drivel-3.0.0-1.el6.x86_64.rpm
yum localinstall blogtk-2.0-1.el6.noarch.rpm
yum localinstall gnome-blog-0.9.2-1.x86_64.rpm

Drivel & WordPress

Drivel supports WordPress with a small with the following configuration:

  1. Configure your User/Pass as you normally would have
  2. Set the Movable Type to Journal type
  3. Set the Server Address field to be http://yourusername.wordpress.com/xmlrpc.php. For example I would have put http://nuxref.wordpress.com/xmlrpc.php for my own blog.

Another thing to note about Drivel is I was unable to retrieve a list of recent posts made to the WordPress server. However every other aspect of the tool appears to fine. People using different blog engines may not notice any problem at all.

Gnome-Blog & WordPress

  1. Set the Blog Type to Self-Run Other
  2. Set the Blog Protocol to MetaWeblog
  3. Set the XML-RPC URL field to be http://yourusername.wordpress.com/xmlrpc.php. For example I would have put http://nuxref.wordpress.com/xmlrpc.php for my own blog.
  4. Configure your User/Pass as you normally would have

Not Open Source, but other Free Alternatives:

  • ScribeFire:A plugin exists for Firefox & Chrome users called ScribeFire which also enables blogging functionality from within your browser. It’s worth noting as another alternative if you want it. It doesn’t involve extra packaging since it can be installed from within your browser.
  • Thingamablog: Another free solution; Thingamablog provides the binaries directly from their website here

Credit

If you like what you see and wish to copy and paste this HOWTO, please reference back to this blog post at the very least. It’s really all I ask.

If I forgot any (Open Source) Offline Bloggers that you know about; please let me know. I have no problem updating this blog to accommodate it.

Sources

I referenced the following resources to make this blog possible:

Install GIMP v2.8 on CentOS 6.x

Introduction

GIMP v2.8 offers a whole slew of new photo editing features to play with but requires many libraries newer then what CentOS (or even Red Hat) 6 offer. For those like me who chose their Linux platform based on stability and the slower release cycles that come with it, well… we sometimes sacrifice the possibility of not always having bleeding edge tools available to us as a result. It’s not always because these applications can’t work on our systems, but because the effort involved in making it happen simply isn’t worth it. We have to hope someone on the internet will get so frustrated that they’ll just created a solution and share how they did it with the rest of us. But more importantly, we hope the solution isn’t going to jeopardize the stability of our system.

Why Isn’t there a GIMP v2.8 package already available?

CentOS (and Red Hat) follow a set of rules when they release a major version of their platform. These rules play a major role as to why their releases are so stable. One of those rules involves fixing the version of the core library GLIB to a specific and unaltered version. What’s important to know is GLIB truly is the core library used by just about every application we ever ran in Linux. With CentOS and Red Hat, the only updates to GLIB you will ever see are small patches fixing bugs only. Again I stress the words “bugs only“; these are patches applied to our existing version of GLIB and will not introduce features offered in newer versions of the library.

In September of 2011 GLIB introduced a new standard called C++11 offering developers easier ways write their code. C++11 introduces things that other programming languages have had forever such as the true use of NULL value (separating it from 0 – zero).  I truly can’t say enough great things about C++11 and the many new features it offers. In fact, the C++11 standard is so ingenious that most (if not all) active projects being used today are adopting them into their code for their benefits. Yes… One of those projects is GIMP v2.8.

So here is our problem… GLIB v2.12 shipped with CentOS and Red Hat 6 does not support C++11. Hence our problem is that we can’t run any of the new applications because they simply can’t (and won’t) work (or even compile for that matter) in our environment any more.

What are you going to do about it?

My goal is to have GIMP v2.8 installed on my CentOS 6.x system without jeopardizing the existing stability of my system. So upgrading my version of GLIB is completely out of the question.  I simply want to install the application in parallel through the same package management our platform is built on (RPMs). I certainly do not want to have to install all kinds of development libraries to pull this feat off either.  With my extremely picky requirements, I found absolutely ‘nothing’ on the internet showing me how to do this.

Rajiv Sharma had posted a blog (link) that came the closest to a near working suggestion; at least proving that running GIMP v2.8 can run on CentOS with the right packages.  It was his post that inspired me to take his efforts to another level. My only problem with his approach was that it required you to haul development libraries into your native working environment along with the lack of package management.

The key to the solution I’m offering is a ‘second’ copy of GLIB placed in a completely isolated location on our system so it won’t interfere with anything we already have installed. GIMP can then be compiled and ran against the libraries we isolated safely on our system.  To further this solution; I want to offer it to those who aren’t comfortable with compiling themselves an pre-built packaged solution ready to go.  Trust is hard to earn on the internet; so for those who are skeptical to run a pre-built binary on their system can read further and re-preform the solution for themselves.

Skip To The Goods

99% of my time was spent trying to put this into a working stable and tested RPM file. Some of you aren’t interested in how these results were achieved and simply just want it working for your own system.  I honestly can’t blame you… so here is the prize served to you on a silver platter:

Most users just need the binary package; it can be installed through the command:

yum -y localinstall gimp28-2.8.6-1.el6.x86_64.rpm

Your new GIMP v2.8 Environment

GIMP v2.8 Loading Screen
GIMP v2.8 Loading Screen

In the end everything (about 250MB worth) is installed into /opt/gimp28. It will not impact or touch anything you may or may not have had already installed on your system. This includes running perfectly in parallel with GIMP v2.6 if you choose to keep running it as something to fall back to.

The RPM additionally includes 3 scripts to greatly simplify access to new parallel install of GIMP v2.8.

The following shell scripts were created by the RPM automatically to make accessing GIMP v2.8 easier. They will look after setting up the appropriate environment variables and executing the tools they represent.

  • /usr/bin/gimp28 will start the full blown application itself.
  • /usr/bin/gimp28-console for the console users
  • /usr/bin/gimp28tool and the gimptool application for those who use it.

As an added touch; I set up a Gnome menu item too! You can access this new installed application from:
Applications -> Graphics -> GNU Image Manipulation Program v2.8

All local cache and configuration goes into ~/.gimp-2.8 so it won’t interfere with any of your GIMP 2.6 configuration you may already have set up in ~/.gimp-2.6

GIMP v2.8 Single Window Mode running on CentOS 6
GIMP v2.8 Single Window Mode running on CentOS 6

I’d Rather Build it Myself

For those who would rather build GIMP 2.8 for themselves and not use the packages provided in this blog, you’ll need to keep reading.

Prepare and Install Mock

First off, I’m not a big fan of compiling code as the root user on the system I work with daily.   I am however a big fan of a tool called ‘mock‘ which allows us to develop software as root except within a safe virtual environment instead of our native one. I am also a big fan of package management; whether its a .DEB (Debian Package) or .RPM (Red Hat Package) for obvious reasons. For this tutorial; I’ll stick with RPMs since it’s what CentOS uses. We’ll prepare the RPMs and preform all our compilations within the mock environment.

# Install 'mock' into your environment if you don't have it already
# This step will require you to be the superuser (root) in your native
# environment.
yum install -y mock

# Grant your normal every day user account access to the mock group
# This step will also require you to be the root user.
usermod -a -G mock YourNonRootUsername

At this point it’s safe to change from the ‘root‘ user back to the user account you granted the mock group privileges to in the step above.  We won’t need the root user again until the end of this tutorial when we install our built RPM.

Fetch the Required Packages

You need to haul in a few packages that have to be compiled along with GIMP in order to make this whole thing possible; the steps for this are as follows:

# Create a directory we can work in
mkdir src
# Change to our directory
cd src

# Fetch our sources; you can use curl or wget for this:
wget ftp://ftp.gimp.org/pub/gimp/v2.8/gimp-2.8.6.tar.bz2
wget http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.34/glib-2.34.0.tar.xz
wget ftp://ftp.gimp.org/pub/babl/0.1/babl-0.1.10.tar.bz2
wget ftp://ftp.gimp.org/pub/gegl/0.2/gegl-0.2.0.tar.bz2
wget http://download.gnome.org/sources/atk/2.2/atk-2.2.0.tar.bz2
wget http://cairographics.org/releases/cairo-1.12.16.tar.xz
wget http://ftp.gnome.org/pub/gnome/sources/pango/1.29/pango-1.29.4.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.24/gdk-pixbuf-2.24.1.tar.xz
wget http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.10.tar.xz

# Grab the RPM SPEC file which contains the blueprints; this file is
# the key to making everything work
wget --output-document=gimp28.spec https://www.dropbox.com/sh/9dt7klam6ex1kpp/PkMeLDVYrF/20131005/gimp28.spec?dl=1
# Grab the GIMP Desktop Link
wget --output-document=gimp28.desktop.tgz https://www.dropbox.com/sh/9dt7klam6ex1kpp/Tbxef5KE6t/20131005/gimp28.desktop.tgz?dl=1

Setup a Mock Environment

We now set up a mock environment we can work in. It is in here we’ll do all our compiling. This allows us to keep all of the development libraries outside of our normal environment. For when we’re all done, we can just destroy the Mock environment we created and all of it’s contents go with it.

# Initialize Mock Environment
mock -v -r epel-6-x86_64 --init
# Install stable packaging we don't need to rebuild ourselves that are
# requirements of the GIMP software.
mock -v -r epel-6-x86_64 --install aalib aalib-devel libexif-devel gettext 
libjpeg-devel libpng-devel libtiff-devel 
libmng-devel libXpm-devel librsvg2-devel 
libffi-devel libwmf-devel webkitgtk-devel 
python-devel zlib-devel pygtk2-devel 
intltool chrpath freetype-devel 
ghostscript-devel iso-codes-devel 
bzip2-devel curl-devel fontconfig-devel 
gnome-keyring-devel libgnomeui-devel 
python-devel zlib-devel libX11-devel 
sed findutils

# Copy our retrieved files into the mock's building environment
mock -v -r epel-6-x86_64 --copyin cp *.xz *.bz2 /builddir/build/SOURCES
mock -v -r epel-6-x86_64 --copyin cp *.xz *.bz2 /builddir/build/SPECS

# Now shell into the mock environment
mock -v -r epel-6-x86_64 --shell
cd builddir/build

# Permissions are important to rpmbuild from within the mock
# environment By doing this, your actually just giving it the
# 'mock' user exclusive permissions and ownership (since we are
# in the mock environment when calling them)
chown root.root SOURCES/*
chown root.root SPECS/*

#******************************************
# Now we Build our product!
# This can take a while so be patient!!
#******************************************
rpmbuild -ba SPECS/gimp28.spec

You can now press Ctrl-D (or type: exit) to return back to your regular working environment. You would have produced 2 new RPMs (the binary and source package) which you can now install into your system.

# Retrieve the binary RPM you just built
mock -v -r epel-6-x86_64 
  --copyout /builddir/build/SRPMS/gimp28-2.8.6-1.el6.src.rpm .
mock -v -r epel-6-x86_64 
  --copyout /builddir/build/RPMS/gimp28-2.8.6-1.el6.x86_64.rpm .

You can now install the RPM you just built above into your system:

# You will need to switch back to the superuser (root) to preform this
# The command below will look after resolving any dependencies you were
# otherwise already missing and install the package into your system
# gracefully.
yum -y localinstall gimp28-2.8.6-1.el6.x86_64.rpm

The RPM SPEC File is The Key

This tutorial is pretty easy only because all the hard work is done within the .spec file. Most of my time was spent merging spec files and reading examples as to how the newer platforms built their newer packages.  The rest of the effort was after getting all of the packages to install correctly; have them just ‘work’ without any messing around.

Credit

This is my first blog post and I truly hope readers will find this information useful! Please note that this information took me several weeks to put together and test thoroughly. I may not blog often; but I want to re-assure the stability and testing I put into everything I intend share.

if you like what you see and wish to copy and paste this HOWTO and/or use my SPEC file I designed elsewhere, please reference back to this blog post at the very least. It’s really all I ask.

Sources

  • Once again I want to credit Rajiv Sharma for starting me in the right direction with his blog entry (link).
  • I used pkgs.org frequently to obtain rpm source packaging for GIMP, GDK, etc which helped me construct and build the SPEC file I’m sharing here.
  • rpath alterations played a key in helping made the environment work. I found this link very useful in explaining that to me which again went into the SPEC file design.
  • RPM official reference here; This link here was really useful explaining the SPEC file macro’s.
  • GIMP environment variables and configuration explained here.

Got an idea or request?

If you have an idea of request enhancement; please feel free to contact me and let me know what it is.  I have no problem enhancing the SPEC if the accommodations seem worthy.