arquivo

Arquivo da tag: slackware

Hello friends!

Today is 2016/08/25, 25 years of Linux! Happy Birthday!! 😀 😀

Today we gonna talk about how to upgrade a Slackware, we will use just the official slackware package management tool (slackpkg), lets upgrade a slackware 14.2 to a -current for example (this also works with other versions too, but try upgrade to the next always or deal with consequences).

What is slackpkg?

Slackpkg is a system package management tool developed by PiterPunk and oficially supported by Slackware, some of the most common subcommands are:

slackpkg update          -> synchronize with your mirror 
slackpkg search package  -> looks for 'package' into mirror
slackpkg install package -> install 'package' from mirror
slackpkg upgrade package -> upgrade 'package' from mirror
slackpkg upgrade-all     -> upgrade all packages installed
slackpkg install-new     -> install new software available in repository

First, install and upgrade your slackpkg

# slackpkg update  #(choose a mirror in /etc/slackpkg/mirrors)
# slackpkg upgrade slackpkg

I like the TDS Mirror but you can choice any -current mirror you like there. Then add the kernel packages into blacklist (/etc/slackpkg/blacklist) make sure that looks like this:

#kernel-firmware
#kernel-generic
#kernel-generic-smp
#kernel-headers
#kernel-huge
#kernel-huge-smp
#kernel-modules
#kernel-modules-smp
#kernel-source

(this is not totally necessary but I like to upgrade kernels after upgrade all other softwares)

Second, then upgrade your glibc-solibs, this is EXTREMELY NECESSARY to not crash your system after some upgrades of software.

# slackpkg upgrade glibc-solibs

Third, install and upgrade all your new software

# slackpkg install-new
# slackpkg upgrade-all

Kernel

Now, if you dont build your kernel youself, uncomment lines of blacklist (/etc/slackpkg/blacklist) to build the new kernel of Slackware repository. Check your lilo.conf or grub and apply the new kernel if you like (take care here, confirm that a new kernel was installed and check the images)

# cp /boot/vmlinuz /boot/vmlinuz-backup
# sed -i '/#kernel/s/^#//g' /etc/slackpkg/blacklist
# slackpkg upgrade-all 
# vim /etc/lilo.conf

The huge.s Slackware default kernel (built-in) have a lot of issues when we need use some softwares that require some modules/built-in by default, an example is the Docker. (huge.s default slackware kernel doesn’t support Docker very good). So you can choose use the generic kernel that has almost any module to load after boot the kernel, solving some of these issues. If you choose to do that, type the commands below, if you dont know what are you doing skip this part and use default /boot/vmlinuz.

# /usr/share/mkinitrd/mkinitrd_command_generator.sh 
mkinitrd -c -k 4.4.16 -f ext4 -r /dev/sda1 -m xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:ext4 -u -o /boot/initrd.gz
(this will generate this command to build a initrd.gz image, run this)
(it also, of course, creates '/boot/initrd.gz' with your def modules)
# vim /etc/lilo.conf # or your grub. i dont use this
(put your initrd image here and choice a vmlinuz-generic as default image)

Your lilo.conf should now look like this (tip: create another entry with old kernel, so if this fail to boot you can boot with the older)

image = /boot/vmlinuz-generic  # re-check if you use vmlinuz
 root = /dev/sda1              # change if not your root disk
 initrd = /boot/initrd.gz
 label = Slack64-Generic
 read-only
image = /boot/vmlinuz-backup
 root = /dev/sda1
 label = Slack64-Okay
 read-only

Then save your MBR and reboot your system!

# lilo -v  (check this with attention)
# reboot

And welcome to the -current version of Slackware, keep it upgraded 🙂

Hello friends, I’ve been using KVM a lot of months until now and every new host server that I create I need to change the way of how Slackware seems to create cgroups, libvirt doesn’t function very good if you don’t create specific directories in ‘/sys/fs/cgroup’ tree. So, to do that for me I made this script below

# cat /etc/rc.d/rc.cgroup

#!/bin/sh
#
# /etc/rc.d/rc.cgroup: cgroups init script
# Alexandre Mulatinho <alex@mulatinho.net>
# Unmount /sys/fs/cgroup
umount /sys/fs/cgroup

# Mount cgroup_root in /sys/fs/cgroup
mount -t tmpfs -o mode=755,rw cgroup_root /sys/fs/cgroup/

# Mount all the subsystems available in /sys/fs/cgroup as individual directory
for i in $(lssubsys -a | sed -e 's/,/ /g');
do
    mkdir -pv /sys/fs/cgroup/$i
    mount -v -t cgroup -o $i $i /sys/fs/cgroup/$i
done

# chmod u+x /etc/rc.d/rc.cgroup

And now everytime my slackware system boot, my cgroups tree are build in right way that KVM and libvirt can use him to manipulate things like memory, cpu, io, disk, etc. Hope it helps someone else 🙂

