Archivi Categorie: Debug

MOC (mocp): Very high cpu usage in raspberrypi

MOC is available on the repositories in Raspbian (2.5.0-alpha4 release). Recently an high CPU usage has been signaled by using ‘mocp’ player on RaspberryPi (http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=24647&p=257780).

This bad behavior is currently undergoing review, in the meantime those who uses MOC can run the following command to bypass this problem and reduce (very) the CPU usage:

$ mocp -O "ALSADevice=hw:0,0"

It should use the ALSA hardware directly without the software layer in between format conversion and resampling.

Update (January,23 2013): according to the MOC forum, this issue is tied with a bug in ALSA, probably the one fixed in alsa-lib commit 3fd4ab9b, and is sensitive to sampling rate and sample width.
Version 1.0.26 on Fedora does not exhibit this bug on the RPi.
(Here the MOC rpm for Fedora 17 ARM).

Schermata del 2013-01-18 11:47:24

About these ads

Workaround for ‘vbox modules’ loading

Today again my Fedora 17 Beefy Miracle can’t load vbox modules, maybe caused by systemd that only accepts a list of modules in /etc/modules-load.d/ and not the shell scripts in /etc/sysconfig/modules (see https://bugzilla.rpmfusion.org/show_bug.cgi?id=1083).

If I display VirtualBox.modules …

# cat /etc/sysconfig/modules/VirtualBox.modules
#!/bin/sh
# User is advised to run this on upgrades
/sbin/modprobe -r -b vboxnetflt &>/dev/null ||:
/sbin/modprobe -r -b vboxnetadp &>/dev/null ||:
/sbin/modprobe -r -b vboxdrv &>/dev/null ||:
# Workaround for https://bugzilla.rpmfusion.org/show_bug.cgi?id=1083
insert_module ()
{
grep -qR "^[ \t]*blacklist[ \t][ \t]*$1[ \t]*" /etc/modprobe.d && return
modinfo $1 |awk '/filename:/ {print "insmod "$2}' |$SHELL
}
insert_module vboxdrv
insert_module vboxnetflt
insert_module vboxnetadp

vboxdrv, vboxnetflt, vboxnetadp are loaded by executing the command

# /etc/sysconfig/modules/VirtualBox.modules

then VirtualBox works until next reboot.
Now i want fix in a better way this problem using ‘systemd-modules-load.service’. It is an early-boot service that loads kernel modules from static configuration (see man systemd-modules-load.service); i created a virtualbox.conf file in /usr/lib/modules-load.d:

# vi /usr/lib/modules-load.d/virtualbox.conf
#Loading VirtualBox modules
vboxdrv
vboxnetflt
vboxnetadp

and restart service

# systemctl restart systemd-modules-load.service
# systemctl status systemd-modules-load.service
systemd-modules-load.service - Load Kernel Modules
Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static)
Active: active (exited) since Thu, 13 Sep 2012 15:03:40 +0200; 1s ago
Docs: man:systemd-modules-load.service(8)
man:modules-load.d(5)
Process: 12137 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/systemd-modules-load.service
Sep 13 15:03:39 local systemd-modules-load[12137]: Inserted module 'vboxdrv'
Sep 13 15:03:39 local systemd-modules-load[12137]: Inserted module 'vboxnetflt'

At the next system boot, VirtualBox should work without any error.

Analizzare i problemi di systemd

Systemd è un manager di servizi e di sistema per Linux compatibile con SysV e LSB Init Scripts.
In caso si presentassero dei problemi all’avvio di Fedora con systemd, prima di tutto è fortemente consigliato controllare tra le liste dei bug conosciuti della release in uso (magari il bug è stato già risolto); se invece è necessario aprire un nuovo bug report, vediamo cosa fare per analizzare il fatto e fornire più informazioni possibile ai developers.

Identificazione del problema

  • Rimozione delle opzioni rhgb e quiet dalla riga kernel nel file di configurazione di Grub.
  • Aggiungere l’opzione systemd.log_level=debug alla riga kernel per attivare la modalità debug log di systemd.
  • Aggiungere l’opzione systemd.log_target=kmsg alla riga kernel per ottenere la scrittura del systemd buffer nel kernel log buffer.
  • Avviare il comando $/bin/systemd --test --system --log-level=debug per testare l’avvio di init come systemd e calcolare le transazioni iniziali.

Informazioni da includere nel report

  • Esattamente la riga kernel utilizzata da Grub se diversa da quella di default; si ottiene dal grub.conf o con il comando $cat /proc/cmdline
  • Una copia del $cat /var/log/messages
  • Una copia del dmesg: $dmesg>dmesg.txt
  • L’output del systemd dump: $systemctl dump > systemd-dump.txt
  • L’output di $/bin/systemd --test --system --log-level=debug > systemd-test.txt 2>&1

Configurare una serial console

L’ avvio per un debugging di successo richiederà particolari tipi di login durante il processo di boot. Per abilitare il serial console output sia da kernel che da grub, aprire il grub.conf ed aggiungere le seguenti righe appena sotto la riga ‘timeout’:

serial --unit=0 --speed=38400
terminal --timeout=5 serial console

aggiungere inoltre i seguenti argomenti alla riga kernel in grub.conf

console=tty0 console=ttyS0,38400

Avvio in rescue mode o con la shell d’emergenza

Aggiungere systemd.unit=rescue.target alla riga di comando del kernel
Aggiungere systemd.unit=emergency.target oppure emergency alla riga di comando del kernel.

Vari comandi relativi a systemd

  • systemctl list-jobs
    Identifica, nei boot lenti, i job (lavori o esecuzioni) avviati (running) che rallentano il boot e quelli in attesa (waiting)
  • systemctl list-units -t service --all
    Lista i servizi disponibili e il loro stato
  • systemctl list-units -t service
    Lista i servizi avviati
  • systemctl status sshd.service
    Esamina lo stato corrente del servizio indicato
  • systemctl list-units -t target --all
    Lista tutti i target disponibili
  • systemctl list-units -t target
    Lista tutti i target attivi
  • systemctl show -p "Wants" multi-user.target
    Mostra quali servizi avvia il target indicato
  • systemd --test --system --unit=multi-user.target
    Esamina quali servizi ha avviato il target indicato
Iscriviti

Ricevi al tuo indirizzo email tutti i nuovi post del sito.

Unisciti agli altri 35 follower

%d bloggers like this: