Author: karlo
-
Kobo on Linux, skip installation
Activate: Find the hidden .kobo dir after attaching the kobo to your pc/laptop Install sqlite3 sqlite3 KoboReader.sqlite INSERT INTO “user” VALUES(‘aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa’,’aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa’,’xxxx@xxxx.xx’,’xxxx@xxxx.xx’,’2aaaa aaaaaaaaaaaaa==’,NULL,NULL); sqlite> .exit Add dictionaries: http://www.mobileread.com/forums/showthread.php?t=196931
-
Nagios, nrpe and selinux policies (audit)
Selinux seems to “dontaudit” logs by default. This means that when selinux is permissive, your plugins will work, and when you setenforce 1 your server, plugins fail. This all happens without warnings. If you see this happening: Disable dontaudit: semodule -DB See avc entries filling up audit.log, pipe through audit2allow. Enable again: semodule -B
-
Bash percentage calculate snippet
MEMLINE=$( tac $MGRBASE/$REL_LOGLOC/server.status.log | egrep -m1 ‘\*\*.*Memory Status:’ ) USED=$( echo “$MEMLINE” | egrep -o ‘[0-9\.,]+ MB Used’ | sed ‘s/\..*//;s/,//’ ) MAX=$( echo “$MEMLINE” | egrep -o ‘[0-9\.,]+ MB Max’ | sed ‘s/\..*//;s/,//’ ) PERC=$( printf “%.0f” $(echo “scale=2;($USED/$MAX)*100″ | bc) ) if [[ $PERC -gt $MEM_CRIT_PERC ]]; then ERRORS=”$ERRORS memory ${PERC}%” elif [[…
-
Bash file age check snippet
if [[ -f $BACKUP_LOCKFILE ]]; then #Check age if [[ $(( $( date +%s ) – $(stat -c %Y $BACKUP_LOCKFILE ) )) -gt $BACKUP_MAXLENGTH_SECS ]]; then echo “Backup takes too long” else echo “Doing backup” fi fi
-
Changing default browser in Fedora
Open gnome-control-center, go to system, details, default applications
-
Systemctl for nfs: Failed to issue method call: No such file or directory
systemctl enable nfs Failed to issue method call: No such file or directory Solution: use nfs-server .
-
Generate crypted salted password (for kickstart / shadow file)
python -c ‘import crypt; print(crypt.crypt(“Karlo”, “$6$SaltHere”))’ If your output ends with a dot, copy that as well.
-
Fix Timeout in locking authority file */.Xauthority
When logging in (via SSH) to one of my systems, it said: timeout in locking authority file */.Xauthority When this happens: Make sure the users’ home dir is readable + writeable by the user Make sure the SELinux context is set correctly; this is usually a problem when the users’ home dir is mounted on…
-
Sestatus selinux config not read on RHEL/CentOS
If you want to change the selinux config, be aware that there are two files: /etc/selinux/config /etc/sysconfig/selinux The second one should be a symlink to the first one but I found out that this is not always the case.
-
Disable lid suspeld linux (no gnome)
edit /etc/systemd/logind.conf set HandleLidSwitch=ignore via http://revryl.com/2013/05/16/how-to-disable-auto-suspend-when-laptop-lid-is-closed-in-fedora-1817/
-
No space left on device on Rhel, Centos, Linux – though space is free
I got the error “No space left on device” when doing mkdir. Steps to fix: Is there still space (yes in my case); df -h /data/ Are there still inodes (yes in my case); df -i /data/ File system might be corrupted. Fsck fixed it for me (xfs equivalent xfs_repair /dev/mapper/rhel-data
-
Install RHEL7 using VNC
Start using CD, tab at the install menu, add “inst.vnc inst.vncpassword=kluinst” and it will do a vnc install.
-
Fix requested NFS version or transport protocol is not supported
I got this on RHEL 6: requested NFS version or transport protocol is not supported Restarting the NFS daemon fixed this. Guess some libraries were updated. Haven’t taken the time to investigate further, maybe if the problem shows up more often… ;)
-
YouCompleteMe for Vim required dependencies
For https://valloric.github.io/YouCompleteMe/ you will need (on Fedora) to: cd .vim/bundle git clone https://github.com/Valloric/YouCompleteMe cd YouCompleteMe git submodule update –init –recursive sudo yum install cmake gcc-c++ python-libs python-devel ./install.sh
-
Set hostname RHEL7
Setting hostname via /etc/sysconfig/network does not seem to work anymore. Instead use hostnamectl set-hostname hostname.domain.
-
RHEL7 ifconfig gone! halp!
It is gone, and that is a Good Thing. See my post from 2011: http://karloluiten.nl/deprecated-linux-networking-commands-and-their-replacements/
-
[Fix] Gmail smime.p7m and tnef open mail (with winmail.dat)
Outlook and gmail do not always work together. If a someone sends you a mail from outlook using Rich Text, and has s/mime enabled, the mail will show in gmail as an empty mail with just a smime.p7s or smime.p7m attachment. This can be fixed on a Linux box: Save the smime.p7m/p7s file Rename to…
-
[Fix] Open a winmail.dat file (TNEF)
$ yum install tnef $ tnef –save-body=body –unix-paths winmail.dat $ oowriter body.rtf
-
Check modulus of ssl key and certificate to see if they match
Use these commands to see if a private key matches a server’s certificate: # openssl rsa -noout -modulus -in server.key # openssl x509 -noout -modulus -in server.crt If the modulus us the same, you can use them.
-
Validating kickstart files (ks) for Fedora/Rhel
If you want to validate your kickstart files, install pykickstart. It comes with /usr/bin/ksvalidator which gives info on what is wrong with your kickstart files (syntax et cetera).
-
[Fix] Cifs block device is write protected, mounting read-only
If you only have samba libs, and not cifs-utils installed, you will get: mount: block device //10.0.64.60/linux is write-protected, mounting read-only mount: cannot mount block device //10.0.64.60/linux read-only So install cifs-utils ;). Also make sure you do not have special characters in your username and password. CIFS really does not like backslashes. Remove the last…
-
[FIX] tcpdump: non-network bits set in “1.2.3.4/24
Use the lowest IP of the range, ergo: # tcpdump net 1.2.3.0/24 # tcpdump net 10.0.0.0/8 not .1 at the and.
-
End vim macro in insert mode
Start recording macro (i normaly use qq) Do commands, end in insert mode Ctrl-o q Macro is now ended and saved in insert mode
-
Chrony status command (ntpq -p alternative)
$ chronyc sources 210 Number of sources = 4 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^+ arethusa.tweakers.net 2 10 377 22m -574us[ -574us] +/- 27ms ^* ntp0.mediamatic.nl 2 10 377 22m -946us[-1032us] +/- 32ms ^- dns02.wsrs.net 2 9 377 192 -54ms[ -54ms] +/- 91ms ^+ hosting01.spk.rickes.nl 2 10 377 22m -1834us[-1834us]…
-
Cron headers unix / linux
Compact: #.—————- min (0-59) #| .————- hr (0-23) #| | .———- dom (1-31) #| | | .——- mon (1-12) #| | | | .—- dow (0-7|mon-sun0) #| | | | | Wide:
-
Howto: vmware resize disk (lvm/ext4)
Very short version: echo 1 > /sys/class/scsi_disk/2\:0\:0\:0/device/rescan Resize disk in vmware fdisk /dev/sda2 p, d, 2, n, p, 2 , 258, t, 2, 8e, w reboot/rescan pvresize /dev/sda2 lvextend -l +100%FREE /dev/mapper/VG-lv_data df -h && echo “Be happy” Using parted: resize disk, reboot parted, p (should give larger disk, remember partition start for lvm part)…