valeta.org

December 19, 2011

faw's advogato

19 Dec 2011

29 and counting

Time flies... and very fast.

There are so many things I'd like to share and tell you about but that would make a long and boring post, so I'll divide it in future entries, so I can keep this diary alive, keep people informed and tell a little bit about my story. Eventually, I may split this diary into a technical and a non-technical blog, but for now, I will stick around mixing topics. :-) Last time I wrote was back in 2009 at DebConf9 in Spain and a lot of things happened that year. Not only for Debian, but also for me.


My last year studying Computer Science was 2009 and that same year I was working full time, I helped organizing a large event for Computer Students (ENECOMP 2009), we had some troubles and side effects with Influenza A (H1N1) in my city (Curitiba, PR) and towards the end of the year I got really sick (not from Influenza) and it took a while to know what was going, during this process I did hurt some people I really love and I'm truly sorry. The past, 2010 went on as busy and unstable as 2009, my laptop's hard disk broke twice (January and October) and I survived thanks to backup and recovery procedures. I took some wrong decisions but fixed it later and learned a lot from my mistakes, decisions and choices.


Then 2011 came, my laptop's hard disk broke again and I lost almost 6 months of emails, I find out that after the second crash in 2010 part of my backup got b0rk3d. Fine, I didn't die, everything seems to be fine, but I'm still catching up with a lot of work and backlog. At different times one of my parents also got really sick and I learned quite a bit on how to deal with it.


Due to the laptop and the different things going on in my life I didn't work for Debian as much as I want and I still feel guilty. :-( But that's fine, this is a kind of public apologize for my peers in Debian (i18n, mirrors, release), I still want to help all of you, but I still have quite a bit of backlog to clean and quite a few things to learn in the process. And in general, I'm really sorry if I didn't (or I couldn't) work for Debian as much as I want.


Although I'm taking the chance to apologize in this post, I still want to make clear that I'm quite happy. This last year was pretty good, I had the opportunity to attend DebConf again and also got to know Sarajevo and Zagreb. New lessons were learned, better work cycles, nicer solutions. Today I'm completing 29 years old. 29. This is quite some time, not a long ride, but for one reason or another, I have high hopes for 2012 and what awaits me. And I do plan to learn more, to help more and whenever possible, to contribute back.

Last time I wrote here I mentioned about my graduation and another post to talk about that, I'll write about it as soon as I get my diploma (because of different printing problems it was delayed for almost 2 years). And I do plan to write more frequently. :-)

December 19, 2011 08:00 PM

October 09, 2011

douglas' livejournal

Howto: Setting PXE server to install RHEV-H

There is nothing in special to setup the PXE server for RHEV. However, if you are wondering how to create one, please follow the steps below.

First, let's identify which subnet we are going to use. In my case, the subnet will be 192.168.1.X.

Checking the subnet


# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:1E:C9:20:3F:6B
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21e:c9ff:fe20:3f6b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4453951 errors:0 dropped:0 overruns:0 frame:0
TX packets:3350991 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3216624601 (2.9 GiB) TX bytes:1188936874 (1.1 GiB)
Interrupt:21 Memory:febe0000-fec00000

Installing DHCP



dhcp - is required because the client machine will boot from PXE and adquire an IP address from the DHCP server available at the subnet.

1) # yum install dhcp -y

Setting DHCP


2) vi /etc/dhcp/dhcpd.conf

authoritative;
ddns-update-style none;

subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.190 192.168.1.200;
range 192.168.1.201 192.168.1.250;
option domain-name-servers 192.168.1.101; # DHCP Server
#option domain-name "medogz.com";
option routers 192.168.1.101; # DHCP Server
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}

# HOST - RHEV
host rhev-server1 {
hardware ethernet 00:15:C5:E0:D3:27; # MAC from machine that will boot via PXE
fixed-address 192.168.1.240; # Fixed IP address
filename "pxelinux.0"; # File that will be downloaded by the client
next-server 192.168.1.101; # DHCP Server
}

# vi /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS=eth0

# chkconfig dhcpd on

# service dhcpd start
Starting dhcpd: [ OK ]

Installing TFTP



tftp - will be used to transfer the image to be installed into the clients from the server.

# yum install tftp tftp-server -y

# chkconfig xinetd on
# chkconfig tftp on

# service xinetd start
Starting xinetd: [ OK ]

Preparing pxeboot



Extract files available inside the rpm
Below RPM available only via Red Hat Channel.

# rpm2cpio rhev-hypervisor-6.2-0.17.2.el6.noarch.rpm | cpio -div
./usr/bin/rhevh-iso-to-disk
./usr/bin/rhevh-iso-to-pxeboot
./usr/share/rhev-hypervisor/rhev-hypervisor.iso
./usr/share/rhev-hypervisor/version.txt
241719 blocks

Converting the iso image to a PXE boot

# bin/rhevh-iso-to-pxeboot share/rhev-hypervisor/rhev-hypervisor.iso
Your pxeboot image is complete.

Copy tftpboot/ subdirectory to /tftpboot or a subdirectory of /tftpboot.
Set up your DHCP, TFTP and PXE server to serve /tftpboot/.../pxeboot.0

Note: The initrd image contains the whole CD ISO and is consequently
very large. You will notice when pxebooting that initrd can take a
long time to download. This is normal behaviour.

Copying the generated files

The directory tftpboot/ was generated with the files to create the PXE boot.

Before copying, let's find which directory tftpboot service is setup.

# cat /etc/xinetd.d/tftp | grep -v ^#
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}

In this case, the directory is /var/lib/tftpboot as showed in the server_args parameter.

# cp -Rpv tftpboot/* /var/lib/tftpboot/
`tftpboot/initrd0.img' -> `/var/lib/tftpboot/initrd0.img'
`tftpboot/pxelinux.0' -> `/var/lib/tftpboot/pxelinux.0'
`tftpboot/pxelinux.cfg' -> `/var/lib/tftpboot/pxelinux.cfg'
`tftpboot/pxelinux.cfg/default' -> `/var/lib/tftpboot/pxelinux.cfg/default'
`tftpboot/vmlinuz0' -> `/var/lib/tftpboot/vmlinuz0'

Now it's time to setup the pxelinux.cfg/, this directory holds the files that the pxeboot will look during the boot. Each file be named as the fixed IP address of client converted to hexadecimal, for example (192.168.1.240):

# cd /var/lib/tftpboot/pxelinux.cfg

# gethostip -x 192.168.1.240
C0A801F0

Copying the default settings of RHEV PXE boot
# cp default C0A801F0

Preparing Firewall


Allow the MAC from the client machine.

# iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# iptables -I INPUT 1 -m mac --mac-source 00:15:C5:E0:D3:27 -j ACCEPT
# service iptables save

Ok, everything done, it's time to boot your client machine via PXE (please note that this can take some time)

References about PXE and kickstart


Instalação Automatizada de Servidores com Kickstarts – Parte II – Integrando com Servidores PXE
http://marcelo.mmello.org/2010/04/instalacao-automatizada-de-servidores-com-kickstarts-parte-ii-integrando-com-servidores-pxe/

October 09, 2011 11:18 PM

September 28, 2011

douglas' livejournal

restapi: urllib2 + auth + put + xml

https://github.com/dougsland/rhev3-restapi-scripts/blob/master/sample-put.py

September 28, 2011 01:46 AM

restapi: urllib2 + auth + delete + xml

https://github.com/dougsland/rhev3-restapi-scripts/blob/master/sample-delete.py

September 28, 2011 01:14 AM

September 27, 2011

douglas' livejournal

restapi: urllib2 + auth + post + xml

https://github.com/dougsland/rhev3-restapi-scripts/blob/master/createDataCenter.py

September 27, 2011 04:24 PM

September 25, 2011

douglas' livejournal

yum: prevent a package to be updated in your system

1) Enable the yum-plugin-versionlock

Example:
$ vi /etc/yum/pluginconf.d/versionlock.conf
[main]
enabled = 1
locklist = /etc/yum/pluginconf.d/versionlock.list
# Uncomment this to lock out "upgrade via. obsoletes" etc. (slower)
# follow_obsoletes = 1


2) Add the list of packages to be protected:
/etc/yum/pluginconf.d/versionlock.list

Example:
jack-audio-connect-kit-1.9.4
qjackctl-0.3.6


Additional info:
http://docs.fedoraproject.org/en-US/Fedora/14/html/Software_Management_Guide/ch06s25.html
http://docs.fedoraproject.org/en-US/Fedora/15/html/Musicians_Guide/sect-Musicians_Guide-CCRMA_Preventing_Package_Updates.html

September 25, 2011 04:50 AM

libvirt/virt-manager: snapshot corrupted, how can I start my virtual machine again?

virsh # start my-virtual-machine-name
error: Failed to start domain my-virtual-machine-name
error: cannot send monitor command '{"execute":"qmp_capabilities"}': Connection reset by peer


1) Remove any snapshot available
# rm -f /var/lib/libvirt/qemu/save/my-virtual-machine-name

2) restart libvirtd
# service libvirtd restart

3) Start the virtual machine again

September 25, 2011 03:53 AM

September 09, 2011

douglas' livejournal

RHEV 3.0: REST API example (python)

Below, just an example how powerful and simple REST API is in RHEV 3.0

https://github.com/dougsland/rhev3-restapi-scripts/blob/master/summary.py

$ python summary.py -i 192.168.123.176 -u rhevm@ad.rhev3.com -p T0pSecreT!
Connecting to: https://192.168.123.176:8443/api
hosts: total 1
hosts: active 0
users: total 1
users: active 1
vms: total 0
vms: active 0
storage_domains: total 0
storage_domains: active 0

All examples: 
https://github.com/dougsland/rhev3-restapi-scripts

September 09, 2011 10:09 PM

August 22, 2011

douglas' livejournal

Fedora/CentOS/RHEL: setting bond

Below an example of setting bond (active-backup mode)

1) Disable NetworkManager (if you have)
# chkconfig NetworkManager off
/etc/init.d/NetworkManager stop

2) Load module
# vi /etc/modprobe.d/bonding.conf
alias bond0 bonding

3) Setup eth0
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
MASTER=bond0
SLAVE=yes
USERCTL=no
ONBOOT=yes
BOOTPROTO=none

4) Setup eth1
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1"
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes

5) Setup bond0
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.54
NETWORK=192.168.1.0
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS=8.8.8.8
USERCTL=no
BONDING_OPTS="miimon=1000 mode=active-backup"
TYPE=Ethernet

6) Restart your network service or reboot your machine

7) Checking bonding setup
# cat   /proc/net/bonding/bond0

More about bonding:
/usr/src//Documentation/networking/bonding.txt

August 22, 2011 08:08 PM

August 12, 2011

douglas' livejournal

Fedora: Glade 3.6.7 - Stock button not showing the image

# yum install gconf-editor
# gconf-editor

1. Go to desktop -> gnome ->interface
2. Check "buttons_have_icons"

August 12, 2011 12:55 AM

August 04, 2011

douglas' livejournal

mount.nfs: Unknown error 521

#mount -t nfs 10.10.1.109:/data /data
mount.nfs: Unknown error 521

To solve I have included into my NFS server the insecure mode.

