Pages

Wednesday 15 October 2014

Wifi and LAN at the same time - force using wifi to access internet

In order to play music from my NAS connected to router I must be connected to the same network. But I want to use wifi to browse internet on faster connection from different network. By default with wifi connected and lan cable simultaneously my elementary os was using lan network for all trafic.

Below command switched it to wifi:

sudo ip route replace default via 192.168.1.1 dev wlan0 proto static

IP 192.168.1.1 is the gateway from wifi network.

Saturday 4 October 2014

Undelete files on Linux

I accidentally deleted pictures from SD Card from my tablet. Any android undelete applications failed to identify what I was looking for. I decided to try undelete on my elementary os and the choice was to use PhotoRec. That program recovers lost files by checking data blocks one by one against a signature database of different file types.


  • Supported file formats: video (avi, mov, mp3, mp4, mpg), image (jpg, gif, png), audio (mp3, ogg), document (doc(x), ppt(x), xls(x), html), archive (gz, zip) etc.
  • Supported file systems: EXT2, EXT3, EXT4, HFS+, FAT, NTFS, exFAT
Took most recent version:


For 32-bit Linux:

wget http://www.cgsecurity.org/testdisk-7.0-WIP.linux26.tar.bz2
tar xvfvj testdisk-7.0-WIP.linux26.tar.bz2

For 64-bit Linux:

wget http://www.cgsecurity.org/testdisk-7.0-WIP.linux26-x86_64.tar.bz2
tar xvfvj testdisk-7.0-WIP.linux26-x86_64.tar.bz2

The PhotoRec executable (photorec_static) is found in the extracted directory.

cd testdisk-7.0-WIP/
sudo ./photorec_static 

Next I selected default options. Next challenge was to find pictures that I was looking for among over 50 000 recovered files in multiple subfolders. Most of them were cached browser images and any android stuff. My pictures were large, more than 4 MB. I used find command to copy qualified files to another folder:

find . -type f -size +4M -name "*.jpg" -exec cp {} /home/lukasz/Downloads/testdisk-7.0-WIP/Recovered/Large \;

Finally all my files were in Large folder.





Monday 29 September 2014

Elementary OS messed up resolution on logon screen

After connecting secondary monitor to my laptop the login screen looks like it lost display settings and got resolution changed. I was having trouble finding solution, following is what worked for me:


1. In terminal run xrandr -q to check monitor details.

Laptop display: LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 293mm x 164mm

External monitor: VGA1 connected 1280x1024+1366+33 (normal left inverted right x axis y axis) 376mm x 301mm

2. Create script txt file eg. loginScreenFix.sh with following content:

#!/bin/sh
xrandr --output LVDS1 --primary --mode 1366x768

3. Make it executable with: chmod a+rx loginScreenFix.sh

Can run it to test if worked but resolution should be changed to see difference

4. Copy this to shared folder:

sudo cp loginScreenFix.sh /usr/share/

5. To run it on logon screen I updated lightdm config:

sudo gedit /etc/lightdm/lightdm.conf

Add my fix script path at the end:

display-fix-script=/usr/share/loginScreenFix.sh

6. Reboot to check if it worked.


Sunday 2 March 2014

Open WRT separate 2nd WAN + Load balancing

This post explained what I really need: http://www.dd-wrt.com/wiki/index.php/Switched_Ports#Second_WAN_port

Second WAN Port:
nvram set vlan0ports="1 2 3 5*" 
nvram set vlan1ports="0 4 5" 
nvram commit 
reboot
 
Then apply multi WAN 
 
http://wiki.openwrt.org/doc/howto/mwan3 

Screen recording

Use that http://www.omgubuntu.co.uk/2013/12/simple-screen-recorder-linux

Install Simple Screen Recorder in Ubuntu 12.04 & Up

Want it? The app is free and can be installed on Ubuntu 12.04 and up by adding its dedicated PPA to your Software Sources.

sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
sudo apt-get update && sudo apt-get install simplescreenrecorder



Thursday 20 February 2014

How I enabled middle click on touchpad [Not reliable]

Installed synaptiks in software centre. Not sure why it worked when I lauched it from terminal.

Automount windows SMB shares with Autofs having folders available

I installed Autofs to auto mount windows shares from my NAS. All was described on below links:

https://help.ubuntu.com/community/Autofs

https://wiki.archlinux.org/index.php/autofs


In my case I commented out +auto.master and added this at the end:

/nfs   /etc/auto.nfs --timeout=300 --ghost

The last parameter --ghost is required to have target folders visible.

In auto.nfs I had lines for each individual share:

