Cygnus JAVA_HOME is not set - fiware

I installed cygnus and when I hit sudo service cygnus start I get the status OK running.
But the log file says:
Warning: JAVA_HOME is not set!
+ exec /usr/bin/java -Xmx20m -Dflume.log.file=cygnus.log -cp '/usr/cygnus/conf:/usr/cygnus/lib/*:/usr/cygnus/plugins.d/cygnus/lib/*:/usr/cygnus/plugins.d/cygnus/libext/*' -Djava.library.path= es.tid.fiware.fiwareconnectors.cygnus.nodes.CygnusApplication -p 8081 -f /usr/cygnus/conf/agent_1.conf -n cygnusagent
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/cygnus/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/cygnus/plugins.d/cygnus/lib/cygnus-0.7.1-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
I checked echo $JAVA_HOME and get:
/usr/lib/jvm/java-1.6.0-openjdk.x86_64
I also checked java -version and got:
java version "1.6.0_35"
OpenJDK Runtime Environment (IcedTea6 1.13.7) (rhel-1.13.7.1.el6_6-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
So what am I missing here?
I did all these steps here:
Installing Cygnus
Open a terminal and simply configure the FIWARE repository if not yet
configured and use your applications manager in order to install the
latest version of Cy gnus (CentOS/RedHat example):
$ sudo cat > /etc/yum.repos.d/fiware.repo <http://repositories.testbed.fi-ware.eu/repo/rpm/x86_64/
gpgcheck=0 enabled=1 EOL $ sudo yum install cygnus
IMPORTANT NOTE:
Cygnus, as it is based on Apache Flume, needs Java SDK is installed.
If not yet installed, do it right now:
$ sudo yum install java-1.6.0-openjdk-devel
Remember to export the JAVA_HOME environment variable. In the case you
have installed Java SDK right now as shown above, this would be as:
$ export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk.x86_64
In order to do it permanently, edit /root/.bash_profile (root user) or
/etc/profile (other users).

Despite such a warning message, Cygus will run since the flume-ng (and derived cygnus-flume-ng) script looks for Java if JAVA_HOME is not set:
# find java
if [ -z "${JAVA_HOME}" ] ; then
warn "JAVA_HOME is not set!"
# Try to use Bigtop to autodetect JAVA_HOME if it's available
if [ -e /usr/libexec/bigtop-detect-javahome ] ; then
. /usr/libexec/bigtop-detect-javahome
elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ] ; then
. /usr/lib/bigtop-utils/bigtop-detect-javahome
fi
# Using java from path if bigtop is not installed or couldn't find it
if [ -z "${JAVA_HOME}" ] ; then
JAVA_DEFAULT=$(type -p java)
[ -n "$JAVA_DEFAULT" ] || error "Unable to find java executable. Is it in your PATH?" 1
JAVA_HOME=$(cd $(dirname $JAVA_DEFAULT)/..; pwd)
fi
fi

Related

Google-chrome on AWS Lambda