# vi /etc/exportfs
/data *(rw,sync,insecure)

# exportfs -a (reload /etc/exportfs)

The insecure option allows clients with NFS implementations that don’t use a reserved port for NFS.

The same post is valid to error msg:
mount.nfs: access denied by server while mounting 10.10.1.109:/data

August 04, 2011 03:36 PM

Linux: Installing flash 64 bit - x86_64 - beta 11

http://labs.adobe.com/downloads/flashplayer11.html

# cd /
# tar zxvf flashplayer11_b1_install_lin_64_071311.tar.gz
# mv libflashplayer.so /usr/lib/mozilla/plugins/

restart firefox/chrome

August 04, 2011 03:44 AM

August 03, 2011

douglas' livejournal

virt-manager: cloning sparse images

The virt-manager version 0.8.6 cannot clone sparse images using the virt-manager clone option.
Instead of create a new sparse image, it creates a new image with the full size of image.

To avoid this, you can clone by hand using cp and adding the new image manually, here an example:

Cloning the image
# cd /var/libvirt/images
# cp --sparse=auto my-virtual-machine-template.img my-new-vm.img

# cd /etc/libvirt/qemu/
# cp my-virtual-machine-template.xml new-virtual-machine.xml
# vi new-virtual-machine.xml

Change the fields:
my-virtual-machine-template
dc16b3e4-baee-2bf7-6b02-b6217e81b03d

Example:
new-virtual-machine
dc16b3e4-baee-2bf7-6b02-b6217e81b00d (choose random change)

# virsh define /etc/libvirt/qemu/new-virtual-machine.xml

Now open your virt-manager and enjoy!

August 03, 2011 05:55 PM

virt-manager: importing kvm image

1) Copy the xml definition of your virtual machine from original host to your new host into /etc/libvirt/qemu/
# scp /etc/libvirt/qemu/my-virtual-machine.xml myuser@newhost:/etc/libvirt/qemu/my-virtual-machine.xml
(you can use virsh dumpxml)

2) Copy the original image too /var/lib/libvirt/images
# cd /var/lib/libvirt/images
# scp my-image.iso myuser@newhost:/var/lib/libvirt/images/my-image.iso
Copying sparse file? use rsync instead of scp, otherwise scp will copy the full size of file
http://dougsland.livejournal.com/118882.html

3) Use virsh to enable your the virtual machine
# virsh define /etc/libvirt/qemu/my-virtual-machine.xml

4) Start your virtual machine from virt-manager

August 03, 2011 05:38 PM

copying sparse file over network (rsync)

# rsync -aP --sparse my-virtual-machine-template.img --progress -e ssh myuser@10.10.1.101:my-virtual-machine-template.img

August 03, 2011 05:15 PM

dokuwiki: removing playground and wiki template

rm -r /var/lib/dokuwiki/data/pages/playground
rm -r /var/lib/dokuwiki/data/pages/wiki

refresh your dokuwiki page

August 03, 2011 05:44 AM

August 02, 2011

douglas' livejournal

Fedora: Mounting NFS automatically at boot

# vi /etc/fstab
IP_ADDRESS_NFS_SERVER:/exported_dir /local_dir nfs rsize=8192,wsize=8192,timeo=14,intr

Example:
10.10.1.100:/mydir /mylocaldir nfs rsize=8192,wsize=8192,timeo=14,intr

# mount -a

August 02, 2011 06:37 PM

vono configuracoes - Proxy

Proxy: vono.net.br
Outbound Proxy: 200.146.79.165:1571

August 02, 2011 02:56 PM

August 01, 2011

douglas' livejournal

Fedora: Fixing grub - system reinstalled - lost grub - recover grub

- Boot with your Fedora DVD.
- Choose Rescue installed system.

On prompt:
- #chroot /mnt/sysimage
- #grub-install /dev/sda
If you get any error message, try: # grub-install --recheck /dev/sda
- # reboot

August 01, 2011 10:03 PM

Windows 7: Blue Screen of Death - NMI: Parity - DELL Optiplex 755

Check / Memory Parity Error

During the installation of Windows 7 with my Dell Optiplex 755 I got a
blue screen of death saying:

Hardware Malfunction
Call your hardware vendor for support
NMI: Parity Check / Memory Parity Error
*** The system has halted ***

To continue my installation I have changed the SATA Operation to
Legacyinto the BIOS:
Drivers -> Sata Operation -> Legacy instead of the factory
default setting (RAID Autodetect / AHCI)

A note: Linux worked out of the.

August 01, 2011 02:35 PM

July 30, 2011

douglas' livejournal

python: list python modules installed

# python
>>> help("modules")

July 30, 2011 06:46 AM

fedpkg update: Invalid build

BODHI_USER=your_fas_username fedpkg update
Creating a new update for my-project-1.0.0-4.fcXX
Password for dougsland:
Creating a new update for my-project-1.0.0-4.fcXX
Invalid build: my-project-1.0.0-4.fcXX

Make sure you have executed first fedpkg build and then fedpkg update

July 30, 2011 06:38 AM

July 15, 2011

douglas' livejournal

confparse - python module to parse .conf files (do not require session)

I have decided wrote a python module to parse .conf files (confparse) to easy handle libvirtd.conf and other .conf files that involve my day job.
 

Why write a new python module to parse .conf files if python provides  http://docs.python.org/library/configparser.html ?

 

confparse DO NOT require session argument to change any the config attribute
    * confparse you can manage config attributes as dict variable type, the index of dict will be the attribute name of the config file
    * confparse uses dict to manage the conf file, with this feature you can record all config changes at just one time.

 

Would like to try? Available at: https://github.com/dougsland/confparse/wiki

July 15, 2011 08:52 PM