var -fstype=cifs,rw,username=,password=,uid=1000,iocharset=utf8 ://192.168...../var
tmp -fstype=cifs,rw,username=,password=,iocharset=utf8 ://192.168...../tmp
downloads -fstype=cifs,rw,username=,password=,iocharset=utf8 ://192.168...../Downloads
video -fstype=cifs,rw,username=,password=,iocharset=utf8 ://192.168....../video
music -fstype=cifs,rw,username=,password=,iocharset=utf8 ://192.168....../music
web -fstype=cifs,rw,username=,password=,iocharset=utf8 ://192.168....../web



Tuesday 18 February 2014

Install kali linux tools for elementary os/ubuntu no pgp key issues

All google results ended with pgp key error. The system was so messed that it had to be restored from Timeshift backup. I found only one solution that worked

Original tutorial is here https://www.youtube.com/watch?v=RrYB-UumTr0

In case the video is removed these are the steps:

1. Go to https://launchpad.net/ and search for "Kali linux".
2. Click on the first result: Kali Linux Tools PPA 1 : wagung
3. In software center open software sources and go to tab other software
4. Click add and paste bold part: ppa:wagungs/kali-linux to add it
5. This will have to be done for another 2 PPAs so I post them here:

ppa:wagungs/kali-linux1
ppa:wagungs/kali-linux2

Now this should be available in software center.

Monday 17 February 2014

Ubuntu derivative dual GPU drivers installation that worked for me


My Asus laptop has 2 GPUs, Intel integrated and Nvidia. I was unable to find any 100% working solution, just guides that ended up in non bootable system.

1. Installing NVIDIA drivers:

! Please remove any previous installation of nvidia drivers before you continue !

Please open terminal, you can find it in your applications menu on the left. Type this commands one by one, and provide your user password when prompted.

Version 331, stable ppa (I will only recommend stable versions from now on, edgers ppa is too risky)

This ppa uses stable drivers. For more information Go Here
Code:
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-331 nvidia-settings-331
---------------------------------------------------------------------------------------------
@@@ If you have an optimus enabled graphic (nvidia + intel) then go and continue installation HERE (start from step 2). Otherwise continue with the following:
----------------------------------------------------------------------------------------------

Generate an xorg.conf:
Code:
sudo nvidia-xconfig
Make sure the driver is selected and enabled:
Code:
sudo jockey-text --list
Look up the displayed list. Choose the version of the driver that you want to enable and do:
Code:
sudo jockey-text -e DRIVERNAME
Where the drivername is the name listed like in the example bellow: (Translation, Habilitat = Enabled). Ignore the "not used" statement, it's a known bug.

DO NOT REBOOT


2. INSTALLING BUMBLEBEE Homepage

Please enable all 4 ubuntu software repos before installing bumblebee.(all on first tab without source code)

This is the important manager that will help us make use of our dedicated nvidia graphics.

Code:
sudo add-apt-repository ppa:bumblebee/stable
sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia virtualgl linux-headers-generic
If your system is 64 bits please install this also, otherwise don't.
Code:
sudo apt-get install virtualgl-libs-ia32:i386
By default bumblebee uses Optimus (VirtualGL).

Bumblebee uses VirtualGL to copy the image generated by the second (faster) GPU to your display. VirtualGL was intended for use over a network though, so it takes a great many steps to enable this (compression, sending the image over a network link, decompression, etc).
[OPTIONAL] INSTALLING PRIMUS

Primus brings better performance and less power consumption when using Bumblebee, by replacing VirtualGL. Advantages over Optimus:
- Less overhead (better framerates) and cleaner solution (no networking or compression involved at all)
- Fixes the "bug" that causes Bumblebee to shut down the GPU too early sometimes (no more need for the "optirun bash" workaround)
- Less buggy/glitchy, easier to debug
- Only uses/starts secondary GPU for OpenGL parts of applications - everything else remains on your main GPU (power savings)
Code:
sudo apt-get install primus
If your system is 64 bits please install this also, otherwise don't.
Code:
sudo apt-get install primus-libs-ia32:i386
At this stage, you have a command line working bumblebee. if you want to run programs you have to use the following:
Code:
optirun APP_NAME
primusrun APP_NAME
Example: use glxspheres and glxgears as APP_NAME to do some benchmarking. To test the performance difference between dedicated graphics and the integrated graphics do the with and without using optirun/primusrun respectivelly. This are already installed on your system. It will indicate the framrate, and the grapic card used to test.
3. INSTALLING BUMBLEBEE CONFIGURATION GUI

We use this to configure bumblebee default settings and choose the driver to use.
Code:
sudo add-apt-repository ppa:alessandrofac93/bumblebee-config-gtk-dev
sudo apt-get update
sudo apt-get install bumblebee-config-gui
After installing, write on the terminal the following:
Code:
sudo bumblebee-config
It will open the configuration gui that looks like this. Click in the configure button and make sure you have the same settings like in the images.











Note: The highlighted part must be valid path. I mean nvidia-331 instead of nvidia-current or similar as it was described on other websites. Eg:

