O Ubuntu às vezes começa a trocar como um louco sem motivo

7

De vez em quando, meu Ubuntu começa a usar o disco rígido como um louco, e por 3 minutos eu não consigo mover o mouse nem acessar qualquer console, até mesmo o CTRL-ALT-BACKSPACE e o CTRL-ALT-F1 não fazem nada.

Geralmente é quando se faz alguma ação (abrir uma nova aba do navegador, iniciar o Eclipse, etc.).

Eu acho que nessas vezes meu Ubuntu começa a trocar como um louco, sem motivo.
Acontece mais se eu tiver o OpenOffice + Eclipse + Firefox aberto, mas às vezes isso também acontece com apenas aplicativos muito simples abertos.

Eu usei o iotop para gravar a atividade do disco durante um desses congelamentos. Naquela época eu só tinha o Chrome, gnome-terminal, gedit aberto. Eu tinha começado o iotop com sudo nice -20 sudo iotop -tbod10 > ~/iotop.log . É suposto gravar no log a cada 10 segundos, mas durante o congelamento não conseguiu escrever nada. No entanto, o log pouco antes do congelamento (09:42:23) indica que kswapd é provavelmente o culpado em 12.26 M/s :

    TIME  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN      IO    COMMAND
09:42:23    27 be/4 root        0.00 B/s   12.26 M/s  0.00 % 99.99 % [kswapd0]
09:42:23  1828 be/4 nico     1081.85 K/s    0.00 B/s  1.78 % 61.16 % compiz
09:42:23 31484 be/4 nico      128.22 K/s  668.16 B/s  0.00 % 50.59 % python /usr/bin/indicator-weather
09:42:23 17339 be/4 nico       89.72 K/s  668.16 B/s  0.00 % 50.32 % google-chrome
09:42:23 17397 be/4 nico      806.49 K/s    0.00 B/s  2.13 % 43.42 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc3880c0700.1895579466
09:42:23   315 be/4 root      334.08 B/s    0.00 B/s  0.00 % 37.90 % [flush-8:0]
09:42:23   297 be/3 root        0.00 B/s 1670.40 B/s  0.00 % 32.57 % [jbd2/sda1-8]
09:42:23  1244 be/4 root      502.75 K/s    0.00 B/s  0.77 % 31.90 % X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-XEqu73/database -nolisten tcp vt7
09:42:23 17403 be/5 nico      482.52 K/s    0.00 B/s  0.00 % 30.08 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc386e35000.1143953050
09:42:23 17608 be/4 root        0.00 B/s    0.00 B/s  0.00 % 27.27 % [kworker/0:2]
09:42:23  1857 be/4 nico      430.65 K/s    0.00 B/s  0.00 % 25.40 % indicator-multiload
09:42:23  2178 be/4 nico      100.49 K/s    0.00 B/s  0.00 % 23.91 % dropbox
09:42:23 17340 be/4 nico      448.59 K/s    0.00 B/s  3.66 % 18.24 % google-chrome
09:42:23 17322 be/4 nico      408.79 K/s    0.00 B/s  0.25 % 16.66 % google-chrome
09:42:23 17408 be/5 nico      162.47 K/s    0.00 B/s  0.37 % 15.75 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc387166c40.2054812173
09:42:23  1836 be/4 nico      278.62 K/s    0.00 B/s 72.10 % 14.14 % nautilus
09:42:23  9266 be/4 root       78.63 K/s    0.00 B/s  0.00 % 12.74 % adb fork-server server
09:42:23 17417 be/5 nico        0.00 B/s    0.00 B/s  0.00 % 11.63 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc386e35000.1143953050
09:42:23 17414 be/5 nico        9.79 K/s    0.00 B/s  0.00 % 11.63 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc387166c40.2054812173
09:42:23 17416 be/4 nico      668.16 B/s    0.00 B/s  0.00 % 11.63 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc3880c0700.1895579466
09:42:23 17237 be/4 postfix     5.55 K/s    0.00 B/s 20.29 %  9.59 % pickup -l -t fifo -u -c
09:42:23 17500 be/4 nico       27.73 K/s    0.00 B/s  0.00 %  9.39 % npwrapper.libflashplayer.so --lang=en-US --channel=17322.0x7fc38990c2c0.322771554
09:42:23 17399 be/4 nico       17.29 K/s    0.00 B/s  0.00 %  8.67 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc3880c0700.1895579466
09:42:23   584 be/4 root       87.44 K/s    0.00 B/s  0.00 %  6.36 % NetworkManager
09:42:23 17533 be/4 nico       47.96 K/s    0.00 B/s  0.00 %  5.88 % GoogleTalkPlugin
09:42:23  2218 be/4 nico      173.24 K/s    0.00 B/s  0.00 %  5.78 % unity-panel-service
09:42:23  1462 be/4 mysql      38.82 K/s    0.00 B/s  0.00 %  5.76 % mysqld
09:42:23  1463 be/4 mysql       5.87 K/s    0.00 B/s  0.00 %  5.65 % mysqld
09:42:23 29621 be/4 nico       32.95 K/s    0.00 B/s  0.00 %  4.43 % python /usr/bin/indicator-weather
09:42:23  1382 be/4 root       39.48 K/s    0.00 B/s  0.00 %  4.15 % apache2 -k start
09:42:23 17513 be/4 nico      119.41 K/s    0.00 B/s  0.00 %  4.06 % npviewer.bin --plugin /usr/lib/flashplugin-installer/libflashplayer.so --connection /org/wrapper/NSPlugins/libflashplayer.so/17500-2
09:42:23 17335 be/4 nico       21.86 K/s 1670.40 B/s  0.00 %  4.02 % google-chrome
09:42:23  2201 be/4 nico       10.11 K/s    0.00 B/s  0.00 %  3.85 % bamfdaemon
09:42:23  1842 be/4 nico       30.34 K/s    0.00 B/s  0.00 %  3.23 % gnome-power-manager
09:42:23  1812 be/4 nico       26.10 K/s    0.00 B/s  0.00 %  2.89 % gnome-settings-daemon
09:42:23  1848 be/4 nico       38.17 K/s    0.00 B/s  0.00 %  2.55 % indicator-sensors
09:42:23 12233 be/4 root       31.32 K/s 1002.24 B/s  2.06 %  2.54 % python /usr/bin/iotop -tbod10
09:42:23  1915 be/4 nico       10.11 K/s    0.00 B/s  0.00 %  2.27 % gvfs-afc-volume-monitor
09:42:23  1831 be/4 nico       10.44 K/s    0.00 B/s  0.00 %  2.13 % compiz
09:42:23  1464 be/4 mysql      20.88 K/s    0.00 B/s  0.00 %  1.84 % mysqld
09:42:23  2309 be/4 nico       18.92 K/s    0.00 B/s  0.00 %  1.79 % unity-applications-daemon
09:42:23 17337 be/4 nico        9.14 K/s    0.00 B/s  0.00 %  1.74 % google-chrome
09:42:23 17343 be/4 nico       13.38 K/s    0.00 B/s  0.00 %  1.72 % google-chrome
09:42:23  1252 be/4 root       51.55 K/s    0.00 B/s  0.00 %  1.65 % master
09:42:23  1907 be/4 root       18.27 K/s    0.00 B/s  0.00 %  1.21 % udisks-daemon: polling /dev/sr0
09:42:23  2186 be/4 nico       46.00 K/s    0.00 B/s  0.00 %  1.13 % python /usr/share/system-config-printer/applet.py
09:42:23  1862 be/4 nico        5.22 K/s    0.00 B/s  0.00 %  0.98 % indicator-multiload
09:42:23  2199 be/4 nico       26.10 K/s    0.00 B/s  0.00 %  0.90 % unity-window-decorator
09:42:23   906 be/4 root        2.28 K/s    0.00 B/s  0.00 %  0.82 % irqbalance
09:42:23   580 be/4 avahi      32.63 K/s    0.00 B/s  0.00 %  0.59 % avahi-daemon: running [nico.local]
09:42:23  1877 be/4 nico       18.60 K/s    0.00 B/s  0.00 %  0.57 % notify-osd
09:42:23 17360 be/4 nico       43.72 K/s    0.00 B/s 26.23 %  0.51 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc38672e8c0.1339188300
09:42:23  1800 be/4 nico       27.73 K/s    0.00 B/s  0.00 %  0.34 % dbus-daemon --fork --print-pid 5 --print-address 7 --session
09:42:23   627 be/4 root       10.44 K/s    0.00 B/s  0.00 %  0.33 % wpa_supplicant -u -s
09:42:23  2243 be/4 nico        3.59 K/s    0.00 B/s  0.00 %  0.33 % indicator-application-service
09:42:23  2284 be/4 nico        6.20 K/s    0.00 B/s  0.00 %  0.19 % update-notifier
09:42:23  2234 be/4 nico        0.00 B/s    0.00 B/s  0.00 %  0.18 % indicator-application-service
09:42:23  2220 be/4 nico        4.24 K/s    0.00 B/s  0.00 %  0.10 % unity-panel-service
09:42:23 17362 be/4 nico        7.83 K/s    0.00 B/s  2.54 %  0.00 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc38672e540.2001766922
09:42:23 17412 be/5 nico        0.00 B/s    0.00 B/s  9.26 %  0.00 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc3880afa80.2009126862

    TIME  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN      IO    COMMAND
09:45:22 17596 be/4 root        0.00 B/s    0.00 B/s  0.00 % 99.99 % [kworker/1:0]
09:45:22 17608 be/4 root        0.00 B/s    0.00 B/s  0.00 % 98.44 % [kworker/0:2]
09:45:22   315 be/4 root      808.56 B/s   17.81 K/s  0.00 % 86.79 % [flush-8:0]
09:45:22  1828 be/4 nico      621.79 K/s    0.00 B/s 16.33 % 86.29 % compiz
09:45:22 17340 be/4 nico      815.78 K/s    0.00 B/s 14.61 % 83.30 % google-chrome
09:45:22  1857 be/4 nico      575.28 K/s    0.00 B/s 12.32 % 82.64 % indicator-multiload
09:45:22  1812 be/4 nico      540.14 K/s    0.00 B/s  3.06 % 81.94 % gnome-settings-daemon
09:45:22  1848 be/4 nico      541.02 K/s    0.00 B/s 12.30 % 81.58 % indicator-sensors
09:45:22   584 be/4 root      606.07 K/s    0.00 B/s 11.51 % 78.40 % NetworkManager
09:45:22   906 be/4 root      308.53 K/s    0.00 B/s  0.00 % 76.26 % irqbalance
09:45:22 17335 be/4 nico       18.79 K/s  332.94 B/s  8.56 % 60.25 % google-chrome
09:45:22  1382 be/4 root      361.76 K/s    0.00 B/s  0.00 % 49.17 % apache2 -k start
09:45:22 17533 be/4 nico      282.38 K/s    0.00 B/s  0.00 % 45.30 % GoogleTalkPlugin
09:45:22 17550 be/4 nico      134.88 K/s    0.00 B/s  0.00 % 40.96 % npviewer.bin --plugin /usr/lib/flashplugin-installer/libflashplayer.so --connection /org/wrapper/NSPlugins/libflashplayer.so/17500-2
09:45:22  2309 be/4 nico      260.08 K/s    0.00 B/s  0.00 % 38.69 % unity-applications-daemon
09:45:22  1463 be/4 mysql     171.28 K/s    0.00 B/s  0.00 % 38.61 % mysqld
09:45:22 17360 be/4 nico      377.27 K/s    0.00 B/s  2.14 % 37.14 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc38672e8c0.1339188300
09:45:22  1888 be/4 nico      177.20 K/s    0.00 B/s  8.69 % 35.51 % python /usr/lib/desktopcouch/desktopcouch-service
09:45:22  2172 be/4 nico       64.52 K/s    0.00 B/s  3.93 % 35.19 % dropbox
09:45:22 17536 be/4 nico       71.95 K/s    0.00 B/s  0.00 % 32.79 % npviewer.bin --plugin /usr/lib/flashplugin-installer/libflashplayer.so --connection /org/wrapper/NSPlugins/libflashplayer.so/17500-2
09:45:22  9266 be/4 root      106.53 K/s    0.00 B/s  0.00 % 28.34 % adb fork-server server
09:45:22 17351 be/4 nico      225.76 K/s    0.00 B/s  1.69 % 27.98 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc3866eae00.1806036416
09:45:22 17412 be/5 nico      165.21 K/s    0.00 B/s  0.00 % 24.66 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc3880afa80.2009126862
09:45:22  2179 be/4 nico       58.25 K/s    0.00 B/s 24.18 % 22.89 % dropbox
09:45:22  2178 be/4 nico       29.63 K/s    0.00 B/s  0.00 % 22.83 % dropbox
09:45:22  2284 be/4 nico      139.46 K/s    0.00 B/s  3.82 % 21.98 % update-notifier
09:45:22   627 be/4 root       89.74 K/s    0.00 B/s 74.21 % 21.71 % wpa_supplicant -u -s
09:45:22  2218 be/4 nico      129.89 K/s    0.00 B/s 76.33 % 21.59 % unity-panel-service
09:45:22 17532 be/4 nico       94.64 K/s    0.00 B/s  0.00 % 21.24 % GoogleTalkPlugin
09:45:22  9652 be/4 nico       12.91 K/s    0.00 B/s  0.00 % 20.14 % ruby script/rails console
09:45:22 17408 be/5 nico      152.30 K/s    0.00 B/s 83.52 % 17.19 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc387166c40.2054812173
09:45:22 17362 be/4 nico      178.41 K/s    0.00 B/s  1.63 % 16.11 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc38672e540.2001766922
09:45:22  1907 be/4 root       93.99 K/s    0.00 B/s  0.00 % 15.71 % udisks-daemon: polling /dev/sr0
09:45:22    27 be/4 root        0.00 B/s  136.18 M/s  0.00 % 15.66 % [kswapd0]
09:45:22  1915 be/4 nico       30.82 K/s    0.00 B/s  0.00 % 13.92 % gvfs-afc-volume-monitor
09:45:22 17403 be/5 nico      107.90 K/s    0.00 B/s 89.46 % 12.11 % --disable-client-side-phishing-detection --enable-print-preview --disable-webgl --disable-gl-multisampling --disable-accelerated-compositing --channel=17322.0x7fc386e35000.1143953050
09:45:22  1839 be/4 nico       60.13 K/s    0.00 B/s 21.61 %  9.98 % nm-applet --sm-disable
09:45:22  1244 be/4 root      105.58 K/s    0.00 B/s 84.86 %  9.73 % X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-XEqu73/database -nolisten tcp vt7
09:45:22  1462 be/4 mysql      29.35 K/s    0.00 B/s  9.90 %  8.99 % mysqld
09:45:22  1464 be/4 mysql      26.41 K/s    0.00 B/s  0.00 %  8.55 % mysqld

