Building a new xfwm4 Debian package: Try it, you’ll like it!

In the askubuntu web forum (http://askubuntu.com/questions/821940/configure-mouse-buttons-in-xfce4), I asked if it is possible to change the behavior of the mouse in response to  Alt-Middle click. Currently, that causes a window to be moved to the bottom of the stack of windows. On a new Dell precision 5510, the trackpad makes it difficult to know where the left button is separated from the middle button and I often accidentally get the middle when I want left.

There were no answers for a while, so I asked same question in the XFCE4 support forum. https://forum.xfce.org/viewtopic.php?pid=43174#p43174

The answer is that the Alt-Middle click behavior (pushes window to bottom of stack) is hard coded in the xfwm4 source code. Only way to change it is to recompile xfwm4. Helpful person pointed at src file events.c line 928 for revision. I found easy to build new package and now have xfwm4 behaving the way I want!

In case you have not tried this for yourself, the process is much more straightforward than one might expect. It seems quite a bit better than it was just 18 months ago. In brief, get the source for the package, fiddle the source code, try to rebuild, let it make a patch, then build again.

$ sudo apt-get build-dep xfwm4
$ mkdir -p tmp/xfmw4
$ cd tmp/xfwm4
$ apt-get source xfwm4 
$ cd xfwm4-4.12.3/src
$ vi events.c

In that file I made a correction that amounted to this patchfile. It looks like the spaces were destroyed in cutting an pasting, but if you open events.c and go to line 928, you see there is one line I’ve commented out and one I’ve added.

+++ xfwm4-4.12.3/src/events.c
@@ -925,7 +925,8 @@ handleButtonPress (DisplayInfo *display_
}
else if ((ev->button == Button2) && (state) && (state == screen_info->params->easy_click))
{
- clientLower (c, None);
+ /* clientLower (c, None); */
+ button1Action (c, ev);
}
else if ((ev->button == Button3) && (state) && (state == screen_info->params->easy_click))
{

This causes the Alt-Middle and Alt-Left behaviors to be the same. I fiddle those lines in the source, then run

$ dpkg-buildpackage -rfakeroot

In new version of this program, there is a very handy feature. The builder notices you edited the file and it makes a patch for you and puts the patch in the debian directory, under patches. Read the output, it will be obvious what to do.

$ dpkg-source commit

Before running the builder again, edit the changelog to update the version. The easiest way is to use the helper named “dch”

$ dch

Opens a dialogue where you need to make sure you are incrementing the package name, so that when you install the new xfwm4 you will build, it gets a new number.

Then run the builder again

$ dpkg-buildpackage -rfakeroot

If all goes well, then the new packages will be in the directory above.

$ cd ..
$ sudo dpkg -i xfwm4_4.12.3-1ubuntu4_amd64.deb
$ xfwm4 --replace &

You’ll see the effect of the change right away.

If you’ve never rebuild a Debian/Ubuntu package, you might as well download the source and give it a try. This is one of the most satisfying parts of being a Linux user.

This change in xfwm4 helps me quite a lot because this touchpad is, well, very difficult to use. Without looking down at the touchpad, I find it impossible to know for sure where the left button area ends and the middle button begins. My right thumb does not always reach far enough to find the left button. By making the left and middle button alt-click behaviors the same, I reduce the error rate quite a bit.

In caveman talk, I’d say to Dell: “trackpad bad! buttons good!”. I know I’m out of style here.

Posted in Uncategorized | Leave a comment

Building R-devel on RedHat Linux 6

 

Warning: I’m 85% done with this, formatting is not right. I DO NOT want to type in the prompt in front of every command because then one cannot copy/paste directly.  However, copying some output chunks picks up the dollar signs and I’m inconsistent.

Brief Summary: R-devel will not build without access to newer zlib, bzip2.  This is a problem because CRAN requires users to test packages against R-devel, not against existing R or R-patched. This note has step-by-step information about what was necessary to compile & install R-devel in my user account on a cluster compute environment running RedHat 6 Linux.To upload an R package, one must agree to compile the package against R-devel, the cutting edge version of R.

The 2016 current version of R-devel has removed the versions of several compression libraries that used to be included. Instead of providing those libraries, R-devel supposes they are installed in the operating system. On my up-to-date Ubuntu laptop, this was not a concern because I have up-to-date versions of zlib, xz, pcre, and curl.On the compute cluster, which is still running RedHat 6, it is a more serious problem because the libraries zlib, bzip, pcre, curl, and xz are out of date. We find that out because when we try to build R-devel, it fails and tells us what is out of date.

As a result, one cannot configure and compile R-devel. One must get updated libraries. If the system administrators would replace all of those libraries, we could go ahead.However, in a Unix system, it is possible to compile and install support libraries in a user’s account, without system-wide intervention. With the exception of bzip2, where theinstallation is a non-standard setup, the installs of zlib, xz, curl, and pcre are standard and easy. Building R-devel on a Linux system with slightly older packges.

Here is the process I went through on RHEL6 to make this go. Special thanks to Wes Mason at KU ITTC who provided the critical ingredient.

1. Our cluster defaults to an ancient version of gcc.   I can tell my environment to use the newer gcc compiler

$ module avail
$ module load gcc/4.9.22

2. Try to build R-devel without making any special preparations.

mkdir src
 cd src
 wget --no-check-certificate https://stat.ethz.ch/R/daily/R-devel_2016-02-11.tar.gz
 tar xzvf R-devel_2016-02-11.tar.gz
 cd R-devel
 ./configure --help
mkdir builddir
 cd builddir
 ../configure --prefix=$HOME/packages/R-devel '--with-cairo' \
 '--with-jpeglib' '--with-readline' '--with-tcltk' \
 '--with-blas' '--with-lapack' '--enable-R-profiling' \
 '--enable-R-shlib' \
 '--enable-memory-profiling'
## fails ignominously:
 checking if zlib version >= 1.2.5... no
 checking whether zlib support suffices... configure: error: zlib
 library and headers are required

3. Install zlibDownload, un-tar, configure, compile

cd ~/src
 wget http://zlib.net/zlib-1.2.8.tar.gz
 tar xzvf zlib-1.2.8.tar.gz
 cd zlib-1.2.8
 ./configure --prefix=$HOME/packages

I won’t show all the output for all of these things, but this is brief and representative

 Checking for gcc...
 Checking for shared library support...
 Building shared library libz.so.1.2.8 with gcc.
 Checking for off64_t... Yes.
 Checking for fseeko... Yes.
 Checking for strerror... Yes.
 Checking for unistd.h... Yes.
 Checking for stdarg.h... Yes.
 Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
 Checking for vsnprintf() in stdio.h... Yes.
 Checking for return value of vsnprintf()... Yes.
 Checking for attribute(visibility) support... Yes.

This is the common GNU-style software. configure. make. make install. Run those:

make
make install
$ make install
 cp libz.a /home/pauljohn/packages/lib
 chmod 644 /home/pauljohn/packages/lib/libz.a
 cp libz.so.1.2.8 /home/pauljohn/packages/lib
 chmod 755 /home/pauljohn/packages/lib/libz.so.1.2.8
 cp zlib.3 /home/pauljohn/packages/share/man/man3
 chmod 644 /home/pauljohn/packages/share/man/man3/zlib.3
 cp zlib.pc /home/pauljohn/packages/lib/pkgconfig
 chmod 644 /home/pauljohn/packages/lib/pkgconfig/zlib.pc
 cp zlib.h zconf.h /home/pauljohn/packages/include
 chmod 644 /home/pauljohn/packages/include/zlib.h /home/pauljohn/packages/include/zconf.h

4. Adjust the environment so R-devel builds will find packages installed there.

 export PATH=$HOME/packages/bin:$PATH
 export LD_LIBRARY_PATH=$HOME/packages/lib:$LD_LIBRARY_PATH 
 export CFLAGS="-I$HOME/packages/include" 
 export LDFLAGS="-L$HOME/packages/lib" 
The first two are vital during the “make” phase in R-devel, the latter 2 are vital in the “configure” phase in R-devel.5. Try to build R-devel again, using new zlibI remove and remake the build directory, so that any accumulated errors are eliminated
cd ~/src
cd R-devel/
rm -rf builddir
mkdir builddir
cd builddir/
../configure --prefix=$HOME/packages/R-devel --with-cairo \
 --with-jpeglib --with-readline --with-tcltk \
 --with-blas --enable-BLAS-shlib --with-lapack --enable-R-profiling \
 '--enable-R-shlib' \
 '--enable-memory-profiling'

That succeeds, finds zlib, but configure ends with this error:

checking bzlib.h presence... yes
 checking for bzlib.h... yes
 checking if bzip2 version >= 1.0.6... no
 checking whether bzip2 support suffices... configure: 
error: bzip2 library and headers are required

6. Get new bzlib support. This one is not built with GNU auto tools,so it is a little more interesting/idiosyncratic. Would not havesolved it without help from this site:http://www.linuxfromscratch.org/lfs/view/development/chapter06/bzip2.html

## So we go get bzlib, which is part of bzip2, just like we did on zlib

cd ~/src
wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar xzvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6

Inspect the README. Temptation is to be careless and just run make, but that’s not quite enough because we need the shared library. Then make after

make -f Makefile-libbz2_so
 make clean
 make
 make -n install PREFIX=$HOME/packages
 make install PREFIX=$HOME/packages

7. Try to build R-devel again

cd ~/src/R-devel
 rm -rf builddir/
 mkdir builddir
 cd builddir
 ../configure --prefix=$HOME/packages/R-devel '--with-cairo' \
 '--with-jpeglib' '--with-readline' '--with-tcltk' \
 '--with-blas' '--with-lapack' '--enable-R-profiling' \
 '--enable-R-shlib' \
 '--enable-memory-profiling'

configure fails with

checking whether bzip2 support suffices... no
 checking for lzma_version_number in -llzma... no
 configure: error: "liblzma library and headers are required"

8. Go get liblzma. I tried that, couldn’t compile that, but Wes Mason warned me not to try to install the separate liblzma, but rather get the package known as xz.

cd ~/src
wget http://tukaani.org/xz/xz-5.2.2.tar.gz
tar xzvf xz-5.2.2.tar.gz
cd xz-5.2.2
./configure --prefix=$HOME/packages
make -j3
make install

8.  Try R-devel again, same steps as before, make builddir, then

../configure --prefix=$HOME/packages/R-devel '--with-cairo' \
 '--with-jpeglib' '--with-readline' '--with-tcltk' \
 '--with-blas' '--with-lapack' '--enable-R-profiling' \
 '--enable-R-shlib' \
 '--enable-memory-profiling'

That gets quite a bit further and fails:

checking for pcre/pcre.h... no
 checking if PCRE version >= 8.10, < 10.0 and has UTF-8 support... no checking whether PCRE support suffices... configure: error: pcre >= 8.10 library and headers are required

9. Get pcre. This is getting old now

cd ~/src

 wget
 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz

 tar xzvf pcre-8.38.tar.gz
 ./configure --prefix=$HOME/packages
 make -j3
 make install

9B. Back to R-develR-devel configure fails same way:

checking for pcre/pcre.h... no
checking if PCRE version >= 8.10, < 10.0 and has UTF-8 support...
no checking whether PCRE support suffices... 
configure: error: pcre >= 8.10 library and headers are required

9C So I suspect the UTF-8 support is the issue.Back to PCRE, reconfigure. Usually, best to erase whole sourcedirectory and get a clean run at it. Because I did not do safe thingand use a builddir in there, I have to do that. I run this configure command,

./configure --enable-utf8 --prefix=$HOME/packages
make 
make install

10. Try R-devel again.Fails asking for libcurl

 checking libcurl version ... 7.19.7
 checking curl/curl.h usability... yes
 checking curl/curl.h presence... yes
 checking for curl/curl.h... yes
 checking if libcurl is version 7 and >= 7.28.0... no
 configure: error: libcurl >= 7.28.0 library and headers are 
required with support for https

11. Install libcurl## Note need ignore certificate problem on this one

 cd ~/src
 wget --no-check-certificate https://curl.haxx.se/download/curl-7.47.1.tar.gz
 tar xzvf curl-7.47.1.tar.gz
 cd curl-7.47.1
 ./configure --prefix=$HOME/packages
 make -j3
 make install

12. Try R-devel again

cd ~/src
 cd R-devel
 rm -rf builddir
 mkdir builddir
 cd builddir
 ../configure --prefix=$HOME/packages/R-devel '--with-cairo' \
 '--with-jpeglib' '--with-readline' '--with-tcltk' \
 '--with-blas' '--with-lapack' '--enable-R-profiling' \
 '--enable-R-shlib' \
 '--enable-memory-profiling'

HOORAY, it finished!

config.status: creating tests/Embedding/Makefile
 config.status: creating tests/Examples/Makefile
 config.status: creating tools/Makefile
 config.status: creating src/include/config.h
 config.status: executing libtool commands
 config.status: executing stamp-h commands
R is now configured for x86_64-pc-linux-gnu
Source directory: ..
 Installation directory: /home/pauljohn/packages/R-devel
C compiler: gcc -std=gnu99 -I/home/pauljohn/packages/include
 Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
 C++11 compiler: g++ -std=c++11 -g -O2
 Fortran 90/95 compiler: gfortran -g -O2
 Obj-C compiler: gcc -g -O2 -fobjc-exceptions
Interfaces supported: X11, tcltk
 External libraries: readline, BLAS(generic), LAPACK(generic), curl
 Additional capabilities: PNG, JPEG, NLS, cairo, ICU
 Options enabled: shared R library, R profiling, memory profiling
Capabilities skipped: TIFF
 Options not enabled: shared BLAS
Recommended packages: yes
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally

That last warning, well, I’m ignoring it. I don’t need to build their documents, I need to see if my package builds without errors. I don’t care much that shared BLAS is not enabled, but I ususally would want that if I were making a production system.However, running

make

ends in failure:

gcc -std=gnu99 -shared -fopenmp -L/home/pauljohn/packages/lib -o libR.so 
CommandLineArgs.o Rdynload.o Renviron.o RNG.o agrep.o apply.o 
arithmetic.o array.o attrib.o bind.o builtin.o character.o coerce.o 
colors.o complex.o connections.o context.o cum.o dcf.o datetime.o 
debug.o deparse.o devices.o dotcode.o dounzip.o dstruct.o 
duplicate.o edit.o engine.o envir.o errors.o eval.o format.o 
gevents.o gram.o gram-ex.o graphics.o grep.o identical.o 
inlined.o inspect.o internet.o iosupport.o lapack.o list.o 
localecharset.o logic.o main.o mapply.o match.o memory.o 
names.o objects.o options.o paste.o platform.o plot.o plot3d.o 
plotmath.o print.o printarray.o printvector.o printutils.o qsort.o 
radixsort.o random.o raw.o registration.o relop.o rlocale.o 
saveload.o scan.o seq.o serialize.o sort.o source.o split.o 
sprintf.o startup.o subassign.o subscript.o subset.o summary.o 
sysutils.o times.o unique.o util.o version.o g_alab_her.o 
g_cntrlify.o g_fontdb.o g_her_glyph.o xxxpr.o `ls ../unix/*.o 
../appl/*.o ../nmath/*.o` ../extra/tre/libtre.a -lblas -lgfortran 
-lm -lquadmath -lreadline -lpcre -llzma -lbz2 -lz -lrt -ldl -lm 
-licuuc -licui18n
 /usr/bin/ld: /home/pauljohn/packages/lib/libbz2.a(bzlib.o): 
relocation R_X86_64_32S against `BZ2_crc32Table' can not be used 
when making a shared object; recompile with -fPIC
 /home/pauljohn/packages/lib/libbz2.a: could not read symbols: Bad value
 collect2: error: ld returned 1 exit status
 make[3]: *** [libR.so] Error 1
 make[3]: Leaving directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir/src/main'
 make[2]: *** [R] Error 2
 make[2]: Leaving directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir/src/main'
 make[1]: *** [R] Error 1
 make[1]: Leaving directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir/src'
 make: *** [R] Error 1

13. That’s certainly pointing the finger back at bzip2, which is the only non-standard library in the whole batch. It doesn’t use GNU autoconf, has vague instructions. I went into the bzip2 directory and inserted -fPIC as a CFLAG in the Makefile. Then I ran make and make install PREFIX=$HOME/packages again, as above14. R-devel, againrm the builddirmake a new builddir, go in there, run the configure statement, looksOK

make

succeeds. Be aware, it is VITAL the PATH and LD_LIBRARY_PATH be set in the environment as stated above.Here’s the evidence it did eventually compile

make[2]: Leaving directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir/src/library/Recommended'
make[1]: Leaving directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir/src/library/Recommended'
make[1]: Entering directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir/src/library'
building/updating vignettes for package 'grid' ...
building/updating vignettes for package 'parallel' ...
building/updating vignettes for package 'utils' ...
make[1]: Leaving directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir/src/library'
make[1]: Entering directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir'
configuring Java ...
Java interpreter : /usr/bin/java
Java version : 1.7.0_09-icedtea
Java home path : /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program 
detected JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
make[2]: Entering directory `/library/tmp/Rjavareconf.wg86X6'
gcc -std=gnu99 -I/home/pauljohn/src/R-devel/builddir/include -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include/linux -I/usr/local/include -fpic -I/home/pauljohn/packages/include -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/home/pauljohn/src/R-devel/builddir/lib -L/home/pauljohn/packages/lib -o conftest.so conftest.o -L/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/server -ljvm -L/home/pauljohn/src/R-devel/builddir/lib -lR
make[2]: Leaving directory `/library/tmp/Rjavareconf.wg86X6'
JAVA_HOME : /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre
Java library path: $(JAVA_HOME)/lib/amd64/server
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
Updating Java configuration in /home/pauljohn/src/R-devel/builddir
Done.
make[1]: Leaving directory `/panfs/pfs.acf.ku.edu/home/pauljohn/src/R-devel/builddir'

 

Posted in Linux | Tagged , , , | 36 Comments

New lifescape panorama

 

Today, I was struck by the beauty of the desert on a crystal clear morning. As the panorama below  indicates, there is no apparent sign of life in this seemingly barren, desolate part of the high plains. Only the grizzled veterans like me can see the glimmers of life that lie deep within the sand, waiting for the rainy season to bring precious moisture.

The library on new year's eve

The library on new year’s eve

When the rainy season comes (or the semester starts), the isolated cedar and cactus trees will not look so lonely.

Posted in Uncategorized | Leave a comment

Time Series tips for R users

Two people were in here last week asking me about time series modeling in R. I said I’d look something up.

I thought this was fabulously helpful for translating between R and time series books:

http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm

The leading authority on time series, especially ARIMA, in R is probably Rob Hyndman:

http://robjhyndman.com/hyndsight/time-series-data-in-r/

A new tutorial that was announced today that reminded me I promised to look up time series materials.

http://www.analyticsvidhya.com/blog/2015/12/complete-tutorial-time-series-modeling/

Posted in R | Tagged | Leave a comment

Get out of fail2ban jail

Ever get locked out of your own computer because you tried the password too many times when you were, well, not paying attention? I found it tough to find how to unban myself and was pretty frustrated by the ambiguity of the instructions. Not ambiguous. Comprehensive. I don’t really want to know any more about fail2ban than how to remove one particular IP.

First, get a list of the jails
# fail2ban-client status

Status
|- Number of jail: 1
`- Jail list: sshd

Then review the banned things

# fail2ban-client status sshd

Status for the jail: sshd
|- Filter
| |- Currently failed: 2
| |- Total failed: 634
| `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd
`- Actions
|- Currently banned: 2
|- Total banned: 4
`- Banned IP list: 219.137.44.150 229.137.39.8

# fail2ban-client set sshd unbanip 219.137.44.150

I didn’t find this recipe written down anywhere, probably it is too obvious for an expert to write it own.

However, this guy writes interesting scripts and I was able to deduce the required actions from reading his code

http://www.iredmail.org/forum/topic7498-iredmail-support-handy-script-for-unbanning-ips.html

Posted in Linux | Tagged | Leave a comment

OpenBUGS-3.2.3 Linux Packages

I’m very sorry I stopped paying attention to the packaging on openbugs for a while. I stopped reading the gmail account because I hated their labeling system, but that account is where I’m registered in the OpenBUGS list.

Oh, well. We are back up to date now

1. RedHat/Centos 6 and 7

http://pj.freefaculty.org/EL/

This is a fully fledged EL repository server, users can add the repo to yum and it will be automatic. Otherwise, can download the old fashioned way…

http://pj.freefaculty.org/EL/7/x86_64/openbugs-3.2.3-1.x86_64.rpm
http://pj.freefaculty.org/EL/6/x86_64/openbugs-3.2.3-1.x86_64.rpm

3. Ubuntu

http://pj.freefaculty.org/Ubuntu/15.04/amd64

That’s not a fully fledged repository, that’s too baroque for me. But you can download the package file. I left the whole build directory there and everything, so in case you wonder what is in there, be my guest to snoop about

Posted in Linux | Tagged | Leave a comment

Gambit packages updated

Linux packages for Gambit were built yesterday. All of these do install and I’m able to open the Gambit GUI and create a game. I compiled with no special arguments, these may not include all of the features you want. If I got that wrong, email me at pauljohn@ku.edu. I’m willing to do this once again, but only if you ask:).

The RPM for EL7 systems can be found in the repo described here:

http://pj.freefaculty.org/EL

but if you just want the RPM, get them here:

http://pj.freefaculty.org/EL/7/x86_64/gambit-14.1.0-1EL7.x86_64.rpm
http://pj.freefaculty.org/EL/7/x86_64/gambit-debuginfo-14.1.0-1EL7.x86_64.rpm

If you are in different flavor of Linux, maybe you rebuild the SRPM instead:

http://pj.freefaculty.org/EL/7/SRPMS/gambit-14.1.0-1EL7.src.rpm

I also built packages for Ubuntu/Debian systems. I was uncertain at first if the stable version of Gambit is 13.1.2 or 14.1.0, and so I made both. Get the deb files in these directories

http://pj.freefaculty.org/Ubuntu/14.10/amd64/gambit-13.1.2
http://pj.freefaculty.org/Ubuntu/14.10/amd64/gambit-14.1.0

I am struck once again by how incredibly baroque and cumbersome the Debian packaging process has become. Its too bad. I did not build an apt repo, there’s no straightforward way to do that. Again, too bad.

This Gambit compile did not produce any shared libraries, which improves the chances that one can run them on similar, but not identical, Linuxes. I’m almost certain these will install & run on Debian or Ubuntu-based Mint. If not, all of the stuff to rebuild is uploaded in the same directory.

This version of Gambit does require the wxWidgets 2.8 or newer. In the end, I used the newest ones I could get more-or-less easily. I used the wx from the EPEL repo on the EL7 system. That provided:

wxGTK-media-2.8.12-13.el7.x86_64
wxGTK-gl-2.8.12-13.el7.x86_64
wxBase-2.8.12-13.el7.x86_64
wxGTK-2.8.12-13.el7.x86_64
wxGTK-devel-2.8.12-13.el7.x86_64

It appears to me I may have been conservative there, I did not intentionally avoid the packages named wxGTK3 on EPEL, I simply took the first set I understood. If you require RPM based on wxGTK3, I think i can do it. Just let me know.

On the Ubuntu system, the wx 3.x is available in the default repositories. However, there is an allegation of an unpatched bug (which I’ve not experienced). Currently, I’m running with these packages:

libwxgtk3.0-dev_3.0.1-3_amd64.deb
libwxgtk3.0-dev_3.0.2-1.utopic_amd64.deb
wx3.0-headers_3.0.1-3_amd64.deb
wx3.0-headers_3.0.2-1.utopic_amd64.deb
wx-common_3.0.1-3_amd64.deb
libwxgtk3.0-0-unofficial_3.0.2-1.utopic_amd64.deb

Note the last one is the “unofficial” version, that’s an update from the non-base repo. In my heart, I don’t think you really need that, but I was feeling compulsive and downloaded it from the wx home site. If you want your Ubuntu to work exactly like mine, you can install this repo

deb http://repos.codelite.org/wx3.0.2/ubuntu/ utopic universe

I found that by Mr. Google, same way you would, I expect (https://www.wxwidgets.org leads you to https://www.wxwidgets.org/downloads which leads to http://codelite.org/LiteEditor/WxWidgets30Binaries#toc2).

There is an open question on how to package some working examples and make them easy for users of these packages. I’ve asked in the gambit email list. In the olden days, I recall packging up the Gambit test programs with this and telling users how to run from the command line to test the calculations. I can’t find any evidence of that now, however. It would be nice if we could set this up to install some examples that are supposed to run. Maybe call them templates or whatnot. They may be in the source code now, but I’m too careless to find them. What do you think?

I promised one user I’d demonstrate steps to compile Gambit on EL7.

I did a “manual compile” as a non-root user that installed into /tmp, for exploration. The session was in an Emacs shell, here it is, errors and all:

http://pj.freefaculty.org/scraps/gambit-build-201505.txt

I had to install wxWidgets devel support from the EPEL repository. In case you want to see what the RPM building process does, here is the output

http://pj.freefaculty.org/scraps/gambit-RPM-build.txt

Posted in Linux | Tagged , , , | Leave a comment

Compiz, Multi-Head, Workspace Backgrounds

The approach described in the post earlier this week works well on single-head systems, but not when there are several monitors. Compiz handles these differently than XFCE4 or Gnome, causing some revision in the script.

Since Compiz treats the combined monitors as a single workspace, it is not actually possible to show separate images on the separate monitor backgrounds. There is a workaround, however: Use ImageMagic montage to manufacture a large image and then let compiz display that. I wanted the script to be flexible, so the -w argument now has 4 roles.

If -w -2, then all workspace backgrounds will be reset with randomly drawn images from one directory
If -w -1, then all workspaces are set to the same background
If -w n, for any “n’th” workspace, then that workspace will be replaced
If -w n > existing number of compiz wallpapers, then the new image will be added for the n+1’th workspace.

The -p argument determines whether we are setting for one page (one monitor) or two pages (2 monitors).

WIthout further adieu, here’s the script that works. I never wrote anything in Python before, so take mercy


#!/usr/bin/env python3

## Paul E. Johnson 
## 20150102

## A script to randomly reassign compiz background images for viewports.
## Recall compiz after 0.9.2 uses "viewports" to simulate workspaces.

## Will choose an image file randomly from within dir hierarchy. 

## Can replace one viewport's wallpaper.  The w argument will be
## interpreted in one of 3 ways 

## 
## 1. If w is either 0 or -1, this means remove all
## existing wallpapers and replace with one randomly chosen image.
##
## 2. If w is -2, then all workspace backgrounds will be replaced
## with different images from same directory
##
## 3. If 1 < = w <= N (where there are N wallpaper images already
## defined), then the image on viewport w will be replaced. All of the
## other images will remain the same.
##
## 4. If N < w, we interpret this as a request to expand the
## wallpaper array by one.
## 

## I thought it was a little interesting to make types 1 and 3
## work together with compiz. To change the number of wallpapers,
## it is required to correctly change these variables in the
## wallpaper plugin as well:
## "bg-fill-type"
## "bg-image-pos"
## "bg-color1", 
## "bg-color2", s

## I had previously been doing this by dbus-send, but compiz's
## interaction with dbus has become less and less stable, so this version
## uses "gsettings".

## About the schema argument:
## Because I do not use Unity as my desktop environment, I have to point
## SCHEMA at the location where compiz stores wallpapers. If you get
## compiz working with XFCE4, for example, make sure you use the Gsettings
## backend and DO allow Compiz to interact with the desktop environment in
## advanced settings. 

## If you are using Unity, you probably need to change the path, removing
## "Default" with "unity".  You can do from command line or by editing script.

## If you want to know how to get Compiz going without the Unity Desktop, 
## this is not a bad set of advice 
## http://www.webupd8.org/2012/11/how-to-set-up-compiz-in-xubuntu-1210-or.html
## If you have Unity installed, it is necessary to remove it, or else
## launching compiz with the Gsettings back end gets Ubuntu all confused and
## Unity keeps starting at same time. If you have trouble with that, I can help


import argparse
import subprocess
import sys
import os
import random

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--dir",  help = "directory path", 
                    default = "/usr/local/share/Backgrounds")
parser.add_argument("-p", "--pages",  help = "pages", 
                    default = "1", type = int)
parser.add_argument("-w", "--workspace", 
                    help = "workspace number, -1,  0, 1-n, or > n", default = "0", 
                    type = int)
parser.add_argument("-schema", help = "gsettings shema", 
                    metavar = "SCHEMA", default = "org.compiz.wallpaper:/org/compiz/profiles/Default/plugins/wallpaper/")
parser.add_argument("-key", help = "gsettings key", metavar = "KEY", default = "bg-image")
args = parser.parse_args()

array = eval(subprocess.check_output(["gsettings", "get", args.schema, args.key]))

## print(array)
arraylen = len(array)

## python arrays index 0, ... , N-1, so downshift workspace number
ws = args.workspace - 1

def getFn( pages, mydir, myws ):
    if pages > 1:
        dirlist = [os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(mydir)) for f in dn]
        if (len(dirlist) > 0):
            filelist = [os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(random.choice(dirlist))) for f in fn]
        else:
            filelist = [os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(mydir)) for f in fn]
        print(filelist)
        filename1 = random.choice(filelist)
        filename2 = random.choice(filelist)
        newfn = '/tmp/dual-%d.jpg' % myws
        if (os.path.isfile(newfn)) == True:
            os.remove(newfn)
            newfn = '/tmp/dual-%d.%s.jpg' % (myws, "2")
        subprocess.call(["montage", filename1, filename2, "-tile",  "2x1", "-geometry", "1600x1200+0+0", "-background", "black", newfn])
        filename = newfn
    else:
        filename = random.choice([os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(mydir)) for f in fn])
    print("The newly found filename is:")
    print(filename)
    return filename




## print("Array length was")
## print(arraylen)

## If ws 0 or smaller, we are going to reset whole collection back to
## just one image. if ws > N of images, then add a new image.
if ws == -3:
    for num in range(len(array)):
        array[num] =  getFn(args.pages, args.dir, num)

    subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])
elif ws < 0:
    filename = getFn(args.pages, args.dir, 1)
    array=[str(filename)]
    subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])
    subprocess.call(["gsettings", "set", args.schema, "bg-fill-type", str("[0]")])
    subprocess.call(["gsettings", "set", args.schema, "bg-image-pos", str("[0]")])
    subprocess.call(["gsettings", "set", args.schema, "bg-color1", str("['#000000ff']")])
    subprocess.call(["gsettings", "set", args.schema, "bg-color2", str("['#000000ff']")])
elif ws < arraylen:
    filename = getFn(args.pages, args.dir, ws)
    array[ws]=str(filename)
    subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])
else:
    filename = getFn(args.pages, args.dir, len(array))
    array.append(str(filename))
    subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])
    arraylen = len(array)
    subprocess.call(["gsettings", "set", args.schema, "bg-fill-type", str([0]*arraylen)])
    subprocess.call(["gsettings", "set", args.schema, "bg-image-pos", str([0]*arraylen)])
    subprocess.call(["gsettings", "set", args.schema, "bg-color1", str(['#000000ff']*arraylen)])
    subprocess.call(["gsettings", "set", args.schema, "bg-color2", str(['#000000ff']*arraylen)])



subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])


print("HELLO, corrected image array is:")               
print('\n '.join(array))

Now, if you don't want to use Compiz, but instead any other XFCE4 compatible window manager, such as OpenBox, then you can use XFdesktop to draw separate backgrounds on the monitors. I've done that too.

Posted in Linux | Tagged , , | Leave a comment

Success: compiz wallpapers changed via python script (Ubuntu 14.10 XFCE4)

I started using Linux because it had cool desktop features that made it fun and interesting. The compiz window manager was a highlight, but I stopped using it for a while because I could not make the dbus commands work to change the background after version 0.9 or so. I don’t enjoy Unity, but do like XFCE4, and have been using the Openbox window manager.

Openbox is OK, but it lacks flavor. No wobbly windows, not garish animations that we love so much.

Recently, on Ubuntu 14.10, using XFCE4 as the main desktop environment, I had some time and decided to re-investigate ways to run Compiz. Most things are working well now, especially since I have this swell new script
to change wallpapers. There are some verbose comments at the beginning.

A key benefit of this approach is it handles a lot of book keeping, so the script can eliminate the entire wallpaper vector and replace with one image, or it can replace a single image within the wallpaper vector, or it can grow the vector. I’ll paste in an example session after the code.

If you want to know how to get Compiz going without the Unity Desktop,
this is not a bad set of advice
http://www.webupd8.org/2012/11/how-to-set-up-compiz-in-xubuntu-1210-or.html

Caution: Do follow the advice to run ccsm before starting Compiz, and DO
enable the plugins. TURN ON wallpapers.

Caution: In the separate ccsm preferences dialogue (bottom left, above “advanced search”), make sure you choose the Gsettings backend and do allow the interaction with the desktop environment.

Caution: If you have Unity installed, it is necessary to remove it, or else
launching compiz with the Gsettings back end gets Ubuntu all confused and
Unity keeps starting at same time. If you have trouble with that, I can help

#!/usr/bin/env python3

## Paul E. Johnson 
## 20150102

## A script to randomly reassign compiz background images for viewports.
## Recall compiz after 0.9.2 uses "viewports" to simulate workspaces.

## Will choose an image file randomly from within dir hierarchy. 

## Can replace one viewport's wallpaper.  The w argument will be
## interpreted in one of 3 ways 
## 
## 1. If w < 1, (either 0 or a negative number), this means remove all
## existing wallpapers and replace with one randomly chosen image.
##
## 2. If 1 <= w <= N (where there are N wallpaper images already
## defined), then the image on viewport w will be replaced. All of the
## other images will remain the same.
##
## 3. If N < w, we interpret this as a request to expand the
## wallpaper array by one.


## I thought it was a little interesting to make types 1 and 3
## work together with compiz. To change the number of wallpapers,
## it is required to correctly change these variables in the
## wallpaper plugin as well:
## "bg-fill-type"
## "bg-image-pos"
## "bg-color1", 
## "bg-color2", s

## I had previously been doing this by dbus-send, but compiz's
## interaction with dbus has become less and less stable, so this version
## uses "gsettings".

## About the schema argument:
## Because I do not use Unity as my desktop environment, I have to point
## SCHEMA at the location where compiz stores wallpapers. If you get
## compiz working with XFCE4, for example, make sure you use the Gsettings
## backend and DO allow Compiz to interact with the desktop environment in
## advanced settings. 

## If you are using Unity, you probably need to change the path, removing
## "Default" with "unity".  You can do from command line or by editing script.



import argparse
import subprocess
import sys
import os
import random

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--dir",  help = "directory path", 
                    default = "/usr/local/share/Backgrounds")
parser.add_argument("-w", "--workspace", 
                    help = "workspace number, 0, 1-n, or > n", default = "-1", 
                    type = int)
parser.add_argument("-schema", help = "gsettings shema", 
                    metavar = "SCHEMA", default = "org.compiz.wallpaper:/org/compiz/profiles/Default/plugins/wallpaper/")
parser.add_argument("-key", help = "gsettings key", metavar = "KEY", default = "bg-image")
args = parser.parse_args()

array = eval(subprocess.check_output(["gsettings", "get", args.schema, args.key]))

## print(array)
arraylen = len(array)

filename = random.choice([os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(args.dir)) for f in fn])
print("The newly found filename is:")
print(filename)