July 13, 2011

douglas' livejournal

libvirt: add virtio to kvm guest (xml)

# cd /etc/libvirt/qemu/
# cp guest.xml original.guest.xml
# vi guest.xml

Add the following lines:

<interface type='network'>
      <source network='default'/>
      <model type='virtio'/>
</interface>

# virsh define guest.xml

# virsh start guest

(Inside guest)

# ifconfig -a (check if the interface eth0 exists)
# dhclient eth0

July 13, 2011 07:13 PM

July 07, 2011

douglas' livejournal

python exercise to get configuration value from a file.

There are many Config Parser in python but usually they require to use [session] to locate the session of configuration and then parse the file to locate the conf value. Below my response (quick/simple hack) method to these modules....

Example of use:
==================
self._getConfValue("/etc/libuser.conf", "crypt_style")

Function return
==================
if the configuration is commented will return the caracter "#", otherwise will return the value of configuration

Code:
===========

def _getConfValue(self, pathFile, stringValue):
       confValue = ""
       try:
           lines = open(pathFile).readlines()
       except IOError, reason:
           print "Cannot open file!"
           sys.exit(1)

        for line in [l.strip() for l in lines]:
            if not line:
                continue

        ret = line.find(stringValue)
        if ret != -1:
            # configuration commented? return value #
            if line[0] == "#":
                confValue = "#"
            else:
                sizeString = len(line)
                indexEqual = line.index('=')
                indexEqual += 1 # Get next caracter from =
                for i in range(indexEqual, sizeString):
                    if (line[i] == "\"") or (line[i] == " "):
                        continue
                    confValue += line[i]

return confValue

July 07, 2011 04:33 AM

June 16, 2011

douglas' livejournal

powershell - Executing quick SELECT statement

Just to share an example:

$Connection = New-Object System.Data.SQLClient.SQLConnection
$Connection.ConnectionString = "server=MY_SQL_SERVER_NAME;database=MY_DATABASE;trusted_connection=true;"
try {
       $Connection.Open()
}
catch {
        Write-Host "Cannot connect to the SQL Server!"
         exit
}
$SqlCmd.CommandText = "select count(*) from users"
$SqlCmd.Connection = $Connection
$nro_users = $SqlCmd.ExecuteScalar()
Write-Host "Saving number of users:" $nro_users
$nro_users > 'c:\users.txt'
exit

June 16, 2011 06:06 PM

June 15, 2011

douglas' livejournal

powershell: exporting certificate

To export certificate from LocalMachine, Trusted Root Certification Authorities and subject *RHEVM CA*

$cert = (dir cert:\localmachine\root)[0] | where { $_.Subject -like "*CN=RHEVM CA*" }
$type = [System.Security.Cryptography.X509Certificates.X509ContentType]::Cert
$bytes = $cert.export($type)
[System.IO.File]::WriteAllBytes("C:\mycert.cer", $bytes)

June 15, 2011 05:57 PM

June 14, 2011

douglas' livejournal

powershell: reading windows registry entry

$reg_path = "HKLM:\SOFTWARE\Wow6432Node\RedHat\SetupInfo\"
$reg_key = Get-ItemProperty -path $reg_path -name InstallLocation
$rhevPATH = $reg_key.InstallLocation


Write-Host $rhevPATH
exit

June 14, 2011 08:13 PM

May 11, 2011

douglas' livejournal

resume NFS failed copy

curl -C - -O file:///my-super-path/file
 http://www.omnigia.com/news/2008/10/16/resume-interrupted-cp-using-curl/

May 11, 2011 04:31 AM

March 31, 2011

douglas' livejournal

Vmware: "Initialization for vtd failed. with -1"

VMware started to show me the message "Initialization for vtd failed. with -1" and iommu was not able to be started during the boot.
Also VSphere stopped to work.

I have tried to disable on the BIOS VT Direct IO (IOMMU) and Vmware stoped to work and doesn't boot anymore.
To solve the issue I have updated the BIOS of my mainboard.

Mainboard: Intel DP43TF
Updated to BIOS Version: 107

Binary: NBG4310H.86A.0107.EB.EXE
http://downloadcenter.intel.com/Detail_Desc.aspx?lang=eng&changeLang=true&DwnldID=19740

March 31, 2011 02:18 AM

March 26, 2011

douglas' livejournal

fedora 13: Acessando página do Banco Do Brasil no Linux

http://blog.rosset.us/2010/10/fedora-14-openjdk-firefox-banco-do-brasil/

March 26, 2011 11:40 PM

fedora: rc.local not working with synergy?

Add your synergy line to

# vi /etc/gdm/Init/Default

<snip>
PATH=/usr/bin:$PATH
OLD_IFS=$IFS
</snip>

/usr/bin/synergys -c /home/dougsland/.synergyserver

http://synergy-foss.org/

March 26, 2011 04:33 AM

March 24, 2011

douglas' livejournal

nagios: client denied by server configuration: /usr/lib64/nagios/cgi-bin/statusmap.cgi

# tail -f /var/log/httpd/error_log
<snip>
client denied by server configuration: /usr/lib64/nagios/cgi-bin/statusmap.cgi, referer: http://IP/side.html
</snip>

#vim /etc/httpd/conf/httpd.conf
<directory>
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

# service httpd restart

March 24, 2011 03:01 PM

February 19, 2011

douglas' livejournal

C# - Add certificate (.cer) to LocalMachine -&gt; Personal

public void addCertificatePersonal(string pathToCert)
{

/* Load certificate */
X509Certificate2 cert = new X509Certificate2(pathToCert);

/* Place to store cert */
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);

/* Add cert to the store */
store.Open(OpenFlags.ReadWrite);
store.Add(cert);
store.Close();
}

