Saturday, March 19, 2011

Manage users and groups

To add a new user:
# useradd -m user_name

To set or change a user password :
# passwd user_name

To modify an user account:
# usermod [options] user_name

To delete an user:
# userdel - Delete a user account and related files
# deluser - remove a user from the system

To add an user to a secondary group (append a group to a user):
# usermod -aG group_name user_name

To show the groups that belongs a user:
This show a reduced set of groups (maybe just the secondary groups)
# groups user_name

If the user uses the command groups without a user name, it will show an extended list of groups (maybe the primaries and secondaries groups)

The command id -nG user_name has the same behavior that group.

To remove a user from a group:
it is needed write all the groups the user belongs less the unwanted groups.
# usermod -G {groupname1,groupname2,...} user_name

To add a new group:
 # groupadd group_name

To modify a group:
 # groupmod [options] group_mane

To delete a group:
# groupdel - Delete a group
# delgroup - remove a group from the system

You can edit manually the OS groups file (needs logout-login):
# vi /etc/group

Example:
In KDE with HAL: The error that appears when I pugged a USB HDD was solved adding my user to the groups users and plugdev:
# usermod -aG users my_user
# usermod -aG plugdev my_user

Sunday, December 26, 2010

Slackware 13.1+ i810

I have installed Slackware 13.1 six month ago and since that I have a problem with video. Sometimes while I'm working the screen keeps freezing, I can move the mouse and see how the pointer moves, but always the screen shows the same image. In the console I have found the following error:

(EE) intel(0): Failed to submit batch buffer, expect rendering corruption or even a frozen display: Input/output error.

I have tried a pair of times solve the problem, but never successfully. Now I'm going again, taking care of documenting everything.

My graphic card is: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)

I used to use the i810 driver from Intel, but now this driver is deprecated and replaced by Intel graphic driver that support more cards from Intel.

The configuration:

  • Kernel: 2.6.33.4-smp
  • Xorg server: 1.7.7
  • xf86-video-intel: 2.11.0

I have found these error in Xorg.0.log :

(II) LoadModule: "fbdev"
(WW) Warning, couldn't open module fbdev
(II) UnloadModule: "fbdev"
(EE) Failed to load module "fbdev" (module does not exist, 0)

I have used xorgsetup to create a xorg.conf file, after that I have not seen the error again. But glxgears goes very slow yet, and possibly the video will fail again.

Listing just directories with "ls"

Basic but not so obvious for me:
For listing only the directories in, for example, /dev:

$ ls -d /dev/*/
/dev/block/ /dev/bsg/ /dev/bus/ /dev/char/ /dev/disk/ /dev/dri/ /dev/fd/ /dev/input/ /dev/mapper/ /dev/pts/ /dev/shm/ /dev/snd/

$ ls -adl /dev/*/
drwxr-xr-x 2 root root 720 2010-12-26 11:41 /dev/block/
drwxr-xr-x 2 root root 140 2010-12-26 11:41 /dev/bsg/
drwxr-xr-x 3 root root 60 2010-12-26 08:31 /dev/bus/
drwxr-xr-x 2 root root 4660 2010-12-26 11:41 /dev/char/
drwxr-xr-x 6 root root 120 2010-12-26 11:41 /dev/disk/
drwxr-xr-x 2 root root 80 2010-12-26 08:31 /dev/dri/
dr-x------ 2 felipe felipe 0 2010-12-26 12:21 /dev/fd/
drwxr-xr-x 3 root root 260 2010-12-26 08:31 /dev/input/
drwxr-xr-x 2 root root 60 2010-12-26 08:31 /dev/mapper/
drwxr-xr-x 2 root root 0 2010-12-26 08:31 /dev/pts/
drwxrwxrwt 2 root root 40 2010-12-26 11:31 /dev/shm/
drwxr-xr-x 3 root root 240 2010-12-26 11:32 /dev/snd/

$ ls -adl /dev/*/*/
drwxr-xr-x 6 root root 120 2010-12-26 08:31 /dev/bus/usb/
drwxr-xr-x 2 root root 300 2010-12-26 11:41 /dev/disk/by-id/
drwxr-xr-x 2 root root 80 2010-12-26 11:41 /dev/disk/by-label/
drwxr-xr-x 2 root root 220 2010-12-26 11:41 /dev/disk/by-path/
drwxr-xr-x 2 root root 120 2010-12-26 11:41 /dev/disk/by-uuid/
drwxr-xr-x 2 root root 100 2010-12-26 08:31 /dev/input/by-path/
drwxr-xr-x 2 root root 60 2010-12-26 08:31 /dev/snd/by-path/

For listing the current directory: ls -d */

Saturday, December 25, 2010

WD My Passport for Mac on Slackware and formatted in NTFS