## print("Array length was")
## print(arraylen)

## python arrays index 0, ... , N-1, so downshift workspace number
ws = args.workspace - 1

## If ws 0 or smaller, we are going to reset whole collection back to
## just one image. if ws > N of images, then add a new image.
if ws < 0:
    array=[str(filename)]
    subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])
    subprocess.call(["gsettings", "set", args.schema, "bg-fill-type", str("[0]")])
    subprocess.call(["gsettings", "set", args.schema, "bg-image-pos", str("[0]")])
    subprocess.call(["gsettings", "set", args.schema, "bg-color1", str("['#000000ff']")])
    subprocess.call(["gsettings", "set", args.schema, "bg-color2", str("['#000000ff']")])
elif ws < arraylen:
    array[ws]=str(filename)
    subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])
else:
    array.append(str(filename))
    subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])
    arraylen = len(array)
    subprocess.call(["gsettings", "set", args.schema, "bg-fill-type", str([0]*arraylen)])
    subprocess.call(["gsettings", "set", args.schema, "bg-image-pos", str([0]*arraylen)])
    subprocess.call(["gsettings", "set", args.schema, "bg-color1", str(['#000000ff']*arraylen)])
    subprocess.call(["gsettings", "set", args.schema, "bg-color2", str(['#000000ff']*arraylen)])



