WSO2 EI 6.5.0 - admin password reset using chpasswd.bat due to a UserStoreException - ant

I am trying to reset admin user password by using chpasswd.bat as forgot my old password in WSO2 EI 6.5.0 by follows this link
OS: windows 10
prerequisite:
Apache Ant 1.10.7 has been installed in my machine.
environment variable set done.
Since i am using default H2 Database, Copied related H2 JDBC driver into <PRODUCT_HOME>/lib/
goto product path <PRODUCT_HOME>/bin/ and execute below command
chpasswd.bat --db-driver "org.h2.Driver" --db-url "jdbc:h2:./repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000" --db-username "wso2carbon" --db-password "wso2carbon" --username "admin" --new-password "newadmin"
after executing above command getting below log
C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\bin>chpasswd.bat --db-url "jdbc:h2:$CARBON_HOME\repsitory\database\WSO2CARBON_DB"
Buildfile: C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\bin\build.xml
setup:
[copy] Copying 40 files to C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\lib
[mkdir] Created dir: C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\tmp\setup
[unzip] Expanding: C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\components\plugins\org.wso2.carbon.security.mgt.stub_5.12.387.jar into C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\tmp\setup
[unzip] Expanding: C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\components\plugins\org.wso2.carbon.security.mgt.ui_5.12.387.jar into C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\tmp\setup
[unzip] Expanding: C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\components\plugins\org.wso2.carbon.security.mgt_5.12.387.jar into C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\tmp\setup
[delete] Deleting directory C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\tmp\setup
[unzip] Expanding: C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\components\plugins\h2_1.3.175.wso2v1.jar into C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\lib
[unzip] Expanding: C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\components\plugins\org.wso2.carbon.utils_4.4.40.jar into C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\lib
[move] Moving 91 files to C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\lib
[delete] Deleting directory C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\lib\META-INF
[delete] Deleting directory C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\wso2\lib\org
BUILD SUCCESSFUL
Total time: 15 seconds
Username: admin
New password: in
Re-enter new password: in
log4j:WARN Error during default initialization
java.lang.NoClassDefFoundError: org/wso2/carbon/bootstrap/logging/LoggingBridge
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327)
at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:785)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.apache.log4j.Logger.getLogger(Logger.java:104)
at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:262)
at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:108)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1025)
at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:844)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:541)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:292)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:269)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
at org.wso2.carbon.user.core.config.RealmConfigXMLProcessor.<clinit>(RealmConfigXMLProcessor.java:56)
at org.wso2.carbon.core.util.PasswordUpdater.run(PasswordUpdater.java:158)
at org.wso2.carbon.core.util.PasswordUpdater.main(PasswordUpdater.java:48)
Caused by: java.lang.ClassNotFoundException: org.wso2.carbon.bootstrap.logging.LoggingBridge
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 40 more
Error updating credentials for user wso2admin : org.wso2.carbon.user.core.UserStoreException: Error while reading realm configuration from file
C:\Development_Avecto\WSo2EIServers\wso2ei-6.5.0\wso2ei-6.5.0\bin>
some Jar called ant-contrib-1.0b3 placed after getting above error inside apache-ant-1.10.7\lib path
Is there any config i missed? or how to run that chpasswd command in windows 10 to reset password ?