Ok, yes, this problem was a little weird, but some reasons I have bought an external USB HD for Mac and I want to use it with my Slackware 13.1 machine.
So step by step the problems I had to use it was:
  1. When I plug the disk on my PC appears two devices in /dev :
    1. /dev/sdb1 : hfsplus filesystem; this is the disk I want use.
    2. /dev/sr1 : udf filesystem; this is other small disk, about 600MB, that I don't care by now.
  2. The HD that was formatted for Mac (/dev/sdb1), it use HFS+ filesystem. I want use the disk on Linux and Windows so I need a NTFS filesystem disk. I have used fdisk to change the filesystem of sdb1 to NTFS and then I have formatted it with mkfs.ntfs -f -L Disk_label /dev/sdb1
  3. When I have mounted sdb1 I had no access to the data stored in the disk, but if I did it on windows it works fine, so the problem was the way that is was mounted. I had installed NTFS-3g and the problem was solved with:
    mount -t ntfs-3g /dev/sdb1 /media/hd
    By this way, now I have complete access to the disk, but I have to mount it manually and as root.
  4. On /etc/fstab I had the row:
    /dev/sdb1 /media/memory0 auto noauto,user,exec,rw 0 0
    When the disk was mounted it is did it using the native NTFS filesystem instead of NTFS-3g. I have changed it by:
    /dev/sdb1 /media/memory0 ntfs-3g defaults 0 0
    With it I can mount the drive with mount /dev/sdb1 but just as root. I suppose that with this change I could have problems with volumes with other filesystems (FAT32 for example) linked to the same device (/dev/sdb1). But this is another problem that don't care by now.
Nothing that I have searched and tried have helped.
  1. I have created the file /etc/filesystems like a copy of /proc/filesystem but changing the line ntfs by ntfs-3g, but doesn't work.
  2. From the FAQ of NTFS-3g I have found something that should have help me but it didn't. http://www.tuxera.com/community/ntfs-3g-faq/#unprivileged
  3. Another page referring to the FAQ but with more information. http://pxnh.wordpress.com/ (at the end of the page).
  4. I have changed the group of ntfs-3g to plugdev but doesn't work.
So much time I have gave it to that little problem, so I'm thinking in changing the HDD filesystem to EXT3 or 4.
Finally I have formatted the HDD with EXT4 supposing that it would resolve the problem. But when I have mounted the HDD, I didn't have access to write in it. I have deleted from /etc/fstab the line that define /dev/sdb1 and after mounting the drive for first time, as root, I have changed the owner and permissions to my user and 760. Now the drive is mounted automatically in KDE using HAL. A dirty solution but is ok by now.

The error that appears when I pugged a USB HDD was solved adding my user to the groups users and plugdev and restarting the computer:
# usermod -aG users my_user
# usermod -aG plugdev my_user

Sunday, April 13, 2008

Slackware 12 + i810

Tenía problemas en X, no podía ver videos ni DVD, el openarena colgaba al PC, etc, además al iniciar X salen alguno errores. Buscando en la Internet leí que eso sucede porque el driver de mi tarjeta de video el i810 no estaba presente pues al momento de instalar el SO se instala una versión nueva que se llama intel y que el driver i810 en realidad es un link hacia intel. Para solucionar el problema bajé el paquete original del driver i810 y lo reinstalé.

El paquete está aquí : http://packages.slackware.it/package.php?q=current/xf86-video-i810-1.7.4-i486-2

Comando de instalación : # upgradepkg --reinstall xf86-video-i810-1.7.4-i486-1.tgz

Referencia : slacky.eu

Sunday, April 06, 2008

.poweroff

Por omisión Slackware no permite a los usuarios no root apagar el computador. Para evitar tener que entrar como root cada vez metí este comando a la lista sudo.

Editar con visudo el archivo sudoers agregando la siguiente línea.

felipe TheEnterprise = NOPASSWD: /sbin/shutdown -h now


Con ello el usuario felipe puede ejecutar el comando /sbin/shutdown -h now en el computador TheEnterprise sin necesidad de password. Claro que puede ser inseguro y más aún publicarlo en internet, pero creo que eso no importa porque mi computador es sólo de uso personal.

Luego hice un script de nombre .poweroff que puse en mi carpeta home y dentro de él agregué la siguiente línea:

sudo /sbin/shutdown -h now


Parece trivial, pero la memoria es frágil.

Sunday, March 23, 2008

Synaptics Touchpad + USB mouse

La compilación del driver Synaptics no dió especial problema, sin embargo X no partía pues decía que no encontraba un touchpad Syptics instalado. La solución pasó por editar el archivo /etc/rc.d/rc.modules-2.6.21.5-smp en la sección "PS/2 mouse support" se eliminó la opción "proto=imps" que trae por omición Slackware. Con ello todo funcionó bien. En la configuración de xorg se agregó un mouse USB, uso un MS IntelliMouse Optical 1.1, funciona pero no he probado si se pueden usar los 5 botones, por lo menos los tres tradicionales y la rueda funcionan bien.

El xorg.conf además considera la configuración para el monitor LCD y la salida de Svideo, al iniciar X veo que esto da algunos errores pero se ejecuta de todas maneras. No he probado la salida de Svideo, esto lo solucionaré más adelante. También veo que puede haber un problema con el teclado pues sale un error, pero esto no se nota al momento de usarlo. En resumen, esta configuración funciona, sucio pero funciona.

