Author: karlo
-
TMUX Toggle pane synchronize key
In tmux.conf, add: bind e set -g synchronize-panes Prefix-e now toggles pane synchronization.
-
Fix: Terminal entry not found in terminfo ‘screen-256color’ not known
I got: E558: Terminal entry not found in terminfo ‘screen-256color’ not known. Available builtin terminals are: … This means that the remote host you are working on does not know about the terminal ‘screen-256color’. Fix: local$ infocmp screen-256color > screen-256color.ti local$ scp screen-256color.ti remote: local$ ssh remote remote $ sudo yum install ncurses ncurses-bin #optional…
-
Fix “hostname: Name or service not known”
Simple fix, as root: # hostname -f hostname: Name or service not known # echo “127.0.0.1 `hostname`” >> /etc/hosts # hostname -f karlo-laptop
-
HOWTO: Solve / investigate high Linux system load
On support websites I am noticing there is a lot of confusion about system load. This post is my attempt to make a short guide to understanding (and fixing) high Linux system load. Disclaimer: I might be wrong ;). Get your current sysload: $ w 18:54:44 up 22 days, 22:47, 1 user, load average: 2.54,…
-
SSH: Don’t display motd and banner
Stop display of motd on login: # On the machine of which you don’t want to see the banner $ touch ~/.hushlogin Stop display of banner on ssh login: # Method 1: $ ssh -q targethost #Method 2: # Add to .ssh/config: Host * LogLevel Quiet
-
TMUX: Auto start on shell start
I always want to use tmux. So I put the following in my bashrc (just before the functions). # If not running interactively, do not do anything # If you don’t do this, your (graphical) login sessions will hang [[ $- != *i* ]] && return # If we are not yet in a screen…
-
Auditd find syslog code
Don’t know what a syscall code means in your audit output? Follow these steps to find out: Find the source for your kernel: https://www.kernel.org/pub/linux/kernel/v2.6/ Extract the file Go to /[yourkernelversion]/arch/[your_architecture]/include/asm Open the header file unistd_[32/64].h Find the syscall code Defines: #define __NR_read 0 #define __NR_write 1 #define __NR_open 2 #define __NR_close 3 #define __NR_stat 4…
-
Monitor ntp without ntpq
I was working on a server which did not have ntpq installed, so I couldn’t do ntpq -p. Simple solution is to stop the ntp service and run ntpd -d This will output logging to stdout. Simple solution ;).
-
Can not login to server: “Server is going down” on ssh login
I was not able to log into an old server. Directly after connecting over ssh, I got a “Server is going down” message. Solution is to reboot into safe mode, remove /etc/nologin, do a sync, and properly shutdown the machine.
-
Reposync errors: empty rpm’s
I recently got empty rpm’s back from Red Hat. The system was registered properly. Problem was thet for reposync, I used a different .repo file. This file still had the old ssl/tls key sources. Update your reposync .repo file to reflect the current ssh/tls keys and things will work again :).
-
TMUX: Start window count at 1 instead of 0
Add to tmux.conf: # Count 1 set -g base-index 1 set -g pane-base-index 1 Completely stop and start all tmux processes and you are good to go!
-
Samba LDAP new version error [AttributeType not found: “displayName]?
When I was updating to a new openldap server version, I got: samba olcObjectClasses: AttributeType not found: “displayName” I first tried recompiling the ldif’s with a new samba.schema (you can find samba.schema in here), that made no difference. Solution is to move the files in /etc/openldap/slapd.d/cn=config/cn=schema . Change the numbering so that samba is after…
-
yum update matahari errors (libcommon, libmnet, …)
Are you getting the following on yum update ? libmcommon.so.0.0.1()(64bit) is needed by (installed) matahari-net-0.4.0-5.el6.x86_64 libmnet.so.0.0.1()(64bit) is needed by (installed) matahari-net-0.4.0-5.el6.x86_64 matahari-lib = 0.4.0-5.el6 is needed by (installed) matahari-net-0.4.0-5.el6.x86_64 libmqmfagent.so.0.0.1()(64bit) is needed by (installed) matahari-net-0.4.0-5.el6.x86_64 matahari-agent-lib = 0.4.0-5.el6 is needed by (installed) matahari-net-0.4.0-5.el6.x86_64 Solution: yum remove matahari* yum install matahari Matahari is deprecated.
-
RHEL6: “DeprecationWarning: Call to deprecated function: hasNow”
A RHEL6 installation complained: “DeprecationWarning: Call to deprecated function: hasNow” in /usr/libexec/rhsmd . According to RedHat, this is not a problem, as rhsmd is working fine. Workaround in order to stop seeing the mails: # diff /tmp/rhsmd /etc/cron.daily/rhsmd 5c5 < /usr/libexec/rhsmd -s --- > /usr/libexec/rhsmd -s 2>&1 | grep -v DeprecationWarning
-
RHEL6: Fixing reposync UnboundLocalError: local variable ‘exit_code’ referenced…
yum-utils-1.1.31-7 fixes this issue, but it’s not available for RHEL (as far as I see). You can fix /usr/bin/reposync: — a/reposync.py +++ b/reposync.py @@ -198,6 +198,7 @@ def main(): # maybe this shouldn’t be entirely fatal sys.exit(1) + exit_code = 0 for repo in my.repos.listEnabled(): reposack = ListPackageSack(my.pkgSack.returnPackages(repoid=repo.id)) @@ -293,7 +294,6 @@ def main(): pkg.repo.cache…
-
Installing ruby mysql / activerecord-mysql-adapter gem on RHEL 6 x86_64
I couldn’t install activerecord-mysql-adapter. After some duckduckgo’ing, I found the solution. Error: Error: Building native extensions. This could take a while… ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb –with-mysql-config=/usr/lib64/mysql/mysql_config checking for mysql_ssl_set()… no checking for rb_str_set_len()… no checking for rb_thread_start_timer()… no checking for mysql.h… no checking for mysql/mysql.h… no…
-
Backup and restore permissions linux (accidental chmod -R)
cd /etc/ chmod -R 664 . *SHIT!* If you find you did an accidental chmod -R, you may be able to restore it. Make sure SSH login keeps working (chmod -R 0600 /etc/ssh ) Install a similar machine On that machine, issue this command: find /etc/ -exec stat –format “[ ! -L \”{}\” ] &&…
-
A better todo.txt repeated task inserter
I have a scheduled.txt file like this: # Scheduled tasks for todo.txt # Format: # # a dow, Mon,Tue,Wed,… # b moy, Jan,Feb,Mar,… # d dom, 01..31 # D m/d/y 12/30/12 # F Y-m-d 2012-12-30 # j doy 001..366 # V woy 01..53 # # %2 = Division by 2 is possible # %N2= Devision…
-
Todo.txt – Insert repeating tasks v1
(Not tested extensively). A script to add todo’s to todo.txt. Add a crontab each dat at 0:00 with the following script: #!/bin/bash SCHEDFILE=$HOME/todo/scheduled.txt TODOFILE=$HOME/todo/todo.txt # Look for all date types in scheduled for RAWDATE in $(egrep -o “^[a-zA-Z]*” $SCHEDFILE); do # Format date types for date DATESTR=” for str in $RAWDATE; do DATESTR+=”%$str”; done #…
-
Use a new ttf font in Fedora 17
First, find the dir you can put the font: $ grep dir /etc/fonts/fonts.conf . If it lists ~/.fonts , create the /home/username/.fonts dir Put the ttf file in the ~/.fonts directory < Rescan: $ fc-cache done.
-
Split an image into multiple images
1. Install imagemagick 2. $ convert originalimage.png -crop 100%x50% +repace output-page.png
-
Disable terminal window border in fallback mode
-edit- this only works for gnome with compiz $ ccsm go to window border type the following in ‘Decoration windows’: !(class=Gnome-terminal)
-
Force fallback for gnome 3
Do: $ dbus-launch gsettings set org.gnome.desktop.session session-name ‘gnome-fallback’
-
Opera better ctrl-tab (without pop-up)
Go to opera:config, search for ‘Window Cycle Type’, change to 2
-
Dropbox problem on Fedora 16, 64 bit, not responding
I had this: /home/karlo/.dropbox-dist/libz.so.1: version `ZLIB_1.2.3.3′ not found (required by /usr/lib64/libxml2.so.2) Failed to load module: /usr/lib64/gio/modules/libgvfsdbus.so And the icon did not show the sync-arrows. Disabling proxies worked for me. Right-click the db icon, settings, … you’ll find it.
-
Slow down fan speeds (less noise) on Fedora with Nouveau (default) driver
Add this to your commandline: nouveau.perflvl_wr=7777 Will allow you to change the fan speed. After a reboot, change fan speed by; # echo 40 > /sys/class/drm/card0/device/pwm0 I put the following in the root crontab to monitor temperature: * * * * * test `cat /sys/class/drm/card0/device/temp1_input` -gt 75000 && echo 100 > /sys/class/drm/card0/device/pwm0 || echo 10…
-
Multiple JPGs to one single PDF (Linux/Fedora)
Found here: http://blog.hacka.net/#post49 # yum install install ImageMagick pdftk $ cd jpgdir; for FILE in *.jpg; do convert $FILE -compress JPEG $FILE.pdf; done; pdftk “*.pdf” cat output allPages.pdf :)
-
Useful ‘command not found’ output for bash
Add this to your .bashrc: clippy() { echo “I see you’re trying to use the terminal …”; echo ” v “; echo ” ╭─╮”; echo ” ⌾ ⌾”; echo ” │▕│”; echo ” ╰─╯”; } function command_not_found_handle { clippy $1; } It will result in: $ adsf I see you’re trying to use the terminal…