Thursday, April 28, 2016

ubuntu: Install a package from a different repository

In this case network-manager-openconnect came bad in the 16.04 first release, see bug https://bugs.launchpad.net/ubuntu/+source/network-manager-openconnect/+bug/1571300 for details.

16.04 is xenial and the fixed version was released in the yakkety repository, so had to do this:
sudo vi /etc/apt/sources.list
and add
deb http://mx.archive.ubuntu.com/ubuntu/ yakkety universe
right below the xenial universe line, then
sudo apt-get update
and now you should be able to see the available versions like this:
$ apt-cache policy network-manager-openconnect
network-manager-openconnect:
  Installed: (none)
  Candidate: 1.2.0-1build1
  Version table:
     1.2.0-1build1 500
        500 http://mx.archive.ubuntu.com/ubuntu yakkety/universe amd64 Packages
     1.0.2-1build1 500
        500 http://mx.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Cool, 1.2.0-1 is the one containing the fix from the bug report, how do I specify I want that version and not the xenial one? well, candidate points to the version which gets installed by default, but if for some reason we'd like to install the other version we could do it with
sudo apt-get install network-manager-openconnect=1.0.2-1build1
for this case the candidate points to the fixed version, so a simple
sudo apt-get install network-manager-openconnect
will do.

Running apt-cache policy again will show the installed package marked with the ***:
$ apt-cache policy network-manager-openconnect
network-manager-openconnect:
  Installed: 1.2.0-1build1
  Candidate: 1.2.0-1build1
  Version table:
 *** 1.2.0-1build1 500
        500 http://mx.archive.ubuntu.com/ubuntu yakkety/universe amd64 Packages
        100 /var/lib/dpkg/status
     1.0.2-1build1 500
        500 http://mx.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

Disable bluetooth at startup in ubuntu 16.04

sudo "echo 'manual' > /etc/init/bluetooth.override"
 

Tuesday, November 24, 2015

Raspberry Pi + ubuntu MATE

Well, after some time of experimentation with a few distros for the rpi2 I decided to stick with ubuntu MATE, because it provides the best user experience and a good environment for applications development, a big thank you to Martin Wimpress and Rohith Madhavan.

https://ubuntu-mate.org/raspberry-pi/

After downloading and decompressing the img file, instructions tell you to use

sudo ddrescue -d -D —force ubuntu-mate-15.10-desktop-armhf-raspberry-pi-2.img /dev/sdX

which fails with a 
ddrescue: Can't open input file: Invalid argument

but why?.. because fuck you, that's why, syntax is perfectly fine, and it even fails with absolute paths, so no fucking reason at all, anyway.. using the good old dd works fine:

sudo dd bs=4M if=ubuntu-mate-15.10-desktop-armhf-raspberry-pi-2.img of=/dev/mmcblk0

in addition, in a separate terminal you can use

sudo pkill -USR1 -n -x dd

to display progress, progress will be shown in the terminal writing the image.

Now just to be safe, type sudo sync to let all remaining operations finish, then you can safely remove the microSD card and boot your rpi2.

yaaay! we can see it booting and getting to the beautiful system configuration page, select your preferred settings and let it install everything for you and reboot.

Now login, connect to the network and update all packages:

sudo apt-get update && sudo apt-get upgrade

time to resize file system to use all our microSD storage:

sudo fdisk /dev/mmcblk0
d,2
n,p,2,enter,enter,w
reboot
sudo resize2fs /dev/mmcblk0p2


surprisingly enough, the last command gave me a "Permission denied to resize filesystem", even as root, it was complaining about "on-line resizing required", I went the easy way and resized it monuted in my laptop.

I had to go into recovery mode and run e2fsck to fix several issues, reboot again and rerun the command, it turned out to be a bad setting, I was using bs=1M in the dd command, that created wrong desc_blocks, so always use 4M.

We now have the 100% of our storage available, time for next steps:

Some useful packages are not installed


sudo apt-get install vim htop ntpdate

 

Date/Time is normally wrong 

Run and create a init script with this line:

$ sudo ntpdate -u ntp.ubuntu.com

$ sudo vi /etc/init.d/time-sync
> /usr/sbin/ntpdate -u ntp.ubuntu.com


$ sudo chmod +x /etc/init.d/time-sync

$ sudo update-rc.d time-sync defaults

Some overclocking settings, if you have a good power source

#safe overclock
arm_freq=1000
#arm_freq_min=400
sdram_freq=500
#sdram_freq=250
core_freq=500
#core_freq=250
over_voltage=6
temp_limit=80
boot_delay=0
disable_splash=1
gpu_mem=256
initial_turbo=60

#extreme speed, VOIDS WARRANTY!!

gpu_mem=256
force_turbo=1 #Voids warranty!
arm_freq=1100
sdram_freq=500
core_freq=500
over_voltage=6
temp_limit=80 #Will throttle to default clock speed if hit.
boot_delay=0
disable_splash=1

Troubleshooting

I connected a wifi dongle and worked out of the box, but I also used a dongle for wireless keyboard and mouse and at some times the power supply was not enough and rebooted my system, I added over_voltage=6 to /boot/config.txt in order to mitigate the issue a bit, it worked fine but it is preferable to have a good power source if you have this kind of issue.


Monday, March 24, 2014

Manually installing MySQL 5.7 in ubuntu

First we need to get the .deb installer, we can either use the system's GUI installer which is summoned by right clicking the file and choosing install, or install it by terminal:
sudo dpkg -i mysql-5.7.x-xYZ-ubuntu12.04-x86_64.deb

if you run into libaio dependencies issue install the libraries as follows:
sudo apt-get install libaio-dev

after this, the installation path would be
/opt/mysql/server-5.7

now let's add the mysql user and group into our server:
sudo groupadd mysql
sudo useradd -r -g mysql mysql

and place a link for local reference and setup the proper ownerships to install the db:
cd /usr/local
sudo ln -s /opt/mysql/server-5.7 mysql
cd mysql
sudo chown -R mysql:mysql . sudo scripts/mysql_install_db --user=mysql

now set final ownerships and configure system  service:
sudo chown -R root .
sudo chown -R mysql data
sudo ln -s `pwd`/support-files/mysql.server /etc/init.d/mysql
sudo update-rc.d mysql defaults

now you can start your server with
sudo service mysql start

usage for mysql service is:
mysql  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]

Thursday, June 4, 2009

Grabar una imagen/cd/dvd desde la terminal

Utilizando el comando

cdrecord -dev=/dev/cdrom -speed=52 -dao -pad -v respaldo.iso

grabamos el contenido de nuestro iso en un dvd =)

Hacer respaldo del sistema desde la terminal

Pues me vi en la necesidad de respaldar algunos servidores ke estan totalmente aislados de la civilizacion(internet) por lo cual invoque la fuerza de la todopoderosa terminal para hacer respaldos. La cosa va asi:

En mi caso hice un respaldo de todo el sistema, intente hacerlo dentro del sistema pero habia archivos que cambiaban de tamaƱo y el script de respaldo tronaba y se salia sin terminar.

Entonces tome el live cd e inicie con ese, una vez dentro hay que abrir la terminal y teclear

sudo fdisk -l

para localizar la(s) particion(es) del sistema entonces la montamos

sudo mkdir /media/root

sudo mount /dev/sda1 /media/root

Si tenemos mas particiones pues las montan en su respectivo directorio.

Posteriormente hacemos cd /media/root y creamos un iso de toda la particion:

sudo mkisofs -exclude-list exclude-list -iso-level 4 -joliet-long -l -r -o archivo.iso /particion/a/respaldar

El archivo se guarda en la particion root del sistema por lo que al reiniciar lo encontraremos ahi.