subprocess.call(["gsettings", "set", args.schema, args.key, str(array)])

print("HELLO, corrected image array is:")               
print('\n '.join(array))

I've got a massive background image collection, I think you'll get the idea

First, I'll give a negative value for w, so all existing wallpapers will be replaced by one:

$ ./pjbg.py -w -1 -d /usr/local/share/Backgrounds
The newly found filename is:
/usr/local/share/Backgrounds/Water/DOT_Arizona_VII_Grand_Canyon_Clear_Creek_6.jpg
HELLO, corrected image array is:
/usr/local/share/Backgrounds/Water/DOT_Arizona_VII_Grand_Canyon_Clear_Creek_6.jpg

Second, lets grow some more wallpapers

$ ./pjbg.py -w 5 -d /usr/local/share/Backgrounds
The newly found filename is:
/usr/local/share/Backgrounds/Scenery/Village_in_Alta_Roca_Region_Corsica_France.jpg
HELLO, corrected image array is:
/usr/local/share/Backgrounds/Water/DOT_Arizona_VII_Grand_Canyon_Clear_Creek_6.jpg
 /usr/local/share/Backgrounds/Scenery/Village_in_Alta_Roca_Region_Corsica_France.jpg

$ ./pjbg.py -w 5 -d /usr/local/share/Backgrounds
The newly found filename is:
/usr/local/share/Backgrounds/Scenery/dot_peru_machu_picchu_7.jpg
HELLO, corrected image array is:
/usr/local/share/Backgrounds/Water/DOT_Arizona_VII_Grand_Canyon_Clear_Creek_6.jpg
 /usr/local/share/Backgrounds/Scenery/Village_in_Alta_Roca_Region_Corsica_France.jpg
 /usr/local/share/Backgrounds/Scenery/dot_peru_machu_picchu_7.jpg

$ ./pjbg.py -w 5 -d /usr/local/share/Backgrounds
The newly found filename is:
/usr/local/share/Backgrounds/Italy/DOT_Italy_XIII_Venice_086.jpg
HELLO, corrected image array is:
/usr/local/share/Backgrounds/Water/DOT_Arizona_VII_Grand_Canyon_Clear_Creek_6.jpg
 /usr/local/share/Backgrounds/Scenery/Village_in_Alta_Roca_Region_Corsica_France.jpg
 /usr/local/share/Backgrounds/Scenery/dot_peru_machu_picchu_7.jpg
 /usr/local/share/Backgrounds/Italy/DOT_Italy_XIII_Venice_086.jpg

$ ./pjbg.py -w 5 -d /usr/local/share/Backgrounds
The newly found filename is:
/usr/local/share/Backgrounds/Scenery/DOT_Colorado_IV_009_Mesa_Verde_National_Park.jpg
HELLO, corrected image array is:
/usr/local/share/Backgrounds/Water/DOT_Arizona_VII_Grand_Canyon_Clear_Creek_6.jpg
 /usr/local/share/Backgrounds/Scenery/Village_in_Alta_Roca_Region_Corsica_France.jpg
 /usr/local/share/Backgrounds/Scenery/dot_peru_machu_picchu_7.jpg
 /usr/local/share/Backgrounds/Italy/DOT_Italy_XIII_Venice_086.jpg
 /usr/local/share/Backgrounds/Scenery/DOT_Colorado_IV_009_Mesa_Verde_National_Park.jpg

After that, I have 5 wallpaper images stored. So when I run the same command again, the
program no longer adds a new element, but it instead replaces workspace 5.

$ ./pjbg.py -w 5 -d /usr/local/share/Backgrounds
The newly found filename is:
/usr/local/share/Backgrounds/Scenery/Sozaijiten_085-Mountains-091_dbg.jpg
HELLO, corrected image array is:
/usr/local/share/Backgrounds/Water/DOT_Arizona_VII_Grand_Canyon_Clear_Creek_6.jpg
 /usr/local/share/Backgrounds/Scenery/Village_in_Alta_Roca_Region_Corsica_France.jpg
 /usr/local/share/Backgrounds/Scenery/dot_peru_machu_picchu_7.jpg
 /usr/local/share/Backgrounds/Italy/DOT_Italy_XIII_Venice_086.jpg
 /usr/local/share/Backgrounds/Scenery/Sozaijiten_085-Mountains-091_dbg.jpg

$ ./pjbg.py -w 5 -d /usr/local/share/Backgrounds
The newly found filename is:
/usr/local/share/Backgrounds/dot_greece_ix_cape_sounion_poseidon_temple_3.jpg
HELLO, corrected image array is:
/usr/local/share/Backgrounds/Water/DOT_Arizona_VII_Grand_Canyon_Clear_Creek_6.jpg
 /usr/local/share/Backgrounds/Scenery/Village_in_Alta_Roca_Region_Corsica_France.jpg
 /usr/local/share/Backgrounds/Scenery/dot_peru_machu_picchu_7.jpg
 /usr/local/share/Backgrounds/Italy/DOT_Italy_XIII_Venice_086.jpg
 /usr/local/share/Backgrounds/dot_greece_ix_cape_sounion_poseidon_temple_3.jpg

You can monitor the effect of this in 2 ways.

1. Run "ccsm", look in the Wallpapers plugin
2. Run "dconf-editor", look under org.... to see the settings change.

After all of that, you end up with a vector of viewports

Posted in Linux | Tagged , , | Leave a comment

ssh: too many authentication failures

Did you follow along with the instructions to make ssh connections “automatic” and “secure” with your favorite servers by transferring your public keys to the authorizedKeys file an then editing your ~/.ssh/config?

The .ssh/config file fills up with entries like this

Host *.fedoraproject.org fedorapeople.org *.fedorahosted.org
IdentityFile ~/.ssh/pjfedora-20111114
IdentitiesOnly yes

Host svn.*gnu.org
IdentityFile ~/.ssh/PaulJohnson-id_rsa-20110510
IdentitiesOnly yes

If you did that for a few servers (and it is, well, required on lots of servers I use), then you will start to get this error when you try to connect to the places that used to work:

$ ssh 129.237.49.83
Kernel 3.10.0-123.13.2.el7.x86_64 on an x86_64
Received disconnect from 129.237.49.83: 2: Too many authentication failures for pauljohn

It used to work, but no more. The ssh system is reading your ~.ssh/config file, finding lots of identities in there, throwing them at the remote server, and the server’s patience is exhausted with your and you get rejected.

To work around this, you have to tell the remote system to not try to use your keys. I find both of these work, don’t know if one is preferred to the other:

$ ssh -o IdentitiesOnly=yes 129.237.49.83

$ ssh -o PubkeyAuthentication=no 129.237.49.83

Both of those work for me.

To me, the very difficult thing is to remember either one of those because I forget 99% of the time that I need to do that. So I wrote it in the blog, and I can’t forget. Can I?

WARNING

Do not follow the advice you see on some Websites that you should insert

IdentitiesOnly yes

at the top of yoru config file. We found that several connections that were otherwise valid would fail after making that change. We had weird problems with SparkleShare after that change, for example.

WARNING

Don’t make your server less secure by allowing more failed logins. How silly is that :)

Posted in Uncategorized | Leave a comment