Access Movistar Router via 192.168.1.1 – Page Not Available

I recently changed to a (Spanish) Movistar Fiber Optic internet connection, and as you do, tried to connect the usual way to have a poke around in the router.

I immediately got webpage errors for 192.168.1.1 on everything from my phone, tablet and laptop. Guessing it was a Chrome induced security issue, I decided to have a Google.

It turns out that Movistar routers still use an unsecure SSL v3 connection, and as such is blocked by decent browsers such as Chrome and Firefox, after the much publicized “Poodle Attack”.

There is a workaround however, and you can temporarily disable SSL v3 blocking thusly:

1. Open Firefox
2. Type “about:config” in the search bar
3. Accept the warning message
4. Search for security.tls.version.min and security.tls.version.fallback-limit
5. Set the first one to 0 and the second one to False

Now you can access your router. It is strongly advised to revert the settings back to 0 and True once you’ve finished meddling with your router configs.

Install Spotify on Crunchbang 11

Installing Spotify
Next up was to install Spotify, and as I thought, there would be a hiccup due to a missing dependency. When this happens, a simple “apt-get -f install”” usually fixes it, but it turns out I needed an extra file from squeeze as Crunchbang 11 is based on Wheezy the new Debian Stable and Spotify Linux is old.

First I needed to download libssl0.9.8 from HERE and install it:

cd downloads
sudo dpkg -i libssl0.9.8_0.9.8o-4squeeze14_i386.deb

Then I had to add the Spotify Linux repo to my sources list:

sudo vim /etc/apt/sources.list

And add these lines:

## SPOTIFY
deb http://repository.spotify.com stable non-free

Next I imported the gpg key:

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 94558F59

Now I just needed to update and install Spotify

sudo apt-get update
sudo apt-get install spotify-client

Screenfetch Terminal System Info instead of Archey on Crunchbang

I usually use Archey to brighten up my terminal, but realised that Screenfetch does the same job with a difference, I get a nice Crunchbang logo instead of a bright red swirly Debian logo.

To get screenfetch:
wget -O screenfetch https://raw.github.com/KittyKatt/screenFetch/master/screenfetch-dev

Make it executable:
chmod +x screenfetch

Move it to the bin directory to launch it:
sudo mv screenfetch /usr/bin/

Now add it to your bashrc file:
echo “screenfetch” >> ~/.bashrc

All done!

Image

Speeding up wireless internet on Crunchbang 11

On a recent new install of Crunchbang 11 I was having major problems connecting to my router with a Ralink RT3370 wireless USB dongle from my main tower. After investigating and playing around, this is my list of changes which got me sorted:

1. AES vs TKIP Encryption:
Connect to the router and change the WPA2 encryption from AES to TKIP. My first suspicon about the lack of connection was the encryption method and maybe the latest RT3370 drivers and wpasupplicant. After changing to TKIP I could connect, allbeit with a slow connection due to packet loss.

2. Move Adapter from USB2 to USB3:
Moved the Dongle from the front USB2 connector to a blue USB3 connector at the back, and I noticed a slight speed increase. After these hardware changes, it was time to go for some terminal-fu and edit a few files to get some extra internet speed.

3. Firstly I edited /etc/nsswitch.conf:
sudo vim /etc/nsswitch.conf
I commented out the original line:
#hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
And changed it to:
hosts: files dns

4. Next I disabled ipV6 in Iceweasel:
In the address bar I typed “about:config” and changed “network.dns.disableIPv6” to “true” with a double-click.

5. Next up was to disable ipV6 system wide:
echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf

6. Adaptor Power Management:
Another thing I had heard is that sometimes powercontrol can interfere with wireless speed as well so I disabled it for the USB dongle:
sudo iwconfig wlan0 power off

7. Swap nm-applet and network-manager for a Manual Static Wireless Connection:
First I disabled nm-applet from autostarting:
sudo mv /etc/xdg/autostart/nm-applet.desktop /etc/xdg/autostart/BKPnm-applet
Then I stopped Network Manager:
sudo /etc/init.d/network-manager stop
And completely Disabled it:
sudo echo "manual" | sudo tee /etc/init/network-manager.override

8. Just needed to add my manual network config:
sudo vim /etc/network/interfaces
Added my wifi info:
auto wlan0
iface wlan0 inet static
address 192.168.1.136
netmask 255.255.255.0
gateway 192.168.1.1
wpa-ssid ROUTER_ESSID
wpa-psk MYPASSWORD

Then manually added the Google dns addresses:
sudo vim /etc/resolv.conf
And add these:
nameserver 8.8.8.8
nameserver 8.8.4.4

Rebooted into a system with awesome internet cow-power-fu speeds!!

Installing Crunchbang 11 on a Netbook with external monitor

Back on Linux at Home and Blogging again
It’s been a while since i’ve posted as a new business project has had me using Windows a lot, yeah I know, but hey, life’s like that sometimes.
I moved my main computer tower into the lounge and it now serves as our main media center, with xbmc, spotify, games etc.

Crunchbang 11 on the Netbook
This left me with a monitor, keyboard and mouse in our bedroom…. and an Asus Netbook, so I thought what the hell and set about removing Ubuntu (slow as a snail, painfully slow) and installing my trusty old friend Crunchbang (which i’m typing from now).

I downloaded the 32bit version from HERE, made a Crunchbang pendrive via Unetbootin, installed and set about configuring it to be used as a desktop.

External Monitor Resolution
The first thing I noticed was that when I changed the resolution of the monitors, the settings would be lost after reboot, so I added these xrandr commands to my autostart.sh and both get set when I login:

## Set both external monitor and netbook resolutions
xrandr –output VGA1 –mode 1920×1080
xrandr –output LVDS1 –mode 800×600

All looking nice. next up to install XBMC…..

Synchronizing Google Calendar on Linux with Thunderbird Mail

Business needs and Google services
Currently setting up my desktop for business use and decided that i’d make as much use of Google’s free online services as possible (Mail, Drive, Calendar).

Web or desktop apps?
I usually do everything via web, but am looking for a company solution as well, which will mean that I can use Linux desktops with access to Gmail, Gcalendar by simply creating a company related email address.

What do you need?
Ok, so first you need to install Mozilla Thunderbird as the email application. Available in all repos (Icedove in Debian).

Addons
The first add-on is “Lightning” calendar.
http://www.mozilla.org/projects/calendar

Then “Provider for Google Calendar” to be able to synch with your Calendar
https://addons.mozilla.org/en-US/thunderbird/addon/provider-for-google-calendar/

These can both be install inside of Thunderbird via its built-in “Addon-Manager”

Setting up your Calender Synch
Now just restart Thunderbird for the add-ons to be activated. Then add you just need a few simple steps.

1. Open your Google Calendar in your browser
2. Click on the Settings link located in the box at the right of the page.
3. Click on the calendar you want to use with Thunderbird Lightning or Sunbird.
4. Click on XML button shown at the bottom which says “Private”.
5. Copy that link

Now in your Thunderbird Lightning Calendar, click “Add Calendar”, Choose “Network Calendar”, then paste that xml URL as the destination.

All done! You now have bi-directional functionality with your Google Calendar.

 

The disk drive for uuid= is not ready yet or not present, Continue to wait; or Press S to skip

So you just saw this message at boot: 
The disk drive for uuid=[long string of numbers and letters]…. is not ready yet or not present, Continue to wait; or Press S to skip

Why did this happen?
A couple of reasons. One of your hard-drives is knackered, You’ve been messing around and accidentally unplugged a hard-drive, a partition has been formatted or is unreadable.

Most Probable Cause:
You installed another Linux distro to dual-boot with, and it has renumbered your SWAP partition, and now your old Linux doesn’t recognize it.

How do I fix it?
1. Open your Terminal with 3 tabs (Ctrl+T) on Terminator, Gnome-Terminal etc. Or just open 3 terminals if you prefer that.


2. In terminal One, list your discs and partitions to find SWAP

sudo fdisk -l

Mine are:

Device Boot Start End Blocks Id System

/dev/sda1 * 1859031040 3907028991 1023998976 7 HPFS/NTFS/exFAT

/dev/sda2 2048 1859031039 929514496 7 HPFS/NTFS/exFAT

Device Boot Start End Blocks Id System

/dev/sdb1 * 2048 488476671 244237312 7 HPFS/NTFS/exFAT

/dev/sdb2 488476672 976773119 244148224 7 HPFS/NTFS/exFAT

Device Boot Start End Blocks Id System

/dev/sdc1 2048 256008191 128003072 83 Linux

/dev/sdc2 * 512007615 623081024 55536705 7 HPFS/NTFS/exFAT

/dev/sdc3 623081472 625141759 1030144 82 Linux swap / Solaris

/dev/sdc4 256008192 512006143 127998976 83 Linux

3. In Terminal Two, get the UUIDs for each partition:

sudo blkid

Mine are:

/dev/sda1: UUID=”5A81E99E5D0E4BEC” TYPE=”ntfs”

/dev/sda2: UUID=”2ED785F62B8C2905″ TYPE=”ntfs”

/dev/sdb1: UUID=”AC84B67484B6409E” TYPE=”ntfs”

/dev/sdb2: UUID=”6E5D895444E6C134″ TYPE=”ntfs”

/dev/sdc1: UUID=”fb9b8f73-8755-41d7-9c86-a721fd354bad” TYPE=”ext4″

/dev/sdc2: UUID=”22B0AAE8B0AAC1A1″ TYPE=”ntfs”

/dev/sdc3: UUID=”a90dd59c-cba2-4275-8fc0-23cf097675a2″ TYPE=”swap”

/dev/sdc4: UUID=”cb69c289-170b-4b37-8d8f-970707ec0fd0″ TYPE=”ext4″

4. We are going to turn SWAP off before we edit anything.

sudo swapoff -a

5. In Terminal 3 we will edit fstab and change the UUID for SWAP which we can see is wrong.

sudo vim /etc/fstab

Mine looks like this:

proc /proc proc nodev,noexec,nosuid 0 0

# / was on /dev/sdb1 during installation

UUID=fb9b8f73-8755-41d7-9c86-a721fd354bad / ext4 errors=remount-ro 0 1

# swap was on /dev/sdb3 during installation

UUID=8389288c-0a99-40c7-8d56-4c9333e458dc none swap sw 0 0

# Storage Partition 1 on /dev/sda1

UUID=5A81E99E5D0E4BEC /storage1 ntfs-3g auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8 0

# Storage Partition 2 on /dev/sda2

UUID=2ED785F62B8C2905 /storage2 ntfs-3g auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8 0

# Storage Partition 3 on /dev/sdb2

UUID=6E5D895444E6C134 /storage3 ntfs-3g auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8 0

6. Now we are going to remove the UUID from the SWAP line, and leave the cursor just after the “=”

# swap was on /dev/sdb3 during installationUUID= none swap sw 0 0

7. Now look at Terminal Two and copy that UUID from SWAP, and paste it into the fstab file so it looks like this:

# swap was on /dev/sdb3 during installationUUID=a90dd59c-cba2-4275-8fc0-23cf097675a2 none swap sw 0 0

8. Save and Quit vim with “:wq + Enter”
9. Turn SWAP on again

sudo swapon -a

That’s it, all done, you now have the correct UUID for your SWAP partition.

Wireless-Only installs with Debian, Crunchbang and Kali Linux – Missing Non-Free Firmware

Wireless Network
I changed my entire network over to wireless and my router is now fixed to the wall, 25 meters away from my office, in my lounge. The wireless from my office reaches ok, and means we have a stronger signal from the lounge where we have our XBMC media center and everybody connects with their smart phones.

Wireless PCI/USB cards and Non-Free Drivers
Due to the fact that some manufacturers won’t release the source code for their drivers (Thank you Broadcom and Ralink!!) we still have a bit of a hard time, even though Linux geniuses have reverse engineered and hacked practically all of them for us so we can load wireless modules from the kernel.

Politics and Freedom
Some distros willingly provide non-free drivers right from the get-go, others are more conservative and stick to Stallmanesque non-free restrictions. Debian does this…. still…. in 2013.


Debian Live Builder
I’ve built my own Debian based distros, and like other distros which are built with this system, mainly Crunchbang and just recently Kali Linux (The New “Debian-Based” Backtrack).

Live Yes – Install No
I recently got a bit of a surprise with some Live installs, as I found that when running both Crunchbang and Kali live, my Ralink wireless USB firmware was loaded and allowed me to connect to the internet, but when I went for the install, at the network configuration step, I was told that the firmware was missing!!

Solution
When this stage happens:
1. Take a picture of the screen on the Debian Installer which tells you which files you need from /lib/firmware. In my case “rt2870.bin” and “rtl8168e-3.fw”.

2. Insert a blank USB Pendrive
3. Reboot the Live CD to get to the Live Session
4. Copy the two needed files from /lib/firmware on the Live CD to the Pendrive
5. Reboot and run the installer

The Debian Live installer will detect the firmware on the Pendrive, load it, and allow you to choose your wireless ESSID and WPA key, and continue the install.

There’s no time like now for the old adage “You learn something new every day”.

May all you fellow wireless-only users, now be able to install any Debian-based distro without being put off by this minor freenoyance.

Unofficial Debian Wheezy Netinstall with Non-Free Wireless Firmware

Wireless Network
As I am on a completely wireless home network, with about 25 meters separating my office computer from the router in my lounge, I went on a hunt for a Debian Netinstall iso with wireless firmware already added.

Non-Free Wireless Firmware Included
I remember a while back I came across a Squeeze version. Luckily for me, there is also a Wheezy version too!

Here:
http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/wheezy_di_rc1/amd64/iso-cd/firmware-wheezy-DI-rc1-amd64-netinst.iso

 

Stop resolv.conf being overwritten by Network Manager

Going Minimal and Manual
This is one of those niggly little problems that happens when people who install full desktop environments face when they go for a bit of fluff reduction and start doing things manually.

Network-Manager and Wicd
I’ve already written about manually setting up a wireless connection, and static wired connections, which will just usually takeover and leave network-manager-gnome or wicd redundant but still showing the applet in your panel.
I completely remove network-manager-gnome anyway, but you may have a reason for keeping it just in case.


Resolvconf
The thing is, you still have the resolvconf package installed which will automatically take over and wipe your manually edited /etc/resolv.conf file, it even tells you what will happen at the top of the file in a commented out warning.

Quick n Easy Method
Just edit and change the write permissions on the resolv.conf file so that resolvconf can’t wipe it.

sudo vim /etc/resolv.conf

Add your nameservers (Iuse Google’s)

nameserver 8.8.8.8
nameserver 8.8.4.4

Then change it to read only (Can be reveresed by changing the + to a – in that command)

sudo chattr +i /etc/resolv.conf

Now reboot, you should have a nice manually configured wireless connection with no DNS issues or resolv.conf overwriting.

How to fix Plymouth on Ubuntu 12.10 with Ati and Nvidia proprietary drivers

I was going to do this manually, but after a bit of Googling I came across a script which does the job nicely. I downloaded it, had a look at the code, and once satisfied, ran it. I now have plymouth at boot.

The code courtesy of d0rkye and kyleabaker:

wget http://launchpadlibrarian.net/121675171/fixplymouth
chmod +x fixplymouth
./fixplymouth

Original article found here:
http://www.webupd8.org/2010/10/script-to-fix-ubuntu-plymouth-for.html

Thanks webupdate, d0rkeye and kyleabaker.

Ubuntu 12.10 on AMD64 missing microcode boot error

No Plymouth and Module Load Error:

I don’t get the fancy Plymouth screen at boot, and I get this annoying message;
“failed to load file amd-ucode/microcode_amd.bin”

AMD 64bit Quadcore CPU Microcode Module:

So, first to get this error fixed, then Plymouth later. As i’m using a 64bit AMD Quadcore CPU, I guessed it was a module either failing to load or a non-existent module, and a bit of Googling proved me right.

**Note
In the comments Mathias pointed out that you can install the needed module from the Ubuntu repos, whereas below I provide a step by step manual install. To install it automatically:

sudo apt-get update && sudo apt-get install amd64-microcode

I downloaded and installed the microcode manually from AMD:

http://www.amd64.org/support/microcode.html

First download and add the AMD public key to your keyring and verify the signature:

To import the key (when downloaded from amd64.org) use
gpg –import ucode.sign.pgp.pub

To download the public key from keyserver use
gpg –keyserver keys.gnupg.net –recv-keys 9F94BC90

The key fingerprint is
0719 2E77 C9C5 79D6 D122 6AC3 6257 68B9 9F94 BC90

To verify the integrity of the GPG key fingerprint use
gpg –fingerprint ucode@amd64.org

To verify the integrity of the container file package use
gpg –verify amd-ucode-latest.tar.asc amd-ucode-latest.tar

Now let’s download this module and get it installed, locked and loaded:
1. Create a directory for the module:

sudo mkdir /lib/firmware/amd-ucode

2. Go here and accept the conditions to download the tar file: 

http://www.amd64.org/index.php?id=50&file=amd-ucode-latest.tar

3. Extract it.

cd Downloads
tar xf amd-ucode-latest.tar
cd amd-ucode-2012-09-10

4. Copy the microcode over to the firmware directory:

cp microcode_amd.bin   /lib/firmware/amd-ucode
cp microcode_amd_fam15h.bin    /lib/firmware/amd-ucode

5. Now remove any old modules, and reload your new microcode module:
sudo modprobe -r microcode
sudo modprobe microcode
That’s it, now reboot and you should be blessed with an error-free boot

Ubuntu 12.10 – Install Nvidia GeForce 8400 GS Driver

Ubuntu Nvidia borkage
I see a load of people over on the Ubuntu forums getting their daily borkage fix trying to install the “nvidia-current” driver so they can get that much desired full 3D acceleration out of their cards.

Debian and Nvidia over the years
As a Debian user who suffered for years with Nvidia, enough to change to Ati, I know all about Nvidia borkage.

Ati to Nvidia
Anyway, long story short, needed the 1Gb Ati card for my Debian media center, so ended up having to use a 256Mb Nvidia GeForce 8400 GS on the office box, which due to boredom just got Ubuntu 12.10 installed on it.


Necessities for installing anything
Couple of things here that are regulars for us Debian users, which the Ubuntu crowd rarely post about. Mesa-Utils, and (the essential) Module-Assistant, as it gets your headers, build-essential and all manner of “compile-ready” bits n bobs.

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install module-assistant mesa-utils

Module Assistant
Module assistant will run off and fetch everything you need to compile and load any kernel module, from graphics card drivers to wireless firmware. This usually includes build-essential and your kernel-headers amongst other things. So just tell it to prepare your system with a simple:

sudo m-a prepare

Installing the proprietary Nvidia kernel module/driver

sudo apt-get install nvidia-current

Now just reboot and fire up glxgears (from the mesa-utils package) in the terminal and watch those pretty cogs show you how fast your 3D accelerated Nvidia card is.

 

Transparent Conky with Kde4

Conky and Kde4
I’ve had some spare time to play with my new Kde4 desktop, and decided to add a new Conky for something to do. One thing I noticed is that I only got a solid colour as the background, and not the wallpaper showing through.

Setting Wallpaper with Feh
I had a Google and found that I need to set the wallpaper with “feh” and add a line to the end of Conky so that the wallpaper in the background shows up.

First I installed “feh”:

sudo apt-get install feh

Then I opened my conkyrc for editing:

vim .conkyrc

And added this line to my current wallpaper at the end:

${texeci 1000 feh –bg-scale “/home/rich/Pictures/wallpapers/debian_black.jpg”}

Restart Conky and Voila
As soon as I saved and closed vim, Conky refreshed and my wallpaper was now visible as the Conky background.

Screenshot of Wallpaper and Conky:

 
 

 

Kde / Kubuntu Single / Double Mouse Click to Open / Select Files / Folders

KDE Single Mouse Click Annoyances
Having a single-click to select or open folders and files is annoying. Especially when you just want to highlite a file or folder.
I have also noticed that if you click an item on the start menu and move your mouse towards the desktop, a launcher is created because you moved the mouse so fast after that first click that you inadvertently dragged the icon by mistake.

Solution
Go to your Start Menu and select System Settings

Now choose “Input Devices” then “Mouse”. Now all you have to do is to change the setting from Single Click to Double Click.

A beginners guide to getting started with Linux

So you’ve made it here
Great, that means you have heard about Linux, and you have made the first step by doing a seach for “A beginners guide to getting started with Linux”. Well done! Let’s get started 🙂

How User Friendly is Linux for beginners?
Most Linux distros are available as a Live CD, which means you can start your computer with the CD in the CDROM drive and run it from there to try it for a while and have a play with your new chosen distro without having to install it, also it will NOT change anything at all on your computer whatsoever. So your Windows is completely SAFE.
Any good Linux suggestions for beginners?There are so many Linux distributions, and so many tastes, that it is impossible to tell somebody which is best for them and their computers. However, you can begin with the most popular which are easy for beginners to run and install. It’s like choosing a car for yourself, your partner, and your mother, each person has different needs and knowledge about cars. Distrowatch is a long established Linux website, and can give you a taste of what’s available from it’s Top 100, and also which are the most popular based on page-views. The current Top 5 as of Sept 2012 are:

Top 5 on Distrowatch.com:
1 Mint
2 Mageia
3 Ubuntu
4 Fedora
5 openSUSE

Other new-user-friendly distributions are:


Getting Information About Linux Distributions
Many new users have forgotten this skill. Go to the main website of your distro and also
the support forum and USE-THE-SEARCH-BOX. They all have them, and remember Google is your friend.
Be prepared to take notes, print information and sign up on a support forum.
Social networks are also teaming with experienced Linux users, go to Facebook, Twitter and Google+ and do a search for “Linux”. make friends with Linux users, ask questions to everybody using the #linux tag.

A Few Extra Notes Before The Impatient Ones Dive In Feet First

a) Linux Distros are downloaded as an iso file and will need to be burned to a cd or dvd as an image NOT data. Most CD/Dvd burners have the option to burn as an “image”.
b) Linux images should be burned at the slowest possible speed. Each burner will vary, try with 4X to start with.
c) Not ALL distros work on ALL hardware, although Linux comes with 1000’s of hardware drivers preinstalled or easily available. So you may have a problem with you 8 year-old “no-brand” USB webcam you bought at the market 🙂
d) Use Google or a Forum Search for a “How to Install [Distro] Guide”, most distros will now offer you a step-by-step installation program that will do it all for you anyway, all you have to do is answer a few questions on the application by clicking Yes or No.
e) If in doubt at any stage whatsoever, ask on the forum, or friends on Google+ Twitter or Facebook.

Linux Forum Do’s and Don’ts
There is a little netiquette involved on many forums, and each has their own way of doing things to keep the forum friendly, helpful, organised and easy to use. Forum communities are like little towns; everybody knows eachother, you will always be welcomed with open arms, there will be hepful and not so helpful advice, young and old, novices and experts, and probably a village idiot too! 😀

Forums will be run by a team of Administrators and Moderators, some are friendly and blend in as members, others are like the Gestapo on a power trip with their new found position. In general they are all there to help maintain order and support with different degrees of efficiency.
DO

DO try and find an “introduction thread” and post a “Hello everybody, i’m new to Linux”. See what kind of welcome you get from staff as well as members.

DO read the forum rules. Some are long winded while others are short and to the point.

DO use the forum Help button which will provide a guide on forum use and features.

DO look at the various sections and post in the right place.

DO use the Forum Search, your question may already have been asked and solved and even have a Howto guide.

DO be prepared to help yourself, you get far more respect and quicker help if you can show that you have tried.

DON’T 

DON’T expect an answer within 5 seconds. Forums are run by volunteers with jobs, families and lives outside of the forum.

DON’T whine and complain. Stick to the point and stay positive, you will have everybody jumping in to help you.

DON’T double post your problem a second time or in different sections, you will not get helped any faster.

DON’T post useless information. “My screen is black”. State what your hardware is, and try to remember any error messages.

DON’T post attention-seeking exagerated titles. “[Distro] broke my computer!!!!!!!!! going back to Windows!!!!! AAaaaaah!”.

Linux Checklist
Ok, so, you have got a list of possible Linux distros, you know how to look for information and help. What now?

  • Go and buy a pack of good quality blank cd’s/dvd’s.
  • Head over to Distrowatch.com and read up on the Top 10 distros.
  • Start downloading your chosen Linux distro images.
  • Burn the images to cd’s
  • Insert in one into the CDROM drive and reboot the computer.
Nine out of Ten times, you will wait about 2 minutes and will be at a Linux desktop. You will be able to play and experiment without having to worry about any adverse effects whatsoever on your already installed Windows system.

That’s it !! Welcome to the wonderful world of Linux

New Debian Mirrors

New mirrors closer to Debian users
From: Debian Project News
http://www.debian.org/News/weekly/2012/17/#mirrors

The Debian mirrors team, together with our sponsors, is happy to announce three new mirrors: in Russiaprovided by the National Research Nuclear University MEPhI whose administrators are pleased to provide a full Debian mirror to Russian users; in Vietnamprovided by MAYCHU; and in Malaysiaprovided by the Multimedia University of Malaysia

For other countries, the full list of mirrors is available online, as well as the experimental redirector which will automatically take into account these new mirrors. There are still countries lacking good connectivity to a Debian mirror; sponsors interested in hosting are invited to contact the mirrors team.

Kde Panel – Moved clock and system tray, cannot move them back

Kde Panel – Clock Moved
So you are new to Kde and accidentally do something, a mouse click or whatever on the Kde Panel, and all of a sudden, you have your clock on the left, your open windows have disappeared, and your system tray is now in the middle of the panel.


How to get it all back to normal

  • 1. Right Click on the panel and choose “Unlock Widgets
  • 2. Click the Golden Cashew Nut thingy (Panel Tool Box) on the right
  • 3. Now when you mouse over the panel widgets, a cross appears and allows you to move each thing.
  • 4. Start with the clock, move to the right, and when you want to position it, wait for a greyed-out box to appear on the panel and then drop it.
  • 5. Repeat with all the other stuff you messed up, close the golden cashew nut, and lock widgets.
  • 6. Now control yourself, and your mouse, and stop clicking every damn thing on the desktop 🙂

Set Vim in Terminal as Permanent Default Text Editor

I use Vim on every distro for text editing, so I like to make sure that it is the Default text editor both in the Terminal and the Gui Desktop.

How to set Vim as default system wide, issue the command and choose Vim:

sudo update-alternatives –config editor

Which gives me this output:
You can see that Nano is currently set as default so I choose number 3 to set vim.basic


There are 4 choices for the alternative editor (providing /usr/bin/editor).

Selection    Path                Priority   Status
————————————————————
* 0            /bin/nano            40        auto mode
1            /bin/ed             -100       manual mode
2            /bin/nano            40        manual mode
3            /usr/bin/vim.basic   30        manual mode
4            /usr/bin/vim.tiny    10        manual mode

Setting the Terminal Vim as the Gui Text Editor:
Most desktop environments and distros have one of the top 3 terminals and text editors set as default, so we are going to create a little Bash script to tell the system to use our terminal Vim text editor instead of the system’s default Gui Editor:

D/E        TERM                    EDITOR
Xfce       xfce4-terminal         Mousepad
Gnome   gnome-terminal      Gedit
Kde        konsole                 Kate

1. Create the script:

 vim vim-gui

 2. Add this with your particular terminal:
Leave it as it is for Gnome, Xfce, Xterm, etc but remove the quotes “” from [vim $ARGS] for konsole.
Thanks to penguiniator for pointing that out in the comments 🙂

 #!/bin/bash
ARGS=”$@”
gnome-terminal -e “vim $ARGS”

3. Save and Quit:

 :wq

4. Make script executable:

 chmod +x vim-gui

5. Copy script to your scripts directory (/home/USER/bin)

 cp vim-gui /home/rich/bin/

 6. Set it as the default editor from your desktop:
Open your file browser; Dolphin, Nautilus, Thunar etc, right click on any text file and select “Properties“.
Now look for the “Open With” option, and select “Add” or “Use Custom Command” and navigate to your vim-gui script in /home/USER/bin.

You can do this for any files you wish to open with Vim in the terminal by default.

 

Search and Replace text with Vim


Search and Replace with Vim
My main use of Search and Replace on vim would be for urls and country mirrors in my sources.list. If you find a particular mirror is running a bit slow (very common for me in Spain with the Spanish Debian/Ubuntu mirrors), then you can change all of them in one go to a faster mirror like this:

:%s/es.debian.org/fr.debian.org/g

This will replace all instances of the Spanish (es) Debian mirror for the (fr) French mirror which is usually faster. 

The :substitute command searches for text, and replaces it with different text. The g flag means global, each occurrence in the line is changed, rather than just the first.

Examples:
:s/foo/bar/g               Change each ‘foo’ to ‘bar’ in the current line.
:%s/foo/bar/g            Change each ‘foo’ to ‘bar’ in all lines.
:5,12s/foo/bar/g        Change each ‘foo’ to ‘bar’ for all lines from line 5 to line 12.
:’a,’bs/foo/bar/g         Change each ‘foo’ to ‘bar’ for all lines from mark a to mark b.
:.,$s/foo/bar/g           Change each ‘foo’ to ‘bar’ for all lines from line (.) to line ($).
:.,+2s/foo/bar/g         Change each ‘foo’ to ‘bar’ for line (.) and the two next lines (+2).
:g/^baz/s/foo/bar/g    Change each ‘foo’ to ‘bar’ in each line starting with ‘baz’.

Source: http://vim.wikia.com/wiki/Search_and_replace

 

How to create uncrackable, easy to remember passwords

Xkcd and Password Strength
If you’ve never read Xkcd before, then you should start now, it’s hilarious if you are a bit of a Geek.
Apart from the humour, there are some awesome cartoons which adhere to the old adage “Many a true word spoken in jest”, and probably one of my favourites is “Password Strength”, as it’s true as well as funny.

Click to enlarge:

Source: http://xkcd.com/936/

Enable Spell Check in Vim text editor

I use Vim for all system file editing,and also for writing scripts. Sometimes i’m logged into my server and as there is no desktop there are no gui apps, I use Vim to send out a quick tweet to twitter via Twitvim. I also compose Mutt emails with Vim, so therefore having a spell check is pretty handy.

To enable Spellcheck in Vim, you need to edit your Vim config file:
vim .vimrc

And add these lines with your language to it:

syn spell toplevel
set spell spelllang=en_us

Using multiple Languages:
As I use both English and Spanish, I created two copies of my .vimrc file and called them vispellen and vispelles (ENglish and ESpanish) and then wrote two little Bash script so I can type “ven” or “ves” in the Terminal to interchange the different config files.
ven script:

#!/bin/bash
# This copies vispellen with English spell check to .vimrc
cp vispellen .vimrc

ves script:

#!/bin/bash
# This copies vispelles with Spanish spell check to .vimrc
cp vispelles .vimrc

Very basic I know, but it works.

