Author: karlo
-
Delete old yum/rpm packages from repository (reposync)
repomanage -k2 –old /data/repo/data/el-6-epel | xargs rm -f
-
[Fix] KS RHEL minimal (no base)
Not documented in the kickstart docs I use: https://fedoraproject.org/wiki/Anaconda/Kickstart , the way to do a minimal (core/nobase) install: %packages –nobase @core @server-policy %end
-
[Fix] NFS directories mounted as ‘nobody’ user
My nsf shares were mounted as ‘nobody. In /etc/idmap.conf the [Translation] Method= nsswitch, so that is not the problem. Solution is to do “nfsidmap -c” on the box where the share is mounted. And make sure the uid/gid’s are the same (use ldap or something).
-
Failed to find module vboxdrv/vboxnetflt/vboxnetadp
Problem: Dec 6 09:09:19 kahuna-karlo systemd-modules-load[8745]: Failed to find module ‘vboxdrv’ Dec 6 09:09:19 kahuna-karlo systemd-modules-load[8745]: Failed to find module ‘vboxnetflt’ Dec 6 09:09:19 kahuna-karlo systemd-modules-load[8745]: Failed to find module ‘vboxnetadp’ Solution: yum install kernel-devel gcc dkms akmod-VirtualBox syslog: Dec 6 09:10:31 kahuna-karlo systemd[1]: Starting Load Kernel Modules… Dec 6 09:10:31 kahuna-karlo kernel: [ 1877.376766]…
-
[HOWTO] Copy and paste in tmux (complete HOWTO)
I often forget this (because I don’t use copy/paste a lot in tmux), so this is a reminder for me: Go to the pane from where you want to copy Prefix [ Navigate to beginning of copy part, press space Navigate to end of copy part, press enter Text is now in buffer. Paste by…
-
[FIX] The GPG keys listed for the “*” repository are already installed but they are not correct for this package.
I got: Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release The GPG keys listed for the “RHEL6 Server” repository are already installed but they are not correct for this package. Check that the correct key URLs are configured for this repository. Fix: Run the update command with -v. You will get the same output, but before the error, you…
-
[FIX] Clean up old puppet reports and reclaim mysql space (ibdata)
MySQL for puppet dashboard gets BIG. You can make this smaller by deleting old records. Source for this article is here. To get the size in GB of the dashboard: # mysql -uroot -ppassword > SELECT CONCAT ( ROUND( ( ( SUM(DATA_LENGTH)+SUM(INDEX_LENGTH) ) / 1024 / 1024 / 1024 ) ,2 ), ” GB”) as…
-
[FIX] Could not allocate requested partitions: requested size exceeds maximum allowed
I got “Could not allocate requested partitions: requested size exceeds maximum allowed” while installing RHEL on a SAN. Linux seems to be having a max partition size of 2.2TB (2TB). Fix: Stop partitioning, click ‘back’ Go to a text terminal (alt-f2) Find the device you want to put a 2GB+ system on: ls -al /dev/mapper/…
-
[FIX] vfs unable to mount root fs unknown-block
A RHEL update today fucked up a RHEL system, giving: “vfs unable to mount root fs unknown-block”. Fix: Boot from RHEL CD Choose rescue mode Start (with network) Type: chroot /mnt/sysimage (to work in the actual disk) Go and remove the oldest kernel, find oldest kernel by typing `rpm -q kernel` Remove by doing: `rpm…
-
Linux java control panel binary location
I sometimes need the java control panel. It is not named like the other java programs (java javac javadoc javah javap javaws), that is why I sometimes can’t find it. The java control panel for Linux is called ‘jcontrol’ and can be found in (/usr)/bin/jcontrol. Now you can set java proxy settings in linux and…
-
FIX: RHEL Vbox/Virtualbox extension pack install fail
I got this on my laptop: Progress state: NS_ERROR_FAILURE VBoxManage: error: Failed to install “/home/klu/tmp/Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack” VBoxManage: error: The installer failed with exit code 127: Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty’): No such device or address VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ExtPackManager, interface IExtPackManager VBoxManage: error:…
-
Bash get full path of file
Get the full path of a file via: $ readlink -f ./file Tip: make an alias: alias fullpath=’readlink -f’
-
Fix Error mounting: $MFTMirr does not match $MFT (record 0).
While transferring 200k files to my USB HDD, it stopped and when remounting the disk, I got: Error mounting /dev/sdj1 at /run/media/karlo/WD: Command-line `mount -t “ntfs” -o “uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177” “/dev/sdj1” “/run/media/karlo/WD”‘ exited with non-zero exit status 13: $MFTMirr does not match $MFT (record 0). Failed to mount ‘/dev/sdj1’: Input/output error NTFS is either inconsistent, or there…
-
Dell Linux Dock display switcher script
This might be helpful for someone. A quick script I made for changing output modes on my Dell laptop. There are different configurations. laptop: laptop screen only vga: vga output + laptop screen mix: hdmi + vga output, laptop screen off dock: dell dock display setup #!/bin/bash LAPTOP=’LVDS-1′ DOCKLEFT=’DP-2′ DOCKRIGHT=’DP-1′ VGA=’VGA-1′ HDMI=’HDMI-1′ case $1 in…
-
Openssl encrypt & decrypt files
Encrypt: openssl enc -aes-256-cbc -a -salt -in plain.txt -out encrypted.enc Decrypt: openssl enc -d -aes-256-cbc -a -in encrypted.enc -out plain.txt Functions: #!/bin/bash function encrypt() { openssl enc -aes-256-cbc -a -salt -in $1 -out ${1}.enc ; stat $_ ; } function decrypt() { openssl enc -d -aes-256-cbc -a -in $1 -out $( echo $1 | sed…
-
Bash: SSL x509 check enddate / expiration time of certificate with openssl
You can check the endtime/end time/notafter/expiration date of a site by doing this: openssl s_client -connect google.com:443 2>/dev/null
-
Fix “auxpropfunc error invalid parameter supplied” on RHEL6
Delete package cyrus-sasl-ldap after verifying you don’t need SASL/LDAP on your machine. See https://bugzilla.redhat.com/show_bug.cgi?id=167300 .
-
Linux sync process
$ watch -n 5 grep Dirty /proc/meminfo Gives you the amount of unsync’ed memory every 5 seconds.
-
Script: Puppet module create template
Adjust to your needs ;) #!/bin/bash # Create puppet module layout if [[ -z “$1” ]];then echo “$0 modulename” exit 1 fi if [[ -d $1 ]]; then echo “Dir already exists” exit 1 fi # Actual work M=$1 mkdir -p \ $M \ $M/files \ $M/manifests \ $M/templates # Files cat $M/manifests/${file}.pp done #…
-
FIX has missing requires of
From here.: yum check dependencies \ | grep ‘has missing requires’ \ | sed ‘s/.\+has missing requires of //’ \ | sed ‘s/ [=].\+//’ \ | while read dep; do yum -y install “$dep”; done
-
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.