Compile and install kfilebox 0.4.10 on Debian Jessie

If you using Dropbox client and you would like full system tray integration unfortunately you can not install a package that will work without issues with latest versions of dropbox client.

Solution is to download, compile and install kfilebox from source, but since kfilebox is unmaintained for long time I found this fixed version on github page: https://github.com/gtgt/kfilebox. Continue reading “Compile and install kfilebox 0.4.10 on Debian Jessie”

Fix failed to fetch Google Chrome packages under Debian

Google decided to drop 32bit support for Chrome lately my Debian Jessie is giving me following errors when doing apt-get update

W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file)

To fix the issue you need to edit following file: /etc/apt/sources.list.d/google-chrome.list and change the line:

deb http://dl.google.com/linux/chrome/deb/ stable main

to

deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

Save your file and do normal apt-get update.

It seems that the change in google-chrome.list gets overwritten somehow, so I recommend you to set read only permissions on the file with:

chmod 444 /etc/apt/sources.list.d/google-chrome.list

Remember just next time if you need to modify this file to add write permissions back.

Remove SCSI faulty spare hdd from RAID with mdadm

I manage a lot of servers with simple software RAID1 configuration. One of the disks started to fail notably on partition sdb8, so I had to set all other partitions to failed status before removing and replacing the disk:

mdadm --manage /dev/md0 --fail /dev/sdb5
mdadm --manage /dev/md3 --fail /dev/sdb7
mdadm --manage /dev/md1 --fail /dev/sdb6

After this my /proc/mdstat looked like this:

cat /proc/mdstat
Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md2 : active raid1 sdb8[1](F) sda8[0]
 284019576 blocks super 1.0 [2/1] [U_]
 bitmap: 3/3 pages [12KB], 65536KB chunk

md0 : active raid1 sda5[0] sdb5[1](F)
 528372 blocks super 1.0 [2/1] [U_]
 bitmap: 0/1 pages [0KB], 65536KB chunk

md3 : active raid1 sda7[0] sdb7[1](F)
 4200436 blocks super 1.0 [2/1] [U_]
 bitmap: 0/1 pages [0KB], 65536KB chunk

md1 : active raid1 sda6[0] sdb6[1](F)
 4199412 blocks super 1.0 [2/1] [U_]
 bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>

Continue reading “Remove SCSI faulty spare hdd from RAID with mdadm”

Find files in sub-directories and unpack them in place

I have a lot of zip and rar archives in various sub-directories, which I wanted to extract but to leave the files in their sub-directories.

I have used for a long time this command to search for files and extract them in working directory:

find ./ -iname "*.zip" -print0 | xargs -0 -I {} 7z -y x {}

Which works OK if you want your files all to be extracted to the directory where you started the find command. But to leave files in their own folder this command was not appropriate.

It seems that find command has this neat flag called “-execdir” which does exacty that what I wanted, so here are few examples:

Find all zip files in sub-directories and unzip them in place using unzip:

find ./ -iname "*.zip" -execdir unzip -o '{}' ';'

Find all rar files in subdirectories and unzip them in place using unrar:

find ./ -iname "*.rar" -execdir unrar e '{}' ';'

The same using 7zip would look like:

find ./ -iname "*.zip" -execdir 7z -y x '{}' ';'

and

find ./ -iname "*.rar" -execdir 7z -y x '{}' ';'

Later on if you want to delete your zip and rar files and only leave the contents you can use similar command from where I have started.

For example to delete all rar archives that are named .rar, r00, r01 … r0x you can use:

find ./ -iname "*.r??" -print0 | xargs -0 -I {} rm {}

and similar you can can use to delete zip files, but please make sure that you don’t have zip files in your zip archives that you do not want to delete:

find ./ -iname "*.zip" -print0 | xargs -0 -I {} rm {}