Estou usando o Ubuntu 2011.04 com home criptografado e 4GB de memória física + 4GB de swap:

free -m
             total       used       free     shared    buffers     cached
Mem:          3894       3044        850          0         94        935
-/+ buffers/cache:       2013       1880
Swap:         4023        942       3081

Eu tenho muito mais RAM do que realmente preciso, então essa loucura de troca é desconcertante.
Como posso parar esses congelamentos?

ATUALIZAÇÃO: conforme solicitado, aqui está a saída de hdparm -Idc /dev/sda1 :

/dev/sda1:
 IO_support    =  1 (32-bit)
 HDIO_GET_DMA failed: Inappropriate ioctl for device

ATA device, with non-removable media
    Model Number:       FUJITSU MJA2500BH G2                    
    Serial Number:      K95FT9A26PNT
    Firmware Revision:  0084001C
    Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6
Standards:
    Used: ATA-8-ACS revision 3f 
    Supported: 8 7 6 5 
Configuration:
    Logical     max current
    cylinders   16383   16383
    heads       16  16
    sectors/track   63  63
        --
    CHS current addressable sectors:   16514064
    LBA    user addressable sectors:  268435455
    LBA48  user addressable sectors:  976773168
    Logical  Sector size:                   512 bytes
    Physical Sector size:                   512 bytes
    device size with M = 1024*1024:      476940 MBytes
    device size with M = 1000*1000:      500107 MBytes (500 GB)
    cache/buffer size  = 8192 KBytes (type=DualPortCache)
    Form Factor: 2.5 inch
    Nominal Media Rotation Rate: 5400