Slackbuid : synaptics.SlackBuild

xorg.conf : xorg.conf

Wednesday, March 05, 2008

Configurar Lilo y framebuffer

La configuración de lilo se hace en /etc/lilo.conf, en él cambié la posición de la sección Linux para arriba de la sección refente a windows, cambié el timeout desde 2 minutos a 10 segundos.
También cambié la cadena de texto que describe a cada SO en el archivo /boot/boot_messaje.txt nuevo texto:
Slackware 12
Windows XP

El framebuffer se eligió con las siguiente sentencia:
## VESA framebuffer console @ 1024x768x256
vga = 773

Para acelerar la partida agregué la siguiente palabra en la primera línea de /etc/lilo.conf:
compact

una vez terminado eso, ejecutar la aplicación lilo

Configurando tarjeta wifi

Este computador tiene la clásica tarjeta ipw2200, los drivers están instalados pero no se por que no está el firmware en su lugar, para instalarlos bajé la versión 3 del firmware desde el sitio del proyecto ipw2200, luego de descomprimir el archivo copié su contenido a la carpeta donde deben ir:
# cp ipw2200-bss.fw /lib/firmware
# cp ipw2200-ibss.fw /lib/firmware
# cp ipw2200-sniffer.fw /lib/firmware

Luego crear el archivo para dar parámetros al módulo cuando sea cargado, esto es, crear un archivo de texto /etc/modprobe.d/ipw2200 y escribir en su interior:
options ipw2200 led=1
Con ello se activará el led que indica el estado de la tarjeta wifi.

- Modifiqué el archivo /etc/rc.d/rc.inet1.conf en las siguientes lineas (se agregó "yes"):
USE_DHCP[0]="yes"
USE_DHCP[1]="yes"

- Se modificó el archivo /etc/rc.d/wireless.conf para la red wifi local que corresponde.
- Luego me cambié de casa y ahora la red wifi está encriptada con WPA. Para conectarse a la red se debe :
- Modificar el archivo /etc/wpa_supplicant.conf y poner los datos que corresponden a la red.
- ejecutar los comandos:
# wpa_supplicant -i eth1 -c /etc/wpa_supplicant.conf -B
# dhcpcd eth1

con ello se configura la tarjeta inalámbrica (eth1) para encriptación WPA.

Para que al iniciar el computador se conecte a al red WPA especificada en wpa_supplicant.conf editar el archivo /etc/rc.d/rc.inet1.conf y agregar esto en la sección de la tarjeta de red que corresponda, en este caso eth1.

WLAN_WPA[1]="wpa_supplicant"

Según leí hay otras opciones que se pueden agregar, pero cuando probé especificando el driver el computador no se pudo conectar a la red.

Primer boteo

- El teclado es qwerty/la-latin1.map
- El sonido está silenciado por omisión, para subir el volumen usar alsamixer y luego guardar configuración con alsactl.
- Crear un usuario para evitar usar al cuenta root:
# useradd -m felipe
# passwd felipe

El Hardware

La máquina destino a la que se refiere este sitio es un Laptop HP Pavilion dv1117la. El resultado de un lspci se agrega al final del post.

Todos los archivos de configuración y los slackbuilds que he usado están en:
http://alumnos.elo.utfsm.cl/~fperona/Linux/slackware/12.0/


Resultado de lspci:
00:00.0 Host bridge: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
00:00.1 System peripheral: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
00:00.3 System peripheral: Intel Corporation 82852/82855 GM/GME/PM/GMV Processor to I/O Controller (rev 02)
00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)
00:02.1 Display controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 83)
00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 03)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 03)
00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 03)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
02:06.0 Network controller: Intel Corporation PRO/Wireless 2200BG Network Connection (rev 05)
02:09.0 CardBus bridge: Texas Instruments PCIxx21/x515 Cardbus Controller
02:09.2 FireWire (IEEE 1394): Texas Instruments OHCI Compliant IEEE 1394 Host Controller
02:09.3 Mass storage controller: Texas Instruments PCIxx21 Integrated FlashMedia Controller
02:09.4 Generic system peripheral [0805]: Texas Instruments PCI6411/6421/6611/6621/7411/7421/7611/7621 Secure Digital Controller

Poco duró Gentoo

Luego de dedicarle un tiempo a Gentoo, actualizarlo e instalar algunos programas, me decidí a volver a Slackware, ¿por qué?. Pues simplemente porque me dí cuenta que debía dedicarle mucho tiempo para sentirme cómodo utilizándolo. Unas de las cosas que me llevó a probarlo fue que se supone que es fácil de actualizar y de instalar nuevos programas y que la instalación compila cada programa en en computador destino. Bueno tuve algunos problemas para instalar algunos programas y no supe resolverlos rápidamente, para hacerlo tuve que dedicar más tiempo del que quería. Entonces pensé que si me siento cómodo con Slackware mejor dedicar tiempo a seguir conociéndolo. La idea es que ahora la instalación sea más limpia que la vez anterior y por lo mismo usaré este espacio para dejar manifiesto de los pasos que he seguido durante la configuración posterior a la instalación.