jueves, 31 de diciembre de 2015

list of commands after a fresh install of Debian Jessie

Although there are a lot of this kind of post, here it is my list of commands I used after a fresh install of Debian, at the right of some commands I wrote a short explanation:

1. enable non free repos: add 'contrib non-free' at the end of your repos, then apt-get update and apt-get dist-upgrade

2. apt-get install wireless-tools

3. apt-get install firmware-realtek  //in case you've realtek NIC's

4. apt-get install firmware-linux-nonfree libgl1-mesa-dri xserver-xorg-video-ati // for ATI video cards

5. apt-get install unzip cmus shotwell vlc recordmydesktop gthumb baobab rar unrar //some utils

6. sudo apt-get install netselect-apt //looks for best repo for you (this is related with your ISP backbone, long talk about it)

 7. apt-get install build-essential module-assistant
     apt-get -f install

8. apt-get install flashplugin-nonfree  //flash player for iceweasel

sábado, 26 de diciembre de 2015

install realtek modules on debian jessie

My two NICs are Realtek, after a fresh installation of Debian you need to follow these steps to enable them:

1. edit your sources.list and add the non-free repositories (contrib non-free)

2. apt-get update

3. apt-get install firmware-realtek

After that, restart your system, you should use your NIC now.

cheers

lunes, 14 de diciembre de 2015

backup your Postgres Database Server

Very easy trick, but useful at the same time, whether you need to backup your PostgreSQL database server just follow these steps:

1. su postgres

2. psql -l

3. pg_dumpall > allmypgdata.sql

Now, in case you have any doubts, to check the databases had been backed up just use this:

 grep "^[\]connect" allmypgdata.sql

You have to see all databases' names

That's all

sábado, 12 de diciembre de 2015

avoiding "can't load menu.c32" error on booting from a pendrive

I needed to install Lubuntu on an old HP mini 110 laptop, normally I have a pendrive with  multiple Linux distro, I use multisystem to accomplish this; so, I tried to boot from my pendrive but I always got the error "can't load menu.c32 from..." I copied it on several location on the pendrive but it did not work, at last I got the error "can't load image file", so I decided to drop multisystem and try to install lubuntu on it using unetbootin.

Then I tried to boot from it and I always got the same error, so, to solve this I followed these steps:

1. from a terminal on another computer with Linux, go to /usr/lib/syslinux/modules/bios

2. copy the file vesamenu.c32 to the pendrive, just copy it outside any directory, it would be enough.

3. then try to boot from it and you'll see the Grub Menu to try Lubuntu or any other linux distro you need to install.

This little trick is useful when the videocard of the computer is not so fancy, to load you just need to load the VESA module and everything will work.


viernes, 11 de diciembre de 2015

bringing to life a deadly XFS partition

This kind of post makes me feel really happy because it could helps anyone when the things looks pretty bad and for the joy to solve an issue I needed to fix.

Long long long time ago I had a problem with one HDD, it had two partitions, one of them was an ext4 and the other one was an XFS, I was copying more than 400 GB of data but an energy outage happened and the partitions became corrupted;`  as a result, I could not read the entire HDD, I had important data in there so I have to recover them.

I think the most important step to accomplish this task is to be calm as much as you may; by that time, I had a lot of stuff in progress, my job, an outsource IT project, and teaching at university, I had to wait around 8 months to start working on this, so, avoiding that comment, these steps were really helpful for me:

1. plug your HDD using an enclosure
2. You may a distro called System Rescue CD, it has a programm called testdisk, so boot your computer using that distro
3. an important step was to make sure if the filesystem is recognize by the OS, SystemRescueCD has a programm called "Display Filesystems", I used it and I could see the filesystem on my broken HDD, one ext4 and the other the XFS one.
4. next step I tried to mount the partitions but I got and input/output error then I decided to use testdisk.
5. Using testdisk I found I had a problem with the geometry of the HDD, you have to choose to do a "quick search" test in order to fix this, then you need to write the changes made to the disk
6. I decided to do a Deep Search to the disk, this was not necessary because at this time I could mount the partition but one of them could not be written, but using this option you could list the files that are in the partition and save it to a safe location.
7. As I wrote, at this point the partitions could be mounted but the XFS one couldn't be written, I still got an input/output error, the ext4 did not present any problem at all.
8. There is an utility called xfs_repair, you may install it using "apt-get install xfsprogs", after that I use this line:
xfs_repair -L /dev/location_of_the_partition

and that's it, xfs_repair found some zombie inodes, it moved them to lost+found and the process was successful.

Then I tried to mount it and everything works perfect, I could backup my data.

Hope it may help you in case on emergency.

miércoles, 21 de octubre de 2015

Adding user account to several groups

Fast Ball, whether you need to add your user account to several group use this command:

usermod -a -G

Example:

usermod -a -G ftp bobdylan

Cheers

sábado, 4 de julio de 2015

backup and restore PostgreSQL database

I am sure there are a lot of ways how to do this but I would like to show you this effective way

1. whether you want to backup a database the sintaxis is:

pg_dump -h -U -f

Example:
pg_dump -h localhost -U bob accounting -f accounting07042015.sql

2. whether you want to restore a database you may use this sintaxis:
 psql -H -U -d -f

Example:
psql -h localhost -U bob -d accounting -f accounting07042015.sql

pay attention whether you get some warning or error messages.

Cheers