Wednesday, October 19, 2016

Ubuntu. Cannot upgrade because of full /boot partition. Freeing some space

If you try to upgrade linux distribution (for example from 14.04 to 16.04) sometimes upgrade fail because of no free space at /boot partition. This happens because there are old kernel installed that are no longer needed. To remove old kernel you shoul issue command like this:

sudo apt-get purge linux-image-x.x.x-xx-generic

where "x" are numbers. so you remove all kernels except one that is used. ( check it with uname -r command). Usually in /boot partition there are many of kernels, so removing them one by one is time consuming operation. To make it more convenient use that crazy long command and wait :)

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

 It remove all unused kernels from your /boot partition.

Thursday, October 13, 2016

How to check your "external" ip from command line.

Sometimes when you are behind the NAT you need to know what is your "external" IP address.
You can check it from browser(for ex. http://whatismyip.org), but what if you have only command line? Just type in these lines:

nslookup myip.opendns.com. resolver1.opendns.com

do not forget dot "." after first host.

Thursday, October 6, 2016

Install x11vnc on xubuntu 16.04 for remote access

Tight VNC server opens new session, but if you need to connect to active session(like in teamviewer when user see what you are doing) I suggest to install x11vnc.
Installation process as follows:

sudo apt-get install x11vnc -y

next - specify password for remote connections:

sudo x11vnc -storepasswd /etc/x11vnc.pass

now create service unit file:

sudo touch /lib/systemd/system/x11vnc.service

and open it in editor:

sudo nano /lib/systemd/system/x11vnc.service

paste to file:

[Unit] 
Description=Start x11vnc at startup. 
After=multi-user.target
[Service] 
Type=simple 
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared 
[Install] 
WantedBy=multi-user.target

 now configure service:

sudo systemctl enable x11vnc.service  
sudo systemctl daemon-reload

now reboot and try to connect to x11vnc.