I was able to fix this issue for EI 6.5.0. If you have WSO2 subscription try updating the product. If not follow the instructions below.
Note: I did not have a Windows environment to test hence I fixed this for a Linux environment. You can do a diff between the following file and include the required fixed in the bat file.
Copy the org.wso2.carbon.bootstrap-4.5.3.jar to the ${EI_HOME}/wso2/lib directory. This will get rid of the NoClassDefFoundError issue.
Then update the chpasswd.sh with the following content.
#!/bin/sh
# ----------------------------------------------------------------------------
# Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------------
#
# Environment Variable Prequisites
#
# CARBON_HOME Home of CARBON installation. If not set I will try
# to figure it out.
#
# JAVA_HOME Must point at your Java Development Kit installation.
#
# NOTE: Borrowed generously from Apache Tomcat startup scripts.
# if JAVA_HOME is not set we're not happy
if [ -z "$JAVA_HOME" ]; then
echo "You must set the JAVA_HOME variable before running chpasswd."
exit 1
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
os400=false
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
esac
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
# Get standard environment variables
PRGDIR=`dirname "$PRG"`
# Only set CARBON_HOME if not already set
[ -z "$CARBON_HOME" ] && CARBON_HOME=`cd "$PRGDIR/.." ; pwd`
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CARBON_HOME" ] && CARBON_HOME=`cygpath --unix "$CARBON_HOME"`
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For OS400
if $os400; then
# Set job priority to standard for interactive (interactive - 6) by using
# the interactive priority - 6, the helper threads that respond to requests
# will be running at the same priority as interactive jobs.
COMMAND='chgjob job('$JOBNAME') runpty(6)'
system $COMMAND
# Enable multi threading
QIBM_MULTI_THREADED=Y
export QIBM_MULTI_THREADED
fi
ant -buildfile "$CARBON_HOME"/bin/build.xml
# update classpath
CARBON_CLASSPATH=""
for f in "$CARBON_HOME"/wso2/lib/*.jar
do
CARBON_CLASSPATH=$CARBON_CLASSPATH:$f
done
for g in "$CARBON_HOME"/repository/lib/*.jar
do
CARBON_CLASSPATH=$CARBON_CLASSPATH:$g
done
for h in "$CARBON_HOME"/wso2/lib/api/*.jar
do
CARBON_CLASSPATH=$CARBON_CLASSPATH:$h
done
for i in "$CARBON_HOME"/bin/*.jar
do
CARBON_CLASSPATH=$CARBON_CLASSPATH:$i
done
CARBON_CLASSPATH=$CARBON_CLASSPATH:$CLASSPATH
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
CARBON_HOME=`cygpath --absolute --windows "$CARBON_HOME"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi
# ----- Execute The Requested Command -----------------------------------------
cd "$CARBON_HOME"
CARBON_CLASSPATH="$CARBON_HOME/lib/patches":"$CARBON_HOME/conf":$CARBON_CLASSPATH
$JAVA_HOME/bin/java -Dcarbon.config.dir.path="$CARBON_HOME/conf" -cp "$CARBON_CLASSPATH" org.wso2.carbon.core.util.PasswordUpdater $*
Also note that you do not have to copy any additional drivers for H2 DB access as the product already have the driver installed. Also I observed a issue with your database URL. Refer the following command and fix your command accordingly.
sh chpasswd.sh --db-driver "org.h2.Driver" --db-url "jdbc:h2:../repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000" --db-username "wso2carbon" --db-password "wso2carbon" --username "admin" --new-password "newadmin"
References: https://github.com/wso2/micro-integrator/commit/0754a7130eacf88dccc960e92227f2c5635a63de

Related

Why do I keep getting this error message in buildozer even tho I installed every single thing it needs?

I made a simple python app using kivy and when I wanted to convert it to apk using buildozer it kept giving me this error. I searched everywhere but couldn't find any solution. Do you guys have any idea ?
(stackoverflow is asking me to provide more details so don't mind this line. Below is the output I get when running the buildozer -v android debug command.)
root#DESKTOP-VQBOS27:/home/dtomper/environments/Tests/app test# buildozer -v android debug
# Check configuration tokens
Buildozer is running as root!
This is not recommended, and may lead to problems later.
Are you sure you want to continue [y/n]? y
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.7 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
# -> found at /usr/bin/git
# Search for Cython (cython)
# -> found at /usr/bin/cython
# Search for Java compiler (javac)
# -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url'
# Cwd /home/dtomper/environments/Tests/app test/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /home/dtomper/environments/Tests/app test/.buildozer/android/platform/python-for-android
* master 5a94d074 [origin/master] Merge pull request #2244 from Chronolife-team/native_services_upstream
# Run '/usr/bin/python3 -m pip install -q --user \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_version<"3.4"\' \'sh>=1.10; sys_platform!="nt"\' \'pep517<0.7.0"\' \'toml\''
# Cwd None
# Apache ANT found at /root/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /root/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 19c
# Android NDK found at /root/.buildozer/android/platform/android-ndk-r19c
# Check application requirements
# Compile platform
# Run '/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/dtomper/environments/Tests/app test/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21 --ignore-setup-py'
# Cwd /home/dtomper/environments/Tests/app test/.buildozer/android/platform/python-for-android
/home/dtomper/environments/Tests/app test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py:84: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/dtomper/environments/Tests/app test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1260, in <module>
main()
File "/home/dtomper/environments/Tests/app test/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
ToolchainCL()
File "/home/dtomper/environments/Tests/app test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 694, in __init__
self.ctx.setup_dirs(self.storage_dir)
File "/home/dtomper/environments/Tests/app test/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 173, in setup_dirs
raise ValueError('storage dir path cannot contain spaces, please '
ValueError: storage dir path cannot contain spaces, please specify a path with --storage-dir
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/dtomper/environments/Tests/app test/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21 --ignore-setup-py
# ENVIRONMENT:
# SHELL = '/bin/bash'
# SUDO_GID = '1000'
# SUDO_COMMAND = '/usr/bin/bash'
# SUDO_USER = 'dtomper'
# PWD = '/home/dtomper/environments/Tests/app test'
# LOGNAME = 'root'
# HOME = '/root'
# LANG = 'C.UTF-8'
# LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
# LESSCLOSE = '/usr/bin/lesspipe %s %s'
# TERM = 'xterm-256color'
# LESSOPEN = '| /usr/bin/lesspipe %s'
# USER = 'root'
# SHLVL = '1'
# PS1 = '\\[\\e]0;\\u#\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\u#\\h:\\w\\$ '
# PATH = '/root/.buildozer/android/platform/apache-ant-1.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin'
# SUDO_UID = '1000'
# MAIL = '/var/mail/root'
# _ = '/usr/local/bin/buildozer'
# OLDPWD = '/home/dtomper/environments/Tests'
# PACKAGES_PATH = '/root/.buildozer/android/packages'
# ANDROIDSDK = '/root/.buildozer/android/platform/android-sdk'
# ANDROIDNDK = '/root/.buildozer/android/platform/android-ndk-r19c'
# ANDROIDAPI = '27'
# ANDROIDMINAPI = '21'
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
ValueError: storage dir path cannot contain spaces, please specify a path with --storage-dir
As it says, try using a directory without spaces in its name.

NetSuite 64bit ODBC Driver installation on Ubuntu 18.04 Cluster giving error:- Can't open lib '/opt/netsuite/odbcclient/lib64/ivoa27.so

Have been running around this issue since 2-3 days now with no luck. Hope someone guides me and help resolve this issue here.
I am running a Python application from /home/admin/app/example.py directory in a 3 node Ubuntu 18.04 clustered environment which is supposed to connect to NetSuite via ODBC and read list of tables. The code and directory setup is same across all 3 nodes. There's a load balancer routing request to all these 3 nodes.
Here's example how the connection is made via PyODBC module:
import pyodbc
cnxn = pyodbc.connect('DSN=NetSuite;UID=user;PWD=pass'.format(dsn, uid, pwd), autocommit=True)
cursor=cnxn.cursor()
tables_list = []
for row in cursor.tables():
tables_list.append(row.table_name)
print (tables_list)
However, while running the python application on cluster, I am always getting error as:- Can't open lib '/opt/netsuite/odbcclient/lib64/ivoa27.so; even though the driver file, all its dependencies (via ldd command) and all the path variables i.e. $LD_LIBRARY_PATH, $ODBCINI and $OASDK_ODBC_HOME exists and is set to be available system-wide (added under /etc/environment file) as below on all the 3 nodes:
PYTHON_APP_HOME=/home/admin/app/
LD_LIBRARY_PATH="/opt/netsuite/odbcclient/lib64"
ODBCINI="/opt/netsuite/odbcclient/odbc64.ini"
OASDK_ODBC_HOME="/opt/netsuite/odbcclient/lib64"
Here's the output from "ldd" command for driver dependencies:
-rwxr-xr-x 1 root root 3277375 Jul 25 16:03 ivoa27.so
/opt/netsuite/odbcclient/lib64$ ldd /opt/netsuite/odbcclient/lib64/ivoa27.so
linux-vdso.so.1 (0x00007fff401a2000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fee1d589000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fee1d385000)
libicuuc.so.42 => /opt/netsuite/odbcclient/lib64/libicuuc.so.42 (0x00007fee1d12b000)
libicudata.so.42 => /opt/netsuite/odbcclient/lib64/libicudata.so.42 (0x00007fee1c0e6000)
libpam.so.0 => /lib/x86_64-linux-gnu/libpam.so.0 (0x00007fee1bed8000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fee1bcb9000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fee1b930000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fee1b592000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fee1b37a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fee1af89000)
/lib64/ld-linux-x86-64.so.2 (0x00007fee1db3c000)
libaudit.so.1 => /lib/x86_64-linux-gnu/libaudit.so.1 (0x00007fee1ad60000)
libcap-ng.so.0 => /lib/x86_64-linux-gnu/libcap-ng.so.0 (0x00007fee1ab5b000)
Below is how the steps were performed as per Netsuite driver README.txt instructions and the ODBC driver is setup similarly across all the 3 nodes on Ubuntu 18.04 OS.
The Netsuite 64bit Linux driver files/folders are unpacked and copied at location:
$cd /opt/netsuite/odbcclient/*. This entire dir,sub-dir & files within have both r+x permissions.
Installed libraries $sudo apt install unixodbc && apt-get install unixodbc-dev
Executed script/command provided by Netsuite from dir /opt/netsuite/odbcclient:- $source oaodbc64.sh (since it's a bash shell). This sets up the same variables as shown above.
From the same directory/folder ran below command for registering it as system-wide Driver:
$sudo odbcinst -i -d -f /opt/netsuite/odbcclient/odbcinst.ini
which returned message as:
odbcinst: Driver installed. Usage count increased to 1.
Target directory is /etc
odbcinst: Driver installed. Usage count increased to 1.
Target directory is /etc
Then ran below command also for installing it as system DSN:-
$sudo odbcinst -i -s -l -f /opt/netsuite/odbcclient/odbc64.ini
After this, checked /etc directory where both odbc.ini and odbcinst.ini files where created/registered. Both *.ini files were also given execute permissions to all.
-rwxr-xr-x 1 root root 500 Jul 24 10:31 odbc.ini
-rwxr-xr-x 1 root root 199 Jul 24 10:31 odbcinst.ini
$odbcinst -j
unixODBC 2.3.4
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /opt/netsuite/odbcclient/odbc64.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
$odbcinst -q -d
[ODBC Drivers]
[NetSuite ODBC Drivers 8.1]
$odbcinst -q -s
[NetSuite]
[ODBC]
I am also able to connect from each individual nodes via isql and also by running the example.py via python shell locally.
$isql -v 'NetSuite' 'user' 'pass'
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
But when running the same on cluster, it gives same error always. Please help. I am sure am missing something.
Here's the output of odbc.ini and odbcinst.ini files from /etc directory:
/etc$ more odbcinst.ini
[ODBC Drivers]
NetSuite ODBC Drivers 8.1=Installed
UsageCount=1
[NetSuite ODBC Drivers 8.1]
APILevel=1
ConnectFunctions=YYN
Driver=ivoa27.so
DriverODBCVer=03.52
FileUsage=0
SQLLevel=1
UsageCount=1
/etc$ more odbc.ini
[ODBC Data Sources]
NetSuite=NetSuite ODBC Drivers 8.1
[NetSuite]
Driver=/opt/netsuite/odbcclient/lib64/ivoa27.so
Description=Connect to your NetSuite account
Host=XXXXX.connect.api.netsuite.com
Port=1708
ServerDataSource=NetSuite.com
Encrypted=1
Truststore=/opt/netsuite/odbcclient/cert/ca3.cer
CustomProperties=AccountID=XXXXX;RoleID=XXXX
[ODBC]
Trace=0
IANAAppCodePage=4
TraceFile=odbctrace.out
TraceDll=/opt/netsuite/odbcclient/lib64/ddtrc27.so
InstallDir=/opt/netsuite/odbcclient
Tried below other things that didn't work:
Added ODBC variable paths within .profile,.bashrc ,/etc/profile,/etc/bash.bashrc other than /etc/environment.
Changed the owner of /lib64/ folder and all files within it and *.ini files under /etc from root to admin.
By creating symbolic links:
sudo ln -s /etc/odbcinst.ini /usr/local/etc/odbcinst.ini
sudo ln -s /etc/odbc.ini /usr/local/etc/odbc.ini
Thanks !!
UPDATE - SOLVED !! One important step that was missing from our end was the reboot/restart of all the nodes for those 3 variables to take into system-wide effect after it had been added into /etc/environment file(s).
In order to investigate, we printed below additional things into our code to ensure that it indeed is a 64 bit platform/architecture, drivers and datasources are registered and listed. However, the variables were still showing blanks/none. That verified that although the variable path was set/effective locally when running from individual nodes. However, when running from outside/via remote session, the variable values didn't get apply.
import os
import pyodbc
import platform
print(platform.architecture())
print (pyodbc.drivers())
print(pyodbc.dataSources())
print(os.environ["LD_LIBRARY_PATH"])
print(os.environ["ODBCINI"])
print(os.environ["OASDK_ODBC_HOME"])
Before reboot:
[2020-07-27 18:46:51,948] {logging_mixin.py:112} INFO - ('64bit', 'ELF')
[2020-07-27 18:46:51,949] {logging_mixin.py:112} INFO - ['ODBC Drivers', 'NetSuite ODBC Drivers 8.1']
[2020-07-27 18:46:51,950] {logging_mixin.py:112} INFO - {'NetSuite': '/opt/netsuite/odbcclient/lib64/ivoa27.so', 'ODBC': ''}
[2020-07-27 18:46:51,950] {logging_mixin.py:112} INFO - Error: 'LD_LIBRARY_PATH'
After reboot:
[2020-07-28 06:11:59,961] {logging_mixin.py:112} INFO - ('64bit', 'ELF')
[2020-07-28 06:11:59,963] {logging_mixin.py:112} INFO - ['ODBC Drivers', 'NetSuite ODBC Drivers 8.1']
[2020-07-28 06:11:59,965] {logging_mixin.py:112} INFO - {'NetSuite': '/opt/netsuite/odbcclient/lib64/ivoa27.so', 'ODBC': ''}
[2020-07-28 06:11:59,965] {logging_mixin.py:112} INFO - /opt/netsuite/odbcclient/lib64
[2020-07-28 06:11:59,965] {logging_mixin.py:112} INFO - /opt/netsuite/odbcclient/odbc64.ini
[2020-07-28 06:11:59,965] {logging_mixin.py:112} INFO - /opt/netsuite/odbcclient/lib64

How do I set the ulimit in a nix build shell?

I am attempting to install the certbot package for nix, and it fails during the tests every time because the tests hit the open file limit on the system. I have modified the certbot install script just enough to print out the ulimit at the beginning of the patchPhase and find that the maximum number of allowed open files is 256. However, in the shell from which I am executing nix-shell or nix-env, my ulimit (both hard and soft) is set to 100000.
How can I propogate that limit down to the certbot build process? I would like to avoid trying to figure out how to modify the python build script that certbot uses.
Running a Bash shell on OSX 10.13.
Manually raise the ulimit in the patchPhase stanza of certbot.nix. Turns out that this change propogates through the rest of the phases in the certbot build script.
buildInputs = [ dialog ] ++ (with python2Packages; [ nose mock gnureadline ]);
patchPhase = ''
ulimit -n 8196
substituteInPlace certbot/notify.py --replace "/usr/sbin/sendmail" "/run/wrappers/bin/sendmail"
substituteInPlace certbot/util.py --replace "sw_vers" "/usr/bin/sw_vers"
'';
postInstall = ''
I will submit a patch to nixpkgs.

Chef cloudera cookbook can't find missing dependency

I'm trying to create a Cloudera's Hadoop cookbook. I'm using this cloudera cookbook to make it work:
# PSEUDEO INSTALL:
# https://ccp.cloudera.com/display/CDH4DOC/Installing+CDH4+on+a+Single+Linux+Node+in+Pseudo-distributed+Mode#InstallingCDH4onaSingleLinuxNodeinPseudo-distributedMode-InstallingCDH4withYARNonaSingleLinuxNodeinPseudodistributedmode
if node[:platform] == "ubuntu"
execute "apt-get update"
end
# Install required base packages
package "curl" do
action :install
end
package "wget" do
action :install
end
# Install Cloudera Basic:
case node[:platform]
when "ubuntu"
case node[:lsb][:codename]
when "precise"
execute "curl -s http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh/archive.key | sudo apt-key add -"
execute "wget http://archive.cloudera.com/cdh4/one-click-install/precise/amd64/cdh4-repository_1.0_all.deb"
when "lucid"
execute "curl -s http://archive.cloudera.com/cdh4/ubuntu/lucid/amd64/cdh/archive.key | sudo apt-key add -"
execute "wget http://archive.cloudera.com/cdh4/one-click-install/lucid/amd64/cdh4-repository_1.0_all.deb"
when "squeeze"
execute "curl -s http://archive.cloudera.com/cdh4/ubuntu/squeeze/amd64/cdh/archive.key | sudo apt-key add -"
execute "wget http://archive.cloudera.com/cdh4/one-click-install/squeeze/amd64/cdh4-repository_1.0_all.deb"
end
execute "dpkg -i cdh4-repository_1.0_all.deb"
execute "apt-get update"
end
if node['cloudera']['installyarn'] == true
package "hadoop-conf-pseudo" do
action :install
end
else
package "hadoop-0.20-conf-pseudo" do
action :install
end
end
# copy over helper script to start hdfs
cookbook_file "/tmp/hadoop-hdfs-start.sh" do
source "hadoop-hdfs-start.sh"
mode "0744"
end
cookbook_file "/tmp/hadoop-hdfs-stop.sh" do
source "hadoop-hdfs-stop.sh"
mode "0744"
end
cookbook_file "/tmp/hadoop-0.20-mapreduce-start.sh" do
source "hadoop-0.20-mapreduce-start.sh"
mode "0744"
end
cookbook_file "/tmp/hadoop-0.20-mapreduce-stop.sh" do
source "hadoop-0.20-mapreduce-stop.sh"
mode "0744"
end
# helper to prepare folder structure for first time
cookbook_file "/tmp/prepare-yarn.sh" do
source "prepare-yarn.sh"
mode "0777"
end
cookbook_file "/tmp/prepare-0.20-mapreduce.sh" do
source "prepare-0.20-mapreduce.sh"
mode "0777"
end
# only for the first run we need to format as hdfs (we pass input "N" to answer the reformat question with No )
################
execute "format namenode" do
command 'echo "N" | hdfs namenode -format'
user "hdfs"
returns [0,1]
end
# Jobtracker repeats - was the only way to get both together
%w{jobtracker tasktracker}.each { |name|
service "hadoop-0.20-mapreduce-#{name}" do
supports :status => true, :restart => true, :reload => true
action [ :enable, :start ]
end
} if !node['cloudera']['installyarn']
# now hadopp should run and this should work: http://localhost:50070:
%w(datanode namenode secondarynamenode).each { |name|
service "hadoop-hdfs-#{name}" do
supports :status => true, :restart => true, :reload => true
action [ :enable, :start ]
end
}
# Prepare folders (only first run)
# TODO: only do this if "hadoop fs -ls /tmp" return "No such file or directory"
################
if node['cloudera']['installyarn'] == true
execute "/tmp/prepare-yarn.sh" do
user "hdfs"
not_if 'hadoop fs -ls -R / | grep "/tmp/hadoop-yarn"'
end
else
execute "/tmp/prepare-0.20-mapreduce.sh" do
user "hdfs"
not_if 'hadoop fs -ls -R / | grep "/var/lib/hadoop-hdfs/cache/mapred"'
end
end
So, after I create a vagrant vm, I try to have hadoop installed on it:
knife bootstrap localhost --ssh-user vagrant --ssh-password vagrant --ssh-port 2222 --run-list "recipe[cloudera]" --sudo
but the only result I get is:
localhost The following packages have unmet dependencies:
localhost hadoop-0.20-conf-pseudo : Depends: hadoop-hdfs-namenode (= 2.0.0+1554-1.cdh4.6.0.p0.16~precise-cdh4.6.0) but it is not going to be installed
localhost Depends: hadoop-hdfs-datanode (= 2.0.0+1554-1.cdh4.6.0.p0.16~precise-cdh4.6.0) but it is not going to be installed
localhost Depends: hadoop-hdfs-secondarynamenode (= 2.0.0+1554-1.cdh4.6.0.p0.16~precise-cdh4.6.0) but it is not going to be installed
localhost Depends: hadoop-0.20-mapreduce-jobtracker (= 2.0.0+1554-1.cdh4.6.0.p0.16~precise-cdh4.6.0) but it is not going to be installed
localhost Depends: hadoop-0.20-mapreduce-tasktracker (= 2.0.0+1554-1.cdh4.6.0.p0.16~precise-cdh4.6.0) but it is not going to be installed
localhost STDERR: E: Unable to correct problems, you have held broken packages.
localhost ---- End output of apt-get -q -y install hadoop-0.20-conf-pseudo=2.0.0+1554-1.cdh4.6.0.p0.16~precise-cdh4.6.0 ----
localhost Ran apt-get -q -y install hadoop-0.20-conf-pseudo=2.0.0+1554-1.cdh4.6.0.p0.16~precise-cdh4.6.0 returned 100
localhost [2014-04-03T03:41:41+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
I have had tried to install those dependencies, but it does work. Could someone please help me?
We struggled down this path for a while and concluded that it made more sense to use vms provided by cloudera and hortonworks. Too many working parts, not enough benefit over the vendor provided vms.
There appears to be a lot of wreckage along the side of this road - people creating their own chef hadoop recipes/cookbooks. Evidence: Crowbar project, which is probably excellent, but appears to be a hopelessly complex ball of mud.
One perspective only. We would use it, if an appropriate recipe appeared. Or, cloudera and/or hortonworks could release a cookbook instead of a vm....
Your apt-cache is out of date. Either manually run apt-get update during your bootstrap process, or add the apt cookbook first in your run list.

Installing more than one version of Erlang/OTP on a machine

Is this possible to have different versions of Erlang/OTP installed simultaneously on the same platform?
I use Kerl to install Erlang on my machines. Quite easy to use, and allows to have several Erlang systems installed on same machine. You can then easily choose the one you want to use.
It is no only possible, but also very frequent. On my machine I have one version that I installed for development (R13B03) it is the default version when I launch erl.
A second copy of the same version associated with nitrogen. this copy is used when I start my nitrogen website. The version will not change when I will use the R16B.. for development
A partial older version which came with the installation of Wings3D.
Yes, I usually install different versions in my home directory. I build them from source:
./configure --prefix=$HOME/r15b01
make && make install
Then I can choose a version to use with PATH=$HOME/r15b01/bin:$PATH, and compile and run things as usual.
These days I use asdf for this. Install asdf and add the relevant line to your .bashrc, and then run:
asdf plugin add erlang
asdf install erlang 22.3.3
asdf install erlang 23.0.2
Then you can set one of the Erlang versions you just built as the default version:
asdf global erlang 23.0.2
Or you can set it to be used in the current directory and its subdirectories - this will create a .tool-versions file in the current directory:
asdf local erlang 22.3.3
On a Mac, Macport helps switching, even between versions it covers and newer ones.
E.g. with Erlang 17 installed directly from Erlang Solutions, you could switch back to RB1603 (open a new terminal window afterwards):
sudo port activate erlang #R16B03-1_0+hipe+ssl
Switch back to Erlang 17 by _de_activating the Macports install (and open a new terminal window afterwards):
sudo port deactivate erlang #R16B03-1_0+hipe+ssl
List all versions you have installed with:
port installed erlang
Using the Nix package manager there is no need to globally install interpreters (especially because sometimes multiple versions are needed), and nix-shell will open up a sub-shell with the Erlang executable available in the path.
1. Getting only the Erlang (no shell.nix)
For the current version in the active channel:
nix-shell -p erlang
For other versions not in the current channel, a specific channel can be given:
nix-shell -I nixpkgs=channel:nixos-unstable -p erlangR22
Or add path to the Nix expression in your NixOS/nixpkgs clone:
$ nix-shell -I nixpkgs=~/clones/nixpkgs -p erlangR23
2. More elaborate project setup configurations: use a shell.nix file
A complex development environment can be spun up, and calling nix-shell shell.nix will take care of all - even automatically when entering a directory if set up with direnv(archived).
2.1 Examples
Erlang
This will drop you in a shell with erl and rebar3 available, along with the other programs specified in buildInputs.
{ pkgs ? import ~/clones/nixpkgs {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
beam.packages.erlangR22.erlang
beam.packages.erlangR22.rebar3
curl
ffmpeg
git
google-cloud-sdk
jq
];
# Where would be the best place for this?
shellHook = ''
export ERL_AFLAGS="-kernel shell_history enabled"
'';
Elixir/Phoenix web project
This (archived) will set up an environment for an Elixir/Phoenix web app complete with a spun up PostgreSQL dev instance:
####################################################################
# Importing a cloned Nixpkgs repo (from my home directory), because
# the latest channels don't have Elixir 1.9.
# See https://nixos.org/nix/manual/#idm140737317975776 for the meaning
# of `<nixpkgs>` and `~` in Nix expressions (towards the end of that
# section).
####################################################################
{ pkgs ? import ~/clones/nixpkgs {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
beam.packages.erlangR22.elixir_1_9
postgresql_11
nodejs-12_x
git
inotify-tools
];
shellHook = ''
####################################################################
# Create a diretory for the generated artifacts
####################################################################
mkdir .nix-shell
export NIX_SHELL_DIR=$PWD/.nix-shell
####################################################################
# Put the PostgreSQL databases in the project diretory.
####################################################################
export PGDATA=$NIX_SHELL_DIR/db
####################################################################
# Put any Mix-related data in the project directory
####################################################################
export MIX_HOME="$NIX_SHELL_DIR/.mix"
export MIX_ARCHIVES="$MIX_HOME/archives"
####################################################################
# Clean up after exiting the Nix shell using `trap`.
# ------------------------------------------------------------------
# Idea taken from
# https://unix.stackexchange.com/questions/464106/killing-background-processes-started-in-nix-shell
# and the answer provides a way more sophisticated solution.
#
# The main syntax is `trap ARG SIGNAL` where ARG are the commands to
# be executed when SIGNAL crops up. See `trap --help` for more.
####################################################################
trap \
"
######################################################
# Stop PostgreSQL
######################################################
pg_ctl -D $PGDATA stop
######################################################
# Delete `.nix-shell` directory
# ----------------------------------
# The first step is going back to the project root,
# otherwise `.nix-shell` won't get deleted. At least
# it didn't for me when exiting in a subdirectory.
######################################################
cd $PWD
rm -rf $NIX_SHELL_DIR
" \
EXIT
####################################################################
# If database is not initialized (i.e., $PGDATA directory does not
# exist), then set it up. Seems superfulous given the cleanup step
# above, but handy when one gets to force reboot the iron.
####################################################################
if ! test -d $PGDATA
then
######################################################
# Init PostgreSQL
######################################################
pg_ctl initdb -D $PGDATA
######################################################
# PORT ALREADY IN USE
######################################################
# If another `nix-shell` is running with a PostgreSQL
# instance, the logs will show complaints that the
# default port 5432 is already in use. Edit the line
# below with a different port number, uncomment it,
# and try again.
######################################################
# sed -i "s|^#port.*$|port = 5433|" $PGDATA/postgresql.conf
fi
####################################################################
# Start PostgreSQL
# ==================================================================
# Setting all necessary configuration options via `pg_ctl` (which
# is basically a wrapper around `postgres`) instead of editing
# `postgresql.conf` directly with `sed`. See docs:
#
# + https://www.postgresql.org/docs/current/app-pg-ctl.html
# + https://www.postgresql.org/docs/current/app-postgres.html
#
# See more on the caveats at
# https://discourse.nixos.org/t/how-to-configure-postgresql-declaratively-nixos-and-non-nixos/4063/1
# but recapping out of paranoia:
#
# > use `SHOW` commands to check the options because `postgres -C`
# > "_returns values from postgresql.conf_" (which is not changed by
# > supplying the configuration options on the command line) and
# > "_it does not reflect parameters supplied when the cluster was
# > started._"
#
# OPTION SUMMARY
# --------------------------------------------------------------------
#
# + `unix_socket_directories`
#
# > PostgreSQL will attempt to create a pidfile in
# > `/run/postgresql` by default, but it will fail as it
# > doesn't exist. By changing the configuration option
# > below, it will get created in $PGDATA.
#
# + `listen_addresses`
#
# > In tandem with edits in `pg_hba.conf` (see
# > `HOST_COMMON` below), it configures PostgreSQL to
# > allow remote connections (otherwise only `localhost`
# > will get authenticated and the rest of the traffic
# > discarded).
# >
# > NOTE: the edit to `pga_hba.conf` needs to come
# > **before** `pg_ctl start` (or the service
# > needs to be restarted otherwise), because then
# > the changes are not being reloaded.
# >
# > More info on setting up and troubleshooting remote
# > PosgreSQL connections (these are all mirrors of the
# > same text; again, paranoia):
# >
# > + https://stackoverflow.com/questions/24504680/connect-to-postgres-server-on-google-compute-engine
# > + https://stackoverflow.com/questions/47794979/connecting-to-postgres-server-on-google-compute-engine
# > + https://medium.com/scientific-breakthrough-of-the-afternoon/configure-postgresql-to-allow-remote-connections-af5a1a392a38
# > + https://gist.github.com/toraritte/f8c7fe001365c50294adfe8509080201#file-configure-postgres-to-allow-remote-connection-md
HOST_COMMON="host\s\+all\s\+all"
sed -i "s|^$HOST_COMMON.*127.*$|host all all 0.0.0.0/0 trust|" $PGDATA/pg_hba.conf
sed -i "s|^$HOST_COMMON.*::1.*$|host all all ::/0 trust|" $PGDATA/pg_hba.conf
# + `log*`
#
# > Setting up basic logging, to see remote connections
# > for example.
# >
# > See the docs for more:
# > https://www.postgresql.org/docs/current/runtime-config-logging.html
pg_ctl \
-D $PGDATA \
-l $PGDATA/postgres.log \
-o "-c unix_socket_directories='$PGDATA'" \
-o "-c listen_addresses='*'" \
-o "-c log_destination='stderr'" \
-o "-c logging_collector=on" \
-o "-c log_directory='log'" \
-o "-c log_filename='postgresql-%Y-%m-%d_%H%M%S.log'" \
-o "-c log_min_messages=info" \
-o "-c log_min_error_statement=info" \
-o "-c log_connections=on" \
start
####################################################################
# Install Node.js dependencies if not done yet.
####################################################################
if test -d "$PWD/assets/" && ! test -d "$PWD/assets/node_modules/"
then
(cd assets && npm install)
fi
####################################################################
# If $MIX_HOME doesn't exist, set it up.
####################################################################
if ! test -d $MIX_HOME
then
######################################################
# ... but first, test whether there is a `_backup`
# directory. Had issues with installing Hex on NixOS,
# and Hex and Phoenix can be copied from there, just
# in case.
######################################################
if test -d "$PWD/_backup"
then
cp -r _backup/.mix .nix-shell/
else
######################################################
# Install Hex and Phoenix via the network
######################################################
yes | mix local.hex
yes | mix archive.install hex phx_new
fi
fi
if test -f "mix.exs"
then
# These are not in the `if` section above, because of
# the `hex` install glitch, it could be that there is
# already a `$MIX_HOME` folder. See 2019-08-05_0553
mix deps.get
######################################################
# `ecto.setup` is defined in `mix.exs` by default when
# Phoenix project is generated via `mix phx.new`.
# It does `ecto.create`, `ecto.migrate`, and run
# `priv/seeds`.
######################################################
mix ecto.setup
fi
'';
####################################################################
# Without this, almost everything fails with locale issues when
# using `nix-shell --pure` (at least on NixOS).
# See
# + https://github.com/NixOS/nix/issues/318#issuecomment-52986702
# + http://lists.linuxfromscratch.org/pipermail/lfs-support/2004-June/023900.html
####################################################################
LOCALE_ARCHIVE = if pkgs.stdenv.isLinux then "${pkgs.glibcLocales}/lib/locale/locale-archive" else "";
}
How to find packages with attributes path on the console
$ nix-env -qaP 'erlang*'
# ...
nixos.erlangR20 erlang-20.3.8.9
nixos.erlangR21 erlang-21.3.8.3
nixos.erlang erlang-22.1.7
# ...
$ nix-env -f ~/clones/nixpkgs/ -qaP 'erlang*'
# ...
nixos.erlangR20 erlang-20.3.8.9
nixos.erlangR21 erlang-21.3.8.3
nixos.erlang erlang-22.1.7
# ...
=== >>> erlangR23 erlang-23.0.2 <<<====
Consider using kerl. It allows you to work with several Erlang installations https://github.com/kerl/kerl

Resources