Pokazywanie postów oznaczonych etykietą linux. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą linux. Pokaż wszystkie posty

niedziela, 15 września 2013

Dell's e6430 discrete graphics card on Debian

Some new laptops have two graphics cards. One power-efficient integrated with CPU and one powerful discrete (separate board).

Bumblebee project provides support for NVIDIA Optimus laptops. Installing and usage is straightforward and described here. In short (if you want proprietary drivers):
  1. make sure you have contrib and non-free repositories enabled 
  2. Install packages:
    # apt-get install nvidia-glx nvidia-kernel-dkms bumblebee-nvidia primus
  3. Installing nvidia driver package will automatically set it as a default rendering engine but it's not desired. Normally 3D would be rendered by integrated Intel card, so do:
    # update-alternatives --set glx /usr/lib/mesa-diverted
Normally this should be it, but unfortunately in current debian testing there is a bug causing an output:

$ optirun glxgears
[   42.214557] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver
[   42.214599] [ERROR]Aborting because fallback start is disabled.


To fix this in file /etc/bumblebee/bumblebee.conf in section [driver-nvidia] change line:
KernelDriver=nvidia

to:
KernelDriver=nvidia-current

piątek, 13 września 2013

Debian - slow brightness responce on Dell laptop fix

On some Dell laptops with gnome3 brightness change takes veeeery long (seconds) and system is choppy in the meantime.

A workaround has been posted: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/828296/comments/5

The workaround is:
  1. add acpi_backlight=vendor to GRUB_CMDLINE_LINUX_DEFAULT option in /etc/default/grub file
    (eg. GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_backlight=vendor")
  2. run
    $ sudo update-grub
Bug for ubuntu is filed: https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/847001

Worked on my Dell e6430.

czwartek, 30 maja 2013

OpenStreetMap tile server on Debian

There are many reasons why one might want to run own OpenStreetMap tile server. It is somehow explained here, here and here. but, in my opinion, not thoroughly enough.

I'll explain in detail how I did it on a Debian Jessie server. Note that in this method tiles are generated manually. To generate tiles automatically a solution like apache mod_tile must be used.
  1. Download OpenStreetMap data.
    This file contains a map itself but in an abstract format. It's best to start with a small dataset (available at download.geofabrik.de), the whole planet is 28GB.
  2. Install and configure PostgreSQL database (description at debian wiki). That's where OpenStreetMap data will be kept for easy access.
    $ sudo aptitude install postgresql postgresql-client
    Add a user (preferably the name of user that will be accessing the database, say bob):
    $ sudo -u postgres createuser bob
    Add a database named gis owned by bob:
    $ sudo -u postgres createdb --encoding=UTF8 --owner=bob gis
  3. Install postGIS. This is a PostgreSQL extension for keeping there geographic data.
    $ sudo aptitude install postgis
    Configure created database for postgis:
    $ sudo -u postgres psql -d gis -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
    $ sudo -u postgres psql -d gis -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
    sudo -u postgres psql -d gis -c "ALTER TABLE geometry_columns OWNER TO bob"
    $ sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO bob"
  4. Install osm2pgsql - a script to load data from .osm file into PostgreSQL database.
    $ sudo aptitude install osm2pgsql
    Perform import:
    $ osm2pgsql --slim -C 1500 poland-latest.osm.pbf
  5. Install Mapnik - library to generate tiles (images) based on data in PostgreSQL database.
    $ sudo aptitude install python-mapnik2 mapnik-utils
  6. Download and extract Mapnik stylesheet fileshttps://github.com/openstreetmap/mapnik-stylesheets/archive/master.zip (it has a nice README file).
  7. Download coastline shapes with script included in archive above:
    $ ./get-coastlines.sh
  8. Modify xml files with script provided:
    $ python generate_xml.py --dbname gis --user bob --accept-none
  9. I had problems with fonts (they are mentioned here), but I had to comment out lines in inc/fontset-settings.xml.inc that contained "unifont Medium".
  10. To test if everything works change bounds in generate_image.py to whichever fit your needs (they should be covered by OSM data you downloaded though) and launch the script:
    $ python generate_image.py
    If everything went fine there will be an output:
    output image to image.png!
    And of course an image will be created.
  11. To generate all tiles modify file to choose what tiles you want to be created (at the bottom of the file). There are some examples provided. To create tiles for Poland for zooms ranging from 1 to 12 I used:
    bbox = (14.28,48.92, 24.21,54.95)
    render_tiles(bbox, mapfile, tile_dir, 1, 12 , "Polska")
    To than generate tiles create a directory, say tiles and do (in bash):
    $ MAPNIK_MAP_FILE="osm.xml" MAPNIK_TILE_DIR="tiles/" ./generate_tiles_multiprocess.py
    (it's a trick with setting environment variables for command execution).
To display your tiles using OpenLayers (as described here):
  1. Make your tiles available via web server.
  2. Install packaged version of openlayers:
    $ sudo aptitude install libjs-openlayers
  3. Create an index.html file and paste the following:

niedziela, 21 kwietnia 2013

Entering unicode characters in linux (gnome)

To directly enter any Unicode character,, say ξ, in almost any Gnome application:
  1. Find its UTF-16 encoding, for ξ it's 0x03BE (google "ksi unicode")
  2. Press CTRL+SHIFT and while holding them enter u03be
 Alternative is just to google it, mark, copy and paste.

Very handy for inserting Greek letters in Inkscape and gimp.

Found here.