Capabilities:
    LBA, IORDY(can be disabled)
    Queue depth: 32
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 16  Current = 16
    Advanced power management level: disabled
    Recommended acoustic management value: 254, current value: 254
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5 
         Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4 
         Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
    Enabled Supported:
       *    SMART feature set
            Security Mode feature set
       *    Power Management feature set
       *    Write cache
       *    Look-ahead
       *    Host Protected Area feature set
       *    WRITE_BUFFER command
       *    READ_BUFFER command
       *    DOWNLOAD_MICROCODE
            Advanced Power Management feature set
            SET_MAX security extension
       *    Automatic Acoustic Management feature set
       *    48-bit Address feature set
       *    Device Configuration Overlay feature set
       *    Mandatory FLUSH_CACHE
       *    FLUSH_CACHE_EXT
       *    SMART error logging
       *    SMART self-test
       *    General Purpose Logging feature set
       *    WRITE_{DMA|MULTIPLE}_FUA_EXT
       *    64-bit World wide name
       *    IDLE_IMMEDIATE with UNLOAD
       *    Disable Data Transfer After Error Detection
       *    WRITE_UNCORRECTABLE_EXT command
       *    {READ,WRITE}_DMA_EXT_GPL commands
       *    Segmented DOWNLOAD_MICROCODE
       *    Gen1 signaling speed (1.5Gb/s)
       *    Gen2 signaling speed (3.0Gb/s)
       *    Native Command Queueing (NCQ)
       *    Host-initiated interface power management
       *    Phy event counters
       *    NCQ priority information
       *    DMA Setup Auto-Activate optimization
            Device-initiated interface power management
       *    Software settings preservation
       *    SMART Command Transport (SCT) feature set
       *    SCT LBA Segment Access (AC2)
       *    SCT Error Recovery Control (AC3)
       *    SCT Features Control (AC4)
       *    SCT Data Tables (AC5)

Resultado de sdparm /dev/sda :

    /dev/sda: ATA       FUJITSU MJA2500B  0084
Read write error recovery mode page:
  AWRE        1
  ARRE        0
  PER         0
Caching (SBC) mode page:
  WCE         1
  RCD         0
Control mode page:
  SWP         0

Resultado de smartctl -l selftest /dev/sda :

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Vendor offline      Completed without error       00%         0         -
    
por Nicolas Raoul 12.10.2011 / 08:49

3 respostas

1

A atualização para o Ubuntu 2014.04 resolveu o problema.

(apenas uma atualização, não reinstale)

Então, na verdade, não é um problema de hardware: -)

    
por Nicolas Raoul 22.05.2014 / 15:26
3

Parece mais que você tem um comportamento ruim no disco. Você verificou a saída do hdparm para se certificar de que está usando o DMA? O acesso simples ao disco não deve congelar o sistema a menos que haja algo mais acontecendo. Eu olharia o resultado do dmesg e instalaria o smartmontools para ver se o seu drive está descartando erros do ATA ou se o SMART acha que o drive está morrendo.

E faça o que jnv disse ao aumentar a permuta; O Linux prefere, por padrão, trocar programas ociosos por dados em cache do disco rígido, e com um homedir criptografado, há muito mais atividade de disco para armazenar em cache (você pode considerar não usar criptografia homedir e apenas usar gpg ou similar para criptografar coisas que você realmente se preocupa). :)

    
por dannysauer 28.10.2011 / 18:59
1

Você pode tentar estas duas coisas para reduzir a troca:

  1. Reduza o swappiness (60 é o padrão, tente defini-lo como 10)
  2. Experimente o zRam (Primeiro, os dados serão compactados na memória antes de serem trocados para harddisk)
por jnv 28.10.2011 / 18:40