Posts Tagged ‘Linux’

fstab, boot, mount and STP: a big challenge to solve

16 December 2011

Last week I have to fight with this problem: my host cannot mount by fstab at boot time but it mounts without problem after login by mount -a.
Syslog reports this error:

mount error 113 = No route to host
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

Online you can find too many posts about that error:

  • fstab not mounting my cifs, I have to manually call mount -a
  • unable to mount cifs (windows) partition through fstab
  • cifs not mounting on boot

In fact, it just reports that your host cannot contact your share-server ip.
And so we are going to troubleshoot…

1) Networking problem on host

Of course we focus on networking configuration of host: what’s the difference between manually call mount -a and fstab? When you manually mount, your network interface it’s already up (and you can easly test it with a ping to your server). But what about boot time?
Just look a /var/log/syslog and see what happens before your mount error alerts.
If your network configuration (/etc/network/interfaces or NetworkManager with “all users” automatic connection) it’s ok you can see something like “eth0 up”, “link up”, “eth0 ready” before mount errors! It seems ok!
To be sure, your can also use a fixed ip, but the problem remains!
My host use a fixed ip and syslog reports that my interface (eth0) it’s up before mount try to contact the remote server! WTF!?!? It use a fixed ip. It has eth0 up. Network setup it’s ok. This can make you(&me) crazy!

2) Networking problem on cable (bottom/physical layer)

If your network configuration is ok and up at mount time where is that fu**ing problem!? You can have a problem like this if you use a static ip address, a permanent up interface (without hotplug) but your cable is not connected. But your cable it’s just connected!!!
You can think that a mystical problem involves your packets but it’s strange that it happens only at boot time, after boot all is working fine!
As usual by IT, nothing is mystical: put your network tester in the closet.

3) No problem on host, no problem on cable, what’s next? Switch!

Modern switches uses the STP (Spanning Tree Protocol) on all ports by default to prevent bridge loops and the broadcast radiation.
When a device is first attached to a switch (STP enabled) port, it will not immediately start to forward data. It will instead go through a number of states while it determines the topology of the network. When a host is attached such as a computer, printer or server the port will always go into the forwarding state, albeit after a delay of about 30 seconds while it goes through the listening and learning states. Bingo!
Our interface it’s up and its configuration is ok but our switch don’t forward our host’s packets for about 30 seconds and so we cannot mount by fstab at boot!

4) Solution

A switch with STP is probably managed and your can configure STP properties.
My switch is able to disable STP globally or on a specific port.
Because STP is completely useless for a generic host (and only wasted my time) I have turn STP off on port of host. You can do so safely.
If you cannot turn off STP by port your can disable it globally but be sure that you don’t need it (or booommm).
If you cannot turn off STP on your switch (globally or by port) you can lower the “hello time” STP param to 1 (default is 2) but this can only reduce the listening/learning time (your host may always try to mount before).
If you dont want to turn off STP (or you can’t) you can remove the “auto” option from fstab and put a mount command like sleep 30 && mount /mnt/myshare & in your /etc/rc.local (sleep ensures that your mount happens after 30 seconds when your STP switch port starts to forward).

Happy hacking!!!

Note: 30 seconds it’s just an indication, STP can take usually 30 to 50 seconds to respond to a topology change. If your switch uses  RSTP (Rapid Spanning Tree Protocol) it’s typically able to respond to changes within 3 × Hello times (default: 3 times 2 seconds).

Debian 6.0 (squeeze) and Xerox Unified Driver v. 7-15

9 August 2011

Xerox Unified Driver works very well and you can install it without any problem from console or by the X (gui) wizard. At the moment it doesn’t support officialy Debian 6.0 (it supports old Debian 3.1, 4.0, 5.0 32/64bit) so this isn’t a real bug in fact but it can be a problem if you use squeeze.