About two or three years ago I met the SlackBuilds Project on a mail list and learned to love it! As all slack users know, the philosophy of our distribution is the principle of KISS (Keep It Simple Stupid) and the strong support for developers.

What I don’t understand is why some other slackwares don’t know and/or use the SlackBuilds git tree in his local system to build packages, one in twelve times that I look for some cool app I do not found there, so I decide to put here some of what I do to build at least 70% of my packages.

1. First download all the slackbuilds git tree to your local file system.

$ git clone git://slackbuilds.org/slackbuilds.git

2. Keep updated!

$ cd slackbuilds && git fetch origin && git pull

3. Browse your options by category

slackbuilds# ls -l
total 416
-rw-r--r-- 1 root root 233080 Nov 11 20:24 ChangeLog.txt
-rw-r--r-- 1 root root 258 Sep 15 2013 README
drwxr-xr-x 189 root root 4096 Nov 11 20:24 academic/
drwxr-xr-x 15 root root 4096 Apr 13 2014 accessibility/
drwxr-xr-x 268 root root 12288 Oct 17 22:27 audio/
drwxr-xr-x 12 root root 4096 Oct 17 22:27 business/
drwxr-xr-x 286 root root 12288 Oct 17 22:27 desktop/
drwxr-xr-x 401 root root 12288 Nov 11 20:24 development/
drwxr-xr-x 374 root root 12288 Oct 17 22:27 games/
drwxr-xr-x 46 root root 4096 Oct 17 22:27 gis/
drwxr-xr-x 184 root root 4096 Nov 11 20:24 graphics/
drwxr-xr-x 41 root root 4096 Oct 17 22:27 ham/
drwxr-xr-x 87 root root 4096 Apr 13 2014 haskell/
drwxr-xr-x 728 root root 20480 Nov 11 20:24 libraries/
drwxr-xr-x 141 root root 4096 Nov 11 20:24 misc/
drwxr-xr-x 162 root root 4096 Nov 11 20:24 multimedia/
drwxr-xr-x 520 root root 20480 Nov 11 20:24 network/
drwxr-xr-x 146 root root 4096 Oct 17 22:27 office/
drwxr-xr-x 333 root root 20480 Nov 11 20:24 perl/
drwxr-xr-x 270 root root 12288 Nov 11 20:24 python/
drwxr-xr-x 14 root root 4096 Oct 17 22:27 ruby/
drwxr-xr-x 582 root root 20480 Nov 11 20:24 system/

4. Search and see the directory structure

slackbuilds# find . -iname '*vlc*'
./multimedia/vlc
./multimedia/vlc/vlc.info
./multimedia/vlc/vlc.SlackBuild
slackbuilds# cd multimedia/vlc/
slackbuilds/multimedia/vlc# ls
README doinst.sh.in patch-freerdp.diff patch-projectM-fontpath.diff slack-desc vlc.SlackBuild vlc.info

5. Install with just three commands

# source *info; wget -c $DOWNLOAD; sh *SlackBuild

And that’s it! It will generate a .t?z package of slackware on ‘/tmp’ directory to you run ‘installpkg’ permitting you to run the binary/script installed. Easy and cool way to find your packages quickly and compile them with your architecture optimized.

# upgradepkg --reinstall --install-new /tmp/SBo/*vlc*

And if I can’t find my package there!?
Can you build yourself this new package? Why not? A slackbuild is just a basic shell script and in this case have almost the same code of all others, you just need to change a few things to make your Slackbuild script too, and perhaps put they on github or something like that,

You just need four files! Like in the example below with ‘gmrun’:

$ README gmrun.SlackBuild gmrun.info slack-desc

Lets look a sample of ‘.info’ file

PRGNAM="gmrun"
VERSION="0.9.2"
HOMEPAGE="http://sourceforge.net/projects/gmrun/"
DOWNLOAD="http://downloads.sourceforge.net/gmrun/gmrun-0.9.2.tar.gz"
MD5SUM="6cef37a968006d9496fc56a7099c603c"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="Binh Nguyen"
EMAIL="binhnguyen@fastmail.fm"
APPROVED="rworkman"

Now take a look into ‘slack-desc’ file

# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

     |-----handy-ruler----------------------------------------------------|
gmrun: gmrun (A simple program which provides a run program window)
gmrun:
gmrun: gmrun is a simple GTK program which provides a "run program" window.
gmrun: It features a bash-like TAB completion, Ctrl-R/Ctrl-S for searching
gmrun: through the history and URL handlers for any user defined prefix.
gmrun:
gmrun: Homepage: http://sourceforge.net/projects/gmrun/
gmrun:
gmrun:
gmrun:
gmrun:

And finally into an .SlackBuild file

#!/bin/sh

PRGNAM=gmrun
VERSION=${VERSION:-0.9.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) export ARCH=i486 ;;
    arm*) export ARCH=arm ;;
       *) export ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -eu

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION

chown -R root:root .
find -L . 
 ( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 
  -o -perm 511 ) -exec chmod 755 {} ; -o 
 ( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 
 -o -perm 440 -o -perm 400 ) -exec chmod 644 {} ;

CFLAGS="$SLKCFLAGS" 
./configure 
  --prefix=/usr 
  --libdir=/usr/lib${LIBDIRSUFFIX} 
  --localstatedir=/var 
  --sysconfdir=/etc 
  --build=$ARCH-slackware-linux

make
make install DESTDIR=$PKG

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF 
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

The variables PRGNAM, VERSION and BUILD are respectively the name of program, his version and perhaps a build number, you also need to understand the basic aspects of install to build your new package, be him a tar or zip file or a have a python setup, to put your own build scheme change lines 51-60 and if you want browse the source and know how the things happen on this software just move your mind to ‘/tmp/SBo’ 😉 Hope you enjoy it and share your builds with us!

Quantos aqui não lembram quando a mamãe dizia: ‘meu filho, agradeça todos os dias por tudo que você tem’. Eu posso dizer que esse conselho eu adotei e também que através disto considero-me um previlegiado, uso Linux há mais de 10 anos e tenho oportunidade de realmente ‘BRINCAR’ no meu trabalho, pois trabalho com o mesmo Sistema Operacional diariamente e através do conhecimento que tenho consigo migrar vários ambientes para este sistema maravilhoso.

No meu novo emprego sou considerado ‘um novato’, tenho pouco menos de 6 meses na empresa, mas o pouco tempo que estou de passagem por aqui considero extremamente proveitoso, migrei sistemas legados e da microfofi para sistemas novos, livres e bem legais. Consegui migrar 3 servidores que antes eram piratas e hoje usam Software Livre por completo e atendem todas as necessidades de antes mas com um extra: são melhores! Engraçado né?

Posso dizer que sou feliz pois já tive a oportunidade de ser um dos centroavantes da migração de toda a Secretária de Educação de Recife para Linux, e onde eu passei fiz alguns colegas e amigos, formei também novos linuxers ávidos pelo conhecimento, as idéias que troquei com estes ‘novatos no mundo unix’ não só os ajudaram como a mim também, como é bom fornecer conhecimento gratuito para os colegas, diferente de algumas empresas que se apoiam numa política onde a regra é ‘eu me ferrei para aprender, se ferre também, sozinho’.

Posso confirmar que ando meio afastado da turma do Software Livre na minha região, não porque cansei da filosofia em si, mas porque é realmente complicado motivar pessoas que não querem nada com a vida, principalmente quando se trata de ajudar gratuitamente sem quase nenhum benefício próprio. Viva a liberade, pois:

  • Tenho liberdade para executar o programa, para qualquer propósito (liberdade nº 0);
  • Tenho liberdade de estudar como o programa funciona, e adaptá-lo as minhas necessidades (liberdade nº 1). Acesso ao código-fonte é um pré-requisito para esta liberdade;
  • Tenho liberdade de redistribuir, inclusive vender, cópias de modo que eu possa ajudar o próximo (liberdade nº 2);
  • Tenho liberdade de modificar o programa, e liberar estas modificações, de modo que toda a comunidade se beneficie (liberdade nº 3). Acesso ao código-fonte é um pré-requisito para esta liberdade;

E aí, será que você é tão feliz e livre no trabalho quanto eu?

Muita gente me pergunta: Por que cargas d’agua você usa Slackware como sistema operacional? Ué, for KISS (Keep It Simple Stupid), para manter simples o que é simples estúpido! 😉 Tirando a brincadeira, fiz uma tradução há algumas semanas de um artigo do Eric Hameleers (AlienBOB) no qual ele fala porque ele usa Slackware em vez de outras distribuições, não é que ele e eu temos opiniões semelhantes? 🙂

Segue o link da tradução abaixo:

Por que usar o Slackware?? (http://pe.slackwarebrasil.org/?q=node/36)

É como eu pensei, as primeiras impressões que eu tive da versão 64-bit do Slakware foi de que ainda falta bastante coisa, todavia eu devo dizer que em termos de performance como é de se imaginar é perfeito! As aplicações são realmente bastante rápidas e você sente uma grande potência mesmo no meu humilde Core 2 Duo 1.86GHz, ainda não tentei compilar novamente o kernel de uma forma mais adaptada à minha máquina mas tenho grandes esperanças quando isso acontecer.

A notícia boa é de que o slakware funciona muito bem em aplicações de 32-bit como era de se esperar, mas sua biblioteca (multilib) se diferencia das outras por alguns bons motivos que devem ser tema de um outro post futuramente, estou realmente excitado de ter migrado meu ‘servidor’ para o Slackware64 13.0. E para contribuir de alguma forma estou pensando em alguns projetos extras que brevemente postarei aqui…

É isso! Slackware forever!

%d blogueiros gostam disto: