Year: 2015
-
Automate key and mouse events in Linux (xev/xdotool)
If you need to automate a GUI app, like you would script a CLI app with expect, use xdotool. It should be in your repo. What you can do for example: ( gedit & ) ; sleep 1; for key in H e l l o Return W o r l d ; do xdotool…
-
Better less
Via reddit: -R allows ANSI colors (and other ANSI features) -S allows horizontal scrolling (I don’t use this one with query-logs though) -X Leaves the output on the screen after exiting. I mostly use this one out of habit, since I use less as a pager in the CLI mysql program -M More detailed status…
-
*nix shorter/better commands (grep/wc/cat) from Useless Use of Cat Award
From http://www.smallo.ruhr.de/award.html , dome things to improve in your (and my) scripts ;). Anything that looks like something | grep ‘..*’ | wc -l can usually be rewritten like something along the lines of something | grep -c . # Notice that . is better than ‘..*’ or even (if all we want to do…
-
Regenerate grub2
Note to self; if I have changed /etc/sysconfig/grub, then run grub2-mkconfig -o /boot/grub2/grub.cfg For uefi: grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
-
No memory reserved for crash kernel
“No memory reserved for crash kernel” on RH7 Increase RAM to 2GB+. Also make sure crashkernel=auto is set in your cmdline.
-
FIX error: ‘unixd_config’ undeclared when building apache module
src/xradius_cache.c: In function ‘xrad_cache_dbm_post_config’: src/xradius_cache.c:146:22: error: ‘unixd_config’ undeclared (first use in this function) chown(path1, unixd_config.user_id, -1); ^ src/xradius_cache.c:146:22: note: each undeclared identifier is reported only once for each function it appears in src/xradius_cache.c: In function ‘xrad_cache_dbm_check’: src/xradius_cache.c:200:22: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘apr_size_t’ [-Wformat=] dbmval.dsize); Solution is…
-
FIX misc.py:732:_decompress_chunked:MiscError: xz compression not available
(happened in reposync) Either install pyliblzma via yum or do it yourself: easy_install pip pip install –upgrade pip pip install pyliblzma If the latest install does not work, install gcc and python-devel (and maybe @Development tools).
-
Fix rpm/yum database (BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery)
$ sudo yum update error: rpmdb: BDB0113 Thread/process 11565/140378074454016 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 – (-30973) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open failed Fix by doing: rpm –rebuilddb
-
RHEL not respecting oddjob mkhomedir umask from login defs
Solution: delete the -u definitions from /etc/oddjobd.conf.d/oddjobd-mkhomedir.conf and oddjobd will use the umask from /etc/login.defs . I feel this should be default.
-
Make FreeRADIUS talk to FreeIPA / RHEL IDM
This was a challenge. So it turns out FreeIPA talks ldap out of the box. I wanted to authenticate against FreeIPA using FreeRADIUS. I am thankful to Arran Cudbard-Bell which helped me figure out some of these things in the (very active) FreeRADIUS mailing list. This will not be a nice step by step post,…
-
NTPq -p output signs before hosts
β β β No state indicated for: non-communicating remote machines, βLOCALβ for this local host, (unutilised) high stratum servers, remote machines that are themselves using this host as their synchronisation reference; βxβ β Out of tolerance, do not use (discarded by intersection algorithm); β-β β Out of tolerance, do not use (discarded by the cluster…
-
Fix RedHat IDM server problems
I was seeing this: “/var/run/slapd-*socket”}, 110) = -1 ENOENT” Unable to get connection, skipping disabling agreements: Unable to bind to LDAP server: [Errno 2] No such file or directory “Server error – while fetching master key K/M for realm After debugging, stracing, traffic dumping and generating a selinux module, the module indicated: #============= dirsrv_t ==============…
-
Rsyslog syntax error on token ‘regex’ / ‘ereregex’
Use re_match. http://www.rsyslog.com/doc/master/rainerscript/functions.html?highlight=re_match if ( $fromhost-ip startswith ‘10.0.0’ and re_match($hostname,’.*-fw[0-9]’) ) then action(type=”omfile” file=”/tmp/test.log”)
-
Postgres install on RHEL7
Install postgresql-server, do postgresql-setup initdb, change listen address in /var/lib/pgsql/data/postgresql.conf, change ident methods in /var/lib/pgsql/data/pg_hba.conf, systemctl start postgresql, ^start^enable. CREATE USER unam PASSWORD ‘123’; CREATE SCHEMA unamschema AUTHORIZATION unam; CREATE DATABASE unamdb OWNER=unam;
-
RHEL replace rsyslog with rsyslog7 without clearing dependencies
You want to install rsyslog7 but you get: Error: rsyslog7 conflicts with rsyslog-5.8.10-10.el6_6.x86_64 So you choose to erase/remove rsyslog first, but this removes: cronie, cronie-anacron, crontabs, redhat-lsb, redhat-lsb-compat, redhat-lsb-core, redhat-lsb-graphics, redhat-lsb-printing, rsyslog-relp, sysstat The solution is to use yum shell (EDIT: OR USE YUM SWAP) # yum shell Loaded plugins: security Setting up Yum Shell…
-
Grep color matched lines but show all
tail -f /var/log/messages | grep -E –line-buffered –color ‘.*kernel.*|$’ This will show all lines from the tail, with lines having ‘kernel’ in them colored.
-
View swap rates Linux/vm
Use vmstat . Also try vmstat -f to see # of forks (interesting). Use -w to make the output more wide.