insserv: warning: script 'K07smfpd' missing LSB tags and overrides
insserv: warning: script 'smfpd' missing LSB tags and overrides
insserv: There is a loop at service rmnologin if started
insserv: There is a loop between service rmnologin and mountnfs if started
insserv:  loop involving service mountnfs at depth 6
insserv:  loop involving service nfs-common at depth 5
insserv: There is a loop between service rmnologin and checkroot if started
insserv:  loop involving service checkroot at depth 3
insserv:  loop involving service mountdevsubfs at depth 2
insserv: Starting smfpd depends on rmnologin and therefore on system facility `$all' which can not be true!
(...)
insserv: Starting smfpd depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Max recursions depth 99 reached
insserv:  loop involving service portmap at depth 4
insserv: There is a loop between service rmnologin and pcmcia if started
insserv:  loop involving service pcmcia at depth 2
insserv:  loop involving service udev at depth 1
insserv:  loop involving service module-init-tools at depth 4
insserv:  loop involving service mountnfs-bootclean at depth 8
insserv:  loop involving service exim4 at depth 8
insserv: There is a loop between service rmnologin and mountoverflowtmp if started
insserv:  loop involving service mountoverflowtmp at depth 3
insserv:  loop involving service mountall-bootclean at depth 2
insserv:  loop involving service avahi at depth 8
insserv: There is a loop between service rmnologin and ifupdown if started
insserv:  loop involving service ifupdown at depth 5
insserv:  loop involving service ifupdown-clean at depth 4
insserv:  loop involving service fuse at depth 11
insserv:  loop involving service networking at depth 7
insserv:  loop involving service mountall at depth 5
insserv:  loop involving service checkfs at depth 4
insserv: There is a loop between service rmnologin and ifupdown-clean if started
insserv: There is a loop at service smfpd if started
insserv:  loop involving service smfpd at depth 1
insserv:  loop involving service hwclockfirst at depth 4
insserv:  loop involving service hostname at depth 5
insserv: There is a loop between service rmnologin and mountall if started
insserv:  loop involving service mtab at depth 7
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header

To solve this problem you can:

  1. uninstall Xerox Unified Driver, update your system or install your software and then reinstall the Xerox driver
  2. “If your MFP device is not connected to LPT port, you can safely disable execution of this script” so remove /etc/init.d/smfpd (and its symlinks) from your init.d and rc.X folders
  3. Recommended: “LSBize” the init script to fix the problem (http://wiki.debian.org/LSBInitScripts). Add these lines to your /etc/init.d/smfpd (at EOF is ok because position is not important, so you can also use a combo of cat /patch >> /etc/init.d/smfpd if you want to fix it automatically)
    ### BEGIN INIT INFO
    # Provides:          smfpd
    # Required-Start:    $syslog
    # Required-Stop:     $syslog
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Xerox Unified Linux Driver LPT Support daemon
    # Description:       Enable support for LPT port service provided by Xerox Unified Linux Driver package.
    ### END INIT INFO

And just request support for Debian 6.0 ;)

update 2011-08-12: there is another minor bug in install.sh at line 1187 because –reload_rules is wrong, change it to –reload-rules

How-to Install Debian 6.0 (squeeze) Linux on HP 620 notebook

5 August 2011

HP 620. It’s a great notebook for business. Hp620 is not the best about performance but it’s fast – really fast! with linux – and it’s ok with it’s easy and clean design. Its hardware is very good (almost everything is manufactured by Intel) and it’s cheap!

Above all, you can also buy it pre-installed with Linux (Suse Enterprise Desktop)!

If you want Debian just install Debian 6.0 (Squeeze) with Desktop System, Notebook and Basic System files.
After installation run these commands from shell (as root).

cd ~
mv /etc/apt/sources.list /etc/apt/sources.list.original
touch /etc/apt/sources.list
echo "deb http://ftp.it.debian.org/debian/ squeeze main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.it.debian.org/debian/ squeeze main contrib non-free" >> /etc/apt/sources.list
echo "deb http://ftp.it.debian.org/debian/ squeeze-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.it.debian.org/debian/ squeeze-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ squeeze/updates main contrib" >> /etc/apt/sources.list
echo "deb-src http://security.debian.org/ squeeze/updates main contrib" >> /etc/apt/sources.list
apt-get update
apt-get install flashplugin-nonfree icedove icedove-l10n-it ntp wireless-tools
apt-get --yes install linux-headers-2.6-686 build-essential module-assistant pulseaudio firmware-ralink
m-a update && m-a prepare
m-a a-i -t alsa-source
echo "acpiphp" >> /etc/modules
echo "ata_piix" >> /etc/modules
echo "cfg80211" >> /etc/modules
echo "iTCO_vendor_support" >> /etc/modules
echo "iTCO_wdt" >> /etc/modules
echo "pci_hotplug" >> /etc/modules
echo "rt3090sta" >> /etc/modules
echo "snd_mixer_oss" >> /etc/modules
echo "snd_pcm_oss" >> /etc/modules
echo "speedstep_lib" >> /etc/modules
echo "tpm" >> /etc/modules
echo "tpm_bios" >> /etc/modules
echo "tpm_tis" >> /etc/modules
echo "auto lo" > /etc/network/interfaces
echo "iface lo inet loopback" >> /etc/network/interfaces
echo "allow-hotplug eth0" >> /etc/network/interfaces

Now you have a perfect business laptop with browser (firefox/iceweasel), email client (thunderbird/icedove) and openoffice (and whatever you want to install).

All hardware now works very well without any problem.
Enjoy.

linux/debian raid 1 recovery how-to

8 May 2009

Hi!

Today one of two harddisks on server fails. How-to repair raid? Easy.

Check raid status (find hda is not updated)

cat /proc/mdstat

If damaged disk is active (for example: only bad sectors) remove it from raid.

mdadm /dev/md0 -r /dev/hda

Turn off your server if hd is not hot-swappable.
Remove damaged hd and replace it with new hd.
Restart your server, be sure that is starts from the old ok hd (ex. hdb). Sometimes bios doesn’t properly updates boot devices and tries to start from new hd or cds, fix it.

System must boot-up properly from old ok hd.

Clean new hd (ex. /dev/hda), remove all partitions.

fdisk /dev/hda

Clean MBR of new disk (to be sure that an old mbr doesn’t exist)

dd if=/dev/zero of=/dev/hda bs=512 count=1

Copy raid partitions scheme from old ok hd.

sfdisk -d /dev/hdb > mbr_hdb.txt

Apply that scheme to your new hd.

sfdisk /dev/hda < /root/mbr_hdb.txt

Add partitions from new disk to your raid

mdadm /dev/md0 -a /dev/hda1

Raid recovery starts.
Check rebuild status

mdadm –detail /dev/md0


/dev/md0:
Version : 00.90
Creation Time : Wed Apr  1 11:10:50 2009
Raid Level : raid1
Array Size : 37110016 (35.39 GiB 38.00 GB)
Used Dev Size : 37110016 (35.39 GiB 38.00 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Fri May  8 11:52:58 2009
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1

Rebuild Status : 74% complete

UUID : b1d86bee:0e4dedf0:4ddd5836:05672650
Events : 0.680998

Number   Major   Minor   RaidDevice State
2       3        1        0      spare rebuilding   /dev/hda1
1       3       65        1      active sync   /dev/hdb1

That’s it!
Wait and be happy.

oh…. as you know this is not a complete/best/lucky tutorial, if you follow it you home may explode, your city my be destroyed, but don’t bother me! :) no warranty

Good luck!! :D

Intel Corporation PRO/Wireless 4965 AG or AGN (HP notebook dv2690el / Debian / Linux)

27 September 2008

Hi! I’m posting to release a fast and furious tutorial to bring your wireless lan active in a few minutes.

I assume that you have a kernel release >= 2.6.24. The iwlwifi driver (we need it) has been merged into mainline kernel since 2.6.24.
Run uname -r command to know your kernel version.

Ex.
$ uname -r
2.6.26-1-686

If your kernel is < 2.6.24, you have to upgrade your kernel.
If your kernel is >= 2.6.24 simply load iwlwifi module with modprobe as root user (to become root user use su command at command line and insert root’s password):

modprobe iwlwifi

Is your wlan led turned blue? It’s right. Your wlan is active.
Now you can configure it with ifconfig or you can create an adeguate configuration in /etc/network/interfaces file. If you need help simply use man interfaces command.

Uhm, but I think you need a basic config to use at home with WPA encryption… you don’t have time to read / search / study… that’s so strange!! :D

So that’s it: edit /etc/network/interfaces (you need root privileges) and put this at the end of file.

#IW
# uncomment next row if you want your wlan active at startup
#auto wlan0
iface wlan0 inet dhcp
pre-up (echo 'Modprobing iwl4965') && /sbin/modprobe iwl4965
post-down (echo 'Removing iwl4965') && /sbin/modprobe -r iwl4965
wpa-ssid YOURNETNAMEAKASID
wpa-key_mgmt WPA-PSK
wpa-proto WPA
wpa-pairwise TKIP
wpa-group TKIP
wpa-psk "yourpassphrase"
wpa-driver wext

With this config you can easy bring up/down your wlan with ifup wlan0 or ifdown wlan0 as root user.

Note: in order to use wpa you need to install a package called wpasupplicant. Install it with apt-get install wpasupplicant as root user.

Have a nice day!

HP notebook dv2690el and linux and… WOW!!!

15 September 2008

Hp dv2690el (dv2000 series) is my new laptop.

dv2690el notebook and linux debian

dv2690el notebook and linux debian

Microsoft Vista is too much slow for a pc like this… Who code Vista think to users or think to Hardware Productors? I can’t belive that a new machine equipped with centrino duo and 2gb ram may be slow like it may be with Vista… like a pentium II and XP four years ago…

So, my friend, I’m going on linux with my preferred distro: Debian. And I’m going like a rocket!!!
When I bought this notebook I thinked «I hope that linux works with it».
But now, with debain unstable and kernel 2.6.26-1-686 I think: «Wow!!! It’s completly ready to work after installation!!!». Webcam works without any configuration, also with Skype. alsaconf configure audiocard in no more than 30s, nvidia video card has native linux drivers directly from productor, wlan is active immediatly and without problems (see my dv2690el linux wireless how-to), touchpad it’s right, eth0 works without problems during installation (NETinst) and after, k3b burn CDs and DVDs whitout stop, special keys work immediatly with xmodmap and remote control too… simply wonderful!!!

You like linux and want a new notebook? dv2690el it’s a good choice!

To use special keys and remote control put these rows in a new file:

keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
keycode 160 = XF86AudioMute

Name this file .Xmodmap and put it in your home (~) directory. Reload X or type xmodmap ~/.Xmodmap.


Follow

Get every new post delivered to your Inbox.