KernelDriver nvidia-331-updates
LibraryPath /usr/lib/nvidia-331-updates:/usr/lib32/nvidia-331-updates
XorgModulePath /usr/lib/nvidia-331-updates/xorg,/usr/lib/xorg/modules
 


For the 32 bits version of eOS the primus library path might be different (/usr/lib/???...). Normally it gets autodetected. You can define bridge as Auto or you can force primus or virtualgl. Primus is prefered for better optimizations and performance.


Save and quit. If it gets stuck on saving (normally if you change the bridge to primus instead of optimus), try to force close it (close terminal window) and then open again to be sure the settings have been saved correctly. I think there are a few bugs with this configurator but it's definetly easier than editing the configuration file directly.


If everything went ok there should be no errors on restart:









Still if you want to check if the configuration has been generated correctly then, on the terminal do:
Code:
cat /etc/bumblebee/bumblebee.conf
and look for the same entries shown on the GUI: kernel driver, library path, xorg module etc.

This is how my configuration file looks like for the 331 version of the nvidia driver:
Code:
# Configuration file for Bumblebee. Values should **not** be put between quotes

## Server options. Any change made in this section will need a server restart
# to take effect.
[bumblebeed]
# The secondary Xorg server DISPLAY number
VirtualDisplay=:8
# Should the unused Xorg server be kept running? Set this to true if waiting
# for X to be ready is too long and don't need power management at all.
KeepUnusedXServer=false
# The name of the Bumbleblee server group name (GID name)
ServerGroup=bumblebee
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
TurnCardOffAtExit=false
# The default behavior of '-f' option on optirun. If set to "true", '-f' will
# be ignored.
NoEcoModeOverride=false
# The Driver used by Bumblebee server. If this value is not set (or empty),
# auto-detection is performed. The available drivers are nvidia and nouveau
# (See also the driver-specific sections below)
Driver=nvidia
# Directory with a dummy config file to pass as a -configdir to secondary X
XorgConfDir=/etc/bumblebee/xorg.conf.d

## Client options. Will take effect on the next optirun executed.
[optirun]
# Acceleration/ rendering bridge, possible values are auto, virtualgl and
# primus.
Bridge=primus
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
VGLTransport=proxy
# List of paths which are searched for the primus libGL.so.1 when using
# the primus bridge
PrimusLibraryPath=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?
AllowFallbackToIGC=false


# Driver-specific settings are grouped under [driver-NAME]. The sections are
# parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
# detection resolves to NAME).
# PMMethod: method to use for saving power by disabling the nvidia card, valid
# values are: auto - automatically detect which PM method to use
#         bbswitch - new in BB 3, recommended if available
#       switcheroo - vga_switcheroo method, use at your own risk
#             none - disable PM completely
# https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods

## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
# Module name to load, defaults to Driver if empty or unset
KernelDriver=nvidia-331-updates
PMMethod=auto
# colon-separated path to the nvidia libraries
LibraryPath=/usr/lib/nvidia-331-updates:/usr/lib32/nvidia-331-updates
# comma-separated path of the directory containing nvidia_drv.so and the
# default Xorg modules path
XorgModulePath=/usr/lib/nvidia-331-updates/xorg,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia

## Section with nouveau driver specific options, only parsed if Driver=nouveau
[driver-nouveau]
KernelDriver=nouveau
PMMethod=auto
XorgConfFile=/etc/bumblebee/xorg.conf.nouveau

Run nvidia-settings when using Bumblebee

If you have a dual graphic card configuration (aka Optimus technology), you probably realized that if you run nvidia-settings, you get a warning saying that: 'No nVidia drivers are in use'. Here's how to run nvidia-settings under Bumblebee:
optirun nvidia-settings -c :8
You should use :8 or any value that is set for 'Virtual Display' in Bumblebee's settings.

http://elementaryforum.org/forum/support-assistance/how-to_aa/3996-nvidia-optimus-drivers-and-tools-installation

Interesting video: https://www.youtube.com/watch?v=8CSFgUBUWrQ

Sunday 16 February 2014

Timeshift saved my linux

I tried installing graphic drivers and my every attempt ended with system that crashed when I logged in. I was luck I made a Timeshift snapshot earlier and was able to restore it. There are better descriptions of what it is and how it works. This is only info that it's must-have application.


Install timeshift in ubuntu 13.10/13.04/12.10. Elementary OS in my case.
Open the terminal and run the following commands
sudo apt-add-repository -y ppa:teejee2008/ppa
sudo aptitude update
sudo aptitude install timeshift

Friday 14 February 2014

How to reset Darkstat logs on Synology Diskstation


Couldn't find answer to this question so I figured it out myself. 
  1. Stop the service
  2. Login to shell
  3. Browse to /var/packages/darkstat/target/var
  4. Delete file darkstat.data
  5. Start the service