Wednesday, October 22, 2014

How to set persistent power governor at boot time

What is power governor?
Power governor in Linux plays the same role as power plan in Windows.
It's used to control power frequency, heat emmision, battery usage.

First, install cpufrequtils

sudo apt-get install cpufrequtils

Check the list of available governors

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

Using your favorite editor create or edit following file (as superuser)

/etc/default/cpufrequtils

Update or add following line
GOVERNOR="conservative"


Reboot system

sudo reboot



Check enabled governor

sudo cpufreq-info | grep T

Common governors

Performance - highest cpu frequency, short battery, more heat
Powersave - lowest cpu frequency, save battery, less heat

Ondemand - will act as performace during high cpu usage and as powersave otherwise.
Conservative - similar to ondemand, but changes are fluent.

Done.

Tuesday, October 21, 2014

Mirror LVM logical volume using only two physical volumes

Task: Mirror LVM logical volume using only two physical volumes

Mirroring: All changes made to logical volume are synchronized across underlying physical volumes.

Suppose you have a volume data (1GB) in group test and you mant to mirror it to improve reliability. You will need at least one physical volume in the same group (test) of the same size or larger.

It's not recommended to place mirrored physical volumes on same physical drive because of two reasons:

  1. In case of disk failure - you will not be able to recover data. Simply you will lose both copies of data.
  2. To copy data between partitions on hard disk, head will need to move between two regions of HDD, that will reduce disk lifetime, increase and slow down write process. 

Prepearation:

  1. Add another physical volume to group test. Volume should be located on another physical drive and should have size of volume data or greater (1GB).
  2. Add physical volume to volume group test

Now we just tell LVM that it should persist data on 2 volumes (we want 1 additional copy of data), and no mirroring log. LVM will start to synchronize data between physical volumes in background.

sudo lvconvert -v -m 1 /dev/test/data --corelog

without --corelog mirroring would use at least 3 partitions (one additional partition for mirrorlog)

To disable mirroring:
sudo lvconvert -v -m 0 /dev/test/data

LVM will leave only one copy of data.

Thursday, October 16, 2014

How to install Flash Player on Debian with Chromium

Chrome vs Chromium

To verify if flash is installed, check following link.

chrome://flash/

Chrome has built-in flash. Chromium users need to install package pepperflashplugin.

Chromium browser does not contain any flash plugin. Adobe does not support this browser.
But don't worry - there's one trick. We can take flash plugin from Chrome and install it in Chromium.
There's one package called pepperflash which does it for you.
It will download Chrome, extract flash plugin and will install it into Chromium.

Step 1: Install pepperflash package


sudo dpkg -i pepperflashplugin-nonfree_1.8.1_amd64.deb 

or just open it with GDebi installer


Step 2: Update pepperflash

Optionally you can update plugin...

sudo update-pepperflashplugin-nonfree --install


Step 3: Check installation status

sudo update-pepperflashplugin-nonfree --status

Flash Player version installed on this system  : 16.0.0.257
Flash Player version available on upstream site: 16.0.0.257



To verify installation restart browser (mandatory), and type again chrome://flash/

You should see a line with version and binary location:
Flash plugin15.0.0.189 /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so


Troubleshooting

If chrome://flash/ says that flash is not installed, don't panic. It's quite possible that your chromium process didn't stop. Even if you don't see window, sometimes chrome process is still there. 
Just reboot your machine or logout and login again (on my machine this worked perfectly).

Other browsers

Adobe has stopped to support linux at version 11.2 (current version is >= 15).
However non-chrome/chromium browser users are still able to download this version from http://get.adobe.com/flashplayer


Monday, October 13, 2014

How to install skype on 64-bit Debian

How to install skype on 64-bit Debian

Step 1. Download latest deb file from skype.com

http://download.skype.com/linux/skype-debian_4.3.0.37-1_i386.deb

Step 2. Install i386 architecture

Skype provides only package which is 32-bit, we must enable i386 architecture support
In terminal type:
sudo dpkg --add-architecture i386
sudo apt-get update

Step 3. Install downloaded package
Install downloaded package (it's important to do this after adding i386 architecture)
sudo dpkg -i skype-debian_4.3.0.37-1_i386.deb 
installation will warn that system lacks i386 dependencies

dpkg: dependency problems prevent configuration of skype:
 skype depends on libc6 (>= 2.3.6-6~).
 skype depends on libc6 (>= 2.7).
 skype depends on libgcc1 (>= 1:4.1.1).
 skype depends on libqt4-dbus (>= 4:4.5.3).
 skype depends on libqt4-network (>= 4:4.8.0).
 skype depends on libqt4-xml (>= 4:4.5.3).
 skype depends on libqtcore4 (>= 4:4.7.0~beta1).
 skype depends on libqtgui4 (>= 4:4.8.0).
 skype depends on libqtwebkit4 (>= 2.1.0~2011week13).
 skype depends on libstdc++6 (>= 4.2.1).
 skype depends on libx11-6.
 skype depends on libxext6.
 skype depends on libxss1.
 skype depends on libxv1.
 skype depends on libssl1.0.0.
 skype depends on libpulse0.
 skype depends on libasound2-plugins.


Step 4. Install missing dependencies

sudo apt-get -f install
System will install missing i386 dependencies.

Your skype is ready to use.

Note: If you still get dependency problems, please make sure that you install package after adding i386 arch.


Sunday, August 3, 2014

How to restore LVM snapshot

How to restore LVM snapshot

list of logical volumes (find your snapshot)
# sudo lvscan 

output:
  ACTIVE   Original '/dev/debian-group/main' [50.00 GiB] inherit
  ACTIVE   Snapshot '/dev/debian-group/backup01' [50.16 GiB] inherit

/dev/debian-group/backup01 is a snapshot of /dev/debian-group/main

merge lvm snapshot with source partition
# sudo lvconvert --main /dev/debian-group/backup01

if your source partition is in use,then changes will be applied on next reboot or next mount of source partition.

Add shortcut debian / gnome 3


to create shortcut:

# gnome-desktop-item-edit ~/.local/share/applications --create-new

to install gnome-desktop-item-edit:

# sudo apt-get install --no-install-recommends gnome-panel


Saturday, August 2, 2014

Create LVM snapshot

How to create LVM snapshot

check volume names:


  • either launch logical volume management, or...

select logical volume you want to snapshot

possibly you will want to load dm-snapshot kernel module:

# sudo modprobe dm-snapshot uname -a (check kernel version) 

dont use start name with snapshot (try my-snapshot01)