venerdì 22 febbraio 2013

upstart - umount cifs before network shutdown


Problema

Per un arcinoto bug delle distribuzioni debian based, il servizio di rete viene spento prima che le share cifs vengano smontate.
Il risultato è che se si stacca il cavo di rete (o wifi) prima che le share siano smontate, il PC ci impiegherà tempi biblici per spegnersi (attende il timeout).


Soluzione

$> sudo vi /etc/init/dbus.conf

Ed aggiungere questa regola upstart: 

pre-stop script
       trap "TERM signal" TERM
      /bin/umount -a -t cifs -l -f
      trap - TERM
end script

In pratica aggiungiamo una regola agli eventi upstart del dbus, in modo che pensi lui a scatenare un umount delle share di tipo cifs durante lo spegnimento del PC.

Effetti collaterali / Mancanze

Come tutti i workaround anche questo ha dei pro e contro:
  1. dato che il workaround viene messo nel file upstart del dbus:
    > In short, that means dbus always stops on the event deconfiguring-> networking, which is emitted when "/etc/init.d/networking stop" is> called.> In other words, whenever "/etc/init.d/networking stop" is called, dbus> gets killed. That has a nasty effect: when dbus stops,> gnome-settings-daemon crashes and that means the desktop theme is lost
  2. se le share di rete erano state connesse tramite vpn , nonostante il workaround durante lo spegnimento andranno in timeout:
    > The cifs mount are avalaible through vpn (in this case cisco vpn),> whenever the vpn connection is gone/disconnect,but the remote
    > drives still appear as mounted in mtab,
    then > $umount --a -t cifs -l -f> takes a lot of time

    Yep, that's an understood failure mode: upstart is able to save
    network-manager itself from being killed before umountnfs, but isn't
    currently able to save the subprocesses (such as those for vpn handling)
    that NM spawns.

Nessun commento:

Posta un commento