Disable transparent huge pages in TokuMX - tokumx

When I try to start the mongod server by giving ./mongod --dbpath /nlu/ind/mongodata
I get an error saying
TokuMX will not run with transparent huge pages enabled.
Tue Aug 20 10:47:34 [initandlisten] Please disable them to continue.
Tue Aug 20 10:47:34 [initandlisten] (echo never > /sys/kernel/mm/transparent_hugepage/enabled)
Tue Aug 20 10:47:34 [initandlisten]
Tue Aug 20 10:47:34 [initandlisten] The assertion failure you are about to see is intentional
Please let me know how to sort this. Thanks in advance for your help.
I have 3 directories in /sys/kernel/mm/ and they are hugepages ksm redhat_transparent_hugepage

As the message states, you need to do the following:
sudo bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled'
You can cat /sys/kernel/mm/transparent_hugepage/enabled to see the current setting and to make sure that your echo worked.
The setting will be cleared when you reboot when setting it in this manner. TokuMX sets this in it's init script.

Please visit this question for a more thorough discussion: https://unix.stackexchange.com/questions/99154/disable-transparent-hugepages
You can add transparent_hugepage=never to the GRUB_CMDLINE_LINUX_DEFAULT option in /etc/default/grub and run sudo update-grub
To test that it took effectcat /sys/kernel/mm/transparent_hugepage/enabled should look like this: always madvise [never]

Related

uwsgi upgrade to python3.7 to fix ImportError: No module named 'encodings'

Honestly, I have no idea what I am doing, so be gentle with me. I am trying to use uwsgi to run my django application on a aws ubuntu instance. I have a virtual environment with python3.7 running, but when I try to run uwsgi. I get this in the logs:
*** Starting uWSGI 2.0.14 (64bit) on [Sun Jan 5 14:51:32 2020] ***
compiled with version: 5.4.0 20160609 on 20 October 2016 05:56:34
os: Linux-4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018
nodename: ip-172-31-41-139
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /home/ubuntu/web/graff
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 3804
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /home/ubuntu/web/graffuwsgi.sock fd 3
Python version: 3.5.2 (default, Oct 8 2019, 13:06:37) [GCC 5.4.0 20160609]
Set PythonHome to /home/ubuntu/.virtualenvs/graff
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Here is my uwsgi.conf
# file: /etc/init/graffuwsgi.conf
description "uWSGI server for graff"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /usr/local/bin/uwsgi --home /home/ubuntu/web/graff/ --socket /home/ubuntu/web/graffuwsgi.sock --chmod-socket=666 --module=graff.wsgi --pythonpath /home/ubuntu/web -H /home/ubuntu/.virtualenvs/graff --logto /home/ubuntu/web/logs/graffuwsgi.log --chdir=/home/ubuntu/web/graff --chmod-socket=666
It seems like python3.5 just doesn't work anymore. I feel like I've had to replace python3.5 with 3.7 in several places lately to fix various bugs, and I have it in my head that if I can get uwsgi to run python3.7 instead of 3.5 then that will solve this error too. Anyway, any help is much appreciated.
Looks like your uwsgi is compiled with different python version, make sure you compile with python 3.5
PYTHON=python3.5 uwsgi --build-plugin "/usr/src/uwsgi/plugins/python python35"
mv python35_plugin.so /usr/lib/uwsgi/plugins/python35_plugin.so
chmod 644 /usr/lib/uwsgi/plugins/python35_plugin.so
you can follow this guide:
https://www.paulox.net/2017/04/04/how-to-use-uwsgi-with-python3-6-in-ubuntu/
The source of error is PythonHome (pyhome, venv, home) setting.
See at the official Python docs on Environment variables
Is your path /home/ubuntu/.virtualenvs/graff suited for Python requirements?
In short:
Use pythonpath (pp) and let the system to find modules.
You can set several repeated options in your uwsgi config to custom modules search, eg:
pythonpath = /opt/web2py/
pythonpath = /opt/anaconda/lib/python3.9/site-packages/
So, I had the same error. And it was fixed by editing uwsgi vassal config.
I thing the core of problem that virtual envs are created with symlinks or have some inner relative paths, so an isolated process inside uwsgi could not find modules.

unexport doesn't work on BBB GPIOs