Vim Spellcheck command basics:

]s  move to the next mispelled word
[s   move to the previous mispelled word
zg   add a word to the dictionary
zug   undo the addition of a word to the dictionary
z=   view spelling suggestions for a mispelled word

More information:
Just type :help spell in Vim.

How to install the Ati proprietary driver on Debian, Ubuntu, Kubuntu, Mint

I usually install my Ati drivers like this on Debian 64bit, and have just found out today that it’s the same for Kubuntu 64bit as well

1. Download Ati driver:

http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx

2. Get all needed files and headers

sudo apt-get install module-assistant

sudo m-a prepare

3. Remove (completely) fglrx drivers (If you have them installed):
sudo apt-get remove –purge fglrx

4. Reboot

5. Go to console

Ctrl + Alt + F1

6. Login as Root and kill X

/etc/init.d/kdm stop

7. Unzip and run the Ati driver installer

unzip amd-driver-installer-12-8-x86.x86_64.zip
sh amd-driver-installer-8.982-x86.x86_64.run

*NOTE* You can also run the installer from desktop terminal as well, but I always do graphic driver installs from the console with no X.

 8. Configure X as root

X -configure
cp xorg.conf.new /etc/X11/xorg.conf

9. Reboot

Thar she blows !!!!!

How to install Picasa 3.9 on Debian Squeeze 64bit

Picasa on Debian Squeeze 64bit
I recently found that Picasa for Linux** no longer exists in the Google/Linux repository, so I had a Google around and  found a few guides on how to install it with Wine. There were a few different guides, but I got errors as my machine is 64bit and didn’t have all the necessary Wine/Windows libs etc..

**Just to be clear, Picasa was always a Windows package, but the Google/Linux download came prepackaged with Wine.


Wine and Winetricks
First you need to install Wine, and then download Winetricks

Wine

sudo apt-get update && sudo apt-get update
sudo apt-get install wine

Winetricks

wget http://winetricks.org/winetricks
sudo mv winetricks /usr/local/bin/
sudo chmod +x /usr/local/bin/winetricks

**NOTE on Debian Wheezy (Testing)
Artur posted in the comments that you may need to install libwine-cms as mscms.dll is needed.

sudo apt-get install libwine-cms

Download Picasa 3.9 for Windows

cd && wget http://dl.google.com/picasa/picasa39-setup.exe

Download Internet Explorer 7 64bit as There is no 64bit IE6
http://www.oldversion.com/windows/download/internet-explorer-7-0-x64

Without it, you won’t be able to login to your Google account.

**Note To Install ie7
You may have to symlink “wineserver” to /usr/local/bin, as suggested by Simon in the comments.

sudo ln -s /usr/lib/wine/wineserver /usr/local/bin/wineserver

Place it in your Winetricks IE7 cache directory:

 mkdir -p /home/YOU/.cache/winetricks/ie7

cp /home/YOU/Downloads/IE7-WindowsServer2003-x64-enu.exe /home/YOU/.cache/winetricks/ie7

Download Cabextract
It is needed to extract Windows Cab files.

sudo apt-get install cabextract

Run the Winetricks script:

winetricks ie7

64bit Dependency

Before running Picasa setup with Wine you need an extra lib:

sudo apt-get install lib32nss-mdns

Finally Run the Picasa setup

wine picasa39-setup.exe

That’s it, now you’re good to go with Picasa!

Debian Installer 7.0 Beta1 release

The Debian Installer team is pleased to announce the first beta release of the installer for Debian 7.0 Wheezy.

Download Here: http://www.debian.org/devel/debian-installer/

Improvements in this release of the installer

  • debian-installer: Switch the boot backgrounds to the Wheezy joy theme.
  • debian-installer: Adjust syslinux boot menu to not overlap with Debian logo.
  • debian-installer: Update to 3.2.0-3 linux ABI.
  • apt: Fix crashes on s390x.
  • apt: Improved behaviour with proxies (redirection handling improved, and HTTP/1.1 pipelining disabled by default).
  • brltty: Add new braille USB IDs to d-i udev rules.
  • busybox: Enable ping applet for udeb build.
  • debian-archive-keyring: Wheezy keys were added.
  • fonts-lohit-telu: Fix some glyphs for Telugu language support.
  • grub2: Prevent EFI systems from running out of memory due to large disk cache.
  • hw-detect: check-missing-firmware now supports looking into xz-compressed udebs.
  • linux kernel: Updated from 3.2.15 to 3.2.21 (many fixes).
    • [sparc,sparc64] Build virtio-modules-udeb for use in qemu (#673320).
    • [ia64,powerpc] udeb: Add crc-itu-t to crc-modules; make firewire-core-modules depend on it.
    • udeb: Add missing dependencies for various modules (see #678587).
  • lowmem: Improved low memory mode.
  • mkvmlinuz: Compress initrd with xz to significantly reduce vmlinuz size (#549681).
  • netcfg: Fix for “Enter the passphrase for WPA PSK” missing a “go back” button (#636211).
  • netcfg: Make link detection timeout preseedable (#610752).
  • netcfg: Fix link detection progress bar.
  • network-console: Add support for public-key authentication (#592550).
  • newt: Fix ‘Escape’ detection when ‘No’ is selected (#665784).
  • pciutils: Update pci.ids to the 2012.06.25 version.
  • rootskel-gtk: Use the Wheezy Joy theme for the installer.
  • wpa: Fix authentication issues with WPA2 passwords.

How to Scrobble to Libre.fm from Rhythmbox

Rhythmbox + Libre.fm
I gave up using Last.fm a long time ago, and prefer to support and use Libre.fm. The one thing I found was that on Debian’s version of Rhythmbox, there is no built-in Libre.fm Scrobbler plugin.

Scrobblefree
A bit of Googling and I came across Scrobblefree. A cool little Python plugin that does what it says on the box.

1. Download Scrobblefree here: http://web.vee.net/projects/scrobblefree/ (Currently version 0.4)

wget http://web.vee.net/projects/scrobblefree/scrobblefree-0.4.tar.bz2

2. Extract it and enter the Scrobblefree directory (There is another Scrobblefree directory inside):

tar xvjf scrobblefree-0.4.tar.bz2
cd scrobblefree-0.4 

3. Place it in your Rhythmbox plugins directory which is in your .local dir (Hidden, see the dot in front)

mv scrobblefree /home/YOU/.local/share/rhythmbox/plugins/

4. Open Rhythmbox and activate the plugin by clicking on “edit” then “plugins” and scroll down to Scrobblefree.

5. Configure it by clicking “configure” and only add your name to the SECOND url: http://turtle.libre.fm (The first url is for Last.fm)

6. Restart Rhythmbox and a popup box will ask for your Libre.fm login password. Type it in and you’re all set.

Happy Scrobbling !!!! 🙂

PS: I’m here: http://libre.fm/user/rich_scadding
PPS: If you ever see Justin Bieber on my recent tracks, a demon has compromised my system, and you must alert me 😀

Complete Computer Hardware Information with one command

There is always something hidden in Debian, and there is always another Debian Geek who will find it. In this  case thanks go to Debian Maniáco.

Open your terminal and type in this command:

  sudo dmidecode -s

Then add one of these arguments after it for the information you want.

  bios-vendor
  bios-version
  bios-release-date
  system-manufacturer
  system-product-name
  system-version
  system-serial-number
  system-uuid
  baseboard-manufacturer
  baseboard-product-name
  baseboard-version
  baseboard-serial-number
  baseboard-asset-tag
  chassis-manufacturer
  chassis-type
  chassis-version
  chassis-serial-number
  chassis-asset-tag
  processor-family
  processor-manufacturer
  processor-version
  processor-frequency

Nice find Lex Aleksandre !!

Howto install Iron Browser and Fix Nacl errors

Google Privacy vs Chrome usefulness
After mulling over some Google privacy issues Vs how good Chrome browser is, I decided to give Iron a go.

Iron Browser
Iron is a Chrome-based browser created by SRWare which claims to eliminate the privacy issues which come part and parcel with Google’s Chrome browser.
Iron vs Chrome: http://www.srware.net/en/software_srware_iron_chrome_vs_iron.php
Linux Download: http://www.srware.net/forum/viewtopic.php?f=18&t=3755

Installing Iron on Debian 64bit
I chose to install the Iron Debian 64bit .deb instead of compiling. It was easy.

1. Go to your downloads directory

cd downloads

2. Download the iron .deb file

wget http://www.srware.net/downloads/iron64.deb

3. Use dpkg to install it

sudo dpkg -i iron64.deb

Dependencies
I’ve got Google Chrome and a whole load of dev files installed and had no dependency problems, but just in case you get any problems just install any dependencies by running:

sudo apt-get -f install

Running Iron
I use Openbox, so I always manually add applications to my menu, but if you have Gnome or some other auto-menu-add desktop, you won’t have to worry about this.
I updated my system database and used locate to find Iron.

sudo updatedb
sudo locate iron

The launcher resides in “/usr/share/iron”, so I cd’d there and ran it.

cd /usr/share/iron
./iron

NACL Error Message
I got an error message in the terminal and Googled (parts of it), only to find that the problem had already been posted on the SRWare.net Iron download page:

LaunchProcess: failed to execvp:
/usr/share/iron/nacl_helper_bootstrap
[5793:5793:846689293:ERROR:nacl_fork_delegate_linux.cc(106)] Bad NaCl helper startup ack (0 bytes)
[5791:5801:846742102:ERROR:nacl_process_host.cc(607)] Failed to open NaCl IRT file “/usr/share/iron/nacl_irt_x86_64.nexe”: -4

Workaround / Temporary Fix
This is just a workaround while I investigate further or if the SRWare guys actually reply to the bug reports on their forum, whichever comes first.
Chrome nacl files not in present with Iron
After searching my system from Nacl related files, I found three in the Google Chrome directory “/opt/google/chrome”, and just copied them over to the Iron directory one by one, launching Iron after each move to see if the error message disappeared. It did.

sudo cp /opt/google/chrome/nacl_irt_x86_64.nexe /usr/share/iron
sudo cp /opt/google/chrome/nacl_helper_bootstrap /usr/share/iron
sudo cp /opt/google/chrome/nacl_helper /usr/share/iron

At the moment Iron launches and runs perfectly, but I will be investigating any issues that may be caused by using the Google Nacl files with iron. I’d also welcome any feedback other iron users may have.

Howto install Mac OSX Snow Leopard in Virtualbox on Linux

Why Mac? You’re a Debian Gnu/Linux user
I did this out of curiosity and just for the challenge more than anything, then deleted this VM shortly afterwards.
One thing I did notice while playing around with Mac, is how similar Ubuntu (Unity) is becoming to the Mac desktop. Everything was polished and nice to look at, but as a Debian (Openbox) user, i’m impressed by speed and reliability, not pretty wallpapers and icons.
What Hardware and Debian do you have?
I use Debian Squeeze with an AMD 64bit Quadcore CPU, Ati 1Gb GPU and 8Gb RAM. This is why I did this out of curiosity, as Apple Macs are Intel-centric.

Part 1 – Virtualbox & Ext4
One thing i noticed is that Virtualbox has an Ext4 bug which means that if you want to install Mac, your VirtualBox VMs directory needs to be on an NTFS partition. Luckily I have one of these, so I created the directory there, and pointed VirtualBox to use that one instead.

Part 2 – Which Mac iso?
I got one created by Hazard that is AMD 64bit compatible. Obviously, the legality of this image and running it virtually is in question, but as I said, both the iso and VM have been deleted now.
http://thepiratebay.se/torrent/5203531/Snow_Leopard_10.6.1-10.6.2_Intel_AMD_made_by_Hazard

Part 3 – Create and Configure the Virtual Harddrive
Create a 30 Gb fixed Virtualbox drive for Mac. Once it is done, open Settings > System > Mother Board, and change:

  1. Remove the Floppy drive.
  2. Chipset selected to ‘ICH9’
  3. Enable IO APIC
  4. Disable EFI (This caused me a couple of failures) 
  5. Only provide up to 2048Mb of RAM, more fails for some reason.



Part 4 – Starting the installation
In the drive settings, choose Hazard’s Snow Leopard iso, attach it the tht virtual CD drive, and start the VM
1. As soon as it starts run, a message will appear for you to hit enter to boot from CD
2. Follow the screens step by step, most of it is common sense.
3. The VBox HD is blank. So you have to format it with ‘Disk Utility’. When you get to the first screen with a menu bar, choose Utilities-> Disk Utility.
4. You’ll see the Disk, but it can’t be used until it formatted.
Choose the Harddrive and click the ‘Erase’ tab. Under Erase, choose Mac OS X Extended (Journaled) and then name it ‘OSX’ and click ‘Erase’ again.
5. Now close the Disk Utility and continue with the installation.

Part 5 – Special Settings for AMD CPUs (Screenshot 1)
At the next screen you’ll see a “Customize” button at the bottom left. Click it, and check the same boxes I have in  the screenshot above, then continue the install. It took about 10 minutes on my machine.
**NOTE** See the Updates marked in RED – Do not install them, you’ll be left with an Unbootable Mac that hangs at the Apple Logo Splash Screen.

Part 6 – First Boot
1. Once the install is finished, remove the CD from the drive, by clicking the Virtualbox window menu Devices > CD/DVD Devices > Remove Disc from virtual drive.
2. Shutdown the VM, close VirtualBox, then reopen VirtualBox and start the VM. If all went well, you will now be greeted with the Mac preparation screen asking for your personal details to setup the desktop.

That’s it, basic install complete.

**NOTE** If you get a Kernel Panic with “vm_page_set_colors” Error
Paul Edwards commented that it can be solved by a simple boot option of “colors=32”.
Link: http://code.google.com/p/xnu-dev/issues/detail?id=390
Thanks for that Paul 🙂

Part 7 – Screen Resolution
I did two hacks to get my Screen Size – 1920×1080


From Linux:
1. Open your terminal, and as a user (not Root, nor Sudo) type this command with your screen resolution and the name of your VM:

VBoxManage setextradata “Snow Leopard” “CustomVideoMode1” “1920x1080x32”

2. Restart the Virtual Machine

From Mac VM:
1. Open the file browser, go to the root directory and open the “Extra” folder. You’ll see a file called “com.apple.Boot.plist
2. Open it with the Text Editor, add the code below, then save it to your Desktop with exactly the same name and suffix (.plist).

Graphics Mode
1920x1080x32

3. Now drag it back to the “Extra” directory, and type in your password (admin permissions) and replace the old one.
4. Restart the Virtual Machine, and you should now have full screen available.

Here it is after the Screen Resolution Hack, which is perfect when you change it to Full Screen:



That’s about it. Have fun.

A heads up to these guys for their isos and guides:

Hazard Mac isos – http://leohazard.com/
Vbox Mac Howto – http://www.sysprobs.com/install-mac-snow-leopard-1063-oracle-virtualbox-32-apple-intel-pc
Vbox Mac Howto – http://randosity.wordpress.com/2010/06/21/running-mac-os-x-in-virtualbox/
VM Guide – http://blog.dmitryleskov.com/tag/vm/
VM Error Help – http://karim-ouda.blogspot.com.es/2011/07/errors-solutions-19.html

Pacpl Music Converter/Ripper/Tagger on Debian

Rhythmbox and Windows Media Audio (wma)
I recently decided to clean up my music collection and found that some files were uneditable from Rhythmbox on Debian as they were old wma (windows media audio) files from back in the day which I had ripped from CD to a Windows computer. I would have ripped the CD again, but it is old and pretty scratched up.

Pacpl on Debian
I love Perl, and when I did an “apt-cache search” in the terminal for Audio Converters, I was over the moon to find Pacpl, a Perl based CLI audio converter/ripper/tagger script in the repos:
http://pacpl.sourceforge.net/

Installation:

1. sudo apt-get update && sudo apt-get upgrade
2. sudo apt-get install pacpl

Usage Information:

man pacpl

Basic example:
I have a storage directory with a Music folder containing all my music. The Album in question was Gangsta Blues by Tanya Stephens, and I wanted to convert the entire album to Mp3 and remove the Wma files after.

pacpl –to mp3 -r -p /storage/Music/Tanya_Stephens/Gangsta_Blues/ –outdir /storage/Music/Tanya_Stephens/Gangsta_Blues/

Which gave this output:

Converting:  [01 Intro.wma] -> [mp3] ..done.
Converting:  [02 Way Back.wma] -> [mp3] ..done.
Converting:  [03 Boom Wuk.wma] -> [mp3] ..done.
Converting:  [04 Damn.wma] -> [mp3] ..done.
Converting:  [05 Good Ride.wma] -> [mp3] ..done.
Converting:  [06 Little White Lie.wma] -> [mp3] ..done.
Converting:  [07 It’s a Pity.wma] -> [mp3] ..done.
Converting:  [08 Tek Him Back.wma] -> [mp3] ..done.
Converting:  [09 I Am Woman.wma] -> [mp3] ..done.
Converting:  [10 This Is Love.wma] -> [mp3] ..done.
Converting:  [11 Gangsta Gal.wma] -> [mp3] ..done.
Converting:  [12 What’s Your Story.wma] -> [mp3] ..done.
Converting:  [13 Can’t Breathe.wma] -> [mp3] ..done.
Converting:  [14 Sound of My Tears.wma] -> [mp3] ..done.
Converting:  [15 The Other Cheek.wma] -> [mp3] ..done.
Converting:  [16 What a Day.wma] -> [mp3] ..done.
Converting:  [17 We a Lead.wma] -> [mp3] ..done. 

Removing old files:

1. cd /storage/Music/Tanya_Stephens/Gangsta_Blues/
2. rm -r *.wma

Pacpl provides superfast conversion, as you’d expect from anything Perl, and has a whole heap of different audio related features. I highly recommend this script if you prefer CLI over GUI.

Icedove Thunderbird – Debian Ubuntu not opening with NS_GetServiceManger Error

Icedove fails to open after system cleanup
I had a clean out of old applications and files on my work Debian Squeeze box, only to reboot and find that Icedove email client wouldn’t run.

I opened the terminal and ran “icedove” and got this error message:

/usr/lib/icedove/icedove-bin: symbol lookup error: /usr/lib/icedove/components/libimgicon.so: undefined symbol: NS_GetServiceManager

A quick Google around a few forums and mailing lists showed it to be a lib error (probably from my recent clean out) and not specifically Icedove on Debian (Hence the reason i’ve posted this here and not on DebianAndI) as it also appeared for Ubuntu users and Thunderbird as well. Anyway, there’s an easy fix.

1. Backup your Icedove email files just in case:

cp .icedove icedovebkp

2. Completely remove Icedove:

sudo apt-get remove –purge icedove

3. And then reinstall:

sudo apt-get install icedove

4: Open your terminal and type:

LD_BIND_NOW=1 icedove

Icedove should open and everything should be back to normal.

Convert to and split flash video (flv) files for Youtube

I recently got asked about uploading videos to Youtube by a friend, and decided to look at the best way to first convert them to Flash (.flv) and then split them into chunks to get round the Youtube video size restrictions.

Winff
If you’ve never used Winff before, then you’ll love it. It allows you to choose your video file and convert into various formats, including Flash for Websites (.flv) It’s available in most Linux repos, and you can find more info here: http://winff.org/html_new/

sudo apt-get install winff

Ffmpeg
Ffmpeg is the tool for everything video and audio. It’s available in all Linux repos and you can find more info here: http://ffmpeg.org/

sudo apt-get install ffmpeg

VLC Media Player:
I would also recommend installing vlc which is probably the most complete lightweight Video/Audio player available. It’s also available in all Linux repositories, more info here: http://www.videolan.org/vlc/

Basically you just convert and split.
1. Open Winff, open the file you want to convert, and choose Flash/Website
2. Let it convert then open your terminal ready for some ffmpeg-foo

Ok, so, case scenario: 
You have a video file called “bacon” that is 30 minutes long and you want to create two 15 minute files. To get file number 1 you split from 0min for a duration of 15 minutes, and then for file number 2 you split from 15min for another duration of 15 minutes like this:

ffmpeg  split originalbacon.flv from [startpoint 0] [for duration 15] to newbacon1.flv
ffmpeg  split originalbacon.flv from [startpoint 15] [for duration 15] to newbacon2.flv

Which in the Terminal is like this:

ffmpeg -i input.flv -sameq -ss 00:00:00 -t 00:15:00 file1.flv

then:

ffmpeg -i input.flv -sameq -ss 00:15:00 -t 00:15:00 file2.flv

Happy splitting and uploading 🙂

Broadcom BCM4311 problem on Debian, Mint, Ubuntu

The STA driver does not work properly for the BCM4311 in Mint/Ubuntu/Debian.
The Restricted Driver Manager only gives you the Broadcom STA driver as an option.

Yesterday got asked by a friend to remove Ubuntu from his 5-year-old laptop. It’s a 64bit, 1Gb Ram machine, with an Nvidia graphics card and Broadcom wireless.

I was pretty certain that the 64bit Linux Mint 12 would just work out of the box, even though i’ve had problems with the Broadcom firmware on other machines (wireless cutting out and needing to be restarted)
The install went fine, and I went straight to the “Restricted Drivers manager” for Nvidia and Broadcom. The STA driver was recommended so I installed it. Only to find it would work.

My laptop at home works ok with the older B43 module, so I went the traditional route and installed that instead.

Install:

sudo apt-get install firmware-b43-installer b43-fwcutter

Then unload both modules:

sudo modprobe -r b43 wl

Now reload the B43 module:

sudo modprobe b43

If when you reboot, the B43 module doesn’t get loaded:, just add it to “modules”:

sudo vim /etc/modules

and add b43 at the end of the list. Now it’ll load at boot.

The STA module may also load at boot, so just blacklist it by adding it to the blacklist:

sudo vim /etc/modprobe.d/blacklist.conf

and it like this:

blacklist wl

Now reboot, and you’ll have Broadcom 4311 wireless working.

Howto setup any HP printer on Debian

Other Printers
I’ve written other guides on setting up printers with Cups in the web browser via localhost:631 (which is still an easy way to setup most printers, however, the drivers weren’t listed for my current printer, so I Googled for the Hplip site at Sourceforge and found a neat little script.

Hp Deskjet 3050
In general with any Linux distro with a full desktop environment you would just install the Hplip package with GUI via the package manager. I have a minimal self-built Debian Squeeze with Openbox window manager, and as such, not all installed applications appear on the Obmenu (even the added Debian menu), so I have my own default menu with my frequently used apps. basically, when I installed the Hplip GUI there was no link to be seen on the menu, so I did an Alt+F2 to do arun-search of all the hp* references.

HP-Setup = No USB Printer Detected
I ran hp-setup and it informed me that there was no printer connected via USB, even though lsusb showed it listed. I checked for usual dependencies, unplugged and replugged the printer, nada, so off to Google I went.

Using the Hplip script from Sourceforge: http://sourceforge.jp/projects/sfnet_hplip/releases/
*NOTE* If you don’t already have it, install python-dev, libcups2-dev, libusb-dev, python-qt3, libsane-dev, libtool and libcupsimage2-dev

sudo apt-get update && sudo apt-get install python-dev libcups2-dev libusb-dev python-qt3 libsane-dev libtool libcupsimage2-dev

*NOTE 2* Optional Dependencies
If you think you may need these, install them as well:

INSTALL MISSING OPTIONAL DEPENDENCIES
————————————-
warning: There are 3 missing OPTIONAL dependencies.
note: Installation of dependencies requires an active internet connection.
warning: Missing REQUIRED dependency for option ‘network’: libnetsnmp-devel (libnetsnmp-devel – SNMP networking library development files)
warning: This installer cannot install ‘libnetsnmp-devel’ for your distro/OS and/or version.
warning: Option ‘network’ has been turned off.
warning: Missing REQUIRED dependency for option ‘gui_qt4’: pyqt4-dbus (PyQt 4 DBus – DBus Support for PyQt4)
warning: This installer cannot install ‘pyqt4-dbus’ for your distro/OS and/or version.
warning: Option ‘gui_qt4’ has been turned off.
warning: Missing OPTIONAL dependency for option ‘fax’: reportlab (Reportlab – PDF library for Python)
warning: This installer cannot install ‘reportlab’ for your distro/OS and/or version.

Running the script and installing

1. Find the latest *.run script (Currently hplip-3.12.4.run) and download it.

2. Open a terminal and go to your “Downloads” directory

cd Downloads

3. Create a HP directory (A lot of files will be downloaded when the script runs)

mkdir HP

4. Move the script there

mv hplip-3.12.4.run HP

5. Change to the HP directory

cd HP

6. Run the script as a regular user

sh hplip-3.12.4.run

Now just go through the motions, it’s self explanatory and will guide you step by step. Basically after reading it turns out that I just said YES to all the default options, and now have a fully working HP Deskjet 3050 on Debian Squeeze.

Howto install Perl Volwheel volume controller

Volwheel is a nice little Perl script panel applet which provides a lightweight sound/volume controller on your chosen panel/toolbar. I use Tint2 on my Openbox desktop, and volwheel is always a part of my setup.

First download Volwheel



Untar it

tar zxvf volwheel-0.2.8.tar.gz

Dependencies

sudo apt-get install libgtk2-trayicon-perl

Install

cd volwheel-0.2.8

sudo ./install.pl

Copy Icons to System

sudo mkdir -p /usr/local/share/volwheel/icons

cd icons

sudo cp -a * /usr/local/share/volwheel/icons

Copy Libs to System

cd ..

cd lib

sudo cp -a * /usr/lib/perl5

Launch Volwheel

volwheel &

Change the theme and settings (I use static + speaker-black)
Right click on Volwheel icon, choose Preferences
Autostart for Openbox

vim .config/openbox/autostart.sh

Add this line:

## Start volumeicon after a slight delay
(sleep 5s && volwheel) &

That’s it, now you have a nice Perl volume icon.

Send email from a fake address

How to send fake emails from fake/invented email addresses

Want to play a trick on your friends?

How about sending an email to your Linux-using Geek buddies from Linus Torvalds, or the Queen of England? Maybe your sister loves Justin Bieber?

Ok, you just need Postfix installed on your Linux box and a simple bash script, and the most excellent mime-construct. I use Vim text editor for my guide, but just replace it with the editor of your choice.

1. Install mime-construct from the repos:
sudo apt-get install mime-construct

2. Put this bash script in your /bin directory:

cd bin

vim fakemail.sh

And add this simple code:

#!/bin/bash
# Fake email just for fun
cat victims.txt | { while read; do
  echo $REPLY >> fakemailog.txt
  mime-construct –header ‘Sender: queen_elizabeth@buckinghampalace.com’ –header ‘From: queen_elizabeth@buckinghampalace.com’ –to $REPLY –subject ‘Invitation to the Royal Ball’ –file fakebody.txt
  sleep 2
done
}

4. Make the script executable:

chmod +x fakemail.sh

5. Write your funny fake email message in a file called “fakebody.txt”

vim fakebody.txt 

———-
The Queen is holding a special royal ball for the gullible people in your town.


You are invited to assist on the 1st of April, 2012


RSVP
———-

6. There is a log file in case you mail to multiple addresses
(to run a “tail -f fakemail.txt” to see how far the script has got with your list of victims):

vim fakemailog.txt

7. Now create the list of email addresses you want as victims 🙂

vim victims.txt

And add:
———–
myvictim@aprilfool.com
myvictim2@biggerfool.com
etc
———-

8. Run your fake email script:

./fakemail.sh

Off you go and have some fun, I need to dash, I just received an email from the Queen!!

Getting Java Console on HP ILO to work with Iceweasel on Debian 64bit

Remote HP Server Administration via ILO
If you ever have to connect to remote servers, especially HP which have ILO (Integrated Lights Out) technology, you’ll probably have come across the problem where you can get to the Administration page, but the Console won’t open.

Using Windows
I used to just fire up Virtual Box with Windows Xp (32bit) installed an do everything from there. ILO allows you to connect with Java install and on windows the .NET framework.

Linux and 64bit Java
One of he main issues with Linux and Java was that you could get the (Sun) 32bit Java to work, but the 64bit Java would fail miserably.

Java Versions
Java can be a real pain if you don’t have the latest version installed, and if you run Debian “Stable” (Currently Squeeze) you will have to install the Sun Java package from their website if you need the latest version as Debian is no longer going to have it in the repos: http://www.debian.org/News/weekly/2011/15/#javarm

Java (64bit) Version/Package Experiments
One of my work colleagues recently called me over and showed me the ILO Java console open and working with Iceweasel on his Debian Squeeze box. I was amazed and asked how he did it.
He’d basically installed a specific version (jdk1.6.0_17) of the sun-java6-jdk package, and symlinked to it.

Howto:

  • 1. Download the sun-jdk1.6.0_17 source (i’ll post a link later)
  • 2. Unpack it to /opt
  • 3. Cd to /usr/lib/mozilla/plugins
  • 4. Symlink these two files
libjavaplugin_jni.so -> /opt/java/jdk1.6.0_17/jre/lib/amd64/libjavaplugin_jni.so
libnpjp2.so -> /opt/java/jdk1.6.0_17/jre/lib/amd64/libnpjp2.so

Howto Crunchbang install proprietary Ati drivers

Installing Manually on Crunchbang Statler (32/64bit)

This method uses the latest Catalyst driver downloaded from AMD/ATI’s site.
This was tested on a virgin install with no other previous attempts at installing Ati drivers. If you have an already edited system, with other drivers installed, remove them “completely” first.
Do everything below as root, in the /root directory

Install the prerequisite packages:

apt-get install build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4 wget execstack libelfg0 module-assistant

Make sure you are ready to go with Module Assistant:

m-a prepare

Download the latest Catalyst package:
This package contains both the 32-bit and 64-bit driver (if you are on a 64bit machine, install ia32-libs) 

cd ~/; mkdir catalyst11.10; cd catalyst11.10/

wget http://www2.ati.com/drivers/linux/ati-driver-installer-11-10-x86.x86_64.run 

chmod +x ati-driver-installer-11-10-x86.x86_64.run

Launch the Ati installer and go through the motions:

./ati*run

Now reboot, don’t try glxgears or the catalyst control center, in fact don’t touch anything, just reboot.


Howto Flash DarkyROM 10.2 Resurrection from Debian on your Samsung Galaxy S

Why this guide if it’s all on DarkyROM Forums?
I’m posting this as I found the guides on the DarkyROM forums confusing, and they all recommend Odin (Pffft! Windows users). If you already have a Darky’s ROM installed, or are coming from a Stock Froyo, it’s easy, just follow the guides on the forum. In fact, before reading how I did it, go to the forums anyway.

This guide is how I got DarkyROM 10.2.2 Extreme Edition installed after a lot of trial and error trying to get rid of Cyanogenmod 7 with a custom kernel. (See my previous post for CM7) This is by no means as in-depth as the official guides, nor can I guarantee it will work for you. As with all ROM flashing shenanigans, you are responsible for your phone, not me.

6 Step Howto Guide

1. Download and install Heimdall CLI HERE

2. Download DarkyROM 10.2 Resurrection and unzip everything all into one directory. HERE

3. Open your terminal and cd to that directory

4. Copy and paste this line: 

heimdall flash –repartition –pit s1_odin_20100512.pit –factoryfs factoryfs.rfs –cache cache.rfs –dbdata dbdata.rfs –primary-boot boot.bin –secondary-boot Sbl.bin –param param.lfs –kernel zImage –modem modem.bin

5. Put your phone into Download Mode (Volume Down+Power Button+Enter)

6. Plug USN cable into computer, then phone, and go back to the terminal and press Enter.


The Whole Story (For those who are about to brick their phone if they don’t read this 😀 )
A few friends on Google Plus were using Darky ROM and singing it’s praises, but I went for CM7 instead as it was easier to to install. I soon realised that I was losing battery every 8 hours, faster with heavy use. I could have tried different kernels and patches etc, but i’d already decided (as I do with Linux) to say goodbye and move on to a “Distro” (ROM) which was recommended and more suited to my needs. Darky’s ROM.

Clockwork Mod and ROM manager
As I was on a rooted phone, and already had CWM installed via my custom kernel, I decided to go for the traditional Darky install via the ROM manager. I downloaded the latest DarkyROM 10.2.2, opened the ROM manager, told it to wipe my phone and install the .zip which had just been downloaded to the root of my internal SD card. The phone rebooted into CWM, I chose Factory reset, wipe cache etc, and chose the darkyrom-10.2.2.zip. It appeared to work, rebooted, and just got the Cyanogenmod 7 boot screen, and that’s where the phone froze. I tried again with the 3-button-techinique, wiped again, reflashed. Same thing. I now had a phone that wouldn’t boot. So I used the 3-button-technique to reflash Cyanogenmod7 (The zip was also on my internal SD card from the last time). CM7 worked.

Bricked (nearly) Phone, Odin and Heimdall and reverting to Stock Froyo
After a lot of downloading and attempted flashes with the 3BT, and ending up with an unbootable phone, I panicked a bit, and went off to Google. I read through the DarkyROM howto but came away even more confused, then found a link to a site that has all the Stock Samsung Galaxy S firmware. I downloaded the Samsung Galaxy S Froyo Firmware, and set off to find a guide about using Odin via USB cable to get my brick phone back to stock.

Odin vs Hemdall
I soon realised that Odin is a leaked application that Samsung uses to flash phones, and is a Windows app. I’m on Debian Squeeze Linux. Next I got wind of a Linux app called heimdall, which even comes with an Odin like GUI frontend called (funnily enough) heimdall-frontend, and there were .deb files. Cool beans methinks, I can flash via USB from Linux. I downloaded the .deb files and installed them with a quick “dpkg -i” All went well, opened it up to check, seems to work.

DarkyROM and Heimdall
Rather than go back to stock straight away, I thought i’d have one last go with Darky’s ROM so I went back to DarkyROM forums and found somebody had posted a Heimdall guide, with screenshots. However, the gui looked nothing like mine, but I thought i’d muddle through. I unzipped the DarkyROM-10.22 package, and found that none of the files i needed were inside. Great! Went back and read some more forum posts, found I may need a version called Resurrection. Downloaded that and found the firmware files inside. I unzipped everything, tried to load the PDA.tar, and Heimdall-Frontend crashed at 99%. I tried again, crashed. In  fact I went through a whole heap of files i’d previously downloaded, and either got “firmware.xml” missing, or the Gui would crash.

Ubuntu and Heimdall-Frontend
I compare Ubuntu to crack cocaine. It’s ok for a quick fix, but you wouldn’t want to use it every day 😀
Ok, just kidding, I don’t want hate mail form hoards of marauding Ubuntu Fanbois, in any case, it saved my ass this time. My daughter’s laptop dual-boots Crunchbang with Ubuntu, so I decided to use Ubuntu as people said Heimdall worked fine on that. And it did. I flashed DarkyROM to my phone, it rebooted……. to the damned Cyanogenmod splash again!!

Stock Froyo ROM
Bugger it, i’m tired, i’ve got an unbootable phone, i’m going back to stock. I unzipped the firmware i had downloaded earlier, flashed it to my phone with heimdall-frontend, the phone booted into stock Froyo, Hurrah!

But!…….. I-need-Darky’s ROM!
What can I say, i’m an install freak, I HAVE to be able to fix something. I can’t just walk away and leave this. I’m serious, I can’t sleep if there is a challenge like this hanging in the air. Distros, databases, web sites, source apps. If Grant Galbraith can haz teh Darky ROM, I can haz it too 😀

Back to DarkyROM forum’s Heimdall guide
I scrolled down, and found that a forum moderator had posted a comand line for heimdall. YES! CLI! I fired up my Debian laptop. Unzipped all the files i saw in that command line into one single directory. Fired up my terminal, copy and pasted the line. Put my phone into download-mode, connected the USB cable, went back to my terminal, crossed my fingers, said a little prayer to Linus, and hit Enter. Bang! the beautiful commands scrolled past, my phone came to life with a gorgeous glow as it’s new lifeblood started to flow into its circuitry. The phone restarted to an corrupted mutlicolour splash. A jittery robot voice stuttered something and it froze. My heart sank, I tried to restart it, I got the horrible dreaded black-screen-of death. My heart sank further as the words echoed through my head “you bricked your phone”, “you had a stock froyo”, “but you had to push it, and you bricked your phone”, “stupid”.  I recalled something on the forum about “Something only Samsung can fix”.


But all wasn’t lost
I took my battery out, replaced and rebooted. I got a beautiful Matrix style splash screen welcoming me to Darky’s ROM, the robot voice… that beautiful robot voice assured me that everything was fine, and I had in fact, successfully installed Darky’s ROM… 10.2 Extreme Edition. It booted.

I am now the proud user of Darky’s ROM 10.2.2 Extreme Edition, and it’s staying that way!

Howto Cyanogenmod on Samsung Galaxy S GT i9000

Well, I was up until 5 am this morning pulling my hair out trying to get Cyanogenmod installed on my phone. I did all the downloading directly to my phone via the browser, and used free apps to get this done without the need for Linux/Windows/Mac and USB cables etc.

If you get this error……..

E: failed to verify whole-file signature

E: signature verification failed

……….I am going to save you a whole heap of time.


ROOT:
I expect you know that you need to be root to flash a Cyanogenmod ROM, but if you didn’t, search the Android Market for Z4Root which will root your phone quickly and painlessly.


Restrictive Recovery Manager
The problem is that the stock Froyo comes with the e3 Recovery Manager, which blocks the installation of unsigned ROMs. The earlier e2 Recovery Manager will let you install unsigned ROMs. So even if you install the recommended ClockwareMod or other ROM Managers to get your ROM installed, it won’t work. And in any case, with my kernel solution you don’t need them anyway.


So how do you get back to the e2 version?
You need to install a different kernel, but don’t panic, there is a free app in the Android Market which will allow you to backup your kernel and flash a new one relatively painlessly. 
Meet the SGS Kernel Flasher: (Download it via the Market)
https://market.android.com/details?id=neldar.sgs.kernel.flasher

Where to get the Kernel? 
After reading a few guides the speedmod kernels came up time and time again, created by Hardcore. So I downloaded and installed this one. There are newer versions, but i stuck with what the guides said as I needed the old e2 Recovery Manager.
speedmod-kernel-k12u-500hz.zip
Here: http://www.hotfilesearch.com/download/55267311-speedmod-kernel-k12u-500hz.zip.html

So I opened up the SGS Kernel Flasher App, chose backup current kernel, then chose to flash the new downloaded kernel, navigated to it, crossed my fingers and tapped. The new kernel got added, and the phone rebooted. Next up was to see if it had indeed left me with a usable phone and the old e2 version.

Boot into System Recovery:
With your phone running, press Volume up + On/Off Button + Enter simultaneously until the phone shuts down and reboots, let go when you see the white GT i9000 boot screen and if all went well, you will now see a different recovery manager which does have the option to “Install from SDcard”. (this option doesn’t appear on the e3 version)

Cyanogenmod Download:
Now you can go and get the Cyanogenmod and download it from here:
http://download.cyanogenmod.com/get/update-cm-7.1.0-RC1-GalaxyS-signed.zip

Now (more or less) follow this guide again (but without any Clockwork or Rom App) by holding down the 3 buttons again: http://wiki.cyanogenmod.com/wiki/Samsung_Galaxy_S:_Full_Update_Guide

Method via Recovery

  1. Place the CyanogenMod update.zip file on the root of the SD card.
  2. Boot into Recovery (By holding down the 3 buttons, NOT with a ROM Manager).
  3. Once the device boots into Recovery, use the side volume buttons to move around, and either the power button or the trackball to select.
  4. Select the option to Wipe data/factory reset.
  5. Then select the option to Wipe cache partition.
  6. Select Install zip from sdcard.
  7. Select Choose zip from sdcard.
  8. Select the CyanogenMod update.zip.
  9. Once the installation has finished, select +++++Go Back+++++ to get back to the main menu, and select the Reboot system now option. The Samsung Galaxy S should now boot into CyanogenMod.

Your phone will now reboot and you will see that beautiful Cyanogenmod Spalsh screen and you will scream WOOT!…… like I did, with all the enrgy I could muster at 5am after 3 hours of trying to find out why I couldn’t install this Cyanogenmod that all the cool kids on G+ have on their phones.


Google Apps:
Finally I realized I didn’t have the App Market, Gmail etc, so after a bit of Googling, downloaded the Gapps zip to my phone and installed it with the 3-button-recovery method, and now have the apps I need:
http://cmw.22aaf3.com/gapps/gapps-gb-20110613-signed.zip

Howto install Minus.com filesharing desktop app on Debian Squeeze or Crunchbang

Minus.com Free 10Gb Unlimited Bandwith Dropbox rival
I just recently heard about minus.com on Google + and thought that their claim of 10Gb FREE along with unlimited bandwidth was suspicious. My comment was “Wait until somebody uploads and publicly shares a Linux distro iso.

Then Phillip Newborough (Corenominal – Crunchbang Linux) said he had actually communicated with John Xie, one of the minus.com founders, aksing exactly the same thing. John said that the minus.com team are all Linux users and have no problem whatsoever with Linux users/developers sharing their isos via the service.

This-is-awesome! I am uploading all my Dropbox files as I type this. Minus.com is going to be huge if they can maintain this type of service.

Ok, so I signed up and immediately started to look for Android and Debian desktop synchronization. I found only Ubuntu and Arch packages, and the screenshots clearly show a Gnome desktop, but I thought “what the hell” an downloaded the 64bit Ubuntu.deb package and threw caution to the wind.

Installation on Debian Squeeze 64bit with Openbox Desktop:


Download and install the .deb file from: 
http://minus.com/pages/tools

wget http://blog.minus.com/updates/minus-desktop-tool_amd64.deb

Install it:

sudo dpkg -i minus-desktop-tool_amd64.deb

Errors:
I got told I needed the libqt4-gui, I am on a very basic Squeeze with Openbox, so I just installed it.

dpkg: dependency problems prevent configuration of minus-desktop-tool:

 minus-desktop-tool depends on libqt4-gui; however:

  Package libqt4-gui is not installed.

dpkg: error processing minus-desktop-tool (–install):

 dependency problems – leaving unconfigured

Errors were encountered while processing:

 minus-desktop-tool

Get the dependencies:
sudo apt-get -f install

All done!

Just to check, I ran minus in the run dialog box, and hey presto! all working schwimmingly 🙂

Files:

The config.ini file is in ~/.local/share/data/minusdesktop
Minus runs from /usr/bin/minus

Autostart:
And i also added minus to start at login with my Openbox autostart.sh

vim .config/openbox/autostart.sh

And add: 

# Autostart the Minus daemon

(sleep 30s && minus) &

Howto Debian Live – Build your own Squeeze based distro


How to build your own Debian
Debian live-build was created to help you to build a Debian Live CD or USB. There are other applications and scripts which allow you to respin/remaster, but live-build will help you buil a Debian-based distro “the Debian way”.

Anybody can start with a base Debian and add a desktop environment and within around 30 minutes have their own Debian-based distro. It is that simple to use. A more experienced user could dig-in deep and add scripts, themes, wallpapers, specific applications and scripts.

Installation
You will need an installed Debian system to start. Install the live-build package.

*NOTE* sid-snapshot live-build error with squeeze builds

cp: cannot stat `/usr/share/syslinux/themes/debian-squeeze/isolinux-live’

Squeeze or Wheezy based distro?
If you want to build a Squeeze-based distro, use “squeeze-snapshots” to avoid the above error.
If you want to build Wheezy/sid-based distros, use the sid-snapshots repo. (live-build 3.0 is still under development, and therefore can break)

For Squeeze Pin the Squeeze Live-Build version:

cd /etc/apt/apt/preferences.d

Then create a file called “live_build” and add the Pin:

vim live-build

Package: live-helper
Pin: release a=squeeze
Pin-Priority: 900 

Package: live-build
Pin: release a=squeeze
Pin-Priority: 900 

Now add the Squeeze Live Build to your sources.list:

echo deb http://live.debian.net/debian/ squeeze-snapshots main contrib non-free >> /etc/apt/sources.list

echo deb-src http://live.debian.net/debian/ squeeze-snapshots main contrib non-free >> /etc/apt/sources.list

wget http://live.debian.net/debian/project/keys/archive-key.asc -O – | apt-key add –

apt-get update

apt-get install live-build dosfstools genisoimage memtest86+ mtools parted squashfs-tools genext2fs mtd-tools sudo fakeroot uuid-runtime win32-loader syslinux syslinux-themes-debian syslinux-themes-debian-squeeze

Configuration And Testing
Create a work directory as Root:

su
password

mkdir my-livecd

cd my-livecd

To create a simple test Live system (no X, just shell):

lb config

And you should end up with this directory structure:

|– binary_debian-installer

|– binary_grub

|– binary_local-debs

|– binary_local-hooks

|– binary_local-includes

|– binary_local-packageslists

|– binary_local-udebs

|– binary_rootfs

|– binary_syslinux

|– chroot_apt

|– chroot_local-hooks

|– chroot_local-includes

|– chroot_local-packages

|– chroot_local-packageslists

|– chroot_local-patches

|– chroot_local-preseed

|– chroot_sources

|– includes

`– templates

The Config Directory
lb config will create a CONFIG directory with some very simple default settings in commented files that can be edited by hand. This is where you will be adding your config files, packages (.debs) and the contents of your skel directory. This will probably be the most important directory for live-build distro builders.

Get lb config info from your Debian terminal:

man lb_config

The Build Command
lb build will download the packages from the debian repository, install them in a chroot, apply hooks and other things and then create an ISO file which you can burn or run virtually.

Editing/Adding/Removing and Rebuilding
Each time you want to rebuild the live-cd to include some changes, you’ll have to run:

lb clean

lb build

The process will be repeated, but this time the packages you downloaded before will be reused from a cache directory where they were saved the first time round.

Build an Xfce4 based Debian
Debian Squeeze with Xfce live USB image and some extra stuff: (These are straight commands that will add the information to the live-build scripts. Obviously you can edit the scripts themselves manually, and have all this preconfigured so that you run “lb build”, go and have a coffee and come back to a shiny new Debian iso, alreday to be fired up in VirtualBox to test.

lb clean

lb config –architecture i386 –archive-areas “main contrib non-free” –packages-list xfce

You can find more packages lists for gnome, kde and others in /usr/share/live/build/lists/.

debian-forensics debian-live-pxe-server gnome-core gnustep kde-extra lxde  standard studio-gnome xfce debian-junior debian-science gnome-full kde kde-full    minimal standard-x11 studio-kde xfce-junior debian-live-devel gnome gnome-junior kde-core kde-junior rescue studio studio-xfce [your-personal-list]

The i386 architecture boots on 32 and 64 bit processors.

Add some more packages you’d like:

lb config –packages “irssi screen obmenu obconf iptraf vim”

Rebuild

lb build

Customizations
You can make changes to the system interactively during the build process in a shell, using interactive shell parameter.

lb clean

lb config –interactive shell

lb build

A prompt will appear during the build process. Make the changes you want and then log out with “exit” to finish the build process. To disable interactive shell again for unattended builds run:

lb config –interactive disabled

Create Hooks to automate customizations:
Add the following example script inside config/chroot_local-hooks/, make it executable and then rebuild (more hooks in /usr/share/live-helper/hooks/):

#!/bin/sh

echo “HOOK: ssh server”

# install

apt-get install –yes –force-yes -y openssh-server

# disable root login

echo “I: disabling root login in ssh”

sed -i “s/PermitRootLogin yes/PermitRootLogin no/” /etc/ssh/sshd_config

# don’t start ssh on boot (safer)

update-rc.d -f ssh remove

Now rebuild.

Skel and the /home/user directory
To add some files to the user $HOME directory, copy them to config/chroot_local-includes to the /etc/skel directory:

lb clean

mkdir -p config/chroot_local-includes/etc/skel

cp -ra ~/.config/openbox config/chroot_local-includes/etc/skel/

lb build

Installing to USB pendrive:

lb clean –binary

lb config -b usb-hdd

lb build

Now copy the resulting image file to the USB pen drive

dd if=binary.img of=/dev/sdb

Where /dev/sdb is the usb pendrive.

Persistent Pendrive (Allows you to save files and settings)
To save changes between boots (a.k.a. live persistence), create a new partition with the remaining free space in the pen and change the label of the new partition to “home-rw”. Boot with the “persistent” boot option to use it. Now the changes in $HOME will survive. They can be used again booting with “persistent” again.

Installing To Hard Disk
One of the advantages of live-helper is being closely linked to Debian, Debian Policy and to Debian-Installer. Once you have selected the packages you want and have the system setup/configured the way you want with your hooks and preseeds, you can use the livecd iso to install your distro to hard disk with debian-installer (d-i) as with a normal official Debian CD.

The installer work normally (language selection, partitioning) but when it comes to installing the system, it will extract the live system to disk, then remove the live addons and install a bootloader. It is actually much faster that the normal installation, because it doesn’t have to unpack all the deb packages.

Debian guides:
http://debian-live.alioth.debian.org/,
http://wiki.debian.org/DebianLive/FAQ,
http://live.debian.net/manual/html/index.html,
http://www.debianuserforums.org/viewtopic.php?f=9&t=185.

How to: Shared Directory Permissions for specific Users of a specific Group


This guide is basically aimed at Debian server Administrators who want to control access to specific directories, to specific groups and/or users.

Scenario: 

You want ONLY user1 and user2 to have Read/Write access to the_shared_dir 
Create the new directory: 

sudo mkdir the_shared_dir 

Create new group: 

sudo groupadd thenewgroup 

Add users to the group: 

sudo adduser user1 thenewgroup 

sudo adduser user2 thenewgroup 

Give the directory group permissions: 

sudo chgrp -R thenewgroup the_shared_dir 

Change the directory/file permissions to Recursive Root/Group Read/Write: 

sudo chmod -R 774 the_shared_dir 

sudo chmod g+s the_shared_dir 

sudo setfacl -d -m group:thenewgroup:rwx the_shared_dir/ 

Use getfacl to see directory permissions: 

sudo getfacl the_shared_dir/ 

Which will produce this output: 
# file: the_shared_dir/ 
# owner: root 
# group: thenewgroup 
# flags: -s- 
user::rwx 
group::rwx 
other::r– 
default:user::rwx 
default:group::rwx 
default:group:thenewgroup:rwx 
default:mask::rwx default:other::r-x 
**Now the user has to log-off and on again for permissions to work** 
Links: 
ACL 
Getfacl 
Setfacl 
Permissions 

How to install Libre Office on Debian or Crunchbang with Openbox

Current (October 2012) Final LibreOffice 3.6.3

You can find the .tar.gz packages containing 32 and 64bit .debs on the download page:
32bit Debs (Torrent)

64bit Debs (Torrent)

Download and Unpack
First download the package for your version (mine is 64bit)  to your “/downloads” directory, then unpack it:

cd downloads

ls (then copy and paste the package name after the “tar -xvf” command)

tar -xvf LibO_3.6.3_Linux_x86-64_install-deb_en-US.tar.gz


Install Libre Office 3.6.3
Change to the extracted LibO directory and install all the .deb packages in one go.

Java
**Note** If Libre Office asks for Java (and you want to install it)

sudo apt-get install sun-java6-jre


Libre Office

cd LibO (hit Tab button to complete)

cd DEBS 

sudo dpkg -i *.deb


Where is Libre Office installed?
Libre Office 3.6.3 is now installed in /opt/libreoffice3.6/ and the application launchers are stored in /opt/libreoffice3.6/program

Add Libre Office to your Openbox menu

I use scite text editor to edit my Openbox menu basically as I have the option to save in .xml format (otherwise you get xml, end of line extra character errors etc) . You can also do this with Vim, Nano etc, if you know how to do it. I prefer having Scite already setup for xml editing.

Back-up and Edit

cp .config/openbox/menu.xml .config/openbox/menu.xmlBKP

scite .config/openbox/menu.xml


Add the Office Menu where you like

        

            

                

                    /opt/libreoffice3.6/program/soffice

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/swriter

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/scalc

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/simpress

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/sdraw

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/smath

                

            

        

            

            

                                

                                        /opt/libreoffice3.6/program/sbase                   

                                

                        

                


All done!
That’s it, you now have the latest Stable edition of Libre Office and you can launch everything from your Openbox menu 🙂


So much editing after importing to Blogger

Well, one of the things I had installed on my wordpress blog was a script to add links from posts to specific pages. I have Perl, Howto, etc.

This was so that I could search all the Howto’s by going to my Howto link list page, and hitting Ctrl+F and doing a search from my browser.

This feature doesn’t exist on Blogger so I created the pages manually, then copy and pasted all the links from my WordPress blog. Obviously all those links lead to my old URL and it looks like the only way to edit them all is manually *sigh*

The next peeve is that ALL Blogger post urls contain the year and month in the title !! So I can’t just edit all the urls in a text editor with Find and Replace!

http://richs-lxh.com/title_of_the_post.html

Becomes……….

http://debianandi.blogspot.com/2011/03/title_of_the_post.html

…… and I suppose you’ve seen how many post i’ve made!

Oh well, no time like the present.

Come on Google, give us an Archive Link Page script!

Asterisk PBX on Debian Stable Part 2

Part Two Finally Arrived!
It’s been a while since Part 1, but I decided to dig through my unfinished drafts and see what I fancy finishing off. At work we setup a lot of Asterisk servers for clients, so as you imagine a lot of it is preconfigured and installed with scripts.

Last week though, I got a Fujitsu Primergy TX200 S5 server to play with, and set about installing a KVM on Debian virtual system for testing. As we are looking to deploy some custom Asterisk servers for new clients, I decided that this would be my first test VM.

If you haven’t already installed Asterisk, check out Part 1
So, first look at Part 1 for a basic setup, yes, it’s still relevant for Squeeze. Now we are going to install and configure a software phone (VoixPhone) using the IAX protocol. This is a very basic setup, and will get you started.

Configuring Asterisk for Voixphone
There are two main files which need to be edited to achieve this, and they are both (as with all Asterisk .conf files) in /etc/asterisk.

/etc/asterisk/iax.conf
/etc/asterisk/extensions.conf

First add this to your iax.conf (using your name)

[general]
port=4569
bandwidth=low
disallow=all
allow=gsm
jitterbuffer=yes
tos=lowdelay

[richslxh]
type=friend
context=default
secret=4321
host=dynamic
allow=gsm
auth=plaintext,md5,rsa
callerid=richslxh
mailbox=richslxh
requirecalltoken=noTHIS IS IMPORTANT IF YOU CAN’T CONNECT WITH VOIXPHONE

Now we need to add the coinciding information in /etc/extensions.conf

[from-sip]

exten => 9250,1,Dial(SIP/9250,20)
exten => 9250,2,Voicemail(u9250)
exten => 9250,102,Voicemail(b9250)

exten => 9250,103,Hangup

exten => 9251,1,Dial(SIP/9251,20)
exten => 9251,2,Voicemail(u9251)
exten => 9251,102,Voicemail(b9251)
exten => 9251,103,Hangup

exten => 2999,1,Voicemailmain()
exten => 2999,2,Hangup

include => from-iax

[from-iax]

exten => 4321,1,Dial(IAX2/4321,20)
exten => 4321,2,Voicemail(u4321)
exten => 4321,102,Voicemail(b4321)
exten => 43231,103,Hangup

include => demo ; I have added the demo so you can dial 1000 and test your phone

include => from-sip

Now to get/install VoixPhone
Download it from here: http://www.voixphone.com/voix-phone-download
Unpack it in to your /home/you/bin directory, make it executable (chmod +x) and double click the executable. That’s it, just follow the installer.

Configure VoixPhone to use your Asterisk Server
Just click “Alt+F2” to get the run dialogue and run “VoixPhone” (Don’t forget the capitals).

Now click the icon at the bottom that looks like a cog to get to the settings.
They are pretty self explanatory now that you have just configured Asterisk.

Server Address: 192.168.X.X – Your Asterisk server, obviusleh! 😉
Port: 4569
Username: richslxh
Password: 4321
Caller ID Name: richslxh
Caller ID Number: 4321

Next check your Sound Options to make sure your sound card has been detected.
It maybe the case that all 3 fields are empty, or you get a “Sound not working” error. Do not fear, you just need to load the oss module 🙂

sudo modprobe snd-pcm-oss

Just to be sure it loads at boot, you can add it to /etc/modules, but now you should have sound.

Now from the terminal run Asterisk, reload it, and then restart your VoixPhone. Everything should be hunky-dory 🙂

atserisk -r

reload

Now test VoixPhone with the Asterisk Demo by dialing 1000

Howto Quick n Easy Manual Wireless Wpa2 PSK

Manual Commandline Network setup:

So this guide is for those of you who only connect to the same router via Wpa2/Psk encrypted wireless. Although if you want to, you can scan and connect to any wireless connection manually using the wireless-tools suite of scripts.

Wireless setup via a Gui:

If you regularly roam and need to search for and connect to different wireless connections, i’d suggest you install wicd-gtk, it’s in most Linux distro repositories. There’s also network-manager-gnome which provides the nm-applet gui. I prefer the manual method as the gui apps tend to write over system config files. For example, nm-applet removes your dns configs in /etc/resolv.conf.

Wireless Firmware:

Ok, you need to have your wireless drivers installed and working. I’m using a Broadcom BCM4138, whose drivers are supplied via the “firmware-b43-installer” which fetches the firmware from openwrt.

More on B43 herehttp://linuxwireless.org/en/users/Drivers/b43#b43_and_b43legacy

Next up you need to authenticate with Wpa using PSK TKIP, this is accomplished by installing wpasupplicant:

sudo apt-get update

sudo apt-get install wpasupplicant

Now you need to edit a couple of files:

sudo vim /etc/network/interfaces

Supposing your wireless card is called wlan0, and you want a static IP address you add this:

auto wlan0
iface wlan0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1
wpa-ssid youressid
wpa-psk yourpassword

Just to make sure you can surf the net, check your dns config. I put my router IP and the Google Open DNS IP as well.

sudo vim /etc/resolv.conf

And add:

nameserver 192.168.0.1
nameserver 8.8.8.8

Now to connect, you only have to issue one command, then every time you login after that you will automatically be connected:

sudo ifup wlan0

That’s it, no need for Gui applications sucking resources and overwriting important files. Just a quick and easy auto-connected wireless every time you bootup.

Howto install Libre Office on Debian Squeeze / Crunchbang Statler

**UPDATE**

LibreOffice 3.4.2 Final is available at the end of July

You can download the 3.4.2 RC3 tar.gz from here, unpack and install the .debs manually if you prefer. (see comments)  http://www.libreoffice.org/download/

—————————————————————————————————————————————————-

Libre Office is currently only available in the wheezy ,sid and squeeze-backports repositories at the moment so I chose to install it from squeeze-backports.

1. You need to add backports to your sources.list:

sudo vim /etc/apt/sources.list

And add this line:

#SQUEEZE-BACKPORTS
deb http://backports.debian.org/debian-backports squeeze-backports main

2. Update apt with:

sudo apt-get update

3. Then install Libre Office with:

apt-get -t squeeze-backports install libreoffice


E voilá !

How to add a Google Plus One button to your WordPress blog

Now that Google + has finally started to let us all in, more and more peple want the Google + button on their websites, so i thought i’d put up a quick n easy guide.

Basically you need to add this code to the header of your site. In wordpress it’s a separate file called “header.php” in your Theme directory. But most website headers have the same format.
**Add it just before the tag.**


Now once that is done, you can add the following code to anywhere you want the Google Plus button to appear:

On wordpress, I need it to appear at the bottom of each post with the other “share” buttons, so I had to edit the “single.php” file, and place it just after the post content:


That’s it, now you’ll see a Google Plus One button so you can show me some love on Google + 🙂

Microsoft Outlook inbox doesn’t refresh : Google it!

Yet another example of why Microsoft is losing to Google Docs and Open Office (Free Open Source).

Eurogaran Informatica
My company deals with Linux servers, we design and build high speed, secure networks and servers for corporations and large companies. This can be anything from mail/Web servers to RAIDed Mysql high-availability clusters.

Windows Desktop Support
We do however offer some desktop support to long-term clients. Windows desktop support! No complaint about the users, they do what they can, ad they aren’t Geeks, so we help out with everything that Microsoft can throw at us. Let’s get one thing straight. The fact that Microsoft has the gall to “sell” there products is beyond me, honestly, you wouldn’t believe the bugs we find on a daily basis.

Outlook inbox doesn’t Refresh
Microsoft Outlook is a Croc, no two ways about it, it’s an absolute pile of crap. End of. We get various support requests for everything from it just freezing up (Outlook 4Gb storage limit), to new emails not being visible in the inbox as Outlook doesn’t refresh. I mean this is schoolboy programming stuff, if Microsoft programmers can’t get a simple view-refresh right, what hope is there of them securing your server?

Google it!outlook+inbox+doesn’t+refresh
Yeah! hundreds of thousands of posts on support forums, mailing lists and no reply whatsoever from Microsoft. No Service Pack 173b, to fix the latest flood of bugs and security flaws. Nada.

However, I did find some real cute fixes, which just left me flabbergasted:
http://forums.techguy.org/web-email/723805-outlook-2007-inbox-does-not.html

This is for a fresh installation of Office 2007

Close the outlook 2007 Application and open Word 2007 . You should get a Microsoft Customer Experience Improvement Program notification. Once you have done this , YOUR Outlook will work fine.

Thanks
Menino

WTF!? Oh by the way, I bookmarked that one, as I bet it actually works too! 🙂

More solutions:
http://www.pcreview.co.uk/forums/outlook-2007-inbox-view-does-not-refresh-new-mail-received-t3703037.html

I am adamantly against being forced to participate in a program that sends
“any” information to “anyone” regardless of their “Privacy Statements” in
order to have their application function as expected!!!

This requirement is ludicrous and I will be happy to post this to every blog
and Microsoft Support site on the internet unless Microsoft ceases and
corrects this IMMEDIATELY!

Good grief!

Howto create a Virtualbox 4 image clone

VirtualBox 4 for multiple OS availability
If you are like me and do a lot of testing with Virtual Machines, then you will know that to keep having to create a new machine and installing a Debian netinstall each time is a complete p.i.t.a

Cloning vdi’s
No need for all that malarkey now. Just create a fresh VM, install a base Debian netinstall, or any other OS for the matter, i’ve got loads installed!

Once you have it all setup, shut down VirtualBox, open your terminal and issue a command like this:

vboxmanage clonevdi /home/rich/VirtualBoxVMs/Squeeze64/Squeeze64.vdi /home/rich/VirtualBoxVMs/Squeeze64b/Squeeze64b.vdi

As you can see, all my vdi’s are stored in /home/rich/VirtualBoxVms so just adapt the command to suite your needs.

The output will be like this (with a new uuid created for the harddisk):
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: cc76ae5a-719a-4833-b481-42f254f5fe2e

So, imagine you want to create a new Debian clone called “MyBigFatCopy”.

cd /directory/where/your/vdis/are/stored/
mkdir MyBigFatCopy

Now run the code from before:

vboxmanage clonevdi /home/you/VirtualBoxVMs/ORIGINAL/original.vdi /home/you/VirtualBoxVMs/MyBigFatCopy/mybigfatcopy.vdi

Adding your new clone to the VirtualBox list
Now open up VirtualBox4, choose “NEW” and create a VM called MyBigFatCopy

(**NOTE** It has to have “exactly” the same name as the directory you just created).

Instead of creating a new harddrive, just choose an “existing” vdi, yup, you’ve guessed, navigate to your newly cloned mybigfatcopy.vdi 🙂

Finish off, restart VirtualBox4, and fire up your new mybigfatclone.

If you are on a network (or want to run several VM’s at the same time), just make sure you change the hostname, and if it has a static IP address, change it to dhcp or a new static ip. Now you can fire up your clone alongside your original without any problems.

Happy Cloning! 😉

New Microsoft Windows rootkit so severe, Complete re-install necessary

Microsoft security just keeps getting worse
It has just been announced that a new Trojan Rootkit can embed itself so deep into the Windows operating system, that a complete format of all data and a fresh re-install is needed to get rid of it, as it hooks itself to to the hard disk port driver for protection and then hides in the machine’s boot sector.

From Microsoft Malware Protection:

The bootkit malware Trojan:Win32/Popureb.E has made some changes in its code compared to previous samples (specifically, Trojan:Win32/Popureb.B), and now it introduces a driver component to prevent the malicious MBR and other malicious data stored as disk sectors from being changed. The driver component protects the data in an unusual way – by hooking the DriverStartIo routine in a hard disk port driver (for example, atapi.sys).

Does your Windows computer feel sluggish today? You may just have the unremovable Popureb.E Trojan Rootkit offering up all your private data to the world!

Crunchbang Linux Right Mouse Click Gpg Encrypt/Decrypt scripts

Thunar Right-Click Menu Encryption/Decryption
This was a script inspired by machiner on the LxH Forum who showed me a cool Encrypt/Decrypt script a while ago.

Gpg and Password Protection
I decided to add a password dialogue box as well, which is launched in an xterm. I tried a Zenity diaogue box, but it caused a few problems with input and output, so my work colleague Eduardo stepped in and suggested doing it with an xterm pop-up instead. Edu is a far better coder than me.

Pgp/Gpg Key Creation
Obviously you need to have created pgp-keypair, I used Gpg (Gnu Privacy Guard) frontend, and you can find a Howto HERE You will also need “xterm” installed, but should come as default.

The Encrypt/Decrypt Scripts
You need to create two bash scripts in either /usr/local/bin or your home ~/bin, I chose the latter as I always backup my personal scripts. I called them RMCencrypt and RMCdecrypt. “RMC” means Right Mouse Click 🙂

ENCRYPT

#!/bin/bash
# Handy Encryption Action ##

encrypt ()
{
#PASSWD=`zenity –entry –title “Password” –text “Enter password”`
#if [ “z$PASSWD” != “z” ]; then
# gpg -ac –no-options –passphrase $PASSWD “$1” || \
# zenity –error –text “Decryption failed: $?”
#else
# zenity –error –text “No password: Aborted”
#fi
xterm -e “gpg -ac –no-options ${1+\”$@\”}; echo -n \”Press \”; read”
}

## End Handy Encryption Action ##

encrypt ${1+”$@”}

DECRYPT

#!/bin/bash
## Handy Decryption Action ##
decrypt ()
{
#PASSWD=`zenity –entry –title “Password” –text “Enter password”`
#if [ “z$PASSWD” != “z” ]; then
# gpg –no-options –passphrase $PASSWD “$1” || \
# zenity –error –text “Encryption failed: $?”
#else
# zenity –error –text “No password: Aborted”
#fi
xterm -e “gpg –no-options ${1+\”$@\”}; echo -n \”Press \”; read”
}
## End Handy Encryption Action ##

decrypt ${1+”$@”}

Now just place those two scripts in ~/bin and make them executable (chmod +x).

Next up, open Thunar file manager, click the “edit” then “Configure custom file actions..” and add both scripts with a name and icon of your choice. I chose RMCencrypt and RMCdecrypt like the scripts, which Thunar Actions manager adds an %n after to encrypt the selected file.

You will now be able to encrypt and decrypt any file at the click of a (right) mouse button.


Howto Change all instances of a word in a Mysql database

This how to refers to an Smf Forum database but can just as easily be applied to a WordPress, or any other Mysql database.

I recently re-opened my old forum which is 5 years old and has a lot of old posts, people have changed usernames, email addresses. The forum has had three domain names, so it stands to reason that there is a lot to tidy up. So I set about updating a few things today.

The basic mysql syntax (which can be launched from Phpmyadmin Sql Tab) is this:

UPDATE table SET field_name = REPLACE(field_name, ‘tony’, ‘TONY’)

For example, to change an old url link to a new one in the body of forum posts:

UPDATE smf_messages SET body = REPLACE(body, ‘myoldurl.com’, ‘mynewurl.com’)

Obviously, you just change the table, field and text to be replaced.


Fix: gettext_domain not understood below schema

What does node not understood below mean?
A few people have posted on forums an mailing lists regarding this message, so I thought I’d post a quick fix/workaround.
PS: I had to mess around with that message as my blog wouldn’t post it, even with code tags.

You may install a package or do an update/upgrade from the terminal and see this come up:

Processing triggers for desktop-file-utils ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for gconf2 ...
WARNING: node not understood below
WARNING: node not understood below
WARNING: node not understood below
WARNING: node not understood below
WARNING: node not understood below
WARNING: node not understood below
Processing triggers for man-db ...

This is due to the tag in /usr/share/gconf/schemas/ not being recognized.

You can do a simple grep to find out which schema is causing the problem with this command:

grep gettext /usr/share/gconf/schemas/*

In my case it was caused by the schema for gnome-keyring:

/usr/share/gconf/schemas/gnome-keyring.schemas: <gettext_domain>gnome-keyring</gettext_domain>

Where do all these .schemas come from?

I don’t use gnome-keyring, so I just removed it. But I was curious to see what was there so I cd’d into /usr/share/gconf/schemas to take a look, and in my case I see that practically all the schemas are Gnome related. I’m on Crunchbang Statler Openbox, but did install Gnome a while back to have a play wih a few apps.

This is what I saw:

ls -ln /usr/share/gconf/schemas/
apps_evolution_addressbook.schemas desktop_gnome_interface.schemas gedit.schemas
apps-evolution-attachment-reminder.schemas desktop_gnome_lockdown.schemas gedit-show-tabbar-plugin.schemas
apps_evolution_calendar.schemas desktop_gnome_peripherals_keyboard.schemas gksu.schemas
apps_evolution_email_custom_header.schemas desktop_gnome_peripherals_mouse.schemas gnome-audio-profiles.schemas
apps_evolution_eplugin_face.schemas desktop_gnome_sound.schemas gnome-sound-recorder.schemas
apps-evolution-external-editor.schemas desktop_gnome_thumbnail_cache.schemas gnome-terminal.schemas
apps-evolution-mail-notification.schemas desktop_gnome_thumbnailers.schemas gnome-volume-control.schemas
apps-evolution-mail-prompts-checkdefault.schemas desktop_gnome_typing_break.schemas gnumeric-dialogs.schemas
apps_evolution_shell.schemas desktop_gnome_url_handlers.schemas gnumeric-general.schemas
apps-evolution-template-placeholders.schemas epiphany-lockdown.schemas gnumeric-plugins.schemas
apps_xchat_url_handler.schemas epiphany.schemas gstreamer-0.10.schemas
bogo-junk-plugin.schemas evince.schemas gweather.schemas
desktop_default_applications.schemas evince-thumbnailer-comics.schemas metacity.schemas
desktop_gnome_accessibility_keyboard.schemas evince-thumbnailer-djvu.schemas nm-applet.schemas
desktop_gnome_accessibility_startup.schemas evince-thumbnailer-dvi.schemas notification-daemon.schemas
desktop_gnome_applications_at_mobility.schemas evince-thumbnailer-ps.schemas nst.schemas
desktop_gnome_applications_at_visual.schemas evince-thumbnailer.schemas rhythmbox.schemas
desktop_gnome_applications_browser.schemas evolution-mail.schemas system_dns_sd.schemas
desktop_gnome_applications_office.schemas evolution-webcal.schemas system_http_proxy.schemas
desktop_gnome_applications_terminal.schemas file-roller.schemas system_smb.schemas
desktop_gnome_applications_window_manager.schemas gcalctool.schemas vinagre.schemas
desktop_gnome_background.schemas gedit-drawspaces.schemas yelp.schemas
desktop_gnome_file_views.schemas gedit-file-browser.schemas

Solution Reinstall the offending package
I reinstalled gnome-keyring to take a look at its “.schema” only to find that the offending “gettext” tag no-longer exists. So it appears that it was a bug that has been reported and removed. So if you get this error, just reinstall the offending package and check the .schema, if it is still there, report it as a bug.

Now i’m off to remove all that nasty Gnome baggage 🙂

Complete Debian Linux Guide – On Your Desktop

There are guides that can be installed and accessed from your desktop, so no need for searching the internet to learn about Debian linux.

These multilingual guides can be installed with Synaptic or the command line:

debian-reference - metapackage to install (all) translations of Debian Reference
debian-reference-common - Debian system administration guide, common examples
debian-reference-de - Debian system administration guide, German translation
debian-reference-en - Debian system administration guide, English original
debian-reference-es - Debian system administration guide, Spanish translation
debian-reference-fr - Debian system administration guide, French translation
debian-reference-it - Debian system administration guide, Italian translation
debian-reference-ja - Debian system administration guide, Japanese translation
debian-reference-pl - Debian system administration guide, Polish translation
debian-reference-pt-br - Debian system administration guide, Portuguese translation
debian-reference-zh-cn - Debian system administration guide, Chinese(CN) translation
debian-reference-zh-tw - Debian system administration guide, Chinese(TW) translation

For example, I typed this in the terminal (and hit “enter”):
sudo apt-get install debian-reference-common debian-reference-en

Then once it was installed, I typed this in the terminal (and hit “enter”)
debian-reference

Then the complete Debian Reference Guide opened in my Chrome webbrowser. How cool is that ?!

Bind9 listen on IpV4 only – Disable IpV6

For whatever motive, and until IpV6 is fully adopted, you get speed increases on networks and internet by disabling IpV6 lookups wherever you can. This is how to disable IpV6 in Bind9

Login to your server as root and edit the bind9 file:

vim /etc/default/bind9

IPv4 only:

# run resolvconf?
RESOLVCONF=yes
# startup options for the server
OPTIONS=”-4 -u bind”

IPv6 only:

# run resolvconf?
RESOLVCONF=yes
# startup options for the server
OPTIONS=”-6 -u bind”

Once you have edited the bind9  file and chosen either IpV4 or IpV6, you need to restart the BIND service:

/etc/init.d/bind9 restart

Installing Status.Net (identi.ca) on a Hosted Server

Identi.ca and Status.net

I spend a lot of time chatting on identi.ca and saw a lot of remote instances linking in. Many were from the status.net domain where you can get your own microblog hosted by them. I tried this but kept going back to identi.ca, then realised you can download and install your own status.net instance.

Installaholic

There are many things I like to do, but installing stuff is what I have always liked about both Linux and Servers. Over the years I have installed and hosted practically every type of forum/blog/cms software. So methinks cool!, i’m gonna get me one of those! 🙂

Preparation

I’d already installed and setup a status.net instance on my home and work servers, so decided to install one at my LxH domain for myself and a few buddies. A bit of trial and error lead me to opt for a subDIRECTORY this time over a subDOMAIN. I think the best place for any site is at your host’s root or /var/www unless you are prepared to fiddle with htaccess files and other settings which may need to be redirected.

1. First I logged in to my hosting panel. My host is ICDSoft.com (but more about them later).

2. I decided to call my microblog “lxhica”, yeah, lxh + my favourite microblog site identI.CA 🙂

3. I created a subdirectory and database called lxhix¡ca, then I went to status.net downloads and downloaded the package from here (currently version 0.9.7fix1): http://status.net/download

4. Next I unpacked the tar.gz, connected to my host via ftp and uploaded the contents of the unpacked status.net directory to my newly created /www/www/lxhica directory on my server, and I was ready to go to my browser and navigate to the http://richs-lxh.com/lxhica address and begin the install.

A couple of things

1. Do the installation step-by-step and make sure you have the “fancy-urls” enabled at the beginning. If you don’t, and try to enable them afterwards, you are going to get get grief if you have already created accounts “before” they were enabled. With the fancy urls you get the mystatus.net/you and mystatus.net/group/mygroup links instead of numbers.

http://status.net/wiki/Download

2. Check to make sure your host has everything that status.net needs to run properly. Mainly Php Pear Modules,  Crypt_RSA and bcmath or gmp. If you aren’t sure, ask your host’s support team.

Finally

I Would like to say thanks to the ICDsoft Sure Support team who are second to none in my opinion. And also JordanC at status.net for the amazing assistance they gave me. You can see the support thread here:

http://forum.status.net/discussion/1578/solved-500-error-remote-postinggroups-identica-from-hosted-status.net

Solution Asterisk: manager.c: 127.0.0.1 tried to authenticate with nonexistent user ‘user’

If you get this error message with your Asterisk install, it’s because you have installed some kind of remote gui web manager, such as the op-panel.

manager.c: 127.0.0.1 tried to authenticate with nonexistent user ‘user’

The reason is because ot is trying to login with “user” + “secret” as a password and you haven’t yet added it to /etc/asterisk/manager.conf

So edit like this:

vim /etc/asterisk/manager.conf

Which should only have:

;
; Asterisk Call Management support
;

; By default asterisk will listen on localhost only.
[general]
enabled = yes
port = 5038
bindaddr = 127.0.0.1

; No access is allowed by default.
; To set a password, create a file in /etc/asterisk/manager.d
; use creative permission games to allow other serivces to create their own
; files
include “manager.d/*.conf”

Edit it so it looks like this with “user” added:

;
; Asterisk Call Management support
;

; By default asterisk will listen on localhost only.
[general]
enabled = yes
port = 5038
bindaddr = 127.0.0.1

[user]
secret = secret
deny = 0.0.0.0/0.0.0.0
permit = 127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

; No access is allowed by default.
; To set a password, create a file in /etc/asterisk/manager.d
; use creative permission games to allow other serivces to create their own
; files
include “manager.d/*.conf”

Now reload asterisk:

/etc/init.d/asterisk reload

And connect:

asterisk -r

And it should tell you that “user” has logged in successfully on 127.0.0.1

How to BBC iPlayer outside UK with Chrome

BBC iPlayer Howto-s
The LxH Planet just caught a feed from Kevie on how to download and save TV shows from the BBC iPlayer and I recall an outdated Howto I did a while ago on getting past the BBC’s IP address filter that blocks non UK web surfers before.

On Google Chrome
So I decided to do a Google Chrome version of the older howto as I don’t use Firefox nowadays.

1. Got to the Google Web Store and install the Proxy Switchy plugin
https://chrome.google.com/webstore/detail/caehdcpeofiiigpdhbabniblemipncjj?hl=en-US

2. Once installed, a Tab will open with Proxy Switchy setup. Add a new profile called “iPlayer”, and put the ip of a free UK proxy service and add port 80. ie. 91.198.27.139 _ 80

Getting lucky with Proxy Servers
*NOTE* The BBC isn’t stupid and are well aware fo proxy/vpn services and servers who abuse them by providing non-Uk access to their media. Some proxys are slow, others will have already been blocked, so it’s usually a game of proxy roulette to get a good one. 🙂

Having said that, combined with Kevie’s Howto which only downloads the streamed data, speed is irrelevant, as once it’s finished downloading you can watch it then.

Google “Free+UK+Proxy+Server” and yo’ll gte loads to choose from such as: http://www.freewebproxylist.com/UK_WebProxies.html

Howto install Creepy Social Stalker app on Crunchbang Linux

Get and install Creepy

1. Download the .deb file from here:
https://github.com/ilektrojohn/creepy/downloads

2. Use dpkg for first install run
Creepy needs a few dependencies, so first try and install with dpkg, and then move onto phase 2.

sudo dpkg -i creepy_0.1.92-1ubuntu1_all.deb

3. This will fail due to a lack of dependencies, so go get them:
Update apt first:

sudo apt-get update && sudo apt-get upgrade

Now get your dependencies:

sudo apt-get -f install

4. Now we can install Creepy:

sudo dpkg -i creepy_0.1.92-1ubuntu1_all.deb

Now hit Alt+F2 and run “creepymap”.

You will first have to allow it to connect to your Twitter account, (Settings, Authorize Creepy) where you will be given a special key which you need to copy and paste. Once that’s done, you are ready to start stalking your contacts. Mwahahahaha!

Solution Vncviewer -via ssh tunnel with Vinagre

Vncviewer remote desktop connection
At work if I have to connect to a client’s Windows machine, I used to go in with Vncviewer through a ssh tunnel with the –via option like this:

vncviewer -via clienthostorIP usercomputername:0

No Scaling with Vncviewer
The other day I cam up against a client with Windows 7 and an enormous screen and found I couldn’t scale it small enough to not have to scroll up and down, left and right every 5 minutes to click on the task bar etc.

Vinagre
My boss suggested Vinagre so I had a Google for vinagre+vnc+ssh+scaling and found it has scaling, and has recently added ssh tunneling as an extra option for the Vnc connection.

Well, no matter what I tried I couldn’t get it to connect via vnc with the ssh tunnel option so I came up with a workaround. Just open a ssh tunnel first, and then connect with Vinagre.

Open two tabs or two screens in your Terminal
Tab/Screen 1: open a ssh connection from your clienthostIP to localhost:

ssh -C -L 5901:usercomputername:5900 clienthostorIP

Tab/Screen 2: Open vinagre against localhost:

vinagre localhost:1

Now you can connect to your client with Vinagre via a ssh tunnel and have access to scaling etc.

Perl script to import posts from WordPress to Whird blog

Just as a personal project with Perl and Mysql, I decided to start working on a Perl script to import posts from my WordPress blog to my Whird blog.

Whird
Whird was designed by Corenominal, the Crunchbang Linux head developer, and it looked like a nice platform so I installed it to use as a personal blog and leave the WordPress blog for Linux related posts.
It occurred to me that I may like to import some non-linux posts from WordPress, and that’s where my project began.

Perl vs Php
Although I love Perl, importing data from one site to another is far better suited to Php, something which Corenominal agreed with me on, but I decided to use Perl basically because, to me, Perl is king.

I would highly recommend Whird if you are looking for a new blogging platform which is light, fast, and offers you complete control over the design.

The script below was tested on my localhost installs and imported all the WordPress posts to Whird perfectly. However, it still needs some work to also include attachments, tags and comments. It’s also a vast improvement to my original script which was importing the posts from a wordpress.sql dump instead of the database-to-database connections.

#!/usr/bin/env perl
#########################################################
# SCRIPT TO IMPORT WORDPRESS POSTS TO WHIRD
# BY richs scadding - http://debianandi.blogspot.com
#########################################################
use strict;
use warnings;
use DBI;
use DBD::mysql;
#use Mysql;
#########################################################
# ENTER YOUR DATABASE DETAILS
# Assumes whird and wordpress databases are on same host
#########################################################
my $host = "localhost";
my $dbase = "whird";
my $dbase_orig = "wordpress";
my $login = "rich";
my $pw = "4321";
#########################################################
# GET POSTS FROM WORDPRES AND INSERT THEM INTO WHIRD
#########################################################
my $dbh=DBI->connect("dbi:mysql:$dbase:$host", $login, $pw);
my $dbhorig=DBI->connect("dbi:mysql:$dbase_orig:$host", $login, $pw);
my $sthorig = $dbhorig->prepare("select * from wp_posts");
$sthorig->execute;
while (my $ref = $sthorig->fetchrow_hashref) {
my $sql = "insert into whird_content (_date, _title, _excerpt, _content, _slug, _type) values (".$dbh->quote($ref->{post_date}).", ".$dbh->quote($ref->{post_title}).", ".$dbh->quote($ref->{post_excerpt}).", ".$dbh->quote($ref->{post_content}).", ".$dbh->quote($ref->{post_name}).", ".$dbh->quote($ref->{post_type}).")";
$dbh->do($sql);
}
$sthorig->finish;
$dbh->disconnect();
$dbhorig->disconnect();

Speed up Debian/Crunchbang dns name resolution: Faster Internet

This is just a little tip for those who don’t know about it yet. You may find that your internet connection is a bit slow, or your browser takes a while to connect to certain websites. Well this little bit of editing will provide you with a noticeable difference in speed when browsing the internet.

The problem lies in /etc/nsswitch.conf, so we just edit one line:
Comment out the “hosts:” line, and a new line minus “mdns4_minimal [NOTFOUND=return]” and “mdns4”, so that it only reads “files” and “dns”. [see below]

————————————————————————–
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference’ and `info’ packages installed, try:
# `info libc “Name Service Switch”‘ for information about this file.

passwd: compat
group: compat
shadow: compat

#hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
hosts: files dns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files

netgroup: nis
—————————————————————————-

*Note* It’s always good practice to comment out and rewrite any changes you make on any system file, just in case you need to revert back to the default settings for any reason.

How to remove Captcha from Phpmotion v3

Video site for personal videos
I have been looking around for a Youtube style video script for a while, and after trying a few, including Joomla and WordPress with video plugins, I decided to give Phpmotion a go. The main reason is that I want a site that will just play local avi/divx/mpg/mp4 videos from a local /videos directory, NOT from Youtube and other “hosted” video sites.

Problems
Phpmotion has caused me no end of problems so far, but i’m intending to see it through, as it is quite a nice site once you hack it to get it working.

Squeeze and Php 5.3 –> Lenny 5.2 and Php 5.2
1. Doesn’t support Php 5.3 yet, which is a pain as we have just upgraded all our work and home servers to Debian Squeeze, so I had to install a Debian Lenny on our work Kvm machine. Also it doesn’t look like the Phpmotion developer is going to upgrade any time soon: http://phpmotion.com/forum/index.php?topic=19028.0

Captcha is borked
2. The Captcha on phpmotion is borked, and there are a lot of support requests on the forums regarding this problem:
Google: site:phpmotion.com/forum captcha+doesn’t+show
The solution offered by the devs is “Just downgrade to Php 5.2”.
It appears the best way is to just remove it. (Hence the title of this post)

X doesn’t exist on this server
3. As I type, there are still files and directories that are be reported as not found, when clearly they are there, and have the correct permissions.

a) I created a new test account, logged in (account exists), then went to my profile http://domain/phpmotion/members/test only to get a 404 error page:
Not Found
The requested URL /phpmotion/members/test was not found on this server.

b) As administrator, I tried to upload a test video, only to be told that /cgi-bin/uu_upload.pl doesn’t exist, as you can see below it plainly does!.
test@lennyapache:/var/www/phpmotion/cgi-bin$ ls
audio uu_default_config.pm uu_ini_status.pl uu_lib.pm uu_upload.pl

c) There is more, profile directories that don’t exist, upload directories that don’t exist, phpmotion files that don’t exist etc etc. But anyway, i’ll keep hacking until I get some sort of functionality.

PS: If you want to have a Captcha-free Phpmotion, rename this “inner_signup_form.txt” to “inner_signup_form.htm” and upload it to your “phpmotion/themes/default/templates” directory 🙂

Shopt for Bash – Cdspell for cd dir change mistypes

What is shopt? A marvellous BASH builtin command, that’s what it is!

I’ve added the whole shopt list to my .bashrc below, but i’m only going to talk about CDSPELL for cd dir change mistypes. One thing to remember is that if you issue a shopt command manually as a user or root, then close your terminal, it will revert back to OFF. I have added the shopt options to my .bashrc so that I can enable and disable the specific options i need. There are a few that are enabled by default, so if you decide you want them disabled permanently you just add a -u switch before them.
See the syntax below for enabling and disabling shopt options.

Issuing shopt SET or UNSET commands: From http://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html

Syntax
shopt [-pqsu] [-o] [optname …]

Options
-s Enable (set) each optname

-u Disable (unset) each optname.

-p Display a list of all settable options, with an indication of
whether or not each is set. The output is displayed in a form
that may be reused as input. (-p is the default action)

-q Suppresses normal output; the return status indicates whether the optname
is set or unset. If multiple optname arguments are given with `-q’,
the return status is zero if all optnames are enabled; non-zero otherwise.

-o Restricts the values of optname to be those defined for the `-o’ option to
the set builtin.

The cdspell bash builtin:
As you can see below, apart from the autoset options, I have manually set cdspell. If you spend a lot of time navigating directories via the terminal, you will often make spelling mistakes like “/ect”or “/Etc” instead of “/etc”, with cdspell enabled, bash will autocorrect the mistake and allow you to hit enter and still get to your destination. This saves a lot of time having to keep going back back and correcting directory paths.

My .bashrc shopt section:
############################
#
# SHOPT AUTOSTARTS
#
############################
# autocd
# cdable_vars
shopt -s cdspell # on MANUAL
#checkhash off
#checkjobs off
#checkwinsize on AUTO
#cmdhist on AUTO
#compat31 off
#compat32 off
#compat40 off
#dirspell off
#dotglob off
#execfail off
#expand_aliases on AUTO
#extdebug off
#extglob on AUTO
#extquote on AUTO
#failglob off
#force_fignore on AUTO
#globstar off
#gnu_errfmt off
#histappend on AUTO
#histreedit off
#histverify off
#hostcomplete off
#huponexit off
#interactive_comments on AUTO
#lithist off
#login_shell off
#mailwarn off
#no_empty_cmd_completion off
#nocaseglob off
#nocasematch off
#nullglob off
#progcomp on AUTO
#promptvars on AUTO
#restricted_shell off
#shift_verbose off
#sourcepath on AUTO
#xpg_echo off
############################

Perl Functions to memorize

Remembering Perl functions
Been working my way through this Perl Functions list for a while now. I just take a “Function of the day”, do a search on perldoc or man, and put together a couple of basic for each one.

As the old adage goes:

I hear and I forget. I see and I remember. I do and I understand.” — Confucius

Other Resources:
Sometimes you’ll get something that’s a bit vague, and neither man nor perldoc gives you enough to fully understand the power of a certain function. I’ve got a collection of Perl books and .pdfs, but I still take advantage of a great resource when i’m looking for working examples of Perl-foo. Perl Monks is an awesome community of Perl…. er monks 🙂
http://www.perlmonks.org/

Here’s a few Perl Functions to memorize:

Scalar manipulation
chomp, chop, chr, crypt, hex, index, lc, lcfirst, length, oct, ord, pack, q//, qq//, reverse, rindex, sprintf, substr, tr///, uc, ucfirst, y///

Regular expressions and pattern matching
m//, pos, qr//, quotemeta, s///, split, study

Numeric functions
abs, atan2, cos, exp, hex, int, log, oct, rand, sin, sqrt, srand

Array processing
pop, push, shift, splice, unshift

List processing
grep, join, map, qw//, reverse, sort, unpack

Hash processing
delete, each, exists, keys, values

Input and output
binmode, close, closedir, dbmclose, dbmopen, die, eof, fileno, flock, format, getc, print, printf, read, readdir, rewinddir, seek, seekdir, select, syscall, sysread, sysseek, syswrite, tell, telldir, truncate, warn, write

Fixed-length data and records
pack, read, syscall, sysread, syswrite, unpack, vec

Filehandles, files, and directories
chdir, chmod, chown, chroot, fcntl, glob, ioctl, link, lstat, mkdir, open, opendir, readlink, rename, rmdir, stat, symlink, sysopen, umask, unlink, utime

Flow of program control
caller, continue, die, do, dump, eval, exit, goto, last, next, redo, return, sub, wantarray

Scoping
caller, import, local, my, package, use

Miscellaneous
defined, dump, eval, formline, local, my, prototype, reset, scalar, undef, wantarray

Processes and process groups
alarm, exec, fork, getpgrp, getppid, getpriority, kill, pipe, qx//, setpgrp, setpriority, sleep, system, times, wait, waitpid

Library modules
do, import, no, package, require, use

Classes and objects
bless, dbmclose, dbmopen, package, ref, tie, tied, untie, use

Low-level socket access
accept, bind, connect, getpeername, getsockname, getsockopt, listen, recv, send, setsockopt, shutdown, socket, socketpair

System V interprocess communication
msgctl, msgget, msgrcv, msgsnd, semctl, semget, semop, shmctl, shmget, shmread, shmwrite

Fetching user and group information
endgrent, endhostent, endnetent, endpwent, getgrent, getgrgid, getgrnam, getlogin, getpwent, getpwnam, getpwuid, setgrent, setpwent

Fetching network information
endprotoent, endservent, gethostbyaddr, gethostbyname, gethostent, getnetbyaddr, getnetbyname, getnetent, getprotobyname, getprotobynumber, getprotoent, getservbyname, getservbyport, getservent, sethostent, setnetent, setprotoent, setservent

Time
gmtime, localtime, time, times

Script to edit first letters of multiple files

This is a simple one, and there are just loads of ways to replace lines/characters/spaces with Perl one-liners and Bash.

The main point of this script is when I install a new distro and want to shutdown services that startup automatically on each run level, for Ubuntu in the directories rcS.d, rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d

Each item begins with an “S” for START or a “K” for KILL with a number that pertains to the order of priority (ie S25bluetooth). And depending on the run-level, and how many apps you have installed, this could be 10-20 services launched at boot.

#!/bin/bash
############################################
#KILL STARTUP SERVICES
############################################
#By richs-lxh – http://richs-lxh.com
############################################
#CHANGE “ONLY” THE “FIRST” CHARACTERS AT THE
#BEGINNING OF A FILE (EG FILES S20* to K20* )
############################################
for i in S* ;
do mv “$i” “${i//S/K}”;
done

So if you want to kill all the processes that start with S20, it would be:
for i in S20* ;
do mv “$i” “${i//S20/K20}”;
done

The reason I posted this little script is that when you Google search for scripts and one-liners to edit filenames via the CLI, practically every guide offers newbies an example of how to change the “suffixes” (ie replace .html with .htm) but no clue on how to batch-replace the beginning of filenames.

Squeeze and IpV6 mean a fun 2011 for Debian server admins

Bye bye IpV4
Well, it looks like our good old fashioned, 4-digited IP addresses are about to meet their maker and go to the digit matrix in the sky for good. There has been a lot of talk about the v4 to v6 doomsday, but everybody was hanging on until the last minute before making any changes.

I for one have spent years removing IpV6 from the network settings on my Debian desktop as there was a notable speed difference. But that was only because there was slowdown caused by a search for non-existent IpV6 addresses before the IpV4 search. Now it seems this will no longer be necessary as everybody slowly converts to IpV6.

2011 – Big year for Debian server admins
I work as a Debian server Admin, and 2011 is going to be a memorable year for my colleagues and I. Firstly, Debian Squeeze (6.0) was released as “Stable” yesterday (Feb 6th), which means we will start upgrading all our clients’ servers pretty soon, although we do still have a year of Security updates. And now we are facing more future changes with the changeover to IpV6.

Google and World IpV6 Day

In the same way your phone is associated with a unique number, your computer is assigned a unique Internet Protocol (IP) address when you connect to the Internet. The current protocol, IPv4, allows for approximately 4 billion unique addresses—and that number is about to run out.

This morning the Internet Corporation for Assigned Names and Numbers (ICANN) announced (PDF) that it has distributed the last batch of its remaining IPv4 addresses to the world’s five Regional Internet Registries, the organizations that manage IP addresses in different regions. These Registries will begin assigning the final IPv4 addresses within their regions until they run out completely, which could come as soon as early 2012.

As the last blocks of IPv4 addresses are assigned, adoption of a new protocol—IPv6—is essential to the continued growth of the open Internet. IPv6 will expand Internet address space to 128 bits, making room for approximately 340 trillion trillion trillion addresses (enough to last us for the foreseeable future).

Google, along with others, has been working for years to implement the larger IPv6 format. They’re also participating in the planned World IPv6 Day, scheduled for June 8, 2011. On this day, all of the participating organizations will enable access to as many services as possible via IPv6.

Today’s ICANN announcement marks a major milestone in the history of the Internet. IPv6, the next chapter, is now under way.
http://googleblog.blogspot.com/2011/02/ipv6-marks-next-chapter-in-history-of.html

Debian 6.0 "Squeeze" Released – New Stable

Great news for Desktop users, the fun begins for Debian server admins

Desktop Users
Well the day all Debian and Debian derivative users (Crunchbang Linux) have been waiting for has finally arrived, a shiny new Debian Stable release. Desktop users get to dist-upgrade to a plethora of updates, but what about all the Linux Sysadmins out there.

Server Administrators
I work for a company in Barcelona, Spain (Eurogaran Informatica) who supply Debian servers with everything from MySQL Clusters, RAID, Asterisk PBX systems with Automated dialing, running our clients’ Java based web applications, firewalls, mail servers, web-servers, the list goes on, and we have obviously been talking about the impending upgrades.

Debian Security Updates
The good news is, that anybody running Lenny still has a year of security updates which allows plenty of time to make the transition. The only thing I am worried about is if our clients’ applications will bee 100% forward compatible with the new versions that have arrived with Squeeze, or if we will have to downgrade anything.

New Version Problems (Php5.3)
I’ve already noticed a few php websites which aren’t compatible with php-5.3, ie PHPmotion. This was only a testsite I was playing with last week, and obviously won’t be offering to any of our clients, but it is a valid example of how even minor upgrades can effect a company.

I’ll be posting any major Upgrade headaches in the weeks to come, and i’ll certainly be keeping my eye on the Debian mailing lists for Apache/Mysql/Cluster/Asterisk problems.

Any way, it was great news to wake up and read this today 🙂

—————————————————————————————————————-

Debian 6.0 Squeeze released

February 6th, 2011

After 24 months of constant development, the Debian Project is proud to present its new stable version 6.0 (code name Squeeze). Debian 6.0 is a free operating system, coming for the first time in two flavours. Alongside Debian GNU/Linux, Debian GNU/kFreeBSD is introduced with this version as a technology preview.

Debian 6.0 includes the KDE Plasma Desktop and Applications, the GNOME, Xfce, and LXDE desktop environments as well as all kinds of server applications. It also features compatibility with the FHS v2.3 and software developed for version 3.2 of the LSB.

Debian runs on computers ranging from palmtops and handheld systems to supercomputers, and on nearly everything in between. A total of nine architectures are supported by Debian GNU/Linux: 32-bit PC / Intel IA-32 (i386), 64-bit PC / Intel EM64T / x86-64 (amd64), Motorola/IBM PowerPC (powerpc), Sun/Oracle SPARC (sparc), MIPS (mips (big-endian) and mipsel (little-endian)), Intel Itanium (ia64), IBM S/390 (s390), and ARM EABI (armel).

Debian 6.0 Squeeze introduces technical previews of two new ports to the kernel of the FreeBSD project using the known Debian/GNU userland: Debian GNU/kFreeBSD for the 32-bit PC (kfreebsd-i386) and the 64-bit PC (kfreebsd-amd64). These ports are the first ones ever to be included in a Debian release which are not based on the Linux kernel. The support of common server software is strong and combines the existing features of Linux-based Debian versions with the unique features known from the BSD world. However, for this release these new ports are limited; for example, some advanced desktop features are not yet supported.

Another first is the completely free Linux kernel, which no longer contains problematic firmware files. These were split out into separate packages and moved out of the Debian main archive into the non-free area of our archive, which is not enabled by default. In this way Debian users have the possibility of running a completely free operating system, but may still choose to use non-free firmware files if necessary. Firmware files needed during installation may be loaded by the installation system; special CD images and tarballs for USB based installations are available too. More information about this may be found in the Debian Firmware wiki page.

Furthermore, Debian 6.0 introduces a dependency based boot system, making system start-up faster and more robust due to parallel execution of boot scripts and correct dependency tracking between them. Various other changes make Debian more suitable for small form factor notebooks, like the introduction of the KDE Plasma Netbook shell.

This release includes numerous updated software packages, such as:

KDE Plasma Workspaces and KDE Applications 4.4.5
an updated version of the GNOME desktop environment 2.30
the Xfce 4.6 desktop environment
LXDE 0.5.0
X.Org 7.5
OpenOffice.org 3.2.1
GIMP 2.6.11
Iceweasel 3.5.16 (an unbranded version of Mozilla Firefox)
Icedove 3.0.11 (an unbranded version of Mozilla Thunderbird)
PostgreSQL 8.4.6
MySQL 5.1.49
GNU Compiler Collection 4.4.5
Linux 2.6.32
Apache 2.2.16
Samba 3.5.6
Python 2.6.6, 2.5.5 and 3.1.3
Perl 5.10.1
PHP 5.3.3
Asterisk 1.6.2.9
Nagios 3.2.3
Xen Hypervisor 4.0.1 (dom0 as well as domU support)
OpenJDK 6b18
Tomcat 6.0.18
more than 29,000 other ready-to-use software packages, built from nearly 15,000 source packages.
Debian 6.0 includes over 10,000 new packages like the browser Chromium, the monitoring solution Icinga, the package management frontend Software Center, the network manager wicd, the Linux container tools lxc and the cluster framework Corosync.

With this broad selection of packages, Debian once again stays true to its goal of being the universal operating system. It is suitable for many different use cases: from desktop systems to netbooks; from development servers to cluster systems; and for database, web or storage servers. At the same time, additional quality assurance efforts like automatic installation and upgrade tests for all packages in Debian’s archive ensure that Debian 6.0 fulfils the high expectations that users have of a stable Debian release. It is rock solid and rigorously tested.

Starting from Debian 6.0, the Custom Debian Distributions are renamed to Debian Pure Blends. Their coverage has increased as Debian 6.0 adds Debian Accessibility, DebiChem, Debian EzGo, Debian GIS and Debian Multimedia to the already existing Debian Edu, Debian Med and Debian Science pure blends. The full content of all the blends can be browsed, including prospective packages that users are welcome to nominate for addition to the next release.

Debian may be installed from various installation media such as Blu-ray Discs, DVDs, CDs and USB sticks or from the network. GNOME is the default desktop environment and is contained on the first CD. Other desktop environments — KDE Plasma Desktop and Applications, Xfce, or LXDE — may be installed through two alternative CD images. The desired desktop environment may also be chosen from the boot menus of the CDs/DVDs. Again available with Debian 6.0 are multi-architecture CDs and DVDs which support installation of multiple architectures from a single disc. The creation of bootable USB installation media has also been greatly simplified; see the Installation Guide for more details.

In addition to the regular installation media, Debian GNU/Linux may also be directly used without prior installation. The special images used, known as live images, are available for CDs, USB sticks and netboot setups. Initially, these are provided for the amd64 and i386 architectures only. It is also possible to use these live images to install Debian GNU/Linux.

The installation process for Debian GNU/Linux 6.0 has been improved in various ways, including easier selection of language and keyboard settings, and partitioning of logical volumes, RAID and encrypted systems. Support has also been added for the ext4 and Btrfs filesystems and — on the kFreeBSD architecture — the Zettabyte filesystem (ZFS). The installation system for Debian GNU/Linux is now available in 70 languages.

Debian installation images may be downloaded right now via BitTorrent (the recommended method), jigdo or HTTP; see Debian on CDs for further information. It will soon be available on physical DVD, CD-ROM and Blu-ray Discs from numerous vendors, too.

Upgrades to Debian GNU/Linux 6.0 from the previous release, Debian GNU/Linux 5.0 (codenamed Lenny), are automatically handled by the apt-get package management tool for most configurations, and to a certain degree also by the aptitude package management tool. As always, Debian GNU/Linux systems may be upgraded painlessly, in place, without any forced downtime, but it is strongly recommended to read the release notes as well as the installation guide for possible issues, and for detailed instructions on installing and upgrading. The release notes will be further improved and translated to additional languages in the weeks after the release.

About Debian

Debian is a free operating system, developed by thousands of volunteers from all over the world who collaborate via the Internet. The Debian project’s key strengths are its volunteer base, its dedication to the Debian Social Contract and Free Software, and its commitment to provide the best operating system possible. Debian 6.0 is another important step in that direction.

Contact Information

For further information, please visit the Debian web pages at http://www.debian.org/ or send mail to .

Speedkill – Perl Script to hunt and kill selected PIDs

If you ever run a selection of applications or processes and regularly get lock-ups due to a lack of processing power or RAM. This script allows you to add a selection of non-essential apps to a list which can be knocked-out if resources are running low.

Just copy and paste this script to a file called “speedkill” in /usr/local/bin or your /home/user/bin, make it executable, and then you can run it from the terminal if things start to get a bit “iffy” 🙂 Just edit the line “my $processes = “google-chrome claws-mail conky volwheel”;” and add any apps you can do without.


###########################################
# DESCRIPTION:
#
# This script will kill a bunch of
# expendible processes if your system
# gets frozen.
#
###########################################
# PERL MODULES TO USE
###########################################
# NONE
#use NOTHING
###########################################
# Debugging:
use strict;
use warnings;
###########################################
#Let's tell the user the carnage they are about to inflict
#
print "Hunting down enemy PIDs...\n";
#
#Then we need to find the PIDs of expendable apps

#for my $file (@ARGV) {
my $processes = "google-chrome claws-mail conky volwheel";
my @processes = split (" ", $processes);
for my $process (@processes) {
open (PID, "pidof $process |");
while ($_ = ) {
my @list = split (" ", $_);
for my $pid (@list) {
print "Killing pid $pid ($process)\n";
system ("sudo kill -9 $pid");
}
}
close PID;
}

print "Like lambs to the slaughter!\n";

Adding Windows guides to my Linux blog

I k now it may seem strange to to start seeing Windows based Howto guides on a predominantly Linux blog, but the truth is after so long without having to fix Windows machines I am gradually forgetting all the old tweaks and fixes that come part and parcel with running a slow, inconsistent, unreliable operating system 🙂

I work as a Debian server IT admin for a company with various international clients, and although we provide and maintain Debian based clusters and servers, we also occasionally offer general support for certain clients. It’s not the norm (thankfully), but we do also get requests to help out with Windows desktop and server problems.

Hence the reason I will be adding a few tweaks and guides to my blog for safe-keeping and quick reference.

Up until about 2000/2001 I had Windows (Xp) on my laptop and a few other machines, and I constantly strived for better performance and security. Talking of performance, I managed to get Xp to run quite well on an old Toshiba Satellite that came with Windows ME installed. It only had a 650hz processor and 64Mb RAM, and somebody made the mistake of commenting that it would be “impossible” to run Xp on that laptop. Well, it only stands to reason that I would eventually end-up running and working with Linux, as the tweaking/hacking bug took hold.

Funnily enough that little Toshiba Satellite survived 6 years of Linux Distro-Tests and finally met it’s demise in 2007 *lump in throat, tear in eye* It survived Mandrake, Suse, Debian and from 2004 (Hoary) to 2007 (Dapper) was running nicely on Ubuntu, although it had multiple partitions on its little 6Gb hard-drive for distro tests.

Before changing to Linux, I used to tweak the hell out of Windows and regularly had to reinstall or create partitioned test installs, and it’s amazing the little tricks you learn with scripts, apps, editing the registry and tweaking the Windows default services. I used to know most of them by heart, but unfortunately (?), over the years I have forgotten many of those little Gems and have decided I need to have a little storage area on my blog to provide support for the uncleaned masses who still use this poor excuse for an operating system.

Incidentally, I do have an Xp install at home that is only used as a gaming machine, it does NOT have an internet connection, and only serves one purpose 😉

So there you go, an explanation as to why Windows material will be cropping up on my Linux blog,

Windows longer http keep-alive timeout

This article describes how to change the default HTTP keep-alive value

When Internet Explorer establishes a persistent HTTP connection with a Web server (by using Connection: Keep-Alive headers), Internet Explorer reuses the same TCP/IP socket that was used to receive the initial request until the socket is idle for one minute. After the connection is idle for one minute, Internet Explorer resets the connection. A new TCP/IP socket is used to receive additional requests. You may want to change the HTTP KeepAliveTimeout value in Internet Explorer.

If either the client browser (Internet Explorer) or the Web server has a lower KeepAlive value, it is the limiting factor. For example, if the client has a two-minute timeout, and the Web server has a one-minute timeout, the maximum timeout is one minute. Either the client or the server can be the limiting factor.

By default, Internet Explorer has a KeepAliveTimeout value of one minute and an additional limiting factor (ServerInfoTimeout) of two minutes. Either setting can cause Internet Explorer to reset the socket.

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows

You may have to increase the default time-out value for persistent HTTP connections in Internet Explorer if you are using a Web program that must communicate with Internet Explorer over the same TCP/IP socket after one idle minute. To change the default time-out value for persistent HTTP connections in Internet Explorer, add a DWORD value that is named KeepAliveTimeout to the following registry key, and then set its value data to the time (in milliseconds) that you want Internet Explorer to wait before resetting an idle connection:

To do this, follow these steps:
1. Click Start, click Run, type regedit, and then click OK.
2. Locate and then click the following key in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings
3. On the Edit menu, point to New, and then click DWORD Value.
4. Type KeepAliveTimeout, and then press ENTER.
5. On the Edit menu, click Modify.
6. Type the appropriate time-out value (in milliseconds), and then click OK. For example, to set the time-out value to two minutes, type 120000.
Restart Internet Explorer.

*NOTE*
If you set the KeepAliveTimeout value to less than 60,000 (one minute), you may have problems communicating with Web servers that require persistent HTTP connections. For example, you may receive a “Page cannot be displayed” error message.

*NOTE 2*
If you must have a KeepAliveTimeout value higher than 120000 (two minutes), you must create an additional registry key and set its value equal to the KeepAliveTimeout value that you want. The additional registry key is ServerInfoTimeout. It is a DWORD with a value (in milliseconds) and in the same location as KeepAliveTimeout.

For example, to use a three-minute KeepAliveTimeout value, you must create the following registry keys:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings

KeepAliveTimeout DWORD value 180000 (in milliseconds)
ServerInfoTimeout DWORD value 180000 (in milliseconds)

By default, HTTP 1.1 is enabled in Internet Explorer except when you establish an HTTP connection through a proxy server. When HTTP 1.1 is enabled, HTTP connections remain open (or persistent) by default until the connection is idle for one minute or until the value that is specified by the KeepAliveTimeout value in the registry is reached. You can modify HTTP 1.1 settings in Internet Explorer by using the Advanced tab in the Internet Options dialog box.

Simple Perl Ping Script – Local and Remote

A Perl Beginner Template to play with
This is just a little script I slung together to play with LWP::SIMPLE and NET::PING Perl modules. The main idea is to get info from a website (dyndns.org), clean it up and use it for either input or output. I also wanted a few bits of code for user (choice) input as well. It’s another base that a beginner can build on.

Ask and Go Fetch
It asks for input and based on the reply performs one of two different tasks and offers some info. Nothing more, nothing less. However, if you look at the actions it performs, you will see that this basic script can be adapted to acquire any type of information from any website, which in turn can be used for a completely different script.

#!/usr/bin/perl
#
# This script will get a local or remote IP, ping the address and tell you if the ADSL line is up
# By Rich Scadding  @ http://debianandi.blogspot.com
#
#######################
# PERL MODULES TO USE #
#######################
# Ping Module
use Net::Ping;
# Get Html
use LWP::Simple;# Debian apt-get install libwww-perl
# Debugging
#use strict; (commented as it throws up errors)
use warnings;
#######################

# Check if an ip adress is alive
print “Which IP shall I check? Yours [1] Other [2]: “;
my $answer = ;
chomp $answer;
# If the idiot can’t type, tell them!
die “No, only press 1 or 2. Try again!\n” if ($answer ne “1” and $answer ne “2”);
# 2 needs an IP from the user
if ($answer eq “2”) {
print “Type the IP Address: “;
my $IP = ;
chomp $IP;
print “Checking their IP\n”;
my $p = Net::Ping->new(“icmp”);
print “$IP is alive.\n” if $p->ping($IP);
print “$IP is as dead as a Dodo.\n” unless $p->ping($IP);
$p->close();
}
# 1 will get the external IP from dyndns.org
if ($answer eq “1”) {
my $html;
$html = get( ‘http://checkip.dyndns.org&#8217; );
chomp $html;
print “Checking your IP\n”;
# Print the result from the html file
$html =~ s/.*ddress: //;
$html =~ s/<\/body.*//;
print “$html\n”;

# Remove the html tags from the message and set the resulting IP as $address
my $address = $html;
chomp $address;
$address =~ s/.*ddress: //;
$address =~ s/<\/body.*//;

# Print a ping message
print (“Pinging $address\n”);

# Ping the IP address and report if it is up
my $p = Net::Ping->new(“icmp”);
print “$address is alive.\n” if $p->ping($address);
print “$address is as dead as a Dodo.\n” unless $p->ping($address);
$p->close();
}

As I said, quite basic, and you could just manually ping an IP from the terminal, no need for a script. However, as with most scripts and one-liners, it’s about finding out how to perform certain actions which can be applied to other uses.

Simple Bash Backup Script

I often play around with little Bash scripts and Perl One-Liners in my quest to learn more. This particular script backs up specific data that I need when I reinstall an (Debian) OS.

I’ve got various versions and this is just a base (which you can add-to and play with). As always, with any code, especially Bash, there are a whole heap of ways to write backup scripts, both long and short, but this script is only intended to show newer users some basic commands, and to act as a template for further investigation.

#! /bin/bash
#
#SIMPLE BASH BACKUP SCRIPT BY RICHS-LXH
#
#SAVES FILES TO A DATED DIR ON YOUR /STORAGE PARTITION
#
#ON SCREEN MESSAGE AND LOG CREATED
echo Backing up your data…
echo Backup started `date` >> ~/backuplog
#CREATE NECESSARY FILES
cd /storage
mkdir -p backups/`date +%Y%m%d`
mkdir -p backups/tmpdata/important/
#COPY FILES YOU WANT BACKED UP
sudo cp /etc/host* backups/tmpdata/important/
sudo cp /etc/X11/xorg.conf backups/tmpdata/important/
sudo cp /etc/network/interfaces backups/tmpdata/important/
#EMPTY THE TRASH BEFORE HOME BACKUP !!!
sudo rm -rf /home/rich/.local/share/Trash/files/*
#WAIT UNTIL IT HAS FINISHED REMOVING ALL THE TRASH
wait
#COPY ENTIRE HOME DIR RECURSIVELY TO TMPDATA
sudo cp -a /home/rich backups/tmpdata/
#CD TO TMPDATA AND CREATE A COMPRESSED BACKUP TAR.GZ
cd backups/tmpdata
tar -czf /storage/backups/`date +%Y%m%d`/bkp.tar.gz *
cd ..
#REMOVE THE TEMPORARY DATA
wait
sudo rm -rf tmpdata
#WRITE A LOG AND PRINT A MESSAGE
echo Backup Finished `date` >> ~/backuplog
echo All your data successfully backed up!

Spain rejects Sinde Law

It looks like Wikileaks is making people think for once

Spain last night killed a controversial anti-P2P bill that would have made it easier to shut down websites that link to infringing content. The move was a blow to the ruling Socialist government, but it may be of even bigger concern to the US, which pushed, threatened, and cajoled Spain to clamp down on downloading. And Wikileaks can take a share of the credit for the defeat.

Known as the “Sinde law” (ley Sinde) after Spain’s current culture minister, the bill was actually an amendment to a much broader economic rescue package known as the Sustainable Economy Bill. The Sinde law would have set up a new government committee that could draw up lists of sites which largely link to infringing content. These sites would then go to a Madrid court, which would have four days to rule on whether they should be fully or partially blocked.

Spain has become notorious among rightsholders for its levels of online piracy. International music trade group IFPI said earlier this year that Spain “has one of the highest rates of illegal file-sharing in Europe” and that “sales by local artists in the top 50 have fallen by an estimated 65 percent between 2004 and 2009.”

That’s of real concern to local Spanish artists, but it’s also a big deal to Hollywood and the US music industry, which together supply plenty of the pirated fare. They’ve leaned on the US government, which has in turn leaned on Spain—and hard.

I’ve got a little list

Thanks to Wikileaks, we now have access to some of the cables sent from the US Embassy in Spain, and they show just how the US gets things done in other countries. Spanish daily El Pais reported on these cables at length and made them front-page news in Spain; for English-speaking readers, the Electronic Frontier Foundation has a helpful summary.

READ MORE on ARSTECHNICA http://arstechnica.com/tech-policy/news/2010/12/how-wikileaks-killed-spains-anti-p2p-law.ars

Debian 6.0 Squeeze to be released with complete free Linux Kernel

Debian finally provides a Stallman/Fsf friendly kernel

The Debian project has been working in removing non-free firmware from the Linux kernel shipped with Debian for the past two release cycles. At the time of the releases of Debian 4.0 Etch and 5.0Lenny, however, it was not yet possible to ship Linux kernels stripped of all non-free firmware bits. Back then we had to acknowledge that freedom issues concerning Linux firmware were not completelysorted out.

We have nonetheless kept on working on splitting away non-free bits from the Linux kernel, thanks to the work of the Debian Kernel team and various Linux upstream developers. We are proud to announce that, to the best of our knowledge, all issues are solved and that we will be able to deliver a Linux kernel which is completely Free, according to the Debian Free Software Guidelines (DFSG), with Debian Squeeze. We hereby reaffirm Free Software as one of our priorities, as documented in the Debian Social Contract.

In accordance with the Debian Social Contract, we acknowledge that some users require the use of works that do not conform to the DFSG and that those works might include non-free firmware bits. For the time being, we have added to the non-free area of our archives alternative installation images and additional packages for Debian Squeeze, that include non-free firmware bits needed to enable specific pieces of hardware. They are not part of Debian, they should be looked for explicitly by interested users, and we cannot support them to the same extent of Free firmware as we do not have access to the corresponding source code. We encourage hardware manufacturers to release only DFSG-free firmware and we cannot accept other kind of firmware as part of Debian.

From: http://www.debian.org/News/2010/20101215

Tribler decentralized P2P Torrent App on Debian Squeeze

Tribler means no more central servers or tracker downtime. You ARE the Network.

From: TorrentFreak

BitTorrent is a great technology to share files both quickly and efficiently, but like all other P2P-technologies it has an Achilles’ heel. The download process relies in part on central servers that can crash or go offline for a variety of reasons. To address this vulnerability the first truly decentralized BitTorrent/P2P client has been developed, meaning that no central trackers, or even BitTorrent search engines are required to download movies, software and music.

BitTorrent is branded as a peer-to-peer technology, but despite this label the downloading process still relies heavily on central servers. In the first place there are the BitTorrent search engines and indexes such as The Pirate Bay and isoHunt. These are needed to search for content and to grab the .torrent file one needs to download a file.

Tribler install on Debian Squeeze
I decided to give it a go on Debian Squeeze. Even though they say they are still working on the Linux version, there are some Ubuntu related .deb files available for download.

So I downloaded this file from http://tribler.org:
http://www.tribler.org/download/tribler_5.2.1-1ubuntu1_all.deb

A “dpkg -i tribler_5.2.1-1ubuntu1_all.deb” threw up dependency errors, so i issued an “apt-get -f install” to install any dependencies.

Vlc and Python-vlc
Tribler relies on VLC media player to play music and video, and as such also needs the VLC python bindings.
Unfortunately an “apt-cache search” showed me that there is no python-vlc package in the Debian Squeeze repos, so I searched Google and found an Ubuntu version here:
http://code.google.com/p/vlc-python-bindings/downloads/list
I downloaded the latest i386 version (HERE) and installed it via dpkg and then reinstalled Tribler. Everything installed nicely and I now have it up and running on my Debian Squeeze laptop.

Screenie of Trible on Debian Squeeze with OpenBox desktop


E.E.U.U deciden los derechos de autor de España – Wikileaks

¿Quien manda a España?
El Congreso de España está a punto de votar un nuevo Derecho de Autor/ Derecho de Internet muy dura. Es un secreto abierto, dice que la ley fue redactada esencialmente por los grupos de la industria Americana de trabajo con el representante comercial de EE.UU. Es decir, estan decidiendo vuestros derechos de internet, y que puedes y no puedes acceder.

El Gobierno de España decide nuestros derechos, o los E.E.U.U
Sin embargo, se pone más interesante: 115 de los cables de Wikileaks interceptado por la embajada de EE.UU. en Madrid estaban etiquetados con “KIPR” – es decir, en relación a la “propiedad intelectual” La gran pregunta ha sido: a El País, el periódico español que tiene el tesoro completo de cables de Wikileaks, los pongan en libertad a tiempo para afectar a la votación sobre la nueva ley?

Pues los E.E.U.U
Bueno, ahora que he empezado. Los primeros 35 de los 115 cables han sido liberados, y confirman la sospecha generalizada: el gobierno español y el partido de la oposición se llevó alrededor de la nariz por los representantes de EE.UU. que son la verdadera autoridad legislativa en España.

Un estado títere de EE.UU
Así que aquí está la nueva pregunta: cuando los españoles los votos del Congreso en la ley de copyright de Estados Unidos este mes, van a votar por su soberanía, o actuar como un estado títere de EE.UU.?

La prioridad que los estadounidenses otorgan a la cuestión se manifiesta en el nivel de los interlocutores elegidos. La vicepresidenta María Teresa Fernández de la Vega es uno de los primeros objetivos. Un agregado de la Embajada habla del tema con ella el 22 de febrero de 2005. El cable 27536, elaborado por el agregado al día siguiente de la conversación con De la Vega, se cierra así: “Dada la cantidad de estrellas de la industria del entretenimiento con una abierta preferencia por el Gobierno socialista (es significativo, por ejemplo, que Zapatero acudiera al equivalente español de los Oscar), es posible que este Gobierno sea especialmente sensible a hacer algo en este sector. Necesitaremos un año o así para ver si esta sensibilidad se traduce en resultados”.
El 10 de noviembre de 2005, el embajador se entrevista con la ministra de Cultura, Carmen Calvo: en el cable 45583, el propio embajador concluye que en el Gobierno español hay buenas intenciones, pero no hay resultados.

La tónica se mantiene. La potente Motion Pictures Association, que agrupa a las majors de Hollywood, presiona desde EE UU. La industria local española también se queja de la permisividad con las descargas, sobre todo la musical. En 2007 se produce el punto de inflexión: el 28 de diciembre, la delegación estadounidense en Madrid emite un cable (135868) que contiene un minucioso plan. Asunto: estrategia para los derechos de propiedad intelectual en España. El despacho despliega un detallado plan a corto, medio y largo plazo plagado de citas con responsables políticos, con mandos intermedios de los ministerios de Cultura e Industria, encuentros con las operadoras de telecomunicaciones, visitas a España de expertos norteamericanos… y anticipa, ya, la medida que hay que tomar a medio plazo: colocar a España en la lista negra.

virt-manager ERROR:root:Unable to initialize GTK: could not open display

I recently installed Kvm on my Debian server to have a play with Qemu Virtual Machines. We have this set up at work so i’m pretty familiar with the system.

However, after installing kvm, qemu, vnc4server and vnc4viewer to access my server, when I tried to run virt-manager one of two things happened.

1. As a normal user I had no privileges to create or manage VM’s
2. As root or sudo user virt-manager wouldn’t even launch from the terminal, just gave me a whole string of Gtk error messages.

virt-manager ERROR:root:Unable to initialize GTK: could not open display

So, methinks, A: I need root/sudo privileges, BUT! you NEVER, EVER run graphical apps as root, it’s a no-no.

That’s where I found the solution. To run graphical apps as root/sudo you use GKSU not SU

Solution:

sudo apt-get install gksu

sudo vim /usr/bin/virt-manager

Then in between exec and python, just add a gksudo like this:

#!/bin/sh

exec gksudo python “/usr/share/virt-manager/virt-manager.py” “$@”

Now when I run virt-manager as a normal user, everything is fine.

Error ‘unknown group ‘freerad’ in statoverride file’

Dpkg Error after removing Freeradius
I came across this little error with Dpkg recently after installing and then removing Freeradius on my Squeeze box. It appears that even after removing (and purging) Freeradius, the user and group entries remain in the statoverride file. The statoverride file is located in /var/lib/dpkg/ and contains various entires depending on what you have installed.

Dpkg Statoverride details:
http://man-wiki.net/index.php/8:dpkg-statoverride

I had a list of other entries for the user Freeradius and also Freeradius group entries as well.

root freerad 640 /etc/freeradius/experimental.conf
root mlocate 2755 /usr/bin/mlocate
freerad freerad 2751 /etc/freeradius/certs
freerad freerad 755 /var/run/freeradius
freerad freerad 2751 /etc/freeradius
root freerad 640 /etc/freeradius/preproxy_users
root incron 2755 /usr/bin/incrontab
root freerad 640 /etc/freeradius/policy.conf
root freerad 640 /etc/freeradius/huntgroups
root freerad 640 /etc/freeradius/attrs
root incron 1731 /var/spool/incron
root freerad 640 /etc/freeradius/proxy.conf
root incron 640 /etc/incron.deny
root freerad 640 /etc/freeradius/ldap.attrmap
root freerad 640 /etc/freeradius/acct_users
root freerad 640 /etc/freeradius/eap.conf
root freerad 640 /etc/freeradius/attrs.pre-proxy
root incron 640 /etc/incron.allow
freerad freerad 2751 /etc/freeradius/sites-available
root freerad 640 /etc/freeradius/hints
root freerad 640 /etc/freeradius/radiusd.conf
root freerad 640 /etc/freeradius/clients.conf
root freerad 640 /etc/freeradius/attrs.access_challenge
root freerad 644 /etc/freeradius/dictionary
root ssl-cert 710 /etc/ssl/private
root freerad 640 /etc/freeradius/policy.txt
root freerad 640 /etc/freeradius/sql.conf
root Debian-exim 640 /etc/exim4/passwd.client
freerad freerad 750 /var/log/freeradius
root freerad 640 /etc/freeradius/attrs.accounting_response
root crontab 2755 /usr/bin/crontab
root freerad 640 /etc/freeradius/attrs.access_reject

Clean up
I just opened it with Vim and used the “d+d” keystroke to delete each entire line. Did an apt-get update and hey presto! All solved. Now it’s back as it was before Freeradius was installed:

root mlocate 2755 /usr/bin/mlocate
root incron 2755 /usr/bin/incrontab
root incron 1731 /var/spool/incron
root incron 640 /etc/incron.deny
root incron 640 /etc/incron.allow
root ssl-cert 710 /etc/ssl/private
root Debian-exim 640 /etc/exim4/passwd.client
root crontab 2755 /usr/bin/crontab

Computer hardware shops Barcelona

Computer hardware shops in the centre of Barcelona
If you are a Geek or Linux hacker in Barcelona, this is where you go to peruse the latest hardware.

Barcelona Computer Hardware Shops

Link to Google Map:
Google Maps

Pc Green
C/ Casanova, 34, 08011 Barcelona, Spain
+34 934 51 43 42 ‎

LIFE Informática
c/ Sepúlveda, 173, 08011 Barcelona, Spain
+34 932 28 97 31 ‎

Traxtore
C/ Sepúlveda, 155, 08011 Barcelona, Spain
+34 934 51 57 63 ‎

Pista Cero S.l.
C/ Sepúlveda, 176, 08011 Barcelona, Spain
+34 935 05 94 00 ‎

Computer Orange Multimedia Cuatro
C/ Sepúlveda, 153, 08011 Barcelona, Spain
+34 934 53 77 86 ‎

Neo-Byte Computers
C/ Sepulveda, 166, 08011 Barcelona, Spain
+34 934 24 18 99 ‎

PCBox Barcelona (C/Casanova)
C/ Casanova, 47, 08011 Barcelona, Spain
+34 934 53 95 82 ‎
Category: Tienda de informática

IE3 Informatica
C/ Sepúlveda, 182, 08011 Barcelona, Spain
+34 934 52 57 77 ‎

PnP informática
Tigre 33 bajos (esq. Ronda Sant Antoni), 08001 Barcelona, Spain
+34 933 17 65 38 ‎

Pricoinsa
Ronda Sant Antoni, 51, 08011 Barcelona, Spain
+34 934 23 80 44 ‎

NSE – The Nmap Scripting Engine for Automated Tasks

The Nmap Scripting Engine (NSE) is one of Nmap’s most powerful and flexible features. It allows users to write (and share) simple scripts to automate a wide variety of networking tasks. Those scripts are then executed in parallel with the speed and efficiency you expect from Nmap.

All existing scripts have been improved, and 32 new ones added. New scripts include a whole bunch of MSRPC/NetBIOS attacks, queries, and vulnerability probes; open proxy detection; whois and AS number lookup queries; brute force attack scripts against the SNMP and POP3 protocols; and many more. All NSE scripts and modules are described in the new NSE documentation portal.

Count from one to ten in binary

Counting in binary:
Counting in binary is similar to counting in any other number system. Beginning with a single digit, counting proceeds through each symbol, in increasing order. Decimal counting uses the symbols 0 through 9, while binary only uses the symbols 0 and 1.

Decimal and Binary jump to the left:
When the symbols for the first digit are exhausted, the next-higher digit (to the left) is incremented, and counting starts over at 0.

In decimal, counting proceeds like so:
000, 001, 002, … 007, 008, 009, (rightmost digit starts over, and next digit is incremented)
010, 011, 012, … …
090, 091, 092, … 097, 098, 099, (rightmost two digits start over, and next digit is incremented)
100, 101, 102, …

Decimal from 0-9 then left Binary from 0-1 then left:
After a digit reaches 9, an increment resets it to 0 but also causes an increment of the next digit to the left. In binary, counting is the same except that only the two symbols 0 and 1 are used.

After a digit reaches 1 in binary, an increment resets it to 0 but also causes an increment of the next digit to the left:
0000,
0001, (rightmost digit starts over, and next digit is incremented)
0010, 0011, (rightmost two digits start over, and next digit is incremented)
0100, 0101, 0110, 0111, (rightmost three digits start over, and the next digit is incremented)
1000, 1001, …

Count from 1 to 10 in Binary
Dec Bin
0 = 0
1 = 1
2 = 10
3 = 11
4 = 100
5 = 101
6 = 110
7 = 111
8 = 1000
9 = 1001
10 = 1010
11 = 1011
12 = 1100
13 = 1101
14 = 1110
15 = 1111
16 = 10000

Base 2 System:
Since binary is a base-2 system, each digit represents an increasing power of 2, with the rightmost digit representing 20, the next representing 21, then 22, and so on. To determine the decimal representation of a binary number simply take the sum of the products of the binary digits and the powers of 2 which they represent.

For example, the binary number:100101 is converted to decimal form by:
[(1) × 25] + [(0) × 24] + [(0) × 23] + [(1) × 22] + [(0) × 21] + [(1) × 20] =
[1 × 32] + [0 × 16] + [0 × 8] + [1 × 4] + [0 × 2] + [1 × 1] = 37
To create higher numbers, additional digits are simply added to the left side of the binary representation.

Gratuitously stolen from http://en.wikipedia.org/wiki/Binary_numeral_system

The Linux directory structure – What lives where?

Just open up a terminal and have a browse through these directories to get an idea of where everything is.

To Change to a Directory use:
cd
To LiSt what’s in it use:
ls
To LiSt even the hidden files, ask for All:
ls -a

What directories are there and what do they contain?

/ – This is the root directory. Under windows, DOS, OS/2, and cousins, there’s a seperate root directory for each drive or partition. Linux and other Unix variants put everything in one directory tree, and this is at the base. There’s generally not much in here other than directories, although kernel images might be stored here too.

/boot – Some distros store kernel images and other miscellaneous files needed to boot here.

/tmp – Generally only temporary files needed at boot. Things that need temporary storage after boot generally use /var/tmp, but this isn’t universal by any means.

/mnt – This is where directories go for mounting various miscellaneous filesystems. Sometimes, /cdrom and /floppy are used for mounting cdrom and floppy devices, but I’m not sure how many distros other than Debian do this. /mnt is also sometimes called /mount.

/lib – Libraries needed at bootup. Libraries not needed at bootup but needed after the system is running should go in /usr/lib. Kernel modules generally go in /lib/modules/.

/dev – Device files go here. These are special files created by the Linux kernel that can be used by programs to control hardware devices. Note that network interfaces (eth0, ppp0, etc) don’t exist here.

/proc – This filesystem doesn’t actually exist on disk. It contains files that provide information about the state of the computer, including info on running processes, hardware states, and memory usage. Most of the files aren’t easily read by humans, though.

/var – Contains data changed when the system is running normally. /var/tmp, for example, should be used for storing temporary files. Various processes and daemons dump logs here, and some important subdirectores are:

/var/lock – Lock files. These are created by programs when accessing a specific resource. They don’t actually prevent access, so respecting a lock file is more of a politeness thing. Most programs do respect them, and thus you don’t have to worry about them unless you’re writing a program.

/var/log – Log files are generally written here. This directory may grow quite large, and so may require regular cleaning.

/var/run – Contains various bits of runtime information.

/var/lib – Contains various files needed while the system is running. One that will almost definitely be of interest to laptop users is /var/lib/pcmcia/stab, which contains some information about PCMCIA devices.

/var/spool – Mail, news, and printer queues get stored here.

/root – Home directory of the root user. Shouldn’t be much stored here at all, as you should be using normal, unprivilaged users for anything that doesn’t require root privilages.

/home – This contains the home directories of most of the users on the system. You can type cd to return to your home directory, and you can use ~/ as a shortcut to refer to your home directory. Personal config and data files for normal users go here.

/etc – Probably where you’ll spend most of your time as root, this is where most system-wide configuration files are stored. Files for specific users are almost always stored in the user’s home directory. The contents will vary depending on what you’ve got installed, but some subdirectories that are probably of interest are listed below.

/etc/X11 – This is where system-wide X11 configuration files are stored. XF86Config stores data used by the server to set up the environment. /etc/X11/fonts is where the fonts used by the server are stored, and window managers generally create subdirectories for their config files.

Boot related stuff for Debian:

/etc/init.d – Debian stores the actual scripts for starting daemons and services here. Not all of these are necessarily started at boot time, so don’t remove any unless you’re absolutely sure its safe. Most are created and removed by their associated packages, so you’ll rarely have to do anything here.

/etc/rcS.d – These are soft links to scripts in /etc/init.d that are run during startup no matter what runlevel the system’s booting into. The files start with an S followed by two digits – services are started in an order determined by these two digits. For example, S24foo is started before S42bar. The rest of the filename should be the name of the file in /etc/init.d the file is linked to.

/etc/rc0.d through /etc/rc6.d – These are soft links, just like in /etc/rcS.d, except they’re only executed when entering the specified runlevel. 0 is shutdown and 6 is reboot. Anything starting with a K shuts down a process, and anything starting with an S starts one. Other than that, they follow the same rules as /etc/rcS.d. By default, as far as I can tell, Debian boots into runlevel 2.

/bin and /sbin – Programs and system programs needed when the system is booting, respectively. Most are also useful after the system boots up, but they’re put here because they’re generally needed before any other programs.

/usr – Unix System Resources. This is the really big directory. Almost everything goes under here, unless I mentioned it above, so I’m going to go into quite a bit of detail about subdirectories and so on.

usr/X11 – These are files used by X11, and the files under them are structured like the /usr directory.

/usr/bin – Binary files (program executables) that aren’t needed during boot go here. This is probably where most of the programs you use during normal system operation reside.

/usr/sbin – These are system programs not needed during boot.

/usr/games – Game programs and (sometimes) data files and configuration stuff.

/usr/include – C and C++ header files. Probably not of much interest to you unless you’re into programming with C and/or C++.

/usr/lib – Library and shared library files not needed at bootup.

/usr/info – Data files needed by the GNU info program.

/usr/man – Data files needed by the man program.

/usr/src – Source code files. The linux kernel source is usually in /usr/src/linux.

/usr/doc – Documentation files go under here. There’s probably quite a lot here, and there are quite a few programs that just put copyright and changelog files here and document themselves through man or info. Of particular interest is the HOWTO directory where (probably) your distribution has placed a collection of HOWTOs from http://www.linuxdoc.org. These aren’t quite as simplified as NHFs, but they’re still quite good.

(The perceptive will notice that most directories in /usr/doc are actually links to the real location of the documentation…)

/usr/local – This directory contains things that are specific to the local system. Really only takes on any meaning if /usr is being mounted from a remote machine, VIA smb or nfs or some other networking filesystem. In that case, /usr/local would be a partition on the local machine, and the machine’s user would put their programs there. This directory is usually structured like the /usr tree is.

/usr/shared – Shared files for programs go here. What a program puts here is, as far as I can tell, pretty much arbitrary, but sound files seem to be a fairly common thing to put here.

That’s all the major directories I could pick out of my filesystem. If I’ve made any mistakes, left anything out, or whatever E-Mail me at the above address and I’ll be glad to try and include it.

Start or Stop Iptables Firewall on Debian Linux

I have been given the task at work of configuring the firewalls for a client with a large network and various servers. The system has a lot of security implemented which requires specific control of users, subnetworks, and who has access rights to certain network and internet resources.

Configuring a single computer is relatively easy, and you can find many guides on the net, but I was curious to see that on some Ubuntu/Debian based forums and blogs, people were treating iptables as a service which it most certainly isn’t. There appears to be some confusion between Debian, Redhat, and derivatives (Ubuntu, Fedora, CentOS etc).

Difference between Redhat and Debian
Redhat, Fedora, CentOS do have a script in /etc/init.d which allows you to {save|stop} the iptables configuration, and I believe some people were mistakenly trying to apply it to Debian based systems. That’s not to say that you couldn’t create a Start/Stop script, but it doesn’t come as standard.

Iptables is a command, not a service
Iptables is a command to manipulate the netfilter kernel firewall. Just as modprobe will allow you to load a kernel module, but you can’t /etc/init.d/modprobe start, or service modprobe start. Iptables works the same. It issues, saves, removes commands.

To get Iptables:
sudo apt-get install iptables

Or see if it is already installed:
dpkg -l | grep iptables

How to Enable/Start/Configure Iptables (as root):
Create an empty firewall.rules file that can be manually configured by issuing commands via the terminal and then saving again.
iptables-save > /root/firewall.rules
and/or
iptables-restore < /root/firewall.rules

Now issue these commands as root sequentially:
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

Save your config:
Once you have issued them, save them to firewall.rules with the same command you used to create the file.
iptables-save > /root/firewall.rules

Now you can check to see if the rules file is no longer empty:
vim /root/firewall.rules

Which should give you something like this:(A completely open Firewall)
# Generated by iptables-save v1.4.8 on Wed Oct 27 09:40:48 2010
*mangle
:PREROUTING ACCEPT [106:16689]
:INPUT ACCEPT [79:11460]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [59:9812]
:POSTROUTING ACCEPT [65:10676]
COMMIT
# Completed on Wed Oct 27 09:40:48 2010
# Generated by iptables-save v1.4.8 on Wed Oct 27 09:40:48 2010
*nat
:PREROUTING ACCEPT [46:8205]
:POSTROUTING ACCEPT [14:1382]
:OUTPUT ACCEPT [14:1382]
COMMIT
# Completed on Wed Oct 27 09:40:48 2010
# Generated by iptables-save v1.4.8 on Wed Oct 27 09:40:48 2010
*filter
:INPUT ACCEPT [30:6110]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [24:4552]
COMMIT
# Completed on Wed Oct 27 09:40:48 2010

This is just a basic first step to setting up iptables manually. At work we have a template firewall script that runs from RC2.d at boot on our clients’ and our office servers, and is approximately 250 lines long.

Documentation on the web:
http://www.netfilter.org/
http://www.netfilter.org/projects/iptables/index.html
http://www.netfilter.org/documentation/index.html#documentation-howto

Asterisk 1.8 on Debian Squeeze

As we work a lot with Asterisk PBX systems at work, I decided to download and compile the latest version 1.8 on my Squeeze installation (which hopefully will become the new “stable” soon)

1. Create a temporary directory:
mkdir /home/rich/tmp

2. Change to tmp
cd /home/rich/tmp

3. Get the Asterisk 1.8 tarball from here:
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz

4. Unpack it:
tar xvf asterisk-1.8-current.tar.gz

5. Get some dependencies that are need for Asterisk and Documentation:
sudo apt-get install libxml2-dev libncurses5-dev doxygen libgtk2.0-dev

6. Compile Asterisk 1.8
./configure
make
sudo make install

7. Install the documentation:
make progdocs

All went schwimmingly!

Time to have a play. 🙂

How to Gpg sign emails with Mutt

After having set up Mutt, I decided to try and find out where to add any pgp settings to use my gpg key signature on each email.

I Googled a bit and read various guides, and the quickest one I found was t copy a default gpg config file over and leave it as it is:

cp /usr/share/doc/mutt/examples/gpg.rc /home/rich/.mutt

Now, when I compose a new email, I hit “:wq” to write and quit, and now all I need to do is hit “p” and a new Pgp encryption menu appears with various options.

I choose “a” for “Sign As…”, then add the name of the Gpg key I wish to use. In this case it’s “rich scadding (richs-lxh). Then once I hit “y” send, I get asked for my Gpg password and everything is done.

So, to recap:
1. cp /usr/share/doc/mutt/examples/gpg.rc /home/rich/.mutt
2. Open Mutt and hit “m” to compose an email
3. Write and Quit
4. Hit “p” to sign the email
5. Choose option “a” for “Sign As….”
6. Add the name of the Gpg key you wish to sign with.
7. Hit “y” for Yes to send
8. Enter your Gpg password

How to Use Mutt Email Client with Gmail

Going back to terminal based apps:
I’ve just recently gone back to the old-school ways of using the terminal instead of gui apps, as at work we administer a lot of Debian based servers remotely via ssh. My desktop now has one terminal open, with around 5-6 “Screens” with Mutt(email), Irssi(IRC), TwitVim(Identica), Elinks(Web) and a couple of spares for terminal/ssh work and editing with Vim.

Mutt is easier than you think:

Installing Mutt
To install mutt on Crunchbang/Squeeze:

sudo apt-get install mutt

Next, in the terminal, create these directories that mutt needs to cache message headers and bodies, and store certificates:

mkdir -p ~/.mutt/cache/headers
mkdir ~/.mutt/cache/bodies
touch ~/.mutt/certificates

Now, create a basic Gmail-ready .muttrc
Choose your own text editor, I use Vim

vim .muttrc

And paste this basic gmail-ready config:
Once you have it pasted, edit the Gmail account details (everything you’ll need to alter is IN CAPITALS.) and save the file.
**Note** If you are in the UK you will need to use a slightly different config:HERE

**Edit** Darrin suggested that as your password is in plaintext, it may also be a good idea to encrypt your home directory as well for added security. (I’ll try to post a guide on single file encryption, directory encryption and entire drive/partition encryption at a later date) Thanks for the suggestion Derrin.


# Change the following six lines to match your Gmail account details
set imap_user = "YOUR.EMAIL@gmail.com"
set imap_pass = "PASSWORD"
set smtp_url = "smtp://YOUR.EMAIL@smtp.gmail.com:587/"
set smtp_pass = "PASSWORD"
set from = "YOUR.EMAIL@gmail.com"
set realname = "YOUR NAME"

# Change the following line to a different editor you prefer.
set editor = "vim"

# Basic config, you can leave this as is
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[GMail]/Drafts"
set record = "+[GMail]/Sent Mail"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
set include
set sort = 'threads'
set sort_aux = 'reverse-last-date-received'
set auto_tag = yes
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
alternative_order text/plain text/html *
auto_view text/html
bind editor complete-query
bind editor ^T complete
bind editor noop

# Gmail-style keyboard shortcuts
macro index,pager y "unset trash\n " "Gmail archive message"
macro index,pager d "set trash=\"imaps://imap.googlemail.com/[GMail]/Bin\"\n " "Gmail delete message"
macro index,pager gi "=INBOX" "Go to inbox"
macro index,pager ga "=[Gmail]/All Mail" "Go to all mail"
macro index,pager gs "=[Gmail]/Starred" "Go to starred messages"
macro index,pager gd "=[Gmail]/Drafts" "Go to drafts"

Start Using Mutt:
Run it from the terminal by simply typing mutt and hit “enter”. The first time you do this, you’ll be prompted to accept two SSL certificates from Google; press ‘a’ to always accept these certificates. You should now be greeted by your Gmail inbox.

Navigating, Reading and Sending Emails

Mutt is controlled from the keyboard and the following shortcuts will get you up and running:
For a more in depth list of commands and config features, either hit the “?” key in an open Mutt session or type “man mutt” in the terminal.

j to move down.
k to move up.
d to delete a message
y to archive one
gi to view your Inbox
ga to view All Mail
gd to view Drafts
gs to view Starred messages

And here are a few more that are particular to mutt:

t will mark a message
s will save one, or more
c lets you change to a different folder
/ lets you search the current folder

Sending Email with mutt
The basics look like this:

1. Type m (or r if you’re replying to a mail)
2. Enter the recipients email address; hit Return
3. Enter a subject; hit Return
4. Write your message.
5. Save it.
6. Type y, and your message will be sent.

Type q to quit mutt.

Smf Forum – Merge Member Posts and PM’s with MySQL

So what happens when you decide to have a clean up on your Simple Machines Forum, and part of that clean up is to remove inactive users?

Inactive Members Removed
Well, the user gets removed but their posts remain on the forum unless you specifically delete the account and choose to remove all post. Otherwise the username remains with the word “Guest” alongside each post.

Member Returns
It can sometimes happen that a member who hasn’t been around for a while comes back and has to create a new account as their old account has been removed. This leaves them with a zero post-count and all their PM’s associated with the old account.

How Do I Re-associate All Old Member Data with New Account?
Pretty easily really, with access to the database via phpMyAdmin and a few MySQL Query commands. On every Database, there is a Tab at the top which says “SQL” and has a box where you can issue queries (commands) and hit “Go”.
*Warning* BACKUP YOUR DATABASE FIRST !!

The main Syntax that we are going to issue as a MySQL query is this:
UPDATE whatever_table SET ID_MEMBER_whatever = '2', whateverName = 'new' WHERE whateverName = 'old'

1. Associating Old Posts with new Member account
For example, we want to change all forum posts with the name of a deleted member called OldBuddy, and associate them with his new name which is NewBuddy with member ID 1337.
UPDATE smf_messages SET ID_MEMBER = '1337', posterName = 'NewBuddy' WHERE posterName = 'OldBuddy'

2. Now we want to do the same with his old PM’s (Private/Personal Messages):
UPDATE smf_personal_messages SET ID_MEMBER_FROM = '1337', fromName = 'NewBuddy' WHERE fromName = 'OldBuddy'

By now you should be getting the idea. You just UPDATE whatever table, with new column data for a user ID by changing old for new. Once you get the hang of it, you can issue the UPDATE command on any MySQL database, not just Smf Forum, and recursively replace any data in any table.

Quickly create and delete multiple files or directories

Mkdir and Touch
I am pretty sure most of you already know what the mkdir command does.
Maybe new users won’t know too much about touch which is a great commandline tool which comes as part of the Gnu Coreutils.

For more information in the terminal type:
info coreutils touch invocation
and
man mkdir

To create multiple directories with the same name but a different number:
mkdir dir{1,2,3}

Which will give you:

dir1 dir2 dir3

To remove them:
rmdir dir{1,2,3}

To create multiple files with the same name but a different number:
touch file{1,2,3}.txt

Which will give you:

file1.txt file2.txt file2.txt

To remove them:
rm file{1,2,3}.txt

Debian Backports is now official

This great news for the http://www.backports.org team.

Mailing list link: http://lists.debian.org/debian-publicity/2010/09/msg00007.html

> Backports service becoming official
> >
> The Debian Project is proud to announce that the backports service,
> previously available at http://www.backports.org is now an official Debian
> service and will be available at backports.debian.org
>
> Backports are packages from the testing distribution recompiled for the
> current stable (or even oldstable) release to provide users of the stable
> distribution with new versions of certain packages, like the Linux kernel,
> the Iceweasel browser or the OpenOffice.org suite, without sacrificing
> the overall stability of the system.
>
> The archive currently has packages backported for the Lenny distribution.
> (how many?) As the infrastructure to accept packages for the upcoming
> Squeeze release is already in place, this allows Debian Installer images to
> configure the backports repository by default without generating errors
> on user systems. The service for Squeeze will be enabled at a later
> date, after the release.
>
> Because of limitations in the Debian Bug Tracking System, any bugs
> relevant to backported packages still have to be reported to the
> debian-backports list, which will now also move to lists.debian.org.