February 19, 2011 02:17 PM

C# Add Private Key - Place: LocalMachine -&gt; Personal

public void addPfxCertificate(string pathToPfx, string passwordPfx)
{

X509Certificate2 cert = new X509Certificate2(pathToPfx,passwordPfx, X509KeyStorageFlags.MachineKeySet |
X509KeyStorageFlags.PersistKeySet);

// Place to store
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);

store.Open(OpenFlags.MaxAllowed);
store.Add(cert);
store.Close();

}

February 19, 2011 02:13 PM

January 27, 2011

douglas' livejournal

C# getopt

This is a Getopt port to C#.NET.
http://getopt.codeplex.com/

Just worked fine.

January 27, 2011 03:52 PM

October 27, 2010

douglas' livejournal

serial console Linux

Requer:
===================

1 cabo serial com duas pontas tipo fêmea
2 máquinas com 1 porta serial tipo macho em cada

Linux:
====================
Neste post, será utilizado Red Hat Enterprise Linux 5 (RHEL5) e Fedora 10.
RHEL5 será o server e o Fedora o client. De qualquer maneira, o post é válido
para outras distros.

Teste inicial
=============================

Antes de começar vamos testar se a conexão entre as duas máquinas
esta funcionando. Esse teste é válido p/ validar cabo e placas.

Em ambas máquinas instale o minicom.

# yum install minicom -y

# minicom -s (para entrar no modo de setup)
-> Serial port setup
-> Pressione A p/ configurar o Serial device, neste exemplo /dev/ttyS0 (COM1)
-> Pressione E p/ configurar a velocidade e paridade do seu device, neste exemplo (38400 8N1)
-> Pressione enter p/ voltar ao menu principal e selecione Exit.

Com a tela do minicom aberta em ambas máquinas, tudo que você digitar em uma, deverá aparecer na outra máquina.
E se enquanto você digitava na máquina 'A' apareceu alguns caracteres estranhos na 'B'?
- Altere a velocidade da comunicação nas máquinas (Ex.: de 115200 p/ 38400)

Se tudo ocorreu bem, podemos ir p/ o próximo passo. Caso contrário, verifique velocidade, cabo ou sua placa serial.


Configurando a máquina "A" (server)
===============================================

Passos:

1) Adicionar no grub as configurações de serial (em negrito)

serial --unit=0 --speed=38400

Onde:
unit = é o número da COM (0 = COM1)
speed = velocidade

terminal --timeout=10 serial console

Terminal irá informar que será utilizado a comunicação serial, com o timeout de 10segundos.

kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup01/LogVol00 rhgb quii
et crashkernel=128M@16M loglevel=8 console=ttyS0,38400 console=tty

Na linha do kernel passamos a COM1 (ttyS0) como parâmetro e a velocidade e informamos
que o output tmb irá aparecer no terminar.

Versão final grub.conf
==========================
default=0
timeout=5
#splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
serial --unit=0 --speed=38400
terminal --timeout=30 serial console

title Red Hat Enterprise Linux Server (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup01/LogVol00 rhgb quii
et crashkernel=128M@16M loglevel=8 console=ttyS0,38400 console=tty
initrd /initrd-2.6.18-164.el5.img

Neste momento, reiniciando o servidor 'A' e deixando o minicom no servidor 'B' ativo, será possível visualizar
todo boot do servidor 'A'.


Habilitando opção de login no servidor
=======================================

1) Tenha certeza que sua COM (/dev/ttyS0) esta disponível dentro do /etc/securetty (p/ habilitar conexao via root, caso seja necessário)

2) Adicione a console (c0) no /etc/inittab
c0:2345:respawn:/sbin/agetty ttyS0 38400 vt100-nav

Para carregar as novas configurações você pode digitar (ou reiniciar):

#init q

Na máquina B execute o minicom p/ seu ttyS0 e veja o login aparecendo.


Resolução de problemas
=============================

1) Sujeira aparece no minicom (seja na hora do login ou antes)
- Diminua a velocidade da comunicação, existem cabos que não funcionam em velocidades altas (115200) por causa de
sua pinagem.

2) Nada funciona
- Verifique seu cabo e placas seriais
- Verifique a configuração

Onde comprar os equipamentos?
================================

Existem várias lojas através da internet, alguns exemplos:

www.soscabos.com.br (cabo)
www.digimer.com.br (placa serial pci)

October 27, 2010 04:39 PM

October 10, 2010

douglas' livejournal

Fedora13: mounting iphone

# yum install ifuse -y

# mkdir /media/iphone
# ifuse /media/iphone

# ls /media/iphone

October 10, 2010 06:28 PM

September 20, 2010

douglas' livejournal

Iphone 3G + Linux + Fedora + Operadora TIM + Tethering, Internet Compartilhada (bluetooth)

http://jkeating.livejournal.com/75270.html

September 20, 2010 04:14 AM

September 10, 2010

douglas' livejournal

How to install a kvm guest without graphics?

#mkdir /var/www/httpd/iso
#mount -o loop my-distro.iso /var/www/httpd/iso

virt-install --name my-distro-name --hvm --vcpus 1 --ram 512 --nographics --os-type=linux --disk path=/var/lib/libvirt/images/my-distro-name.img, size=5 --network bridge:virbr0 --extra-args "console=tty0 console=ttyS0,115200" --accelerate -l http://127.0.0.1/iso

Actually, you can use directly -l my-distro.iso, like:

virt-install --name my-distro-name --hvm --vcpus 1 --ram 512 --nographics --os-type=linux --disk path=/var/lib/libvirt/images/my-distro-name.img, size=5 --network bridge:virbr0 --extra-args "console=tty0 console=ttyS0,115200" --accelerate -l ./fedora.iso

September 10, 2010 08:05 PM

August 02, 2010

douglas' livejournal

Receptor USB Tevii S660

Por: Raimundo Eduvirgens Oliveira

Estou feliz em dizer a todos os interessados no assunto, que temos mais um excelente dispositivo funcionando perfeitamente no linux. É o receptor USB TeVii S660. Comprei no ML, liguei na parabólica normal de 2,40m apontada para o Satélite C2 (antigo B1) e sintonizei tantos os canais da Banda C quanto os da Banda Ku. Consegui usá-lo tanto no VLC quanto no Mythtv. A qualidade da imagem é ótima. Pra isso eu fiz o seguinte:


1 – Peguei o driver pra Linux no site da Tevii: www. tevii.com descompactei o arquivo 100315_Beta_linux_tevii_ds3000.rar e segui os passos do arquivo readme como root, usando o comando “sudo su”. Eu testei ele no Ubuntu, nas versões 9.04, 9.10, e 10.04. Funcionou legal em todas.


2 – No VLC, no menu Midia eu abrir o dispositivo de captura e escolhi o modo de captura DVB, mantive o tipo DVB-S e simplesmente coloquei a frequência e a taxa de simbolo do canal desejado. Ex.: pra pegar a repetidora do SBT de Minas eu coloquei a frequência 11526000 e a Taxa de Símbolos do Transponder 4444000. É bom testar vários canais. As frequências e Taxa de Símbolos estão relacionadas no site www.lyngsat.com.


O Mythtv


No Mythtv é um pouco mais complicado porque tem mais recursos. Pra quem não conhece, o Mythtv permite você assistir a TV, dar pause, retrocesso e avanço, tudo isso ao mesmo tempo que tá gravando, você pode também programar uma gravação futura. Apartir de qualquer micro ligado em sua rede, você pode assistir a TV capturada no computador onde está instalada o dispositivo capturador, como também assistir os vídeos gravados e arquivados nesse computador principal. Esses são os principais recursos do Mythtv, mas ele pode fazer muito mais. Para saber de todos os recursos é bom dar uma olhada no site www.mythtv.org.

O Mythtv é composto por dois programas: o primeiro monta o servidor que é chamado de Backend Master e o segundo faz o cliente. Claro que os dois podem ser instalados no mesmo computador ou em computadores diferentes.

Eu, na verdade, sou um usuário novato do Mythtv e não sei usar nem um terço de seus recursos, mas o principal eu já consegui. Configurei o dispositivo Tevii S660 no computador principal (master backend) e posso assistir os canais sintonizados, tanto nesse computador quanto nos outros de minha rede, inclusive no Notebook conectado via wireless.

O Mythtv suporta mais de um dispositivo capturador, por isso eu também uso uma Pixelview Mpeg2 instalada no mesmo micro.

Depois de instalado o driver do Tevii S660 é só entrar no Mythtv Backend adicionar o dispositivo capturador, adicionar uma ou mais fontes de vídeo (vídeo sources), adicionar uma ou mais conecções (input conections) e então sintonizar os canais. Como o dispositivo é capaz de sintonizar tanto na Banda C quanto na Banda Ku, então eu adicionei duas fontes de vídeo e dois inputs também, respectivamente para as duas Bandas C e Ku. Para sintonizar os canais eu fui colocando a frequência e o Symbol Rate de cada canal e manda o programa localizar e fixar o a frequência. Depois, é só fechar o Mythtv Backend, ele vai pedir pra abrir o Database pra gravar as alterações e se tudo estiver ok, já podemos abrir o Mythtv Frontend e assistir a TV, gravar, dar pause, etc.

E isso é tudo. Como eu já disse, não expert no Mythtv nem no Ubuntu, mas se alguém quiser alguma dica e se estiver ao meu alcance, é só postar o comentário. Abraço a todos e obrigado a Douglas pelo espaço concedido.

August 02, 2010 12:33 PM

July 30, 2010

aris' advogato

30 Jul 2010

decided to give github a try today. awesome service so far.

July 30, 2010 03:08 AM

July 28, 2010

douglas' livejournal

Linux: opening .xz with tar tool

http://www.gnu.org/software/tar/#downloading
Version support: 1.22

Changelog:

* Support for xz compression (--xz option)
* Short option -J is reassigned as a shortcut for --xz
* The option -I is a shortcut for --use-compress-program
* The --no-recursive option works with --incremental

July 28, 2010 02:01 PM

July 07, 2010

douglas' livejournal

xen - live migration

Requirements:

- 2 Machines
- 1 NFS Server (can be one of the above machines but better if this is a separate machine)

Step by step:

Host 1:
-------------

1.1) backup your current xend-config.sxp
# cp /etc/xen/xend-config.sxp /etc/xen/xend-config.sxp.bkp-DATE-HERE

1.2) Edit settings
# vi /etc/xen/xend-config.sxp

(xend-unix-server yes)
(xend-relocation-server yes)
(xend-relocation-port 8002)
(xend-relocation-address '')
(xend-relocation-host-allow '')
# (xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$')

1.3) Restart the service
# service xend restart

1.4 Setting NFS (host 1 for example)
# ln /var/lib/xen/images /xen
# vi /etc/exports
/xen *(rw,sync,no_root_squash)
# service nfs start
# chkconfig nfs on

1.5 Start xen guest from Host 1
- From virt-manager or xm

Host 2:
-------------

1.6) Mount the NFS from host 1
# mkdir /xen
# mount -t nfs host1:/xen /xen


Finally, from Host 1 start the live migration:
# xm migrate -live Virtual_Machine host2

You will note that on virt-manager or xm list will show the new virtual
machine. To connect use virt-manager or xm connect.