When entering the /sys/class/gpio/ directory on a beagle bone running Linux beaglebone 4.9.82-ti-r102 #1 SMP PREEMPT Thu Feb 22 01:16:12 UTC 2018 armv7l, already several GPIOs get displayed, without me exporting them first. Trying to unexport them by using sudo echo gpio30 > unexport results in echo: write error: Invalid argument.
Why are all the GPIOs already exportet on BBB?
Why can't I unexport them?
What would be the best way to control those GPIO from a C++/C program? Should I really use ofstream? Or is there a different interfacing-lib already installed on my BBB?

Xcode 4.2 doesn't output exit code?

Since updating to iOS 5 and Xcode 4.2, it appears that Xcode no longer prints "Program ended with exit code: #" on completion of a run. Has anyone else noticed this and is there any way to enable it again? I have an automated testing tool that relies on this output to determine if tests pass or not, so it would be very helpful to have it back.
UPDATE: I looked into this in more detail, and it seems to be a deeper problem. It appears that whenever I run an app, it crashes with a segmentation fault on exit. Sometimes this occurs just before the exit code is printed, sometimes right after, which is why the exit code message appears inconsistently. The seg fault message appears in the device's console, though there is nothing in the Xcode debug output.
I just noticed this too. It seems that in Xcode 4.1 (tty /dev/ttys000) gdb is started like this:
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
But in Xcode 4.2 - No tty /dev/ttys000:
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
To fix this you can do the following from a command line (Terminal.app/iTerm/etc):
echo 'tty /dev/ttys000' >> ~/.gdbinit
# Or, put it into the global gdb config:
# echo 'tty /dev/ttys000' >> /etc/gdb.conf
Then restart Xcode, and you have your exit code back!
Seems that Xcode 4.2's gdb wrapper has changed since 4.1
[ 13:29 Jonathan#MacBookPro / ]$ ls -l /Developer/Library/Xcode/PrivatePlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB /Developer-4.2/Library/Xcode/PrivatePlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB
-rwxrwxr-x 1 root admin 351936 Sep 20 13:23 /Developer/Library/Xcode/PrivatePlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB
-rwxrwxr-x 1 root admin 353776 Oct 8 14:21 /Developer-4.2/Library/Xcode/PrivatePlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB
[ 13:33 Jonathan#MacBookPro / ]$ ls -l /Developer/Library/Xcode/PrivatePlugIns/DebuggerGDB.ideplugin/Contents/MacOS/DebuggerGDB /Developer-4.2/Library/Xcode/PrivatePlugIns/DebuggerGDB.ideplugin/Contents/MacOS/DebuggerGDB
-rwxrwxr-x 1 root admin 1976144 Sep 20 13:23 /Developer/Library/Xcode/PrivatePlugIns/DebuggerGDB.ideplugin/Contents/MacOS/DebuggerGDB
-rwxrwxr-x 1 root admin 1948240 Oct 8 14:21 /Developer-4.2/Library/Xcode/PrivatePlugIns/DebuggerGDB.ideplugin/Contents/MacOS/DebuggerGDB

Erlang causes page faults

When I run the script described here with my user, everything is well:
lorenzo#enzo:~/erlang/pei$ time erl -noshell -smp enabled -S 4 -s fib4 main 10000000
real 0m54.952s
user 1m16.090s
sys 0m0.070s
When I run it as root, it crashed:
lorenzo#enzo:~/erlang/pei$ sudo time erl -noshell -smp enabled -S 4 -s fib4 main 10000000
[sudo] password for lorenzo:
74.68user 0.04system 0:53.56elapsed 139%CPU (0avgtext+0avgdata 66064maxresident)k
0inputs+0outputs (0major+8306minor)pagefaults 0swaps
The error is reproduceable.
My questions are:
Can someone try to explain me what is happending there?
Is it a problem with the erlang runtime or with my OS?
Can someone reproduce this error?
I am running erlang 5.7.4 on ubuntu natty with kernel
Linux enzo 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
on a Phenom X4.
Why do you think it crashed? time just shows more info when running as root. Page fault is not an error but just the way virtual memory works.
The difference between the two runs is that in the first run, you're running the shell builtin time, but in the second run, you're running whatever sudo finds in the path, which is /usr/bin/time. These two tools have different output formats.
$ type time
time is a shell keyword
$ time echo
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ type /usr/bin/time
/usr/bin/time is /usr/bin/time
$ /usr/bin/time echo
0.01user 0.00system 0:00.00elapsed 1000%CPU (0avgtext+0avgdata 2784maxresident)k
0inputs+0outputs (0major+217minor)pagefaults 0swaps

Can "cap deploy:setup" destroy BASH?

I had a problem this morning deploying an application with capistrano.
# git push
# cap deploy:setup
Something strange happened and than I wasn't able to ssh to my host anymore.
Technical staff says (in Italian): "the commands you have run overwrote the shell binaries causing the system to be no more usable". Two options: I am a stupid, or they are wrong.
Here's the shell output on cap:deploy and then the error on ssh. Once the system (VPS) has been rebooted, I wasn't able to ssh anymore.
Any ideas?
mattia#desktop:/var/www/rails/my_application$ git push
Counting objects: 239, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (191/191), done.
Writing objects: 100% (202/202), 379.77 KiB, done.
Total 202 (delta 44), reused 0 (delta 0)
To ssh://mattia#my_application.it/~/git/my_application.git
96c1f19..3cc9e1c master -> master
mattia#desktop:/var/www/rails/my_application$ cap deploy:setup
* executing `deploy:setup'
* executing "mkdir -p /var/www/rails/my_application /var/www/rails/my_application/releases /var/www/rails/my_application/shared /var/www/rails/my_application/shared/system /var/www/rails/my_application/shared/log /var/www/rails/my_application/shared/pids && chmod g+w /var/www/rails/my_application /var/www/rails/my_application/releases /var/www/rails/my_application/shared /var/www/rails/my_application/shared/system /var/www/rails/my_application/shared/log /var/www/rails/my_application/shared/pids"
servers: ["beta.my_application.it"]
[beta.my_application.it] executing command
** [out :: beta.my_application.it]
** [out :: beta.my_application.it] malloc: ../bash/parse.y:2823: assertion botched
** [out :: beta.my_application.it] nunits < 30
** [out :: beta.my_application.it] Aborting...
command finished
failed: "env PATH=/usr/local/bin:/usr/bin:/bin GEM_PATH=/var/lib/gems/1.9.1 sh -c 'mkdir -p /var/www/rails/my_application /var/www/rails/my_application/releases /var/www/rails/my_application/shared /var/www/rails/my_application/shared/system /var/www/rails/my_application/shared/log /var/www/rails/my_application/shared/pids && chmod g+w /var/www/rails/my_application /var/www/rails/my_application/releases /var/www/rails/my_application/shared /var/www/rails/my_application/shared/system /var/www/rails/my_application/shared/log /var/www/rails/my_application/shared/pids'" on beta.my_application.it
mattia#desktop:/var/www/rails/my_application$ ssh beta.my_application.it
Linux my_application 2.6.18-194.26.1.el5.028stab079.2ent #1 SMP Fri Dec 17 19:44:51 MSK 2010 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Feb 7 12:00:53 2011 from dynamic-adsl-xx-xx-xx-xx.------.------.it
malloc: ../bash/subst.c:4494: assertion botched
realloc: called with unallocated block argument
Aborting...Connection to beta.my_application.it closed.
The short-answer is no, unless you have other plugins that aren't standard, or someone gave you a messed up Gem. (Almost nobody bothers to validate the gem signatures.) The standard deploy:setup only creates a couple of symlinks, and directories.
It does run as root, and in theory if you were to set your variables to values (untested) such as set :deploy_to, '/bin/bash', it may damage the binary, but unless you did that, I'd say that's a non-issue.
You can debug this, without relying on a shell - by using SSH in command mode:
# ssh myuser#myserver -c 'history'
Which will dump out the history file (bash) of that user, so you can test if there's been any tampering on the server, you can also check it as root, and/or run commands such as who, last and other one-liners which give you back logs (you can also cat /var/log/messages and look for suspicious activity.
I'd say that the chance of Capistrano being responsible for this is 0 (Source: I'm the maintainer.) - but you can probably get your system back into a working state using the SHS command mode, as I mentioned above (ssh myuser#myserver -c 'aptitude install bash --force' for example)
A word to the wise, if you never figure out how this happened, erase the server and change your passwords… just use this as a method to get things back up and running. It's not a very subtle tactic, but if you've been hacked, a hacker could easily throw you out by making a user which uses an alternative shell, and corrupting yours.
It would also be a huge help from your admins, if they could give you /bin/bash - the contents of the file, so you can see if it's text, junk, corrupted binary, or something from your deploy.

Resources