tech_log: February 2009

Sunday, February 22, 2009

Trouble apt-getting gdb-arm-linux-gnu

Package collided with already installed gdb (man pages).
  1. Marx:/usr/share/man/man1# apt-get install gdb-arm-linux-gnu
  2. Reading package lists... Done
  3. Building dependency tree      
  4. Reading state information... Done
  5. Suggested packages:
  6.   gdb-doc
  7. The following NEW packages will be installed:
  8.   gdb-arm-linux-gnu
  9. 0 upgraded, 1 newly installed, 0 to remove and 189 not upgraded.
  10. Need to get 0B/2348kB of archives.
  11. After this operation, 5046kB of additional disk space will be used.
  12. (Reading database ... 107197 files and directories currently installed.)
  13. Unpacking gdb-arm-linux-gnu (from .../gdb-arm-linux-gnu_6.8-3_i386.deb) ...
  14. dpkg: error processing /var/cache/apt/archives/gdb-arm-linux-gnu_6.8-3_i386.deb (--unpack):
  15.  trying to overwrite `/usr/share/man/man1/gdb.1.gz', which is also in package gdb
  16. dpkg-deb: subprocess paste killed by signal (Broken pipe)
  17. Processing triggers for man-db ...
  18. Errors were encountered while processing:
  19.  /var/cache/apt/archives/gdb-arm-linux-gnu_6.8-3_i386.deb
  20. E: Sub-process /usr/bin/dpkg returned an error code (1)
  21. Marx:/usr/share/man/man1#
Resolution:
dpkg -i --force-overwrite /var/cache/apt/archives/gdb-arm-linux-gnu_6.8-3_i386.deb


Tuesday, February 3, 2009

Ethernet card data on Linux






For logging on to the net or for attaching as a node on a LAN,
your computer needs a network card. The network card forms the
interface between your computer and the network. There are different
kinds of network cards available in the market depending on its speed
and other features. Here is a tip to find out the characteristics of
your network card.

If you want to find what type of network card is used, its speed, on which IRQ it is listed, and the chip type used, you use the following command :

<code># <span style="font-weight: bold;">dmesg |grep <span style="color: rgb(153, 0, 0);">eth0</span></span></code></pre> <div style="text-align: justify;">Here <span style="font-weight: bold; font-family: courier new;">eth0</span> is the first network card. If you have additional cards, it will be named <span style="font-family: courier new;">eth1</span>, <span style="font-family: courier new;">eth2</span> and so on. And here is the output of the above command :<br /></div> <pre><code>divert: allocating divert_blk for eth0<br />eth0: <span style="color: rgb(0, 0, 153); font-weight: bold;">RealTek RTL8139</span> at 0xd800, 00:80:48:34:c2:84, <span style="font-weight: bold; color: rgb(0, 0, 153);">IRQ 9</span><br />eth0:  Identified 8139 chip type 'RTL-8100B/8139D'<br />divert: freeing divert_blk for eth0<br />divert: allocating divert_blk for eth0<br />eth0: RealTek RTL8139 at 0xd800, 00:90:44:34:a5:33, IRQ 9<br />eth0:  Identified 8139 chip type 'RTL-8100B/8139D'<br />eth0: <span style="font-weight: bold; color: rgb(0, 0, 153);">link up</span>, <span style="font-weight: bold; color: rgb(153, 0, 0);">100Mbps</span>, <span style="font-weight: bold; color: rgb(0, 0, 153);">full-duplex</span>, lpa 0x41E1<br />eth0: no IPv6 routers present<br />...<br /></code></pre><div style="text-align: justify;">The important things to note here are those highlighted in colour. As you can see from the above listing, my ethernet card is a <span style="font-family: courier new;">RealTek RTL8139</span> chipset based card on <span style="font-family: courier new;">IRQ 9</span> (Interrupt Request). Its speed is <span style="font-family: courier new;">100 Mbps</span> and is a <span style="font-family: courier new;">full-duplex</span> card. And the link is up.</div><br /><div style="text-align: justify;">As
is the philosophy of Linux, there is more than one way of finding the
same information. Linux also comes with a cute sounding tool called <span style="font-weight: bold; font-family: courier new;">mii-tool</span> which can also be used to get the same information about your network card.<br /></div><pre><code># <span style="font-weight: bold;">mii-tool -v eth0</span></code></pre><pre><code>eth0: <span style="font-weight: bold; color: rgb(0, 0, 153);">negotiated</span> <span style="font-weight: bold; color: rgb(153, 0, 0);">100baseTx</span>-<span style="font-weight: bold; color: rgb(0, 0, 153);">FD</span>, link ok<br />product info: vendor 00:00:00, model 0 rev 0<br />basic mode: <span style="font-weight: bold; color: rgb(0, 0, 153);">autonegotiation enabled</span><br />basic status: autonegotiation complete, link ok<br /><span style="font-weight: bold;">capabilities</span>: 100baseTx-FD 100baseTx-HD 10baseT-FD<br /> 10baseT-HD<br />...<br /></code></pre> <div style="text-align: justify;">Here <span style="font-weight: bold; font-size: 130%;"><span style="font-family: courier new;">-v</span></span> is verbose mode. From the above listed output, one can see that the ethernet card is working as a <span style="font-family: courier new;">100baseTX</span>, <span style="font-family: courier new;">FD</span> (Full Duplex) card which can work in the following modes :<br /></div> <ul><li>100 Mbps Speed (Full duplex or half duplex ) or</li><li>10 Mbps speed (Full duplex or half duplex).<br /></li></ul> <div style="text-align: justify;">And it <span style="font-weight: bold;">uses autonegotiation to bring up the link</span>. You can call the above device as a 10/100 NIC.<br /></div> <div style="text-align: justify;">Another tool which also does the same thing is <span style="font-weight: bold; font-family: courier new;">ethtool</span>. Try the following command on your machine to see the output.<br /></div> <pre><code># <span style="font-weight: bold;">ethtool eth0</span><br /><br />Settings for eth0:<br /> Supported ports: [ TP MII ]<br /> Supported link modes: 10baseT/Half 10baseT/Full<br /> 100baseT/Half 100baseT/Full<br /> Supports auto-negotiation: Yes<br /> Advertised link modes: 10baseT/Half 10baseT/Full<br /> 100baseT/Half 100baseT/Full<br /> Advertised auto-negotiation: Yes<br /> <span style="font-weight: bold;">Speed: <span style="color: rgb(153, 0, 0);">100Mb/s</span></span><br /> <span style="font-weight: bold;">Duplex: <span style="color: rgb(0, 0, 153);">Full</span></span><br /> Port: MII<br /> PHYAD: 32<br /> Transceiver: internal<br /> <span style="font-weight: bold;">Auto-negotiation: <span style="color: rgb(153, 0, 0);">on</span></span><br /> Supports Wake-on: pumbg<br /> Wake-on: p<br /> Current message level: 0x00000007 (7)<br /> Link detected: yes<br /></code>
Here full duplex, half duplex and auto-negotiation have the following meanings.
Full Duplex
- Logic that enables concurrent sending and receiving. This is usually
desirable and enabled when your computer is connected to a switch.

Half Duplex
- This logic requires a card to only send or receive at a single point
of time. When your machine is connected to a Hub, it auto-negotiates
itself and uses half duplex to avoid collisions.

Auto-negotiation
- This is the process of deciding whether to work in full duplex mode
or half duplex mode. An ethernet card supporting autonegotiation will
decide for itself which mode is the optimal one depending on the
network it is attached to.