udev – Change network card label

udev

Several time I’ve been asked how to rename a network card label on a Linux system, this can be achieve by following the steps mentioned bellow.

Stop networking

service networking stop

The network kernel module needs to be removed, but first you need to identify the right kernel module

sudo lspci -k | grep -i -A4

ethernet 04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07) Subsystem: Sony Corporation Device 9099
Kernel driver in use: r8169
Kernel modules: r8169

Reload rules

udevadm control –reload-rules

Edit udev rules by editing the /etc/udev/rules.d/*persistent-net.rules, in the example bellow we will set previous eth0 to eth5

# PCI device 0x10ec:0x8168 (r8169)

SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”d4:3d:7e:xx:xx:xx”, ATTR{dev_id}==”0x0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth5″

 

Remove the module in question

rmmod r8169

I’m using an realtek chip on my Vaio laptop, you should replace r8169 with the module in your system
Request device events from the kernel

udevadm trigger

Start network

service network restart

Et voila! You should have now a network card named eth5 on your system.
If you want to learn more about udev and udevadm check the info here or just type man udevadm on the command line.

Have fun,

Pedro Oliveira

Average file size on directory using gawk

gawk gnu awk

 

While tuning and benchmarking an HP backup device (HPD2D backup system) I needed to estimate the average file size of the IMAP server storage.
You may think I could just count the number of files and the divide the used space by the number of files, but that wasn’t the case because I didn’t want all the files to count, in this case I just needed the maildir files that have the email content.
So I did a little script (just a command line) using gawk to do it for me:

find /home/vmail -type f -name [0-9]* -exec ls -l {} \; | gawk '{sum += $5; n++;} END {print sum/n;}'

First I find all the files that starts with a number on the base directory of my dovecot server (IMAP storage), and the I need to list them as the size info is needed.
Second I’ve a little gawk script that will do the sum and division.
Let me say this took a few hours as the storage holding the files has 8TB of data.
Well hope this will help some1 else.
Cheers,
Pedro

OpenSuSE Linux on Sony Vaio VPCSB – User Review

Hi today I was using my new laptop (well it has about 1 month now) and I thought in sharing my usage experience with it. My Vaio is a VPCSB and I run it with OpenSuSE 11.4 X86_64.
I have a thing for Sony Vaios, this one is my 4th. I like Vaios for their build quality, looks, performance and size as I also travel quite a bit.
I’m not a gamer at all so what I value for my computer usage is:

1 – Size (13 inches or smaller)
2 – Weight (2Kg or lower)
3 – Looks
4 – Display quality
5 – Battery endurance
6 – Performance (CPU, Memory, IO)
7 – Number of IO ports (USB, VGA, DVI, Network cards, DVD or Blue-ray in this case, GSM card)
8 – Extras (Illuminated keyboard, hybrid video systems, etc)
9 – And the most important item… Linux compatibility as it will be my choice OS

So after breaking my old Vaio display, I researched a lot (and not only Vaios), I bought this VPCSB, my expectations were very high as my last laptop, a Vaio SZXN was (and still is because it was fixed) an excellent laptop. It worked flawlessly for 4 years with about 12 hours run everyday, lots of traveling, lots of airplane usage and with minor upgrades on memory (2GB ram to 4GB) and a major upgrade this year on the hard drive where I bought a Samsung high performance SSD.
Well, back to the new computer let’s start on the hardware listing (including lscpi and lsusb output):

CPU:Ā  Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz
RAM: 6GB
HD:SAMSUNG MMDOE56G5MXP-0VB

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation 2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB Controller: Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.2 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 3 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1d.0 USB Controller: Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 6 Series Chipset Family 6 port SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: ATI Technologies Inc NI Seymour [AMD Radeon HD 6470M] (rev ff)
02:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5209 (rev 01)
04:00.0 USB Controller: NEC Corporation uPD720200 USB 3.0 Hayt Controller (rev 04)
05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 08ff:168f AuthenTec, Inc.
Bus 001 Device 004: ID 0c45:64b5 Microdia
Bus 001 Device 007: ID 05c6:9225 Qualcomm, Inc. Sony Gobi 2000 Wireless Modem
Bus 001 Device 006: ID 0489:e00f Foxconn / Hon Hai Foxconn T77H114 BCM2070 [Single-Chip Bluetooth 2.1 + EDR Adapter]
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

So running with Linux (OpenSuSE) what works and what doesn’t work?
Easy there are only 2 things that aren’t running on Linux:
1 – Finger print reader (Bus 001 Device 003: ID 08ff:168f AuthenTec, Inc. )
2 – Touch-pad with multi-touch although it works fine with single-touch
Maybe the multi-touch function can be activated but to be sincere I didn’t pay much attention to it.
The fingerprint is not working due to Sony (they are failing on us here), the multi touch has a signed firmware that doesn’t allow any application to use it, so it needs a Sony interface application to communicate with the system.

What runs and should have trouble running?
The webcams are known to be prone to have trouble and this one works like a charm.
The internal GSM card also works perfectly in Linux (ID 05c6:9225 Qualcomm, Inc. Sony Gobi 2000 Wireless Modem), just a note, I disabled the PIN request on the ISP chip, I did this because from time to time I lost communication with the GSM device after suspending to ram or disk.
The Ati Radeon card works really well with the fglrx driver (even the hybrid features).

What didn’t I tested / used till now:
I never tried to use the blue-ray functions, I’ve recorded and CDs and DVDs but never used blue-ray disks (I just have some Playstation 3 games on blue-ray)

User experience and usability:
Let me say it this way… I LOVE MY NEW VAIO!
It’s small yet powerful, it has a nice amount of ram, fast SSD, good battery life. The display is great, altought the view angles aren’t that good.
In what concerns to mobility I can’t find anything better, I really like the Intel wireless device (supporting 801.11B,G,N), the GSM card it a major feature and it’s a really nice feature to have if you move a lot, and the usual ethernet port also deliveries good performance.
What I don’t like at all are the mouse buttons, they are hard to press and noisy. The same happens to the fan if you’re running at full speed (like compiling a kernel), it will get noisy, but you’re just working on Libreoffice, using FireFox it will be just fine.
On the other hand the lightened keyboard is great for working late at home or in the plane, you’ll not be searching for keys anymore.

Conclusion
Do I tell you to buy this one?
YES, it’s small, fast, pretty and it will deliver, you’ll be able to work full days on this one without miss your desk computer šŸ™‚

PS – What do I like more than my new Vaio?
My new tablet, I’ve also bought a Samsung Galaxy Tab 10.1 but I’ll write about it sometime.
Cheers,
Pedro Oliveira

 

What’s the best linux distribution?

Lots of people ask me what’s the best Linux distro, some say what’s the best for a newbie others want to setup a home server and some others want to build a gatekeeper. So what’s the best distro to accomplish all this?

To be sincere I like OpenSuSE a lot and I use it for all my personal things and my work laptops, but I wouldn’t recommendĀ  it for server usage, I don’t recommend any of the desktops distros (aka distribution) for that matter due to a simple issue. TheĀ  desktop distros like OpenSuSE, Fedora, Ubuntu , etc have a small support cycle. This means that if you want to have security upgrades you’ll need to be constantly updating your server install.

For usage in a server environment I like to use SLES, RedHat and CentOS. The support cycle is great (at least 5 years), the stability and endurance of the OS is great in any of them.

Once again I prefer SLES, this is due to the great tools and support they provide.However I don’t say the same about RedHat support, whenever I need them IĀ  had to find the solution on my own.

These are the two main scopes of Linux distros out there, the desktop and server, but they aren’t the only scopes where you have Linux. For instance if you want to have a firewall, proxy, content filter, qos, and traffic shaping I would recomend the excellent Endian FW (www.endian.it).

If you want to have your linksys/asus and other router working with linux, you may use dd-wrt, would you like to have an older computer as a

media center look at Geex-Box. A hacker distribution so you can test your systems security just download BackTrack. The list can continue and you will be able to find a distribution suited to your needs. Some may need just a live cd or dvd system, other a complete server suite like SME server (that will give you the same offer as Windows small business).

To conclude I don’t think there’s a better distro, there are differences and those differences make some people like one distro over the other.

Personally I like OpenSuSE and SLES.

Cheers,

Pedro Oliveira



Kernel 2.6.31 is out and rocking!

This weekend I’ve had some free time so I tested a new kernel on my suse 11.1 x86_64 system. I’ve been a beta tester for the kernel for some time and I was eager to test the final version.

There are plenty new features, the one I enjoy more are probably on the filesystem area but there is plenty to choose.

This version adds USB 3.0 support, a equivalent of FUSE for character devices used for proxying OSS sound to ALSA, some memory management changes that improve interactivity in desktops, readahead improvements, ATI Radeon Modesetting support, support for Intel’s Wireless Multicomm 3200 Wifi devices, kernel support and a userspace tool for performance counters, gcov support, a memory checker for unitialized memory, a memory leak detector, a reimplementation of inotify and dnotify on top of a new filesystem notification infrastructure, btrfs improvements, support for the IEEE 802.15.4 network standard, IPv4 over Firewire, many new drivers, small improvements and fixes.

You may see the hole list here:

http://kernelnewbies.org/Linux_2_6_31

I still didn’t do extensive testing but so far so good ;), although my kde4.3Ā  seams to lag a bit, I’m not sure if this is from the new kernel or the changes I’ve done within KDE itself.

On the other end with server machines it works perfectly, i’m doing stress tests on two virtual servers and memory usage / IO times / CPU usage.

On the test i’m using two opensuse 11.1 x86_64, one as 2.6.27 kernel version and the other 2.6.31, same amount of memory and 2 cpu each on the same host. Hope to have some more data in a few days and then post the results (cacti graphs) here if they are relevant.

So, what are you waiting for… TRY IT

Cheers

Pedro Oliveira

Click to access the login or register cheese