Notes about open source software, computers, other stuff.

Tag: R

Don’t install Citrix’s AppProtection!

Today I returned to my desktop computer after having been away for a couple of days, during which I only used my laptop. Both machines run Ubuntu Linux, currently version 23.04.

The project I was going to work on required R, but for some reason R didn’t start. No error message, only an exit status of 1 and I was back at the shell prompt. Running R --version worked fine, but Rscript failed in the same way as regular R. I tried running R --vanilla, starting R as a different user, nothing helped.

Time to dig deeper. Make sure all Ubuntu packages are up to date. Reinstall the r-base and r-base-core packages, check whether those packages had been recently updated (no), check whether the package versions were identical to the ones on my laptop (where R worked fine). Nothing…

Maybe there is problem with a (missing) dynamic library? In the (distant) past I have had problems with that, so it is worth a shot:

$ ldd /usr/bin/Rscript (0x00007ffcac7d4000)
	/usr/local/lib/AppProtection/ (0x00007f01b9e00000) => /lib/x86_64-linux-gnu/ (0x00007f01b9bfb000) => /lib/x86_64-linux-gnu/ (0x00007f01ba204000) => /lib/x86_64-linux-gnu/ (0x00007f01ba1ff000)
	/lib64/ (0x00007f01ba22f000) => /lib/x86_64-linux-gnu/ (0x00007f01ba0c1000) => /lib/x86_64-linux-gnu/ (0x00007f01ba095000) => /lib/x86_64-linux-gnu/ (0x00007f01ba081000) => /lib/x86_64-linux-gnu/ (0x00007f01b9991000) => /lib/x86_64-linux-gnu/ (0x00007f01ba07b000) => /lib/x86_64-linux-gnu/ (0x00007f01ba073000) => /lib/x86_64-linux-gnu/ (0x00007f01ba05c000) => /lib/x86_64-linux-gnu/ (0x00007f01b98a8000) => /lib/x86_64-linux-gnu/ (0x00007f01ba038000) => /lib/x86_64-linux-gnu/ (0x00007f01b9893000) => /lib/x86_64-linux-gnu/ (0x00007f01ba02b000)

That’s strange: I usually don’t have stuff installed in /usr/local. What is this AppProtection library doing there? And then it hit me: I recently (the last time I had used my desktop PC) had to install Citrix’s ICA client to do some remote desktop work for one of my clients. When I installed that package I was asked something about installing some sort of app protection. I had selected “yes”… With a feature named like that I should have known better…

Anyway, time to see if this shared library was indeed the problem. I moved the /usr/local/lib/AppProtection/ directory out of the way and tried to start R. All was fine and dandy again! Except that even an ls command now gave an error:

$ ls /usr/local/lib/AppProtection
ERROR: object '/usr/local/lib/AppProtection/' from /etc/ cannot be preloaded (cannot open shared object file): ignored.
ls: cannot access '/usr/local/lib/AppProtection': No such file or directory
ERROR: object '/usr/local/lib/AppProtection/' from /etc/ cannot be preloaded (cannot open shared object file): ignored.

Apparently (obviously?), something still tried to preload the library, even though it no longer existed. It turns out this was done in the file /etc/


Given that this was the only content of that file, I opted to just delete it. Finally, my system is back in a working state.

Conclusion: be more careful when installing stuff from external sources and definitely don’t install anything you don’t really need, like Citrix’s App Protection.

P.S. It turns out this was also the reason why the Mattermost app wasn’t running successfully any more.

Related Images:

Configuring R

I took some time today to configure my R experience. I’m mostly using R from Emacs using ESS (Emacs Speaks Statistics), which means I had to configure some settings there as well.

Previously, my settings only consisted of setting a customised directory in which to install my packages and an alias to start R without asking for saving the histroy when quitting. This I did by setting the following environment variable in my .bashrc and/or .zshrc, as well as an alias:

# Set the library path for R
export R_LIBS_USER=${R_LIBS_USER}:~/Programmeren/R/lib
if [ -n "$(/usr/bin/which R 2>/dev/null)" ]; then
alias R="$(/usr/bin/which R) --no-save"

However, Emacs didn’t pick up either of these variables, so high time to fix that. This meant creating two files with the following content:


# Set the default CRAN repository used by install.packages()
options("repos" = c(CRAN = ""))



I added the following to my .emacs file to start R with the --no-save option:

(setq inferior-R-args "--no-save ")

Additionally I have the following in there to turn on a spelling checker and have line-wraps enabled:

(add-hook 'ess-mode-hook
          (lambda ()
            ;; Set pdflatex as the default command for Sweave (default: texi2pdf)
            (setq ess-swv-pdflatex-commands (quote ("pdflatex"
            (auto-fill-mode t)

Related Images:

Doing a quick fixed-effects meta-analysis using the Rmeta package

This is a quick example of how to do a fixed meta-analysis using the R package Rmeta, just so I dont have to look it up again next time:

## Create data frame containing betas and standard errors
df <- data.frame()
df <- rbind(df, c(2., 0.2))
df <- rbind(df, c(2.5, 0.4))
df <- rbind(df, c(2.2, 0.2))
## Add study names
df <- cbind(df, c("study 1", "study 2", "study 3"))
colnames(df) <- c("beta", "se_beta", "name") 
## Do the meta-analysis 
ms <- meta.summaries(df$beta, df$se_beta, names=df$name)
## Add some colors
mc <- meta.colors(summary="darkgreen", zero="red")
## Make a forest plot
plot(ms, xlab=expression(beta ~ " (mmol/l)"), 
     ylab="Study", colors=mc, zero=2.6)

The resulting plot looks like this:
Forest plot of fake data

Related Images:

© 2024 Lennart's weblog

Theme by Anders NorénUp ↑