Category Archives: Tips & Tricks

Simple pushtogit script

Create new file and add the next lines inside (for example

echo " ====================== running command from" $PWD
cd $PWD
git add .
echo -n " ====================== commit message: "
read message
git commit -m "$message"
git push -u origin master
echo " ====================== done..."

Save the changes and add the alias inside .bashrc

alias pushtogit="/home/USER/PATH/"

There is no suitable CSPRNG installed on your system

Some PHP packages may stop working after update with error message: “There is no suitable CSPRNG installed on your system”.

The reason for this that they stopped using OpenSSL and now they need access to /dev/urandom which isn’t readable by your PHP configuration.

To fix this problem, all you need to do is to add /dev/urandom to your open_base configuration which limits the files that can be accessed by PHP to the specified directory-tree (or trees).

In case you’re using php-fpm, add the “/dev/urandom” in existing php_admin_value[open_basedir] definition (or add this line if it doesn’t exist)

For example:

php_admin_value[open_basedir] = /var/www/html/domain.tld:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom

or if you’re using mod_fcgi, inside .php-fcgi-starter script add parameter

-d open_basedir="/var/www/html/domain.tld:....:/dev/urandom"

CentOS 6.x boot GRUB on software RAID /dev/md0

If you’ve just installed CentOS 6.x on software RAID and it won’t boot from /dev/md0, don’t worry. It can be fixed.

– Insert CentOS media/DVD and boot in rescue mode (select “Rescue mode” during boot)
– Select the “start shell” option
– chroot with

chroot /mnt/sysimage

– install GRUB into /dev/md0 with

grub-install /dev/md0

– enter exit and than reboot

The other option is to enter into rescue mode and inside grub shell type the next commands:

grub> device (hd0) /dev/sda
grub> device (hd1) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

Change hostname on Mint Linux / Ubuntu – Howto

To change your hostname, you’ll need to edit /etc/hostname file with

sudo nano /etc/hostname

The file content is very simple. It contains the current hostname and all you need to do is to replace it with the new one, save and exit

After you save the changes, open /etc/hosts file and replace the current hostname with the new one near IP address.


... old-hostname


... new-hostname

Save file and exit.

Now, enter the next command

sudo hostname new-hostname

Your computer’s hostname will be changed immediately. (The change won’t appear in the terminal until you reopen it again)

This method will work on all Debian based distros (Ubuntu, Kubuntu, ….)

Command line system information

If you’re not sure which components are installed in your server/pc, you can use inxi which is a command line system information script. It will show you the system hardware, CPU, drivers, Xorg, Desktop, Kernel, GCC version(s), Processes, RAM usage, and a wide variety of other useful information.

For example:

myPC@myPC ~ $ inxi -F
System:    Host: myPC Kernel: 3.19.0-32-generic x86_64 (64 bit) Desktop: Cinnamon 2.8.8
           Distro: Linux Mint 17.3 Rosa
Machine:   System: LENOVO product: 20E1000BSC v: ThinkPad W550s
           Mobo: LENOVO model: 20E1000BSC v: SDK0E50510 WIN Bios: LENOVO v: N11ET34W (1.10 ) date: 08/20/2015
CPU:       Dual core Intel Core i7-5600U (-HT-MCP-) cache: 4096 KB 
           clock speeds: max: 3200 MHz 1: 901 MHz 2: 981 MHz 3: 2195 MHz 4: 2199 MHz
Graphics:  Card-1: Intel Broadwell-U Integrated Graphics
           Card-2: NVIDIA GM108GLM [Quadro K620M]
           Display Server: X.Org 1.17.1 drivers: nvidia (unloaded: intel)
           Resolution: 1920x1080@59.9hz, 1920x1080@60.0hz
           GLX Renderer: Quadro K620M/PCIe/SSE2 GLX Version: 4.5.0 NVIDIA 352.63
Audio:     Card-1 Intel Wildcat Point-LP High Definition Audio Controller driver: snd_hda_intel
           Card-2 Intel Broadwell-U Audio Controller driver: snd_hda_intel
           Sound: Advanced Linux Sound Architecture v: k3.19.0-32-generic
Network:   Card-1: Intel Ethernet Connection (3) I218-LM driver: e1000e
           IF: eth0 state: up speed: 1000 Mbps duplex: full mac: 54:ee:75:cc:11:4a
           Card-2: Intel Wireless 7265 driver: iwlwifi
           IF: wlan0 state: up mac: 18:5e:0f:ee:f8:aa
Drives:    HDD Total Size: 768.2GB (17.1% used) ID-1: /dev/sda model: LITEON_LCH size: 512.1GB
           ID-2: /dev/sdb model: ADATA_SP600NS34 size: 256.1GB
Partition: ID-1: / size: 28G used: 9.4G (37%) fs: ext4 dev: /dev/sdb1
           ID-2: /home size: 195G used: 60G (33%) fs: ext4 dev: /dev/sdb3
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 50.0C mobo: N/A gpu: 48C
           Fan Speeds (in rpm): cpu: 2466
Info:      Processes: 229 Uptime: 1:09 Memory: 2341.5/15748.3MB Client: Shell (bash) inxi: 2.2.28

Fix “Failed To Fetch” Apt error Howto

Google announced plans to discontinue 32-bit Google Chrome for Linux and it has. On some 64bit Ubuntu based systems (Mint/Kubuntu/Xubuntu,..), during update process you may notice the next error:

“Failed to fetch Unable to find expected entry ‘main/binary-i386/Packages’ in Release file (Wrong sources.list entry or malformed file)”

To fix this error you’ll need to make some changes in google-chrome.list

Open /etc/apt/sources.list.d/google-chrome.list file and add [arch=amd64] before “http”

deb [arch=amd64] stable main

Do not edit or replace any other text in this file. Save the changes and refresh your package list with

sudo apt-get update

The “failed to fetch” APT error should no longer appear

CentOS PPTP client Howto

The Point-to-Point Tunneling Protocol (PPTP) is a method for implementing virtual private networks. Since it is marked as non secure and vulnerable, I don’t recommend it as a “final” VPN solution. The main reason for its popularity is probably the native MS Windows support (since win 95). Also, it can be easily implemented with Mikrotik RouterOS (like I said, use it for internal VPNs only).

To set up your CentOS box as a PPTP clients you’ll need the pptp package.

yum -y pptp

Open /etc/ppp/chap-secrets and add the next line (at the end). Also, replace the userName and password with the correct details:

userName PPTP password *

Create profile file

nano /etc/ppp/peers/myVPN

and paste the next content (replace IP_OR_HOSTNAME with PPTP server IP or hostname)

pty "pptp IP_OR_HOSTNAME --nolaunchpppd"
name userName
remotename PPTP
file /etc/ppp/options.pptp
ipparam myVPN

save the file and test the connection with

pppd call myVPN

ifconfig should return something like

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:  P-t-P:  Mask:
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:2192 (2.1 KiB)  TX bytes:631 (631.0 b)

also in /var/log/messages you should see something like

Jul 20 10:58:50 mysrv pppd[9352]: pppd 2.4.5 started by root, uid 0
Jul 20 10:58:50 mysrv pppd[9352]: Using interface ppp0
Jul 20 10:58:50 mysrv pppd[9352]: Connect: ppp0 <--> /dev/pts/1
Jul 20 10:58:50 mysrv pptp[9353]: anon log[main:pptp.c:314]: The synchronous pptp option is NOT activated
Jul 20 10:58:50 mysrv pptp[9361]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 1 'Start-Control-Connection-Request'
Jul 20 10:58:50 mysrv pptp[9361]: anon log[ctrlp_disp:pptp_ctrl.c:739]: Received Start Control Connection Reply
Jul 20 10:58:50 mysrv pptp[9361]: anon log[ctrlp_disp:pptp_ctrl.c:773]: Client connection established.
Jul 20 10:58:51 mysrv pptp[9361]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 7 'Outgoing-Call-Request'
Jul 20 10:58:51 mysrv pptp[9361]: anon log[ctrlp_disp:pptp_ctrl.c:858]: Received Outgoing Call Reply.
Jul 20 10:58:51 mysrv pptp[9361]: anon log[ctrlp_disp:pptp_ctrl.c:897]: Outgoing call established (call ID 0, peer's call ID 716).
Jul 20 10:58:51 mysrv pppd[9352]: CHAP authentication succeeded
Jul 20 10:58:51 mysrv pppd[9352]: MPPE 128-bit stateless compression enabled
Jul 20 10:58:51 mysrv pppd[9352]: local  IP address
Jul 20 10:58:51 mysrv pppd[9352]: remote IP address
Jul 20 10:59:51 mysrv pptp[9361]: anon log[logecho:pptp_ctrl.c:677]: Echo Reply received.

If you check your routes, you’ll probably notice that ppp0 connection is not used by any route(s). This is default behavior and you can easily switch/add default route with:

route add default dev ppp0

In my case, I don’t want to route the complete traffic (this VPN is just for management) so I’ll add only one static route

route add -net dev ppp0

To start this connection on boot, add “pppd call myVPN” in rc.local.

HP B110i, B120i and B320i RAID controller – howto

The RAID functionality for the B120i and B320i controllers in the “e” series ProLiant servers is provided by a software driver (FakeRAID). The driver for these RAID controllers is available in binary form on HP site (Currently only for RHEL and SLES). CentOS users (of course) should download RHEL driver but in this case, do not expect support from HP.

Without drivers, the disks won’t be seen as a parts of RAID array.

Option 1 – disable controller / don’t use it

For systems with the B320i SAS controller

  • Boot the server into System Options
  • Navigate to HP Smart Array B320i Raid Configuration
  • Change to DISABLED

For systems with the B120i SATA controller

  • Boot the server into System Options
  • Navigate to SATA Controller Options -> Embedded SATA Configuration

Option 2 – install drivers

  1. Click here to download RHEL 6.x driver
  2. In “Software – Driver Update” section you’ll see the latest update (hpvsa-1.2.12-110.rhel6u6.x86_64.dd.gz). Download the file, extract into FAT32 formatted USB drive
  3. Boot Centos 6 from DVD (or how ever you want)
  4. On the main installation menu, plug in the USB drive. Press “ESC” to manually boot
  5. At that “boot” prompt enter the following command: linux dd blacklist=ahci
  6. Hit ENTER and select Yes for driver option. Select the USB drive, select the driver disk image and select OK.
  7. Continue with the OS installation


Samsung printer on Linux – rastertosplc – No such file or directory

If you try to install Samsung printer (in my case ML1675) on Ubuntu 14.04 or Mint 17, you’ll may have some problems with missing file – rastertosplc.

If you added printer via web (http://localhost:631/) or via printer wizard, delete installed printer and follow the next instructions

Download drivers from this page:, extract them and install drivers with:

sudo ./

(follow the wizard to complete process)

cd into /usr/lib/cups/filter and check the existence of rastertosplc file.

If this file doesn’t exist add symbolic link to /opt/smfp-common/printer/bin/rastertospl with

sudo ln -s /opt/smfp-common/printer/bin/rastertospl rastertosplc

after you should have something like

bla@bla-178 /usr/lib/cups/filter $ ls -la
lrwxrwxrwx  1 root root     40 Aug 23 13:39 rastertospl -&gt; /opt/smfp-common/printer/bin/rastertospl
lrwxrwxrwx  1 root root     40 Aug 23 13:51 rastertosplc -&gt; /opt/smfp-common/printer/bin/rastertospl

The first file is probably created via install script while the second one is “fix” to “File “/usr/lib/cups/filter/rastertosplc” not available: No such file or directory” problem.

After you did this, add printer via wizard and try to print test page.