It is possible to run Google-chrome not Chromium with puppeteer in AWS Lambda with container?
Script stuck when I create new page in browser:
const page = await browser.newPage();
Logs from AWS lambda:
mkdir: cannot create directory ‘/.local’: Read-only file system
touch: cannot touch ‘/.local/share/applications/mimeapps.list’: No such file or directory
/usr/bin/google-chrome-stable: line 45: /dev/fd/62: No such file or directory
/usr/bin/google-chrome-stable: line 46: /dev/fd/62: No such file or directory
[0213/000419.523205:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0213/000419.528197:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0213/000419.648505:WARNING:audio_manager_linux.cc(60)] Falling back to ALSA for audio output. PulseAudio is not available or could not be initialized.
DevTools listening on ws://127.0.0.1:46195/devtools/browser/1d348770-1c99-48a5-934c-fae5254fc766
[0213/000419.769218:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
prctl(PR_SET_NO_NEW_PRIVS) failed
prctl(PR_SET_NO_NEW_PRIVS) failed
I do not use puppeteer but that doesn't matter much.
FROM public.ecr.aws/lambda/provided:al2
RUN yum install unzip atk at-spi2-atk gtk3 cups-libs pango libdrm \
libXcomposite libXcursor libXdamage libXext libXtst libXt \
libXrandr libXScrnSaver alsa-lib \
xorg-x11-server-Xvfb wget shadow-utils -y
COPY install-chrome.sh /tmp/
RUN /usr/bin/bash /tmp/install-chrome.sh
ENV DBUS_SESSION_BUS_ADDRESS="/dev/null"
I am not 100% DBUS_SESSION_BUS_ADDRESS is necessary. I am also not 100% sure whether explicitly naming all these packages are necessary, I stole everything from a dozen different places, likely the chrome rpm will pull in what it needs, but I never used any RHEL based system so I am totally clueless. I know this works. Optimizations are welcome.
Here's the script:
#!/usr/bin/bash
# Download and install chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
# Without -y it doesn't run because it needs to add dependencies.
yum install -y google-chrome-stable_current_x86_64.rpm
rm google-chrome-stable_current_x86_64.rpm
CHROMEVERSION=`wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROMEVERSION/chromedriver_linux64.zip
unzip /tmp/chromedriver_linux64.zip -d /opt
rm /tmp/chromedriver_linux64.zip
mv /opt/chromedriver /opt/chromedriver-$CHROMEVERSION
chmod 755 /opt/chromedriver-$CHROMEVERSION
ln -fs /opt/chromedriver-$CHROMEVERSION /usr/local/bin/chromedriver
# Create a user. /usr/sbin is not on $PATH.
/usr/sbin/groupadd --system chrome
/usr/sbin/useradd --system --create-home --gid chrome --groups audio,video chrome
You can verify it is working by starting it locally with docker run --mount type=tmpfs,destination=/tmp --read-only this simulates well the environment of AWS Lambda. Then you need to run su chrome -c 'xvfb-run chromedriver --allowed-ips=127.0.0.1'. I am using https://github.com/instaclick/php-webdriver/ which is a very thin PHP client for W3C and Selenium 2 webdriver. I used this to test:
<?php
namespace WebDriver;
require 'vendor/autoload.php';
#mkdir('/tmp/chrome');
chmod('/tmp/chrome', 0777);
$wd_host = 'http://localhost:9515';
$web_driver = new WebDriver($wd_host);
$session = $web_driver->session('chrome', [['goog:chromeOptions' => ['args' => [
'--no-sandbox',
'--user-data-dir=/tmp/chrome'
]]]]);
$session->open('https://google.com');

Nvidia driver error - CUDA driver version is insufficient for CUDA runtime version

I am trying to call Laia - a deeplearning toolkit for HRW : https://github.com/jpuigcerver/Laia
This is the code I have:
INPUT_DIR=`pwd`/RecognitionHand/dir_input
OUTPUT_DIR=`pwd`/RecognitionHand/dir_output
CHAR_TRANSCRIBE_FILE=char.txt
WORD_TRANSCRIBE_FILE=word.txt
rm $INPUT_DIR/filelist/filenames.lst
ls -d -1 $INPUT_DIR/images/* > $INPUT_DIR/filelist/filenames.lst
COMMAND="decode --batch_size 20 --log_level info --symbols_table \
$INPUT_DIR/symbtable/symbs.txt \
$INPUT_DIR/model/model_htr.t7 \
$INPUT_DIR/filelist/filenames.lst> $OUTPUT_DIR/$CHAR_TRANSCRIBE_FILE";
# local volumes mapped to the docker volumes
OPTS=( -u $(id -u):$(id -g) );
[ -d "/home" ] && OPTS+=( -v /home:/home );
[ -d "/mnt" ] && OPTS+=( -v /mnt:/mnt );
[ -d "/media" ] && OPTS+=( -v /media:/media );
[ -d "/tmp" ] && OPTS+=( -v /tmp:/tmp );
# call the GPU docker for transcribing
docker run --rm -t "${OPTS[#]}" laia:active \
bash -c "cd $(pwd) && PATH=\" .:$PATH:\$PATH\" laia-$COMMAND";
The last docker command refers to nvidia-docker and I am getting this strange error:
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-918/cutorch/lib/THC/THCGeneral.c line=66 error=35
: CUDA driver version is insufficient for CUDA runtime version
[2020-01-02 14:43:45 WARN] /opt/torch/share/lua/5.1/laia/util/base.lua:39: Optional lua module "cutorch" was not found!
[2020-01-02 14:43:45 WARN] /opt/torch/share/lua/5.1/laia/util/base.lua:39: Optional lua module "cunn" was not found!
[2020-01-02 14:43:45 WARN] /opt/torch/share/lua/5.1/laia/util/base.lua:39: Optional lua module "laia.util.cudnn" was not found!
[2020-01-02 14:43:45 WARN] /opt/torch/share/lua/5.1/laia/util/base.lua:39: Optional lua module "laia.ImageDistorter" was not found!
/opt/torch/bin/luajit: /opt/torch/lib/luarocks/rocks/laia/scm-1/bin/laia-decode:16: attempt to call field 'registerOptions' (a nil value)
stack traceback:
/opt/torch/lib/luarocks/rocks/laia/scm-1/bin/laia-decode:16: in main chunk
[C]: at 0x00405d50
Why is this happening? Has someone met a similar error when running nvidia-docker please?
CUDA driver version is insufficient for CUDA runtime version
means that the nvidia driver for your system is not compatible to the runtime inside the docker image you download. You have to (at least) match those versions.
Another important thing is to check what is the necessary cuda runtime for the tool that you want to use. Assuming that you followed the necessary version and downloaded the correct docker image, you will need to update your system nvidia driver to match the docker image then.

Installation Requirements for mysql with DBIish on rakudo-star docker image

I was creating an own docker image based on the latest rakudo-star docker image. I wanted to use DBIish to connect to a mysql database. Unfortunately I am not able to get the DBDish::mysql to work.
I've installed default-libmysqlclient-dev as you can see in
# find / -name 'libmysqlclient*.so'
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
The error i am facing is:
# perl6 -Ilib -e 'use DBDish::mysql; DBDish::mysql.connect()'
Cannot locate native library 'mysqlclient': mysqlclient: cannot open shared object file: No such file or directory
in method setup at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289
in method CALL-ME at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 539
in method connect at /root/DBIish/lib/DBDish/mysql.pm6 (DBDish::mysql) line 12
in block <unit> at -e line 1
Short answer: you need the package libmysqlclient20 (I added the documentation request to a similar DBIish issue). Debian 9 (stable at the moment) uses and older version than Ubuntu 18.04 (stable at the moment) and Debian Unstable. It also refers to mariadb instead of mysql. Pick libmariadbclient18 on images based on Debian Stable and create a link with the mysql name (see below).
On Debian Testing/Unstable and recent derivatives:
$ sudo apt-get install libmysqlclient20
$ dpkg -L libmysqlclient20
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.9
/usr/share
/usr/share/doc
/usr/share/doc/libmysqlclient20
/usr/share/doc/libmysqlclient20/NEWS.Debian.gz
/usr/share/doc/libmysqlclient20/changelog.Debian.gz
/usr/share/doc/libmysqlclient20/copyright
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
On Debian 9 and derivatives:
$ dpkg -L libmariadbclient18
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmariadbclient.so.18.0.0
/usr/lib/x86_64-linux-gnu/mariadb18
/usr/lib/x86_64-linux-gnu/mariadb18/plugin
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/client_ed25519.so
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/dialog.so
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/mysql_clear_password.so
/usr/share
/usr/share/doc
/usr/share/doc/libmariadbclient18
/usr/share/doc/libmariadbclient18/changelog.Debian.gz
/usr/share/doc/libmariadbclient18/copyright
/usr/lib/x86_64-linux-gnu/libmariadbclient.so.18
Create the link:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libmariadbclient.so.18 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
In order to illustrate this, I created an Ubuntu 18.04 container for the occasion*:
docker run -ti --rm --entrypoint=bash rakudo/ubuntu-amd64-18.04
And the abbreviated commands and output:
# apt-get install -y libmysqlclient20 build-essential
# zef install DBIish
# perl6 -e 'use DBDish::mysql; DBDish::mysql.connect()'
Cannot look up attributes in a DBDish::mysql type object
[...]
The error is because I didn't pass the correct parameters for connect as I didn't have a db running. The important thing is that no .so file is missing.
*: I uploaded it to the Docker Hub, a normal run will put you right in the REPL:
$ docker run -ti --rm rakudo/ubuntu-amd64-18.04
To exit type 'exit' or '^D'
>
(I didn't use the Star image when debugging, but it does not matter because this is a more generic problem.)

Error installing mercurial on linux: unable to generate hg.mo

I am trying to install mercurial from source. I tried installing mercurial version 3.5 and 3.6 from here: https://www.mercurial-scm.org/release/
My Linux version: Red Hat Enterprise Linux Server release 5.11 (Tikanga)
and my python version: Python 2.6.5
This is the error I get when I try to built it locally.
make local
python setup.py \
build_py -c -d . \
build_ext -i \
build_hgexe -i \
build_mo
running build_py
running build_ext
running build_hgexe
running build_mo
generating mercurial/locale/zh_TW/LC_MESSAGES/hg.mo from i18n/zh_TW.po
msgfmt -v -o mercurial/locale/zh_TW/LC_MESSAGES/hg.mo i18n/zh_TW.po -c
usage: msgfmt [ -dv ] [ - ] [ name ... ]
mercurial/locale/zh_TW/LC_MESSAGES/hg.mo: No such file or directory
error: command 'msgfmt' failed with exit status 2
make: *** [local] Error 1
Looks like you have a msgfmt in your PATH that isn't the one that the installer expects to find.
Do:
which msgfmt
and if the result isn't /usr/bin/msgfmt that's probably the cause

Compile mysql client under cygwin with cmake

I need a mysql-client for Eclipse Helios/Perl EPIC, running under windows7. Perl5.10 is running under cygwin on the same machine. I'm really strugglying to compile mysql sources with cmake under cygwin. I have also read the transition guide from "configure" to "cmake".
Here is the last test I tried among dozen of previous variants :
Libraries and source Preparation :
apt-cyg install make cmake gcc4-core gcc4-g++ libncurses-devel libncursesw-devel readline libstdc++6 libstdc++6-devel
mkdir -p /usr/local/src
mkdir -p /usr/local/mysql
cd /usr/local/src
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.9.tar.gz/from/http://mirrors.ircam.fr/pub/mysql/
find . -type f -name "*.tar.gz" -exec tar -zxvf {} \;
find . -type d -name "mysql-*" -exec cd {} \;
Build/Install
CC=gcc; CFLAGS=-O3 ; CXX=gcc ; CXXFLAGS=-O3; export CC CFLAGS CXX CXXFLAGS
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_EMBEDDED_SERVER=0 -DWITH_LIBEDIT=0 -DISABLE_SHARED=1
Build is stopped at 86% with
[ 86%] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.o
Linking CXX executable mysqld.exe
Creating library file: libmysqld.dll.a
libsql.a(mysqld.cc.o):mysqld.cc:(.rdata$_ZTV12Comp_creator[vtable for Comp_creator]+0x10): undefined reference to `___cxa_pure_virtual'
collect2: ld returned 1 exit status
make[2]: *** [sql/mysqld.exe] Error 1
make[1]: *** [sql/CMakeFiles/mysqld.dir/all] Error 2
I read 100's of threads but blindly as lacking compilation skills.
Maybe is there also an alternative or better solution to run my existing mysql debugging server hosted in a Debian's VM (as guest on my windows machine) from Eclipse.. ?
Suggestions are more than welcome.
Thx in advance
hum, looks like that there is no absolute need to do that to use perl epic with Eclipse, as cygwin perl embeds already the DBI modules (to be loaded with CPAN). So it's a way to get around this problem.