July 07, 2010 07:59 PM

June 30, 2010

douglas' livejournal

xen - installing paravirt virtual machine (nfs)

On xen host:
---------------

1) Mount your favorite distro as loop

# mount -o loop LinuxDistro.iso /distro

2) Export the directory as NFS

# vi /etc/exports
/distro *(ro,sync)
             
3) Start nfs service

# service nfs start

4) Install your distro via NFS

# virt-install --paravirt --name LinuxDistro --ram 512 --nographics --os-type=linux
--disk path=/var/lib/libvirt/images/LinuxDistro.img,size=10 --location
nfs:192.168.122.1:/distro

5) To connect to this Domain (if rebooted)
  xm console Domain
  (to exit) CTRL ]

June 30, 2010 11:23 PM

April 06, 2010

aris' multiply

and then... the great hatred

after spending some years asking why someone would have that, I caught myself doing the
same. it could be by osmosis. it could be genetic. it could be simply growing. or in other words:
facing reality. realizing that you're just a biological puppet that believes having "free will" is not
nice. even worse if you like your brain more than everything else. after years of observing people
forget about ethics, pride and being total prostitutes just to get something. after years of people
talking to you indirectly in a petty try of manipulate you to do what they want. after years
believing people don't want to be evil, they just want something. after all that, comes to a point
that I by default despise everything unless proved worth. I don't hate because it's too much work
and nobody is worth it, unless proved otherwise.

April 06, 2010 11:57 PM

March 26, 2010

douglas' livejournal

thunderbird - inline patch (kernel)

Installing thunderbird (Fedora)


# yum install thunderbird -y

Downloading Thunderbird plugin to edit emails with external editors


http://globs.org/articles.php?lng=en&pg=2
Download the .xpi file

Installing exteditor xpi


- Thunderbird -> Tools -> Add-ons -> Plugins -> Install (select .xpi file)
- Restart Thunderbird

Setting external editor


- Thunderbird -> Tools -> Add-ons -> Extensions -> External Editor -> Preferences
- Text Editor: gedit

Then add a button for it using:
-> Click on Write (to write a new email)
-> View -> Toolbars-> Customize and finally just click on `External Editor` and dragging it
to compose dialog.

uncheck "Compose messages in HTML format"


- Configure your mail server composition as plain text
- Thunderbird -> Edit -> Account Settings -> Composition & Addressing
-> uncheck 'Compose Messages in HTML'.

Edit your Thunderbird config settings to tell it not to wrap lines and won't use format=flowed


- Thunderbird -> Edit -> Preferences -> Advanced -> Config Editor
- mailnews.wraplength should contain 0 as value
- mailnews.send_plaintext_flowed should contain false as value

Writing email with a inline patch



- Thunderbird -> Write (to compose)
-> Click External Editor then you will see the bellow template:

Subject: [PATH] file: description
To: mailing@list.com
Cc:
Bcc:
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
copy and paste your patch here (from other gedit window)

- Click Save and close the window; then you will see your compose window with a inline patch

