среда, 29 июля 2015 г.

FreeBSD guest hangs in KVM

   Recently I find the problem when FreeBSD guest in KVM environment was hanging during reboot from console. After googling and tying to understand this problem, I found, that problem was only with freebsd systems which had more than one virtual cpu.  The reason was enabled option in kvm_intel module.
   In my example my host system was ubuntu 14.04 and guest system was freebsd with 2 virtual cpu. Parameter you should change is shown below:

 ~ $ cat /sys/module/kvm_intel/parameters/enable_apicv   
 Y  

It should be - N.

You can do it by adding appropriate command in modules configuration file, for exmaple in /etc/modprobe.d. You can't do it "on the fly" because this module are used constantly and changes for this module locked.

вторник, 28 июля 2015 г.

Elementary OS: Do nothing when close lid

This script is small handy solution for disabling close lid action, my code is not so pretty but it's working, you can just copy and paste it.

Script: Lid-action.sh

 #!/bin/bash  
 grep "HandleLidSwitch" /etc/systemd/logind.conf | grep ignore >/dev/null 2>&1  
 if [ $? -eq 0 ]; then  
     sed -i 's/HandleLidSwitch=ignore/HandleLidSwitch=suspend/' /etc/systemd/logind.conf && restart systemd-logind >/dev/null 2>&1; echo "Suspending enabled"   
 else  
     sed -i 's/HandleLidSwitch=suspend/HandleLidSwitch=ignore/' /etc/systemd/logind.conf && restart systemd-logind >/dev/null 2>&1; echo "Suspending disabled" 
 fi  


Add permissions to launch with sudo without password:

 maugli@calipso:~$ sudo cat /etc/sudoers | grep maugli  
 maugli ALL=(root) NOPASSWD: /home/maugli/lid-action.sh  


Don't forget to use visudo when're changing sudoers file.

Runnning script:

 sudo /home/maugli/lid-action.sh  

понедельник, 27 июля 2015 г.

Simple rsync launch

   This is first article in my new cycle "Copy, Paste and Use". This series of articles will consist of the configuration files or several commands that can be copied and pasted into your console and this will work.
   First article is about rsync, when you need to sync some files from remote system, you can use rsync server on the remote system site, and rsync command on the client side, also don't forget to open apropriate ports on your firewall.

Rsync server configuration file:

# /etc/rsyncd.conf

# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help

# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
use chroot = yes
read only = yes

# Simple example for enabling your own local rsync server
[root]
    path = /
    comment = My Rsync Server
    uid = root
    gid = root
    hosts allow = IP addresses of allowed hosts

Launch configured server:

rsync --daemon --address=Bind_to_address --config=/etc/rsyncd.conf

Client side:

rsync -avh --progress rsync://Rsync_server_address/root/source_directory /destintaion/directory

On client site you also can limit bandwith and enable compression, but this is another story.