Sunday, January 30, 2011

How to create a custom search plugin for Arch Wiki and Forum

See this post: https://bbs.archlinux.org/viewtopic.php?id=93384

Or get the code directly from here.

Firefox Add on creator for Arch wiki and forum is found in that post.
Click on the OpenSearch plug-in ArchWikiGoogle Toolbar button
And click on the OpenSearch plug-in ArchForum button to install.



After downloading it is put in ./.mozilla/firefox/XXX.default/searchplugins.
There you can customize it,if you want.
If you don't have this folder you only have the default search engines and you have to create it.
The best way to do that is by installing the Duckduckgo search engine (and use, it's excellent).


There is another way do sudo pacman -S arch-firefox-search
This is far more easy

Cairo Composite Window Manager

On the Archbang blog some was full of enthusiasm about the cairo-compmgr the cairo composite manager that give you a more lively window behaviour. It works well and especially the mosaic (« exposé ») plugin that you can activate with Tab keys is very neat. Bit I don't need all this bling; but it is nice to know that openbox can have a more luxurious form.

It also has a magnifier build in:

To start simply activate the plugin in the preferences :

magnifier-enable1

and press simultaneously on F12 to launch it.



Friday, January 28, 2011

If a theme doesn't show up in lxappearance

You have 2 tools to configure the look and feel of Openbox : in the preferences of the openbox menu the gui config tool (Obconfig) and User Interface Settings (lxappearance) under Preferences.
If your desired theme doesn't show up in the latter, put it in /home/user/.themes and it will be found and can be activated. The smae with icons; create a folder .icons and install/put icons there.

After install Archbang 2011.1 Symbiosis -what is needed what is nice?

First I want to update; pacman didn't work so I thought the repositories were uncommented in /etc/pacman.d/mirrorlist. I had to sync with pacman -Syy.
After an update of pacman I installed powerpill for quick updating. Then updated with pacman -Syyu.
Symbiosis comes with thunar. As I use single click for opening folders and this option wasn't kept in Thunar as a preference I installed pcmanfm.
In fact I prefer pcmanfm-mod but I also install the basic pcmanfm. The reason I use pcmanfm-mod is that all my other partitions are always shown and easily mounted. It is in AUR.

On the forum I read that packer in which you build pcmanfm-mod was missing fakeroot and patch as dependencies in the default Symbiosis; so installed that. To build pcmanfm-mod I also needed gcc (C compiler), pkg-config and make. You get all the needed build tools in once by doing sudo pacman -S base-devel

You can get all this with pacman -S base-devel .
(Another issue I had is the incompability of fam and gamin; gamin is newer and replaces fam and includes it; had to remove fam and thunar-vfs to be able to install gamin).

With packer I also installed adeskbar and my own self made openbox-madpablo-theme. I put Adeskbar on top in autohide and moved tint2 to the bottom.

Multimedia: vlc (a pity it pulls the qt deps) and minitube. (built with packer).
Create a symbloic link from my media on the ntfs drive to my home video folder
sudo ln -s /media/Backup/VIDEOS /home/paul/videos
Idem for music files.

For versatility: python 2, gksu.

Then I add my keybindings for manipulating windows to /home/user/.config/openbox/ rc.xml.

I installed Firefox, with Adblock plus, Evernote, Xmarks, DuckDuckGo as search engine plugin, dictionaries for spell checking and the most important addon text-area cache that backups everything I type in Firefox and proved a life saver on many occasions. This last add on would already be enough to keep using Firefox. But I drift away from my main topic.Link

Install libreoffice (pulls openjdk) and libreoffice-nl.

Manage groups, add group burning (groupadd burning) and user (gpasswd -a paul burning)
to it.

to be continued

Tuesday, January 25, 2011

Creating a hidden Linux installation

You have a Windows pc maybe somewhat older; wife and kids are using it, and don't want to migrate to Linux; but you hate waiting endlessly till updates and virus checkers an all other bloat has finished and you want to be able to quickly boot up and access internet for example.
You want a Linux install but you don't want to present them a grub menu, even with autoboot in Windows.

If they don't mind seeing and waiting for the grub menu to pass by:
Auto-boot in Windows with grub:
# By default, boot the first entry.
default 0

#sets the delay for mounting in seconds
timeout 3

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Fallback to the second entry.
fallback 1

# (0)Windows XP
title Windows XP
rootnoverify (hd0,0)
chainloader +1
makeactive

# (1) Arch Linux
title ArchBang Linux
root (hd0,7)
kernel /boot/vmlinuz26 root=/dev/sda8 ro noresume
initrd /boot/kernel26.img


You can set the grub delay; with timeout you can influence how long the menu is shown in seconds.

Hiddenmenu the simple option to hide grub

but you overwrite the MBR, the master boot record (more on that below).
As you see you also have the option hiddenmenu that you activate by editing out the # before hiddenmenu (third line). You will have to time exactly when pressing the ESC key to reach your Linux installation, when Windows is the default boot.
You will see a notification that grub is loaded and that you have to press the escape key to load the menu.
By making the timeout very short (2-3 seconds) you can also make this almost hidden too. Or use grub with 0 sec timeout and hold shift when booting for getting the grub menu.
When we want to hide it altogether and leave the mbr untouched, we have to find another way to reach the grub menu. How to arrange that , I'll show below.
But I will already reveal how we are going to do that. We will use a CDROM with the supergrub disk on it.
Hermans dual boot page explains the functionality of the supergrub disk better than I can.

Note that partition sda8 is (hd0,7).

Note further that the first entry in the menu.l st is 0 zero and the second1, etc. When I declare 1 to default, it means that the second entry in the menulist will be the default system, that is loaded without intervention or making a choice with the up/down arrow keys. This order is not corresponding to the order of partitions or so. If you put a Linux or a window distro the first entry in the menu.lst is also of no relevance as long as a default number is mentioned in the menu.lst.



Preparing the Hard Disk
I will write about a XP install.
Don't use this method on win 7: there you need the native Win 7 partition tool to shrink D see this and this post .

The backup data on D can be easily stored on a external hard drive, if you haven't enough space left. So first make D as empty as you can, move files, delete obsolete ones. Remember you will need at least 20 % free space on D after you have made D smaller. After the big cleanup do the defragmentation of D.

So you defragmented your partitions; especially the partition you want to resize. I use the free tool Auslogics Defragment for this task (don't choose the right option Bootspeed; that you will have to pay).
You will need at least 10 gb hard disk space. Optimal double the size of your memory as swap partition and the rest for the Linux install.
I put the Linux install at the end of the second partition; often C is the system partition; D is the backup partition on which all files that should be recovered in case of system crash, E is often a smaller recovery partition.
I will put the new partition after D and before E. It is not wise to change size of C in case you have to use your recovery tool that is set to a specific size of C.
Also it is save to leave the recovery partition intact.


Partitioning with GParted using a live CD

Now we can partition. I always create the partitions with GParted before an install.

If the partition seems locked
Using a live CD, you will be have to aware that if there is already a Linux install on the hard drive the live CD may have started using the swap partition; because only unmounted partitions can be partitioned that may cause a locked extended partition. In that case right click on the swap partition and swap it off.

We have to create two partitions at least swap and the file system partition; some people prefer to have a separate home partition. But if you are short of hard disk space that isn't the fist choice.
Choose ext 3 or the newer ext4 or what you want as file system.
If you're unfamiliar with partitioning using gparted there are enough tutorials with screenshots around. It is fairly simple: first resize D by sliding the ruler back to the desired size creating new unallocated space. After that is created you can create the 1,5 or 2 GB swap space and the new 10 GB partition.
After we have created the two partitions we login in Windows XP. Windows will have some adapting to do, noticing that the partition D has been resized; partition tables are adapted automatically; probably you will get a notification: new devices discovered or installed. So now Windows is OK.
Now we are installing form the live CD; using Archbang this is a fairly simple process; note that you can cancel the partition process and that you will be asked to specify the partitions; first the mount point of the swap partition is asked; than the mount point of / , the filsystem. You will have to set root password, give a username and password.

Where to install GRUB, the bootloader?
Not in the mbr!!! At least without testing the grub setup.
The critical point is the installation of the bootloader: grub has become the standard. By default it will install itself in the mbr, the master boot record.
I prefer to install the bootloader in for example sda8, in the file system of the just installed Linux installation.
Note: sometimes the option of where to install the bootloader is hidden by an advanced button; always use the advanced option to set the custom place where you want it.

The great advantage is that if you decide to install more Linux installations next to each other, each grub bootload file is easily to be found linked to its typical install.

This always leaves all options open; to install another Linux distro and to remove it again; to install grub 2 on one partition next to grub legacy on another. I will prefer to install a distro with grub legacy first on a Linux-free hard drive, because the easy of adapting it and integrating later installations.

A complicated aspect of the present situation is that 2 versions of grub are used next to each other grub legacy 0.97 and grub2. Grub 2 has some advantages but I prefer to use grub legacy because of the easy configuration. Arch comes with grub legacy as default.

So now the install is finished and we haven't touched the mbr, the master boot record.

Tada, now comes the moment supreme for the SUPERGRUB DISK

We have burned the supergrub disk iso: download here

Supergrub makes all kind of wizardry tricks with grub possible.
If you want to login on your hidden partition, put the Supergrub disk in your CD-ROM drive. Ignore the language choice and go in the main orange screen to the option Linux manual. All the boot/grub/ directories in all partitions will be shown. In the scenario I described we only have one; we only have to select it and we're sent to the grub menu and login.
This is the most secure way of testing your grub configuration before touching the mbr.
How many people haven't got shaky when they had overwritten their mbr and booting the first time weren't able to boot in XP any more and also maybe not in the Linux partition. And then had to find out how to fix the mbr. The menu.lst file in /boot/grub (which I had installed in the new Linux partition sda8) is always easily edited using an text editor like leafpad or nano, working as root from a live CD.

The big pay-off is that after you test the grub file logging in in Windows and in the new Linux install and everything is indeed OK, you can with a confident mind overwrite the MBR. For insecure newcomers, making the first Linux install, mostly always a dual boot, this will be a secure and trusted path to walk.
The whole procedure, I mean booting with help of the Supergrub cdrom goes so fast and slick that this is a feasible alternative to installing grub in the mbr. In this way you will have a completely hidden Linux installation without touching the mbr!!

So with all the other benefits of this method, this post might have well been called:

How to overwrite your mbr in the full confidence that you will have a dual boot system after doing so


Some people still don't want to touch the master boot record.
A perfect solution uses the boot.ini file to make a dual boot with Wingrub that finds your grub menu for you. Again this is clearly described in a wonderful tutorial by Herman.

When it is safe and you want install grub in the mbr, to overwrite the MBR
But if you do want to overwrite the mbr and let grub do the booting for you, you just have to use the Supergrub disk again and select grub ==>mbr & !linux! (1) auto in the main page (option two is manual and makes choice for a specific, one out of more grub installs possible).
Some people are simple terrified about touching the mbr, but the mbr is easily fixed again with the wonderful supergrub disk. See option fixmbr.
Or select win ==> mbr &!Win! in the main page.

Thursday, January 20, 2011

Learn Vim

Just discovered that there is a great vim tutor on my machine; just type in terminal vimtutor.
I think it won't be my thing but it is nice to know the basics to be able to edit texts files one any pc.

These basics you learn in vimtutor and more, by doing not memorizing.

NOTE: Remember that you should be learning by doing, not memorization.

:q! quit vim withhout changing
:wq saving edited text, also ZZ


editing text -insert: i brings the insert mode; Esc to stop insert.
The letter position after the cursor highlighted letter is inserted
editing text append: Capital A moves the inserted text to end of line.
p put line below this line (moving lines)
ctrl+o opens new line below the present one: ctrl+O above.

stop editing text Esc
u undo last edit; U undo all editing on line
Ctrl+r redo command

moving cursor: h j k l cursor left down up right
motion: w- until the start of the next word, EXCLUDING its first character.
e - to the end of the current word, INCLUDING the last character.
$ - to the end of the line, INCLUDING the last character.
0 move to begin of the line
2w two words forward first letter
2e two words forward last letter

moving in text: Ctr+G is show on what line you are in text
G move to end of text; gg move to start of text;486G move to line 486
ctrl+o go back to last position
ctrl+i go forward again
ctrl+l moving cursor left while in insert mode
% find matching parenthesis

search forward: /searchword
search backwards: ?searchword
n search again; N search again other direction


delete letter: x cursor on letter is delete
delete word: dw delete word
delete line: dd
delete motions:
dw - until the start of the next word, EXCLUDING its first character.
de - to the end of the current word, INCLUDING the last character.
d$ - to the end of the line, INCLUDING the last character.

replace letter: rx to replace the character at the cursor with x: Capital R to replace more than one character, stopped by Esc.
replace word: ce deletes word and activates insert mode (ce- change till end word; remember motion operators)
replace line: c$

v visual mode being able to select text
y yank+copy text to buffer yw yank word
p paste selected text

:w write file

Substitute
s one character; S rest of line

To substitute new for the first old in a line type :s/old/new
To substitute new for all 'old's on a line type :s/old/new/g
To substitute phrases between two line #'s type :#,#s/old/new/g
To substitute all occurrences in the file type :%s/old/new/g
To ask for confirmation each time add 'c' :%s/old/new/gc

" Auto-completing words
In insert mode, type the beginning characters of a word that has appeared in
the file before.
Ctrl-N " auto-complete with next match
Ctrl-P " auto-complete with prev match



Nice links, reference card and book:
Vim is a beautiful tool - Eric Wendelin's Blog
Gentoo Wiki Archives - Vim

Reference Card Another one both PDF's

Vim Tutorial Book by Molenaar


Managing groups

Started using dbus for opening different partitions on hard drive.
Suddenly had an issue with refused rights.
Had to add myself as user to the group dbus: sudo gpasswd -a paul dbus

Clear Arch-wiki section about managing groups:

List groups

Display group membership with the groups command:

$ groups [user]

If user is omitted, the current user's group names are displayed.

To list all groups on the system:

$ cat /etc/group

Manage group membership

Add users to a group with the gpasswd command:

# gpasswd -a [user] [group]

To remove users from a group:

# gpasswd -d [user] [group]

If the user is currently logged in, he/she must log out and in again for the change to have effect.

source: https://wiki.archlinux.org/index.php/GroupsLink

Tuesday, January 18, 2011

Mplayer-vdpau-svn error when updating

The build I had made with packer of mplayer-vdpau-svn was outdated because of an update of /usr/lib/libx264.so.107 to /usr/lib/libx264.so.112.
I had to recompile it. packer -S mplayer-vdpau-svn
Found the error doing:
 ls -l /usr/lib/libx2*

So to update
packer -S
mplayer-vdpau-svn

It will give as feedback reinstalling but build again.

When you don't manage to start X

Or your screen resolution won't get right.

Many questions on the Archbang forum are related to issues with video drivers and failing screen resolution. People get stuck at a terminal or have a crappy screen display. This post is related to Arch using Openbox window manager.

Don't despair. If you managed to get a good screen resolution when testing with the live CD, then it also must be possible to achieve this after install. To put it in another way: always test with a live CD if this configuration on this live CD is working for your hardware.

Important is to see that the problems most of the time have a few different sources.

Editing grub

To begin with the beginning: sometimes grub is set to vesa to make login possible.
Don't expect the system to use the best driver for you videocard in that case.

To edit the grub boot menu you can press the e key and edit the line that has vesa in it and comment that out or with the terminal #nano /boot/grub/grub.cfg and delete XORG-VESA & NOMODESET.

This is for grub2; in grub legacy, 0.97, you can edit the /boot/grub/menu.lst

Also delete here the vesa and nomodeset options.

In Nano you use Ctrl+ o to write something, then enter and ctrl+x to close nano.

Installing the necessary video driver

If you don't know what hardware video device you have:
lspci -vnn gives a list of your hardware devices, which gives valuable info on which what hardware we are dealing with.
lspci -k gives info on how the kernel drivers handle your hardware at the moment; this is of course very important info too.

Another important source of info is:
On issues with xorg the log file /var/log/Xorg.0.log is often given to help others give support. This gives valuable feedback.
If you can't get into a terminal, use a live CD.
If you want to install a new driver you have to work from your installation on your hard drive.
Most of the time Alt+Ctrl+F2 will give you another working terminal, if you didn't managed to start X and got stuck.

How to install a new videodriver

with a Nvidia video card: sudo pacman -S nvidia nvidia-utils
with the ATi card : sudo pacman -S xf86-video-ati
Intel: sudo pacman -S xf86-video-intel

See also https://wiki.archlinux.org/index.php/Beginners%27_Guide#Install_video_driver


Now the third source of the problem or third kind of problem has to be checked or solved: your xorg.conf in /ect/X11/
With a normal effective install this won't be necessary, but accidents can happen
So nano /etc/X11/xorg.conf ; notice X11 is written with a capital X.

Before editing a xorg file always back it up!! Save it as xorg_old or xorg_default for instance.

Two kinds of problems are possible
1, the wrong driver is mentioned
2. the desired screen resolution(s) is (are) not given in xorg.conf

At problem 1: find vesa in the device section and replace it with nvidia or what your your videocard is called. Specify if possible the card type you are using.
My device section looks like this:

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce GT 330"
EndSection

Edit: due to conflicts between xorg-server 1.11 and nvidia driver it may be necessary or more useful to install the nouveau driver:
So nvidia card using open source driver:
#pacman -S xf86-video-nouveau
and in in /etc/X11/xorg.conf.d/20-gpudriver.conf
instead of nvidia: nouveau

Problem 2: Screen resolution
Normally a screen resolution has not to be identified in the screen section of the xorg file
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection

when the correct driver is working,


but sometimes it has to.

It could look like something like this:

Section "Monitor"
DisplaySize 344 193
HorizSync 30-40
Identifier "Monitor[0]"
ModelName "Unknown"
Option "DPMS"
Option "PreferredMode" "1366x768"
VendorName "Unknown"
VertRefresh 50-75
UseModes "Modes[0]"
EndSection

BTW also font configuration issues can have a devastating effect on xorg and make X not working, crashing. See this post.


If you have finished working on your configuration you can reboot or do startx to start X.

Friday, January 14, 2011

Autocomplete or wordprediction in Linux

I looked for an word prediction feature in a simple text editor and found one for gedit.

At https://github.com/nagaozen/gedit-plugin-autocomplete/ you can find one.
Install script is in the download; make install file executable.
After the install go to Preferences, plugins, check the autocomplete plugin, select it and go to configure and add a wordlist (each lines, one word) to the open text pane.
For more elaborate snippet-like TextMate like code prediction, useful for programmers look at gmate-git.
Another option is (not tested) http://code.google.com/p/gedit-tm-autocomplete/.

Friday, January 7, 2011

roll back kernel version

For the first time I had kernel panic in Arch on old pc that seems to have some hardware issues; I could login on the fallback kernel - recovery mode, but then network wasn't working.

Found this info on kernel panic:

Roll back to previous kernel version

If you keep your downloaded pacman packages, you now can easily roll back. If you didn't keep them, you have to find a way to get a previous kernel version on your system now.

Let's suppose you kept the previous versions. We will now install the last working one.

First you need to get the kernel details.

# cd /var/cache/pacman/pkg
# find kernel*

Now use the kernel details in the command below. Link

# pacman -U /var/cache/pacman/pkg/kernel26-2.6.23.xx-x.pkg.tar.gz


More info here:https://wiki.archlinux.org/index.php/Kernel_panic

Wednesday, January 5, 2011

AdComps adapted Oblogout script

I use an adapted version of oblogout made by AdComp.
The special feature is that the shutdown button is automatically selected and you don't have to focus it with your mouse; so you can close your system blind.
Code here ; save in texteditor, make executable and put in folder oblogout in usr/share and adapt shortcut in rc.xml

Put these images in folder img in folder oblogout:
with following names in order:

system-shutdown.png



system-restart.png


system-log-out.png


application-exit.png


This last most left button means close oblogout, so is in fact a cancel button.

Create a symbolic link to /usr/bin:
[paul@archbang ~]$ sudo ln -s /usr/share/oblgout/oblogout /usr/bin/oblogout

Display Power management time setting Arch

, screenSetting up DPMS in X

Add the following to your /etc/X11/xorg.conf in the Monitor section:

Option "DPMS" "true"
Note: As of Xorg 1.8 DPMS is auto detected and enabled if ACPI is also enabled at kernel runtime

Add the following to the ServerLayout section, change the times (in minutes) as necessary:

Option "StandbyTime" "10"
Option "SuspendTime" "20"
Option "OffTime" "30"


Or

Option "BlankTime" "30"

bron: https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling

Monday, January 3, 2011

image as wallpaper

Somebody asked above red poppies image as wallpaper.
Had lost it.
Found it back (195kb): http://i.imgur.com/JKJBg.jpg

and by the way don't eat piggies, just cuddle them.

Blog Archive

About Me

Exclusion of liability Regarding StillStupid: The use you make of the guides, tips and downloads that you listed on this web site or on another website to which I refer is entirely at your own risk. In no way can I be held liable for damage or consequential damages of any kind, which occurs as a result of that use.