If this doesn`t work?



- I got a issue from thunderbird plugin which I had to to click (two or three times) in external editor button and close the `gedit/gvim/kate` window until it recognize the template.

This tutorial was created using thunderbird 3.0.3 and External Editor Version 0.8.0

References:


Documentation/email-clients.txt
http://repo.or.cz/w/git.git?a=blob;f=Documentation/SubmittingPatches;hb=HEAD
http://globs.org/articles.php?lng=en&pg=2

March 26, 2010 04:36 PM

March 02, 2010

barbanegra's journal

‰ž­(¦¦Ê'±¬¬²‰ž¶§‚‰í…äÕ

Dude! It's been a while since I last shown signals that I'm alive!
Obviously so many things have happened in my life since my last post that there's just no way to summarize all important stuff at this point! :-)
I'll see if I can find a way to have Twitter feed LiveJournal.. but not right now :-)

March 02, 2010 04:05 AM

February 22, 2010

douglas' livejournal

parse-usbsnoop - parse for usbsnoop (usb sniffer) logs

Version: 0.0.1

Description:
This is a quick hack to parse logs from the usbsnoop (usb sniffer)

Settings:
If needed to process a huge log maybe is needed to increase
the php settings.

$ vi /etc/php.ini
memory_limit = xxM

Usage:
$ php ./parse-usbsnoop ./log-usbsnoop.txt > output.txt

Example:
009279: 002309 ms 126080 ms c0 0e a0 00 00 00 01 00 <<< 00
009280: 000007 ms 126087 ms c0 10 a0 00 00 00 01 00 <<< 00
009281: 000005 ms 126092 ms 40 0e a0 00 00 00 01 00 >>> 99
009282: 000107 ms 126199 ms c0 0e a0 00 01 00 01 00 <<< 99
009283: 000015 ms 126214 ms c0 0e a0 00 10 00 01 00 <<< 99

http://cathedrallabs.org/~landgraf/linux-media/parse-usbsnoop/parse-usbsnoop-0.0.1

February 22, 2010 02:42 PM

February 20, 2010

douglas' livejournal

vim + python + autocomplete

Pydiction allows you to Tab-complete Python code in Vim, including: standard, custom and third-party modules and packages. Plus keywords, built-ins, and string literals.

1) Download Pydiction 1.2: http://www.vim.org/scripts/download_script.php?src_id=11062

2) Create dirs

$ mkdir -p ~/.vim/after/pydiction
$ mkdir -p ~/.vim/after/ftplugin

3) Copy files

$ unzip pydiction-1.2.zip
$ cd pydiction-1.2
$ mv python_pydiction.vim ~/.vim/after/ftplugin/
$ mv complete-dict pydiction.py README.txt ~/.vim/after/pydiction/

4) Add data to .vimrc

$ vim ~/.vimrc
" pydiction
filetype plugin on
let g:pydiction_location = '~/.vim/after/pydiction/complete-dict'
let g:pydiction_menu_height = 15

5) Test

Restart vim and type: print and Press TAB

#!/usr/bin/env python
print

References:
http://www.vim.org/scripts/script.php?script_id=850
http://quilobyte.blogspot.com/2009/10/vim-e-python-autocompletar.html

February 20, 2010 08:59 PM

February 17, 2010

douglas' livejournal

ipod + linux

gtkpod - www.gtkpod.org

Fedora:

yum install gtkpod -y

$ gtkpod

February 17, 2010 10:38 PM

February 15, 2010

douglas' livejournal

Vono: Can't connect to login server + pap2t

Setar Outbound Proxy:
200.146.79.165:1571

Manual de cofiguração completo em:
http://www.falevono.com.br/_download/manual_PAP2T-NA.pdf

February 15, 2010 05:15 PM

February 14, 2010

douglas' livejournal

Cães foram enterrados vivos em Joinville, confirma laudo

Isso é Brasil...

http://www.clicrbs.com.br/diariocatarinense/jsp/default.jsp?uf=2&local=18&section=Geral&newsID=a2806488.xml

February 14, 2010 09:37 PM

February 10, 2010

douglas' livejournal

PassSync failed to start. Verify that you have sufficient privileges to start system services

Solution:

Copy the dll msvcr71.dll to C:\Windows\System32 directory and retry the install operation. Dll usually available in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\msvcr71.dll

February 10, 2010 07:02 PM

January 17, 2010

douglas' livejournal

Havaianas welcomes Winter

Amazing video...

January 17, 2010 03:51 PM

January 16, 2010

douglas' livejournal

Saturday... rotfl :)

roftl http://www.rofl.name/f/game_roflcopter

January 16, 2010 05:55 PM

(dica rapida) pushd / popd - Alternando de diretorios rapidamente....

Para trocar alternar de diretorios rapidamente eu recomendo a utilizacao do comando pushd

Neste rapido exemplo, irei adicionar somente dois diretorios, mas podemos adicionar qnts quisermos.

$ [dougsland@medogz ~]$ pushd /tmp/
/tmp ~
$ [dougsland@medogz tmp]$

Certo, adicionamos o diretorio /tmp e agora vamos adicionar o diretorio /var

$ [dougsland@medogz ~]$ pushd /var/
/var /tmp ~

$ [dougsland@medogz var]$

Agora para ficar alternando entre os diretorios e' so' digitar pushd

[dougsland@medogz var]$ pushd
/tmp /var ~
[dougsland@medogz tmp]$ pushd
/var /tmp ~
[dougsland@medogz var]$

Para listar os diretorios que estao na lista?
[dougsland@medogz var]$ dirs
/var /tmp ~

Para remover da lista?
[dougsland@medogz var]$ popd
/tmp ~

January 16, 2010 12:29 AM

Do not access ldap to local users

/etc/nsswitch.conf

passwd: files ldap
shadow: files
group: files

January 16, 2010 12:15 AM

January 15, 2010

douglas' livejournal

How to control (long) delays to do a local login when a LDAP server is down?

Add these lines to /etc/ldap.conf

nss_reconnect_maxconntries 1
nss_reconnect_tries 3
nss_reconnect_sleeptime 1
nss_reconnect_maxsleeptime 1

------------------------------

nss_reconnect_maxconntries - This is the maximum number of reconnection tries.

nss_reconnect_tries - Number of times a reconnection attempt will be made before gives up.

nss_reconnect_sleeptime - Minimum amount of time the code will sleep between reconnection attempts. (seconds)

nss_reconnect_maxsleeptime - Maximum amount of time the code should sleep between reconnection attempts.


Recommended read: http://backdrift.org/how-to-get-pam-ldap-local-logins-to-work-when-networking-is-down

January 15, 2010 10:31 PM

libvirt: How to enable logs?

vi /etc/libvirt/libvirtd.conf

Add these lines (or just uncomment):
-----------------------------------------------

# Logging level: 0 none, 4 errors, 3 warnings, 2 informations, 1 debug
# basically 1 will log everything possible
log_level = 4

To show logs through a file (/var/log/libvirt/libvirtd.log)
---------------------------------------------------------------

# Logging outputs:
# An output is one of the places to save logging informations
# The format for an output can be:
# x:stderr
# output goes to stderr
# x:syslog:name
# use syslog for the output and use the given name as the ident
# x:file:file_path
# output to a file, with the given filepath
# In all case the x prefix is the minimal level, acting as a filter
# 0: everything
# 1: DEBUG
# 2: INFO
# 3: WARNING
# 4: ERROR
#
# Multiple output can be defined , they just need to be separated by spaces.
# e.g.:
log_outputs="1:file:/var/log/libvirt/libvirtd.log"


For filters use:
-----------------------

# Logging filters:
# A filter allows to select a different logging level for a given category
# of logs
# The format for a filter is:
# x:name
# where name is a match string e.g. remote or qemu
# the x prefix is the minimal level where matching messages should be logged
# 1: DEBUG
# 2: INFO
# 3: WARNING
# 4: ERROR
#
# Multiple filter can be defined in a single @filters, they just need to be
# separated by spaces.
#
# e.g:
# log_filters="3:remote 4:event"
# to only get warning or errors from the remote layer and only errors from
# the event layer.


To finish, just restart libvirt:

$ /etc/init.d/libvirtd restart

References: http://libvirt.org/logging.html

January 15, 2010 01:29 PM