tag:blogger.com,1999:blog-49073378682249692642024-03-13T03:03:42.225-07:00My Arch Linux"Keep it simple, stupid!" (Kelly Johnson)György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-4907337868224969264.post-85490548530931807332019-02-27T08:07:00.000-08:002019-02-27T08:07:29.871-08:00Opening files under qemu windows guest from the Linux hostI migrated my VirtualBox Windows 7 client to qemu which uses kernel-level virtualisation. The performance improvement is mind blowing. The migration was really easy but I really missed my shell scripts for file integration tasks that made my life so much easier for years.<br />
<br />
I had a <a href="http://kissmyarch.blogspot.com/2012/01/opening-files-under-virtualbox-guest.html" target="_blank">well working bash script</a> on my Linux machine that allowed my linux applications (like file manager or e-mail client, etc.) to open windows files (like doc, excel, etc.) in the Windows guest machine. VirtualBox has a "vboxmanage" tool to accomplis that. qemu does not have anything similar though. My script has helped me a lot during my everyday life and I simply don't want to give up this seamless integration between my host and guest. I work with documents and excel sheets in Windows but my everyday OS is Linux. In my Arch Linux OS I simply select a .doc or even an .exe file and it will be opened under the guest Windows. Similarly when I get a .ppt slideshow in e-mail as an attachment I simply click on it in my linux mail client and the powerpoint slideshow pops up in my Windows machine.<br />
<br />
<b>Migrating from VirtualBox to QEMU:</b><br />
<br />
I sum up the migration process in bulletpoints but the whole process is well documented in the <a href="https://wiki.archlinux.org/index.php/QEMU" target="_blank">QEMU Arch Wiki page</a>. I am not a qemu or virtualisation expert by any means.<br />
<br />
So the process looks like this:<br />
<br />
install qemu stuff (see arch wiki)<br /><span style="font-family: "Courier New", Courier, monospace;"># pacman -S libvirt qemu spice-guest-tools-windows virtio-win spice spice-gtk</span><br />
<span style="font-family: "Courier New", Courier, monospace;">$ qemu-img convert -f vdi -O raw <your_Windows_vdi_file> <destination_image_file></span><br />
<br />
It looked like this in my case:<br />
<i><span style="font-family: "Courier New", Courier, monospace;">$ qemu-img convert -f vdi -O raw VirtualBox\ VMs/Windows/Windows\ Clone.vdi virt/win.img</span></i><br />
<br />
<br />
This will take a while...<br />
<br />
Try it:<br /><span style="font-family: "Courier New", Courier, monospace;">qemu-system-x86_64 -m 3G -enable-kvm virt/win.img</span><br />
Now your qemu-driven Windows guest should start in a window using the newly created img file.<br /><br />Insert the virtio driver CD to the guest:<br />
<span style="font-family: "Courier New", Courier, monospace;">$ qemu-img create -f qcow2 fake.qcow2 1G<br />$ qemu-system-x86_64 -m 3G -enable-kvm -drive file=virt/win.img,if=ide -drive file=fake.qcow2,if=virtio -cdrom /usr/share/virtio/virtio-win.iso</span><br />
Now the guest should start the same way as before but an inserted CD rom should show up in the machine.<br />
<br />
Install the virtio guest drivers in the Windows guest that you just started. Windows did it automatically for me, probably you have to do some next-next-finish on the CD rom under your guest Windows.<br /><br />Now insert the Spice Guest Tools CD to the guest similarly:<br /><span style="font-family: "Courier New", Courier, monospace;">$ qemu-system-x86_64 -m 3G -drive file=virt/win.img,if=ide,format=raw -drive file=fake.qcow2,if=virtio -cdrom /usr/share/spice-guest-tools/spice-guest-tools.iso</span><br /><br />
In the Windows guest run the .exe on the cdrom to install the Spice Guest Tools.<br /><br />Start the thing without gui and connect to it with a Spice client (some cool features enabled):<br />
<span style="font-family: "Courier New", Courier, monospace;">$qemu-system-x86_64 -nographic -m 3G -drive file=virt/win.img,if=virtio,format=raw -spice port=5900,addr=127.0.0.1,disable-ticketing -device virtio-serial -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -vga qxl -machine type=pc,accel=kvm -usb -device usb-tablet -net nic -net user,smb=/</span><br />
<br />
In another terminal connect to the spice server: <br />
<span style="font-family: "Courier New", Courier, monospace;">$spicy -h 127.0.0.1 -p 5900</span><br /><br />Now the guest machine should appear in a spice client window. The screen resolution should appply when you resize this window and the clipboard should be shared between the host and the guest. You also have file access to your Linux host: the host's <span style="font-family: "Courier New", Courier, monospace;">/</span> folder should be accessible in the guest under <span style="font-family: "Courier New", Courier, monospace;">\\10.0.2.4\qemu\</span> <br />
<br />
If all is ok then install the headless version of qemu instead of the normal one since we use the spice guest to connect to the server:<br />
<span style="font-family: "Courier New", Courier, monospace;">#pacman -S qemu-headless</span><br />
<br />
<b>Setting up file acceess:</b><br />
The process is based on two components: 1. on the Linux host we write the path of a file (in windows format) that we want to open under windows TO A "watch" file. In the Windows guest we read the contents of this file every 3 seconds and if we find a filename in it then we open that file and delete the "watch" file. This is not very nice but I am not a programmer and I wanted to use native commands instead of external apps.<br />
<br />
<i>1. On the linux host:</i><br />
This script will acept a filename (i.e. a doc file or similar) as argument. It removes special characters from the filename (using another script but you can use detox or anything similar) then converts the file pah to windows format and writes this path to the "watch" file. (The "watch" file will be processed on the other side in the guest.)<br />
<br />
My script is called winopen.sh and looks like this:<br />
<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">#!/bin/bash<br /><br /># needs 'clean' script<br /><br /># stdout and errors go here:<br />exec 2>>"/home/<username>/.xlog"<br />exec 1>&2<br /><br />script="$(basename "$0")"<br />driveletter='\\10.0.2.4\qemu'</span><br />
<span style="font-family: "Courier New", Courier, monospace;">watchfile="/home/<username>/virt/watch.txt"<br /><br /># Start vm if not running already<br /><br />if (( $(ps -ef | grep qemu-system-x86_64 | wc -l) == 1 ))<br />then ( qemu-system-x86_64 -m 3G -drive file=/home/<username> /virt/win.img,if=virtio,format=raw -spice port=5900,addr=127.0.0.1,disable-ticketing -device virtio-serial -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -vga qxl -machine type=pc,accel=kvm -usb -device usb-tablet -net nic -net user,smb=/ &<br /> ( sleep 4 ; spicy -f -h 127.0.0.1 -p 5900 ) &<br /> )<br />fi<br /><br /># Get the absolute path of the file on the linux host<br />for i in "$@"<br />do<br /> if echo $i | grep '^/' > /dev/null<br /> then targetfullpath=$i<br /> else targetfullpath=$PWD'/'$i<br /> fi<br /> <br /> #Cleanup filename<br /> if ! cleanpath=$(clean -F "$targetfullpath")<br /> then<br /> echo "File cleaning failed"<br /> exit 1<br /> fi<br /><br /> # The same filepath under the windows guest machine <br /> winfullpath=$(echo "$driveletter""$cleanpath" | sed 's/\//\\/g')<br /><br /> # Place the filename to the watchfile<br /> echo "$script"": opening ""$targetfullpath"" (""$winfullpath"") in qemu" <br /> echo "$winfullpath" >> $watchfile<br />done</span><br /><br />
<br />
<br />
The path cleaning script called 'clean':<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">cat bin/clean<br />#!/bin/bash<br /><br />accent='ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖŐØÙÚÛÜŰÝàááâãäåçèééêëìíîïðñòóôõőöőøùúûüűý'<br />nonaccent='AAAAAACEEEEIIIIDNOOOOOOOUUUUUYaaaaaaaceeeeeiiiidnoooooooouuuuuy'<br />allowed='.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'<br />substitute='_'<br />fullpathchars='~/'<br /><br /># Parse command line arguments<br />shortopts="a:fFhs:"<br />longopts="allow:,fullpath,filerename,help,substitute:"<br />options=$(getopt -n $(basename $0) -u -o $shortopts -l $longopts -- "$@") || exit 1<br />set -- $options<br />while [ $# -gt 0 ]<br />do<br /> case $1 in<br /> # for options with required arguments, an additional shift is needed <br /> -a|--allow) allowed+="$2" ; shift ;;<br /> -f|--fullpath) allowed+="$fullpathchars" ;;<br /> -F|--filerename) allowed+="$fullpathchars" ; filerename="true" ;;<br /> -h|--help) help=y ;;<br /> -s|--substitute) substitute="$2" ; shift ;;<br /> (--) ;;<br /> (*) break ;;<br /> esac<br /> shift<br />done</span><br />
<span style="font-family: "Courier New", Courier, monospace;"><br /></span>
<span style="font-family: "Courier New", Courier, monospace;"># --help #<br />if [[ $help == "y" ]]<br />then<br /> cat <<EOF<br />clean: a tool for cleaning a string from special characters. Transforms the accented characters of STRING to their non-accented form and substitutes special characters with a substitute string, "_" by default. Allowed characters are lower- and uppercase letters, numbers and '.' by default, other characters are substituted. More than one non-allowed subsequent characters are substituted with only one substitute string.<br /><br />Usage: clean [OPTION] STRING<br /> -a "ALLOW_STR", --allow="ALLOW_STR" Accepts characters of ALLOWED_STR besides the default allowed characters.<br /> -f, --fullpath Accepts the tilde and slash ("~" and "/") character besides the allowed characters (useful for transforming full pathnames)<br /> -F --filerename Accepts a file name as STRING. It will rename the file to the cleaned string. If the file with the cleaned name already exists, it creates a backup of that before renaming. <br /> -h, --help Print this help<br /><br />Default values:<br />---------------<br />The following accented characters are transformed to non-accented ones:<br />$accent<br /><br />The default allowed (non-substituted) characters are:<br />$allowed<br /><br />The default substitute character is: $substitute</span><br />
<span style="font-family: "Courier New", Courier, monospace;"><br /></span>
<span style="font-family: "Courier New", Courier, monospace;">EOF<br />exit<br />fi<br /><br />string="$*"<br />#substitute=$(echo "$substitute" | sed 's/[\/\\\?\&]/\\&/g')<br /><br />result=$(echo "$string" | sed -e "y/$accent/$nonaccent/" -e "s/[^$allowed]\+/$substitute/g")<br /><br />if [[ $filerename = "true" ]]<br />then<br /> if [ ! -f "$string" ]<br /> then<br /> echo "Cannot find file or not a regular file: $string"<br /> exit 1<br /> fi<br /><br /> if echo $string | grep '/' > /dev/null<br /> then pathname=${string%/*}"/"<br /> fi<br /> <br /> filename=${string##*/}<br /> resultfilename=$(echo ${string##*/} | sed -e "y/$accent/$nonaccent/" -e "s/[^$allowed]\+/$substitute/g") <br /> <br /> if [[ "$pathname$filename" != "$pathname$resultfilename" ]]<br /> then<br /> if ! mv --backup=numbered "$pathname$filename" "$pathname$resultfilename"<br /> then exit 1<br /> fi<br /> fi<br /> echo $result<br />fi</span><br />
<br />
<br />
<i>2. On the Windows guest:</i><br />
<i> </i><br />
A bat file contains an endless loop watching the "watch" file every 3 seconds. If the file exists then it reads out its contents (which are filenmames) open them then deletes the "'watch" file. A vbs file does nothing but invokes the bat script to eliminate the "cmd" window that the bat file would pop up. The vbs is started on Windows startup.<br />
<br />
Create two files:<br />
<br /><i>winopen.bat:</i><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">set watch=\\10.0.2.4\qemu\home\cuh\virt\watch.txt<br /><br />:loop<br />if exist %watch% (<br /> for /f "delims=" %%i in (%watch%) do (<br /> icacls %%i /grant:r Everyone:F<br /> start %%i<br /> )<br /> del %watch%<br />)<br />timeout /t 3<br />goto loop </span><br />
<br />
<br />
<i>winopen.vbs:</i><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">Set oShell = CreateObject ("Wscript.Shell") <br />Dim strArgs<br />strArgs = "cmd /c C:\Users\cuh\winopen\winopen.bat"<br />oShell.Run strArgs, 0, false</span><br />
<br />
Create a shortcut of the vbs file and place it in the startup folder to start the script automatically. The startup folder is:<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">C:\Users\cuh\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\</span><br />
<br />
<br />
<br />
Now if you invoke winopen.sh under the host with a filename, the file should open under the guest.<br />
<br />
E.g.:<br />
<span style="font-family: "Courier New", Courier, monospace;">winopen.sh <your_doc_file_under_linux.docx></span>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0tag:blogger.com,1999:blog-4907337868224969264.post-89567711662398460552019-02-22T04:52:00.000-08:002019-02-22T04:52:04.396-08:00Changing key bindings of Firefox Quantum with xdotoolsFirefox does not allow to change its key bindings since the Quantum series. There are extensions for that but none of them work as it should be. E.g. on built-in pages like the homepage or the about:blank page or when the URL bar is focused these extensions fail. There have been bug tickets about this issue for half a year now but sadly Mozilla is not doing anything to make its browser as flexible as it used to be in its pre-Quantum versions.<br />
<br />
I have read <a href="http://shallowsky.com/blog/tech/web/modifying-omni.ja.html" target="_blank">ideas about changing the contents of the omni.ja</a> file but anything I did it broke Firefox. At the same time this is a very dirty way of getting the job done as we have to change the installed files of Firefox meaning that an update can ruin our changes.<br />
<br />
After quite a long research I found an idea to change key bindings at OS level "tricking" Firefox to accept key presses. The process contains of two steps:<br />
<ol>
<li>We create a small shell script that checks if the active window is Firefox and if it is then it sends a key combination to it. Like that we can send a command (like "close tab", undo "close tab", etc. ) to the browser by sending Firefox's defined key combination ("ctrl+w", "ctrl+shift+t", etc. respectively) to the Firefox window. The commands and their key combinations can be checked under the Help menu of Firefox. The script uses xdotools to send the key combination.</li>
<li>We assign a key binding in our window manager to run the script (i.e. send the given command to the browser). Like that we can set up our key bindings in OS (or WM) level independently of Firefox. </li>
</ol>
In practice the two steps:<br />
<br />
<b>1. Creating the script:</b><br />
<ol>
</ol>
I have created the script called <span style="font-family: "courier new" , "courier" , monospace;">mozkey.sh</span> that accepts a Firefox command as argument and sends the appropriate key combination to Firefox. You have to install xdotool for this script to work. <br />
<ol>
</ol>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">/home/$USER/bin/mozkey.sh</span>:</blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: #cccccc;">windowname="Firefox Nightly"<br />#windowname="Mozilla Firefox"<br /><br />commands=(<br />"closetab;ctrl+w"<br />"undoclosetab;ctrl+shift+t"<br />)<br /><br /># We check if the active window is a FF one, if so we store its id<br />if windowid=$(xdotool search --name "$windowname" | grep $(xdotool getactivewindow))<br />then<br /> for i in ${commands[@]}<br /> do<br /> [[ "$1" == "${i%%;*}" ]] && xdotool key --window "$windowid" "${i#*;}"<br /> done<br />fi</span></span></blockquote>
<br />
The <span style="font-family: "Courier New", Courier, monospace;">windowname</span> variable contains a pattern that fits the Firefox browser window. You can use xprop and check the WM_NAME attribute or simply read the window name in your window title to determine a correct pattern. I have Firefox Nightly build installed and its name always contain the string "Firefox Nightly".<br />
<br />
The script accepts "<span style="font-family: "Courier New", Courier, monospace;">closetab</span>" or "<span style="font-family: "Courier New", Courier, monospace;">undoclosetab</span>" as argument but you can edit it to your liking and add more commands to the array with a new line of <span style="background-color: #cccccc;"><span style="font-family: "Courier New", Courier, monospace;">"<commandname>;<Firefox default binding>"</span></span>. <br />
<br />
Its usage is very simple, the script accepts one argument which is the command to be sent to Firefox:<br />
<span style="background-color: #cccccc;"><span style="font-family: "Courier New", Courier, monospace;">mozkey.sh <command></span></span><br />
<br />
It sends the appropriate key combination to Firefox.<br />
<span style="background-color: #cccccc;"><span style="font-family: "Courier New", Courier, monospace;">mozkey.sh closetab</span></span> sends ctrl+w, hence closes the actual tab.<br />
<span style="background-color: #cccccc;"><span style="font-family: "Courier New", Courier, monospace;">mozkey.sh undoclosetab</span></span> sends ctrl+shift+t, hence reopenes the last closed tab.<br />
<br />
<br />
The script does nothing if you run it from a terminal because it checks if the active window is Firefox and if it is not (like in this case your active window is your terminal) then does nothing.<br />
<br />
<br />
<br />
<b>2. Defining your bindings:</b><br />
<br />
I have set up my Awesome WM keybindings to run the script like this:<br />
<br />
<span style="font-family: inherit;">Pressing ctrl+0 executes </span><span style="background-color: #cccccc;"><span style="font-family: "courier new" , "courier" , monospace;">/home/$USER/bin/mozkey.sh closetab</span></span><br />
<span style="font-family: inherit;"><span style="font-family: inherit;"><span style="font-family: "Courier New", Courier, monospace;">Pressing ctrl+1 executes </span></span></span><span style="background-color: #cccccc;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">/home/$USER/bin/mozkey.sh undoclosetab</span></span></span><br />
<br />
My appropriate Awesome WM config lines are:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">.config/awesome/rc.lua:</span><br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: #cccccc;"> -- Firefox key hack<br /> awful.key({ "Control" }, "0", function () awful.spawn("/home/$USER/bin/mozkey.sh closetab") end),<br /> awful.key({ "Control" }, "1", function () awful.spawn("/home/$USER/bin/mozkey.sh undoclosetab") end),</span></span></blockquote>
<br />
If you use another window manager set your bindings according to its configuration.<br />
<br />
Now, in a Firefox window I press ctrl+0 and it closes the tab. I press ctrl+1 and it reopens the last closed tab.<br />
<br />
<b>Possible issues:</b><br />
<b> </b><br />
The thing is new, I haven't tested it a lot. Its caveat can be conflicting bindings. If you want to use a WM key binding which already exists in Firefox for another function that might cause problems since Firefox will get two key combinations at the same time.György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0tag:blogger.com,1999:blog-4907337868224969264.post-82418886971941512342016-06-21T05:53:00.001-07:002016-06-21T06:00:57.054-07:00Tiling wm font renderingDesktops like KDE or GNOME have their nice panels to set up themes and fonts but in a simple tiling window manager there are no such settings. From time to time I face problems with font rendering on xorg updates. Fonts just start looking ugly from one day to another.<br />
<br />
Xorg's font configuration is handled by the extra/fontconfig package as a dependency of the xorg installation.<br />
<br />
Configuration can be easily done by creating symlinks of predefined config files under <span style="font-family: "courier new" , "courier" , monospace;">/etc/fonts/conf.avail/</span> under the <span style="font-family: "courier new" , "courier" , monospace;">/etc/fonts/conf.d/</span> directory as per the <a href="https://wiki.archlinux.org/index.php/Font_configuration#Presets" target="_blank">Font Configuration Arch Wiki</a>.<br />
<br />
Fontconfig sets up default symlinks in <span style="font-family: "courier new" , "courier" , monospace;">/etc/fonts/conf.d/</span> which is a good start. But here the problem comes! If you change these symlinks to your liking a fontconfig upgrade can mess them up, hence you have to redo the configuration after such upgrades.<br />
<br />
How to override this?<br />
<br />
You can specify per-user defined symlinks under the <span style="font-family: "courier new" , "courier" , monospace;">.config/fontconfig/conf.d/</span> dir. But if there are conflicts then the global one takes precedence (why?!). To override this you do this:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"># cd /etc/fonts/conf.d</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># cp 50-user.conf 00-user.conf</span><br />
<br />
Then set up your font config symlinks to your taste under your user config directory. I want to change the hinting setting from the globally defined "slight" one (which gives ugly look on my LCD) to "full". I do it with this symlink command:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$ ln -s /etc/fonts/conf.avail/10-hinting-full.conf .config/fontconfig/conf.d/</span>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0tag:blogger.com,1999:blog-4907337868224969264.post-75913736007631153832015-11-30T06:21:00.000-08:002015-11-30T06:28:34.639-08:00Set ranger as the default file manager of FirefoxI have just created a short script for using <a href="http://ranger.nongnu.org/" target="_blank">ranger</a> (>=version 1.4.2) as the default file manager to open files from Firefox. This is how you make it:<br />
<br />
Create a <span style="font-family: "courier new" , "courier" , monospace;">~bin/fileopen.sh</span> file with this content:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">#!/bin/bash<br /> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">log=$HOME/.xlog<br />path=${1#file://}<br /> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">if [ -d $path ]<br />then</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> /usr/bin/xterm -e "/usr/bin/ranger $path" &>> $log<br />else</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> /usr/bin/xterm -e "/usr/bin/ranger --selectfile=$path" &>> $log<br />fi</span></blockquote>
<br />
Of course you make your script executable:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">chmod 755 ~bin/fileopen.sh</span><br />
<br />
In Firefox go to <i>Edit</i> > <i>Preferences</i> > <i>Applications</i><br />
Set the action for the type "<i>file</i>" and whatever other entries to use your <span style="font-family: "courier new" , "courier" , monospace;">fileopen.sh</span> script for opening these types of files. E.g. I have set "<i>file</i>", "<i>GZ file</i>", "<i>Plain text document</i>", "<i>raw CD image</i>", "<i>shell script</i>" and "<i>Zip archive</i>" types to be handled by ranger. Additionnally when Firefox asks how to open such a file, set it up to use <span style="font-family: "courier new" , "courier" , monospace;">fileopen.sh</span> as well.<br />
<br />
You are done. Download something and/or open your recent download list in Firefox and an xterm window should pop up with a ranger instance opening the file. If the file is a directory (e.g. when you click "Open Containing Folder" in Firefox) then it will not only choose the directory in the tree but will also enter it.György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0tag:blogger.com,1999:blog-4907337868224969264.post-13051400795263836352012-09-13T03:40:00.000-07:002013-08-21T01:30:53.849-07:00Awesome WM Reloaded!I have been <a href="http://kissmyarch.blogspot.com/2011/09/tiling-window-managers.html">playing around</a> with plenty of tiling window managers and until now none of them worked as I wanted. Finally I have succeeded to set up Awesome WM to meet all my needs but I really had to work hard to get to this point. I cannot go further without mentioning the dark sides of Awesome: things are just not working as they are written, sample config files are unfunctional, modules and config scripts are far not compatible with each other, AUR packages are sometimes simply not installable. For example I cannot use bashets because it just does not work on my system although I use the sample config file coming with the latest bashet release. I tried to upgrade my stable awesome to awesome-git from AUR but I could not manage to do it, yaourt complains about a non-existent(!) package as a dependency:<br />
<span style="font-family: "Courier New",Courier,monospace;">error: target not found: xcb-util-image </span><i></i><br />
What is this all around? Why is it so difficult?<br />
<span style="font-family: "Courier New",Courier,monospace;"><i>(</i></span><i>UPDATE: xcb-util problem is solved by now, thanks to the package maintainers!).</i> <br />
<i></i><br />
<br />
OK, now the awesome part of awesome and the workarounds for some issues:<br />
<br />
<b>Installation:</b><br />
<br />
I installed these packages:<br />
<ul>
<li><span style="font-family: "Courier New",Courier,monospace;">awesome</span> (<span style="font-family: "Courier New",Courier,monospace;">3.4.13-1</span>), community repository </li>
<li><span style="font-family: "Courier New",Courier,monospace;">vicious</span> (<span style="font-family: "Courier New",Courier,monospace;">2.1.0-1</span>), community repository</li>
<li><span style="font-family: "Courier New",Courier,monospace;">shifty-github</span> (<span style="font-family: "Courier New",Courier,monospace;">20120913-1</span>), AUR</li>
<li><span style="font-family: "Courier New",Courier,monospace;">awesome-scratchpad-git</span> (<span style="font-family: "Courier New",Courier,monospace;">20120913-1</span>), (optional, if you need a scratchpad), AUR </li>
</ul>
<b>Configuration tips:</b><br />
<br />
See my <a href="http://kissmyarch.blogspot.com/p/rc.html">rc.lua</a>, it works nicely with the above-mentioned software versions.<br />
<br />
<br />
<u>Changed "require" format:</u><br />
<br />
From Lua 5.1 the way you have to load modules in your rc.lua has changed:<br />
<br />
<span style="color: red;">Older format:</span><br />
<span style="color: red;">require("vicious")</span><br />
<br />
<span style="color: lime;">New format:</span><br />
<span style="color: lime;">vicious = require("vicious")</span><br />
<br />
Vicious, for example will not work with the older format!<br />
<br />
<br />
<u>Raise clients on tag switching:</u><br />
<br />
Add this line to your rc.lua:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
require("awful.autofocus")</div>
If you do not do this, navigating between tags will not focus the clients which is quite annoying in my opinion.<br />
<br />
<br />
<u>Run or raise:</u><br />
If you want to have only one instance of certain applications you can
place a small code to the end of your <span style="font-family: "Courier New",Courier,monospace;">rc.lua</span> for defining the <span style="font-family: "Courier New",Courier,monospace;">run_or_raise</span> function. You can read more on this <a href="http://awesome.naquadah.org/wiki/Run_or_raise">here</a>. After this you can define your key bindings to run something only once like this:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">awful.key({ modkey,}, "f", function () run_or_raise("firefox", { class = "Firefox" }) end),</span><br />
<br />
As a result of this example when you press MOD+f firefox will start or if there is already an existing window with WM_CLASS="Firefox" running that window will gain focus.<br />
<br />
<br />
Skype - as usual - needs special attention when you deal with window management. <span style="font-family: "Courier New",Courier,monospace;">Run_or_raise</span> will start a new instance of skype if it is already sitting in your systray. To prevent it you can write a script that examines if skype is already running. My <span style="font-family: "Courier New",Courier,monospace;">skypestart</span> script looks like this:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> if [ "$(pgrep skype)" ]</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> then</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> echo skype is already running</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> else</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> skype</span><br />
<span style="font-family: "Courier New",Courier,monospace;">fi</span><br />
<br />
And the appropriate <span style="font-family: "Courier New",Courier,monospace;">rc.lua</span> line for the binding is:<br />
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<span style="font-family: "Courier New",Courier,monospace;">awful.key({ modkey,}, "s", function () run_or_raise("<your path>/skypestart", { name = "Skype" }) end),</span><br />
<br />
<br />
<u>Use your custom theme:</u><br />
<div style="font-family: "Courier New",Courier,monospace;">
beautiful.init(".config/awesome/themes/<your_theme_dir>/theme.lua")</div>
<br />
See my <a href="http://kissmyarch.blogspot.hu/p/awesome-rclua-theme-files.html">theme.lua</a>.<br />
<br />
<u>Custom statusbar script using vicious:</u><br />
You can set up a shell script to create a status message for your status bar. This script can contain colour codes to have a nicer output. For example I write the battery percentage with red when its value is under 30% instead of the normal orange colour. My bar looks like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-_EEnpubYgOU/Tya1UgKsD3I/AAAAAAAAMy4/PUludEHawHg/s1600/status.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-_EEnpubYgOU/Tya1UgKsD3I/AAAAAAAAMy4/PUludEHawHg/s1600/status.png" /></a></div>
<br />
My <span style="font-family: "Courier New",Courier,monospace;">status.sh</span> script to generate this output:<br />
<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">span_hi='<span color="#ff8700">' #colour for normal battery</span><br />
<span style="font-family: "Courier New",Courier,monospace;">span_lo='<span color="#aaaaaa">' #colour for normal battery</span><br />
<span style="font-family: "Courier New",Courier,monospace;">span_sep='<span color="#ff8700">' #colour for normal battery</span><br />
<span style="font-family: "Courier New",Courier,monospace;">span_warn='<span color="#ff0000">'</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">## Set battery message (works on Thinkpad Edge 11 with </span><a href="http://kissmyarch.blogspot.com/2012/01/arch-linux-on-thinkpad-edge-11.html" style="font-family: "Courier New",Courier,monospace;">tp_smapi driver</a><span style="font-family: "Courier New",Courier,monospace;">)</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">batt=`cat /sys/devices/platform/smapi/BAT0/remaining_percent`</span><br />
<span style="font-family: "Courier New",Courier,monospace;">if (($batt <= 30));</span><br />
<span style="font-family: "Courier New",Courier,monospace;">then battstate=$span_warn$batt'%% </span>'$span_lo`cat /sys/devices/platform/smapi/BAT0/state`'</span>'</span><br />
<span style="font-family: "Courier New",Courier,monospace;">else battstate=$span_hi$batt'%% </span>'$span_lo`cat /sys/devices/platform/smapi/BAT0/state`'</span>'</span><br />
<span style="font-family: "Courier New",Courier,monospace;">fi</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">## Create the output</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">echo ' '$battstate$span_sep' | </span>'$span_lo`cat /proc/cpuinfo | grep "cpu MHz" | awk '{sum+=$4} END { print sum/NR,"MHz"}'`'</span>'$span_sep' | </span>'$span_lo`date "+%a, %Y.%m.%d."`' - </span>'$span_hi`date +"%R"`' </span>'</span><br />
<br />
I initialise this status script from my rc.lua with vicious which upgrades the status bar every 10 seconds:<br />
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
</div>
<span style="font-family: "Courier New",Courier,monospace;">statwidget = widget({</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> type = 'textbox',</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> name = 'statwidget'</span><br />
<span style="font-family: "Courier New",Courier,monospace;">})</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">function run_script()</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> local filedescriptor = io.popen("/<path>/<to>/<your>/status.sh")</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> local value = filedescriptor:read()</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> filedescriptor:close()</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> return {value}</span><br />
<span style="font-family: "Courier New",Courier,monospace;">end</span><br />
<span style="font-family: "Courier New",Courier,monospace;">vicious.register(statwidget, run_script, '$1', 10)</span><br />
<br />
<br />
And I call the vicious widget wen I construct my top bar later in rc.lua:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> topbar[s].widgets = {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mytaglist[s],</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mypromptbox[s],</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> layout = awful.widget.layout.horizontal.leftright</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> },</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mylayoutbox[s],</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> s == 1 and mysystray or nil,</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> statwidget,</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mytasklist[s],</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> layout = awful.widget.layout.horizontal.rightleft</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> }</span><br />
<br />
<u>Scratchpad calculator:</u><br />
It is good to have a calculator at hand in a floating window. The scratchpad is an easy way to pop up a floating window on the actual screen. You can also set the default geometry of the window so it will always show up with the same size and place. With a key binding you can pop up or hide this window.<br />
<br />
<br />
For this you need to install a calculator, I use <span style="font-family: "Courier New",Courier,monospace;">qalculate-gtk</span>. You also need the <span style="font-family: "Courier New",Courier,monospace;">awesome-scratchpad-git </span>AUR package and some configuration in <span style="font-family: "Courier New",Courier,monospace;">rc.lua</span>:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
-------libraries section------</div>
<div style="font-family: "Courier New",Courier,monospace;">
require("scratch")</div>
<div style="font-family: "Courier New",Courier,monospace;">
------globalkeys section------</div>
<span style="font-family: "Courier New",Courier,monospace;">-- Binding for calculator in scratchpad</span><br />
<span style="font-family: "Courier New",Courier,monospace;">awful.key({ modkey }, "q", function () scratch.drop("qalculate","top","center",250,300) end),</span><br />
<br />
If you need a calculator you can pop it up any time with Mod+q. When you do not need it simply hide it with the same binding.<br />
<br />
<br />
<u>Tip: How to take screenshots?</u><br />
You need <span style="font-family: "Courier New",Courier,monospace;">scrot</span>, <span style="font-family: "Courier New",Courier,monospace;">sxiv</span> and <span style="font-family: "Courier New",Courier,monospace;">xfe</span> installed for this to work. Place this line to your <span style="font-family: "Courier New",Courier,monospace;">rc.lua</span> globalkeys section:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
awful.key({ }, "Print", function () awful.util.spawn_with_shell("scrot -e 'mv $f ~/Desktop/ 2>/dev/null && xfe ~/Desktop/ & sleep 1 && sxiv ~/Desktop/$f'") end),</div>
<br />
Your PrintScreen key will take a screenshot and pop it up in an sxiv image viewer window and also in an xfe file manager window for further use.<br />
<br />
<br />
<u>Dual screen and VGA hotplugging</u><br />
One of the major benefits of Awesome is that it can handle a dual head setup quite flawlessly and in an easy-to-configure manner. When you attach or detach displays in your system you can redistribute your clients between your actual monitors by means of a simple keystroke. First you need to install <a href="https://wiki.archlinux.org/index.php/Xrandr">xrandr</a> to fulfil this task. Xinerama might be supported as well, I did not test it with Awesome.<br />
<br />
A simple script using <span style="font-family: "Courier New",Courier,monospace;">xrandr</span> can be handy to make the changes easy. I have a laptop with an LCD panel (LVDS1) and some connectors (VGA1, HDMI1, DP1) where other displays can be attached to the system. My <span style="font-family: "Courier New",Courier,monospace;">dual_screen</span> script examines if an external display is attached to any of these ports and if it finds one it will make that one a primary display and sets the LVDS1 to be the secondary one placed on the left hand side of the primary display.<br />
If it does not find any attached monitors it will set LVDS to be the one and only, primary display. My <span style="font-family: "Courier New",Courier,monospace;">.xinitrc</span> and <span style="font-family: "Courier New",Courier,monospace;">dual-screen</span> scripts to configure dual head setup can be found <a href="http://kissmyarch.blogspot.hu/p/xinitrc-and-related.html">here</a>.<br />
<br />
By running the dual_screen script and restarting Awesome the clients will be arranged according to the rules of your rc.lua.<br />
<br />
I placed a key binding to the global keys of my <span style="font-family: "Courier New",Courier,monospace;">rc.lua</span> to do this on a keystroke:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">-- VGA hotplugging and restarting awesome. The dual-screen bash script runs an xrandr screen setup.</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> awful.key({ modkey, "Control"}, "r",</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> function ()</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> awful.util.spawn_with_shell("/dev/shm/scripts/dual-screen")</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> awesome.restart()</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> end),</span><br />
<br />
And according to my Shifty rules in my rc.lua there are clients to be placed on screen 1 (primary screen) and others on screen 2 (secondary screen). If there is only one screen then Awesome will place all clients on the primary screen.<br />
<br />
<br />
<div style="color: #e69138;">
<span style="font-size: x-large;"><b>And the results </b></span></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-7EjiX8WFZHg/UFIAxkwQriI/AAAAAAAANrA/-44tKS5RtFs/s1600/gimp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://3.bp.blogspot.com/-7EjiX8WFZHg/UFIAxkwQriI/AAAAAAAANrA/-44tKS5RtFs/s320/gimp.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-CaMTT-4a6t8/UFIAysUTjRI/AAAAAAAANrI/GAr4RWF-lqE/s1600/tb.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="105" src="http://3.bp.blogspot.com/-CaMTT-4a6t8/UFIAysUTjRI/AAAAAAAANrI/GAr4RWF-lqE/s320/tb.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-_5ou4sEcB68/UFIAzQPwnAI/AAAAAAAANrQ/LAKVF3eR4jQ/s1600/terminal.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://4.bp.blogspot.com/-_5ou4sEcB68/UFIAzQPwnAI/AAAAAAAANrQ/LAKVF3eR4jQ/s320/terminal.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-tGNnh035kt8/UFIA0VKSJWI/AAAAAAAANrY/E9mYoY9iK1A/s1600/win.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://3.bp.blogspot.com/-tGNnh035kt8/UFIA0VKSJWI/AAAAAAAANrY/E9mYoY9iK1A/s320/win.png" width="320" /></a></div>
<br />György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com3tag:blogger.com,1999:blog-4907337868224969264.post-37057992238419270162012-05-17T08:24:00.002-07:002012-05-17T08:41:32.886-07:00Two simple yaourt tipsJust a quick post to improve your experience with <b>yaourt</b>. For many it will be straighforward but maybe it will be useful for others.<br />
<br />
<div style="color: #e69138;">
<span style="font-size: x-large;"><b>If yaourt asks too much... </b></span></div>
<br />
If you fed up with these questions asked all the time by yaourt:<br />
<b>Edit PKGBUILD ? [Y/n] ("A" to abort)</b><br />
<b>Edit <pkg_name>.install ? [Y/n] ("A" to abort)</b><br />
<b>Continue building </b><b><pkg_name></b><b> ? [Y/n]</b><br />
<br />
The simple solution is to create a <span style="font-family: "Courier New",Courier,monospace;">.yaourtrc</span> under your home directory and configure yaourt to your taste. You can use the global <span style="font-family: "Courier New",Courier,monospace;">/etc/yaourtrc</span> file as a sample:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
cp /etc/yaourtrc ~/.yaourtrc</div>
<br />
Edit <span style="font-family: "Courier New",Courier,monospace;">.yaourtrc</span> to your liking according to <a href="http://archlinux.fr/man/yaourtrc.5.html">http://archlinux.fr/man/yaourtrc.5.html</a><br />
<br />
I simply edited two lines:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
BUILD_NOCONFIRM=1</div>
<div style="font-family: "Courier New",Courier,monospace;">
EDITFILES=0</div>
<br />
These two will prevent yaourt to ask for editing anything and for continuing the build, it will skip these steps and will build the packages for you automatically. Still it will leave you some manual controls not to install anything unintentionally:<br />
<ul>
<li>When you do system upgrade ( <span style="font-family: "Courier New",Courier,monospace;">yaourt -Syua</span> ), it will tell you what packages are to be installed and will ask "Continue upgrade ? [Y/n]".</li>
</ul>
<ul>
<li>It will always ask the last question for installing a package after building it: "Proceed with installation? [Y/n]". </li>
</ul>
<div style="color: #e69138;">
<b><span style="font-size: x-large;">Search and install interactively</span></b></div>
<br />
If you use yaourt without options ( i.e. <span style="font-family: "Courier New",Courier,monospace;">yaourt <pattern></span> ) it will search packages just it would do with the -Ss option ( i.e. <span style="font-family: "Courier New",Courier,monospace;">yaourt -Ss <pattern></span> ) but it will mark the results with numbers and ask if you want to install one of them. Just type the number of the chosen package and hit Enter to install it. If you hit Enter without a number yaourt will quit.<br />
<br />
<br />
<i>If you have any other tips for yaourt, please do not hesitate to leave a comment!</i>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com7tag:blogger.com,1999:blog-4907337868224969264.post-65435147322620799272012-01-24T08:59:00.000-08:002015-06-03T03:29:48.921-07:00VirtualBox tips and tricks - awesome wm integration<div style="color: #e69138;">
<b><span style="font-size: x-large;">Hiding the menu and statusbar of VirtualBox</span></b></div>
<br />
I finally managed to set up <a href="http://awesome.naquadah.org/">awesome wm</a> to work just as I want. I only had some minor problems and customisation needs with my windows VirtualBox guest: <br />
<br />
- Scale mode simply freezes my guest OS, so I do not use it.<br />
- In seamless, fullscreen or scale modes Virtualbox's host key has to be pressed to leave the guest window. As I use almost every window management opertion by keystrokes, it was a bit annoying not to be able to switch out from my windows guest with a simple keystroke but I had to press the host key first. Fortunately in normal view (with the menu bar and the status bar on the top and bottom of the window) you can switch out directly from the guest without using the host key.<br />
- In normal mode the menu and status bars take a bit of a place needlessly.<br />
<br />
I tried some tricks to resize my VB guest in floating mode to "overlflow" my screen but these tricks did not work well. Finally I found the solution <a href="http://helpdeskgeek.com/virtualization/hide-the-menu-bar-and-status-bar-in-virtualbox/">here</a>.<br />
<br />
You can hide the menu and status bars of the VirtualBox window with this simple command:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">vboxmanage setextradata global GUI/Customizations noMenuBar,noStatusBar</span><br />
<br />
Restart Virtualbox and that's it, you are done! :) <br />
<br />
<div style="color: #e69138;">
<b><span style="font-size: x-large;">Disabling the "Win" key</span></b></div>
<br />
I configured my window manager to use the "Win" key as the major alt key of keystrokes. Under my virtual windows guest I had a small annoyance, i.e. when using the "win" key for a window management task the windows menu always shown up. If you have the same issue, you can disable the "win" key under windows by simply downloading and executing the appropriate "Fix it" binary provided by Microsoft's support <a href="https://support.microsoft.com/en-us/kb/216893" target="_blank">page</a>.<br />
<br />
UPDATE: recently I installed a Windows guest machine to a new computer. The method above eliminated the Win key under the guest but my tiling window manager did not work well. The window manager's "Win" key bindings did not work when I was inside the virtualbox guest. To change this behavior:<br />
<br />
Open the VirtualBox GUI, go to "File" > "Preferences" menu, then choose the "Input", uncheck the box labeled "Auto Capture Keyboard".
There is no need to restart the VM if it's running, so this can be
changed "on the fly". Thanks to the Ubuntu folks <a href="http://askubuntu.com/questions/144905/virtualbox-windows-key-pass-through-to-gnome" target="_blank">here</a>.<br />
<br />
<div style="color: #e69138;">
<b><span style="font-size: x-large;">Hiding the recycle bin</span></b></div>
<br />
A small cosmetics on the windows desktop: <a href="http://windows.microsoft.com/en-US/windows-vista/Show-or-hide-the-Recycle-Bin">hide your recycle bin</a>.<br />
<br />
After all these treatments my win7 guest OS looks likesimple and clean and above all integrates very well ito my window manager. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-2S4PHQGnPg4/Tx7jRrMVGSI/AAAAAAAAMt8/UN9eAp6M8Pk/s1600/win7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-2S4PHQGnPg4/Tx7jRrMVGSI/AAAAAAAAMt8/UN9eAp6M8Pk/s400/win7.png" width="400" /></a></div>
<br />
Also, please take a look at <a href="http://kissmyarch.blogspot.com/2012/01/opening-files-under-virtualbox-guest.html">this post</a> if you are interested in a solution for opening windows files in VirtualBox directly from your Linux host.György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com1tag:blogger.com,1999:blog-4907337868224969264.post-36186611838769018802012-01-20T07:27:00.000-08:002016-07-19T02:57:49.189-07:00Opening files under VirtualBox guest from the Linux host<br />
<i>Updated: 08/06/2015 </i><br />
<br />
I have been using VirtualBox to run windows software on my linux box for a while. I always wondered how nice it would be to simply click on a windows file (.doc, .xls, .exe, etc.) under linux to open it with the appropriate application (winword, excel, etc.) under the virtual machine instead of saving the file and looking it up under windows. I did not find any solution for this so I looked around and invented my own one. The operation is based on the <a href="http://www.virtualbox.org/manual/ch08.html#vboxmanage-guestcontrol">VBoxManage guestcontrol</a> utility provided by VirtualBox. This command allows you to initiate program execution inside the guest from the host. A small bash script handles this on the host by converting the filename to windows format and opening the file inside the guest Windows machine.<br />
<br />
The steps for setting all these up:<br />
<br />
<span style="font-size: large;"><b>Add the <span style="font-family: "courier new" , "courier" , monospace;">/</span> directory to the windows guest</b></span><br />
<br />
Install VirtualBox <a href="https://www.archlinux.org/packages/?name=virtualbox-additions">guest additions</a> if it is not installed already. I do not want to describe how to install guest additions, it is well documented <a href="http://www.virtualbox.org/manual/ch04.html#additions-windows">elsewhere</a>. Briefly under Arch Linux you have to install the <span style="font-family: "courier new" , "courier" , monospace;">virtualbox-additions</span> AUR package, add<span style="font-family: "courier new" , "courier" , monospace;"> /usr/lib/virtualbox/additions/VBoxGuestAdditions.iso</span> to your VirtualBox storage and install the guest additions under the guest. <br />
<br />
Create a shared folder under VirtualBox settings and add your linux host's root (/) filesystem. Now let's say your linux<span style="font-family: "courier new" , "courier" , monospace;"> / </span>direcrory is the <span style="font-family: "courier new" , "courier" , monospace;">f:</span> drive under the windows guest.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-zfg7EPQ4sJ0/Tx7JIkCBKYI/AAAAAAAAMtc/ndcH59huVec/s1600/guest_additions.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://4.bp.blogspot.com/-zfg7EPQ4sJ0/Tx7JIkCBKYI/AAAAAAAAMtc/ndcH59huVec/s320/guest_additions.png" width="320" /></a></div>
<br />
<br />
As a result a file named <span style="font-family: "courier new" , "courier" , monospace;">/home/<your_username>/document.doc</span> under linux looks like <span style="font-family: "courier new" , "courier" , monospace;">f:\home\<your_username>\document.doc</span> under the guest.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-NFWqd-ALje4/Tx7JwyyAJzI/AAAAAAAAMtk/lnLOBqSxuZs/s1600/root.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="317" src="https://4.bp.blogspot.com/-NFWqd-ALje4/Tx7JwyyAJzI/AAAAAAAAMtk/lnLOBqSxuZs/s320/root.png" width="320" /></a></div>
<br />
<br />
<span style="font-size: large;"><b>Install Quiet.exe under the windows guest</b></span><br />
<br />
<i>UPDATE: Under my latest Win7 guest installation cmd.exe works just fine without bringing up a command window and without the need of setting up environment variables. If this is not the case you can use Quiet.exe instead.</i><br />
<br />
To open files remotely you can use <span style="font-family: "courier new" , "courier" , monospace;">cmd.exe</span> or the <span style="font-family: "courier new" , "courier" , monospace;">start</span> command but both opens a console window besides the program that you want to run which I find quite annoying. To hide it you have to use additional software: a hand-made vbs script or a third-party tool like hstart, cmdow or Quiet. I will follow the last one, this simple tool works fine.<br />
<br />
Download Quiet from their <a href="http://www.joeware.net/freetools/tools/quiet/index.htm">website</a> and copy the Quiet.exe anywhere you like under your windows guest.<br />
<br />
Let's say it will be here:<br />
<div style="font-family: "Courier New",Courier,monospace;">
c:\Users\<span style="color: #e06666; font-family: "courier new" , "courier" , monospace;"><your_windows_username></span>\Quiet.exe</div>
<br />
<span style="font-size: large;"><b>Enable passwordless guest control under the windows guest</b></span><br />
<br />
If you do not use password in your windows guest (like me), the guest's group
policy must be changed under the guest OS. To do so, open the group policy editor on the
command line by typing <b>gpedit.msc</b>, open the key <b>Computer
Configuration</b> \ <b>Windows Settings</b> \ <b>Security Settings</b> \ <b>Local Policies</b> \ <b>Security
Options</b> and change the value of <b>Accounts: Limit local </b>account use of
blank passwords to console logon only to <b>Disabled</b>.<br />
<br />
Without this step you will get an error when trying use VboxManage:<br />
<i><span style="font-family: "courier new" , "courier" , monospace;">VBoxManage: error: The specified user was not able to logon on guest.</span></i><br />
<br />
<b><span style="font-size: large;">Install detox for cleaning up filenames</span></b><br />
<br />
Not only me but VboxManage also hates special characters and spaces in filenames. <a href="http://detox.sourceforge.net/">Detox</a> is a handy tool for swiping such garbages out of filenames. It will replace spaces to underline sign, convert characters with accents for the non-accent version and remove special characters. You can install it from AUR then use it in your scripts (like I did below).<br />
<br />
<b><span style="font-size: large;">Create the winopen.sh script</span></b><br />
<br />
<i>UPDATE: since Virtualbox 5.0.0 the execute subcommand of </i><i><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">VBoxManage guestcontrol is deprecated. Use run instead with the --exe option (see the script below)</span></span>. </i><br />
<br />
<i>UPDATE: </i><i>since Virtualbox 5.0.0 instead of --environment use the --putenv option in your "</i><i><span style="font-family: "courier new" , "courier" , monospace;">VBoxManage guestcontrol ... </span>run" command</i><i><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> (see the script below)</span></span>. </i><br />
<br />
<i>UPDATE: since Virtualbox 5.1.x instead of <span style="font-family: "courier new" , "courier" , monospace;">run</span></i><i><span style="font-family: "courier new" , "courier" , monospace;"> </span>use </i><i><i><span style="font-family: "courier new" , "courier" , monospace;">start<span style="font-family: "courier new" , "courier" , monospace;">!</span></span></i> run gives session problems, commands stuck after termination. run works for me. Oracle's <a href="https://www.virtualbox.org/manual/ch08.html#vboxmanage-guestcontrol" target="_blank">documentation</a> sucks by the way. </i><br />
<i> </i> <br />
Create a <span style="font-family: "courier new" , "courier" , monospace;">winopen.sh</span> bash script under the linux host. This will be the command for opening windows files within the guest.<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">#!/bin/bash<br /><br /># stdout and errors go here:<br />exec 2>>"/home/<span style="color: #e06666;"><your_linux_username></span>/.xlog<span style="color: #e06666;"><or_anything_you_like></span>"<br />exec 1>&2<br /><br />script="$(basename "$0")"<br />vmname="<span style="color: #e06666;"><the_name_of_your_windows_guest_under_Virtuabox></span>"<br />driveletter="f:" <span style="color: red;"><span style="color: #e06666;">#your ROOT folder's drive letter comes here </span></span><br /><br /># Start vm if not running already<br />if [ $(VBoxManage list runningvms | wc -l) = 0 ]; then<br /> VBoxManage startvm $vmname<br /> echo "Please wait, starting virtual PC..."<br /> sleep 5s <br />fi<br /><br />until VBoxManage showvminfo $vmname | grep '"Graphics Mode": active/running' > /dev/null<br /> do<br /> sleep 0.5s<br /> done<br /><br /># Set the absolute full path of the file in the linux host<br />for i in "$@"<br />do<br /> if echo $i | grep '^/' > /dev/null<br /> then targetfullpath=$i<br /> else targetfullpath=$PWD'/'$i<br /> fi<br /><br />#Cleanup filename, <span style="color: #e06666;">you need detox installed!</span> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cleanpath=$(detox -vs utf_8 "$targetfullpath" | tail -1 | awk '{print $NF}')<br /><br /># The same filepath under the windows guest machine <br />winfullpath=$(echo $driveletter$cleanpath | sed 's/\//\\/g')<br /><br /># Open the file under windows<br />echo $script": opening "$targetfullpath" ("$winfullpath") in Virtualbox" <br />#sleep 1 <span style="color: #e06666;"># uncomment and increase this if you see empty Winword windows</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;">#In newer Windows installations try this:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">VBoxManage guestcontrol "$vmname" <span style="font-family: "courier new" , "courier" , monospace;">start</span> --exe "cmd.exe" --username 'cuh' </span></span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">--putenv "USERPROFILE=C:\Users\<span style="color: #e06666;"><your_windows_username></span>" --putenv "APPDATA=C:\Users\</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #e06666;"><your_windows_username></span></span>\AppData\Roaming"</span> -- "cmd" "/c" $winfullpath &</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"># For older installations:</span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">#VBoxManage guestcontrol "$vmname" execute --image "cmd.exe" --username "<span style="color: #e06666;"><your_windows_username></span>" </span><span style="font-family: "courier new" , "courier" , monospace;">-- "cmd" "/c" $winfullpath &</span> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># If you want to use quiet.exe or have problems with environment variables, try this: </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">#VBoxManage guestcontrol "$vmname" execute --image "C:\Users\<span style="color: #e06666;"><your_windows_username></span>\Quiet.exe" --wait-exit --username "<span style="color: #e06666;"><your_windows_username></span>" --environment "USERPROFILE=C:\Users\<span style="color: #e06666;"><your_windows_username></span>" --environment "APPDATA=C:\Users\</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #e06666;"><your_windows_username></span></span>\AppData\Roaming" -- "cmd" "/c" $winfullpath &</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">done</span><br />
<br />
<br />
Make your script executable, i.e.:<br />
<span style="font-family: "courier new" , "courier" , monospace;">chmod 755 winopen.sh</span><br />
<br />
Optionally place <span style="font-family: "courier new" , "courier" , monospace;">winopen.sh</span> to your path, (i.e. <span style="font-family: "courier new" , "courier" , monospace;">/home/<your_username>/bin/winopen.sh</span> and put <span style="font-family: "courier new" , "courier" , monospace;">export PATH=$PATH:~/bin</span> under your <span style="font-family: "courier new" , "courier" , monospace;">.bashrc</span>)<span style="font-family: "courier new" , "courier" , monospace;">.</span><br />
<br />
<span style="font-family: inherit;"><b>Important notices on environment variables:</b></span><br />
<span style="font-family: inherit;">Without the <span style="font-family: "courier new" , "courier" , monospace;">--environment "USERPROFILE=C:\Users\<span style="color: #e06666;"><your_windows_username></span>"</span> attribute in your winopen.sh script your guest OS sometimes does not get this environment variable and cannot open your files. You get errors like this:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: inherit;"><i>"your AutoCorrect file, MSO1038.acl could not be saved."</i> or <i>"Microsoft Excel cannot access the file ... There are several possible reasons: The file name or path does not exist..."</i></span></span><br />
<br />
<span style="font-family: inherit;">The lack of the </span><span style="font-family: "courier new" , "courier" , monospace;">--environment "APPDATA=C:\Users\</span><span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="color: #e06666;"><your_windows_username></span></span>\AppData\Roaming"</span> attribute can slow down Word document spell checking.<span style="font-family: "courier new" , "courier" , monospace;"></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
In general all the environment variables should be the same as in the Windows guest environment but I was just lazy to write all the environment set to the VboxManage command. <span style="font-family: "courier new" , "courier" , monospace;"><br /></span><br />
<br />
<b><span style="font-size: large;">Usage</span></b><br />
<br />
Invoking the <span style="font-family: "courier new" , "courier" , monospace;">winopen.sh</span> script with one or more filenames will start your Virtualbox (if it was not running already), clean up your filename(s) (if there were special characters in them) and open the file(s) under the windows guest. For example:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
winopen.sh /home/<your_username>/document.doc</div>
or simply (with relative pathname):<br />
<div style="font-family: "Courier New",Courier,monospace;">
winopen.sh document.doc </div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
You can configure Thunderbird, Firefox, file managers, etc. to use <span style="font-family: "courier new" , "courier" , monospace;">winopen.sh</span> when opening windows files (.doc, .xls, ppt, .exe, etc.<span style="font-family: "courier new" , "courier" , monospace;">)</span>, so you simply need to click on an e-mail document attachment or an excel link and it will open automatically under windows.<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-nx5RryxaAww/Tx7USXEPD6I/AAAAAAAAMts/l_6Kf9Q67x8/s1600/associate.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="234" src="https://1.bp.blogspot.com/-nx5RryxaAww/Tx7USXEPD6I/AAAAAAAAMts/l_6Kf9Q67x8/s320/associate.png" width="320" /></a></div>
<span style="font-family: "courier new" , "courier" , monospace;"></span><br />
<ul>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-3sdWY056pWc/Tx7YHtL2QvI/AAAAAAAAMt0/QVmN7YdM9u4/s1600/windows.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-3sdWY056pWc/Tx7YHtL2QvI/AAAAAAAAMt0/QVmN7YdM9u4/s400/windows.png" width="400" /></a></div>
<br />
<br />
Any improvements are welcome!<span style="font-family: "courier new" , "courier" , monospace;"><br /></span><br />
<ul>
</ul>
György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com5tag:blogger.com,1999:blog-4907337868224969264.post-27224413349031535922012-01-18T08:05:00.000-08:002012-01-18T08:12:30.597-08:00Arch Linux on Thinkpad Edge 11I use Arch Linux on my Thinkpad Edge 11 notebook (Intel version with Core i3 Duo (i3-380UM)). This is my office device and I spend my everyday life using this tiny little computer. I briefly concluded the first steps and some minor issues during installation <a href="http://kissmyarch.blogspot.com/2011/09/partitioning-installation-and-first.html">here</a>. Now I am collecting all the device-specific settings I made for fine-tuning Arch Linux for this laptop model.<br />
<br />
<div style="color: orange;">
<span style="font-size: x-large;"><b>TP smapi</b></span></div>
This feature set provides Thinkpad users with detailed battery charge/discharge control, battery status information and hard disk protection.<br />
The package is called <span style="font-family: "Courier New",Courier,monospace;">tp_smapi</span> and can be installed from AUR. After installation add <span style="font-family: "Courier New",Courier,monospace;">tp_smapi</span> to your <span style="font-family: "Courier New",Courier,monospace;">MODULES</span> array of your <span style="font-family: "Courier New",Courier,monospace;">/etc/rc.conf</span>.<br />
Details can be found in the <a href="https://wiki.archlinux.org/index.php/Tp_smapi">tp_smapi page of the Arch Wiki</a>.<br />
<br />
After installation and loading the <span style="font-family: "Courier New",Courier,monospace;">tp_smapi</span> module several useful information can be read out and set up from the <span style="font-family: "Courier New",Courier,monospace;">/sys/devices/platform/smapi/</span> directory.<br />
<br />
The default battery is <span style="font-family: "Courier New",Courier,monospace;">BAT0</span>, its details can be read from the files under<br />
<div style="font-family: "Courier New",Courier,monospace;">
/sys/devices/platform/smapi/BAT0/</div>
<br />
I show some examples how this service can be used:<br />
<br />
<span style="font-size: large;"><b>Battery indicator</b></span><br />
I use simple tiling window managers (like awesome and wmfs) and I created a statusbar script to show (among others) the actual battery percentage and status, The bash code for showing a text like "80% charging" is like this:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
echo "`cat /sys/devices/platform/smapi/BAT0/remaining_percent`"% "`cat /sys/devices/platform/smapi/BAT0/state`"</div>
<br />
<i>See <a href="http://kissmyarch.blogspot.com/p/wmfsrc.html">my wmfs-status script</a> here.</i><br />
<br />
<span style="font-size: large;"><b>Battery notification script</b></span><br />
I created a notification script that uses the <span style="font-family: "Courier New",Courier,monospace;">notify-send</span> command as part of a notification daemon (<span style="font-family: "Courier New",Courier,monospace;">xfce4-notifyd</span> or similar):<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">state=`cat /sys/devices/platform/smapi/BAT0/state`</span><br />
<span style="font-family: "Courier New",Courier,monospace;">if [ "$state" = 'discharging' ]; </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> then batt=`cat /sys/devices/platform/smapi/BAT0/remaining_percent`</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> if (($batt <= 30));</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> then if (($batt <= 10));</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> then notify-send -u critical "Battery is low!</span><br />
<span style="font-family: "Courier New",Courier,monospace;">`acpi -b | tail -c 24 | head -c 10` remaining" ;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> else notify-send "Battery is critical!</span><br />
<span style="font-family: "Courier New",Courier,monospace;">`acpi -b | tail -c 24 | head -c 10` remaining" ;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> fi</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> fi</span><br />
<span style="font-family: "Courier New",Courier,monospace;">fi</span><br />
<br />
<br />
You can run this script from your <span style="font-family: "Courier New",Courier,monospace;">.xinitrc</span> like:<br />
<div style="font-family: "Courier New",Courier,monospace;">
(while true; do sleep 300s; /home/cuh/bin/battwarning.sh; done) &</div>
<br />
As a result you will be notified every 5 minutes when your battery goes below 30% and you get a critical warning when your voltage is under 10%.<br />
<br />
<i>See <a href="http://kissmyarch.blogspot.com/p/xinitrc.html">my full .xinitrc</a> here. </i><br />
<br />
<br />
<span style="font-size: large;"><b>Battery protection</b></span><br />
Some parameters under <span style="font-family: "Courier New",Courier,monospace;">/sys/devices/platform/smapi/BAT0/</span> can be set by writing to the files of this directory. For example you can force discharging the battery even if the power supply is plugged in (it can be useful when your battery is over the <span style="font-family: "Courier New",Courier,monospace;">stop_charge_thresh</span>, see below) by setting the <span style="font-family: "Courier New",Courier,monospace;">force_discharge</span> parameter to 1 (the default value is 0) by this command:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
echo 1 > /sys/devices/platform/smapi/BAT0/force_discharge</div>
<br />
or you can set the battery charging thresholds for keeping the current capacity between 30% and 80% for protecting your LiIon battery from low and high percentages (see <a href="http://www.thinkwiki.org/wiki/Maintenance#Battery_treatment">here</a>) by setting the <span style="font-family: "Courier New",Courier,monospace;">start_charge_thresh</span> and <span style="font-family: "Courier New",Courier,monospace;">stop_charge_thresh</span> values. Unfortunately on my Thinkpad Edge 11 there seems to be a bug in this area because I cannot set both threshold limits. Changing one changes the other so that <span style="font-family: "Courier New",Courier,monospace;">start_charge_thresh</span> is always a higher value than the <span style="font-family: "Courier New",Courier,monospace;">stop_charge_thresh</span> (who understands...). Anyway, I do not really need to set the lower threshold level because when I am on DC power and my battery discharges I get a notification to plug in the power supply and if I am in a situation that I can plug it in I do it so. I limit the upper threshold to 80% to protect my battery from overcharging. To do so I put this line to my <span style="font-family: "Courier New",Courier,monospace;">/etc/rc.local</span> to set the threshold at every boot:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">echo 80 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh</span><br />
<br />
<span style="font-size: large;"><b>HDD drop protection - not working on Edge 11</b></span><br />
According to the <span style="font-family: "Courier New",Courier,monospace;">tp_smapi</span> documentation this package contains the <span style="font-family: "Courier New",Courier,monospace;">hdaps</span> driver as well, which is responsible for HDD protection against physical shocks by means of a built-in accelerometer's signals. After installing <span style="font-family: "Courier New",Courier,monospace;">tp_smapi</span> I loaded the module:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
modprobe hdaps</div>
<br />
The module is loaded but dmesg says:<br />
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
thinkpad_ec: thinkpad_ec_read_row: failed requesting row: (0x01:0x00)->0xfffffff0</div>
<div style="font-family: "Courier New",Courier,monospace;">
</div>
<br />
At the same time my battery status modules stopped working, I cannot access the contents of the <span style="font-family: "Courier New",Courier,monospace;">/sys/devices/platform/smapi/BAT0</span> files.<span style="font-family: "Courier New",Courier,monospace;"><br /></span><br />
<br />
I read that a temporary workaround might be to switch off my laptop, unplug the power supply, remove the battery and place it back after some minutes. Funny that this can be a workaround, but I faced the same with the malfunctioning Fn buttons, too (see below). This time it did not help, now I cannot even load the hdaps driver.<br />
<br />
I tried to overwrite the native kernel <span style="font-family: "Courier New",Courier,monospace;">hdaps</span> driver by the <span style="font-family: "Courier New",Courier,monospace;">tp_smapi</span> driver:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
mv /lib/modules/3.0-ARCH/kernel/drivers/platform/x86/hdaps.ko.gz /lib/modules/3.0-ARCH/kernel/drivers/platform/x86/hdaps.ko.gz_backup</div>
<div style="font-family: "Courier New",Courier,monospace;">
</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<span style="font-family: "Courier New",Courier,monospace;">cp /lib/modules/3.0-ARCH/extra/hdaps.ko.gz /lib/modules/3.0-ARCH/kernel/drivers/platform/x86/hdaps.ko.gz</span><br />
<br />
and this time I got back to the loadable module with the dmesg warning and switched-off battery framework.<br />
<br />
I looked around and some people say that the <span style="font-family: "Courier New",Courier,monospace;">hdaps</span> service is not available on this Thinkpad model, I can confirm this.<br />
<br />
<div style="color: orange;">
<span style="font-size: x-large;"><b>cpu_frequtils</b></span></div>
See the details at <a href="http://www.thinkwiki.org/wiki/How_to_use_cpufrequtils">www.thinkwiki.org</a>.CPU scaling and profiling works fine on the Edge 11, the Extra repository contains the <span style="font-family: "Courier New",Courier,monospace;">cpufrequtils</span> package and the <a href="https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling">Arch Wiki</a> is pretty helpful as usual. Instead of setting up your frequency scaling manually you can use Laptop Mode Tools, see below. After installing <span style="font-family: "Courier New",Courier,monospace;">cpufrequtils </span>and setting up LMT you only need to add acpi-cpufreq to your <span style="font-family: "Courier New",Courier,monospace;">MODULES</span> in <span style="font-family: "Courier New",Courier,monospace;">/etc/rc.conf</span> and edit the <span style="font-family: "Courier New",Courier,monospace;">/etc/laptop-mode/conf.d/cpufreq.conf</span> file to your taste.<br />
<br />
<div style="color: orange;">
<span style="font-size: x-large;"><b>Laptop Mode Tools</b></span></div>
Laptop Mode Tools is a centralised power management solution featuring several power saving services. These services are controlled by only one daemon. In practice this means that you only need to install the <span style="font-family: "Courier New",Courier,monospace;">laptop-mode-tools</span> package, place <span style="font-family: "Courier New",Courier,monospace;">laptop-mode</span> to your <span style="font-family: "Courier New",Courier,monospace;">DAEMONS</span> list of your <span style="font-family: "Courier New",Courier,monospace;">/etc/rc.conf</span> and tune the power saving options as you like with the appropriate config files: <span style="font-family: "Courier New",Courier,monospace;">/etc/laptop-mode/laptop-mode.conf</span> and <span style="font-family: "Courier New",Courier,monospace;">/etc/laptop-mode/conf.d/*</span> . You can set up different CPU governors, different LCD brightness, auto switching off your WiFi antenna when idle, etc. features according to the actual power state (AC / DC) of your laptop. Installation and configuration is well described in the <a href="https://wiki.archlinux.org/index.php/Laptop_Mode_Tools">LMT Arch Wiki</a>.<br />
<br />
<div style="color: orange;">
<span style="font-size: x-large;"><b>Strange bug of Thinkpad function buttons</b></span></div>
Sometimes I have problems with the brightness and volume Fn buttons. They simply do not work. Nothing helps here, neither restarting daemons, nor rebooting the machine. Very strangely the only solution is to switch the laptop off, remove the battery and place it back after 5 secs, and boot up the machine again. I haven't faced this problem for a while, maybe a kernel upgrade (or who knows what) solved it permanently.<br />
<br />
<div style="color: orange;">
<span style="font-size: x-large;"><b>Synaptics touchpad</b></span></div>
To fine-tune the touchpad you have to install the <span style="font-family: "Courier New",Courier,monospace;">xf86-input-synaptics </span>package and set up the options under <span style="font-family: "Courier New",Courier,monospace;">/etc/X11/xorg.conf.d/10-synaptics.conf</span><br />
<br />
With the default settings I had an odd problem with double taps that wanted
to drag and drop elements instead of releasing the mouse click. I worked
a lot to achieve a functioning, fast and responsive touchpad. My config looks like this:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">Section "InputClass"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Identifier "touchpad catchall"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Driver "synaptics"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> MatchIsTouchpad "on"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> MatchDevicePath "/dev/input/event*"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Option "TapButton1" "1"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Option "TapButton2" "2"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Option "TapButton3" "3"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Option "VertEdgeScroll" "on"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Option "VertTwoFingerScroll" "on"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Option "VertResolution" "100"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Option "HorizResolution" "100"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Option "MaxDoubleTapTime" "100"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">EndSection</span>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com2tag:blogger.com,1999:blog-4907337868224969264.post-24112722132959674292011-10-25T04:19:00.000-07:002011-10-25T04:23:44.516-07:00USB automountI looked for a solution for simply (preferably automatically) mounting any USB storages (pendrives, external hard drives, etc.) on my Arch Linux notebook. Gnome and other desktop environments do it for you automatically but if you keep things simple with a small window manager (like <a href="http://kissmyarch.blogspot.com/2011/09/tiling-window-managers.html">Awesome or wmfs</a>) you need to set it up by yourself.<br />
<br />
There are several solutions for doing so:<br />
<br />
<b>1. mounting USB storages manually or with an <span style="font-family: "Courier New",Courier,monospace;">fstab</span> entry:</b><br />
You can do it with some basic Linux knowledge, the method is well documented <a href="https://wiki.archlinux.org/index.php/USB_Storage_Devices">here</a>. It is simple to set up but not flexible enough (i.e. you have to mount the devices manually, it is hard to handle several storages at the same time, fstab can automount only at boot time).<br />
<br />
<b>2. using an external application to handle your usb devices:</b><span style="font-family: "Courier New",Courier,monospace;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace;">pmount</span>, <span style="font-family: "Courier New",Courier,monospace;">skvm</span>, <span style="font-family: "Courier New",Courier,monospace;">udiskie</span> etc. can more or less handle your USB volumes but I found none of them satisfactory. One of them have dependency problems (i.e. using <span style="font-family: "Courier New",Courier,monospace;">hal</span> that I did not want to install), others need consolekit or to be run as root, and all of them needs an extra daemon to be run in the background.<br />
<br />
<b>3. using udev rules to recognise and automount your volumes:</b><br />
The udev daemon natively runs in the background, you do not have to install and/or place it in your <span style="font-family: "Courier New",Courier,monospace;">/etc/rc.conf</span>. You only need to tell it to mount your USB storages when they are plugged in. You can find nice examples for such rules in the <a href="https://wiki.archlinux.org/index.php/Udev#Auto_mounting_USB_devices">udev Arch Wiki</a>.<br />
<br />
I use the following udev rule that mounts automatically the hot-plugged device under /media/<i><label></i> and works seamlessly with vfat, ntfs and other formats of USB storages. Simply create this file and fill it up with the contents as follows:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
<b> /etc/udev/rules.d/10-my-media-automount.rules </b></div>
<br />
<span style="font-family: "Courier New",Courier,monospace;"># vim:enc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=udevrules:</span><br />
<span style="font-family: "Courier New",Courier,monospace;">#</span><br />
<span style="font-family: "Courier New",Courier,monospace;"># /etc/udev/rules.d/10-my-media-automount.rules</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># start at sdb to ignore the system hard drive</span><br />
<span style="font-family: "Courier New",Courier,monospace;">KERNEL!="sd[b-z]*", GOTO="my_media_automount_end"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="my_media_automount_end"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># import some useful filesystem info as variables</span><br />
<span style="font-family: "Courier New",Courier,monospace;">IMPORT{program}="/sbin/blkid -o udev -p %N"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># get the label if present, otherwise assign one based on device/partition</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># create the dir in /media and symlink it to /mnt</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># global mount options</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ACTION=="add", ENV{mount_options}="relatime"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"># filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat) </span><br />
<span style="font-family: "Courier New",Courier,monospace;">ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111,utf8"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># automount ntfs filesystems using ntfs-3g driver</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"># automount all other filesystems</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ACTION=="add", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># clean up after device removal</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># exit</span><br />
<span style="font-family: "Courier New",Courier,monospace;">LABEL="my_media_automount_end"</span>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com3tag:blogger.com,1999:blog-4907337868224969264.post-41400505949759739342011-10-19T12:08:00.000-07:002011-10-19T12:13:44.475-07:00Wicd cannot connect to ad-hoc networksIn my Nokia (5800 Xpress music) phone I have a network sharing application called Joikuspot. Its purpose is to use your phone as a wireless access point offering your mobile data plan via wi-fi to other devices (such as my laptop with Arch Linux). The provided wlan network is in ad-hoc mode though and my Wicd client cannot connect to it. <span style="font-family: "Courier New",Courier,monospace;">dmesg</span> says: "Unable to find TIM Element in beacon". After some research I found this bug, some says that it is solved in the newest version of wicd but for me upgrading to 1.7.0 did not solve the issue.<br />
<br />
Fortunately the ad-hoc network works fine with manual configuration. To bring down the wlan0 interface and restart it in ad-hoc mode without passphrase (as my phone app does not support protected networking) and obtaining an IP address with <span style="font-family: "Courier New",Courier,monospace;">dhclient</span> (<span style="font-family: "Courier New",Courier,monospace;">dhcpcd</span> might work as well) simply use this command:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
ifconfig wlan0 down && iwconfig wlan0 mode Ad-Hoc && iwconfig wlan0 essid <i><ESSID_of_your_wlan></i> key off && ifconfig wlan0 up && dhclient wlan0</div>
<br />
As a workaround for wicd I created a preconnect script (more about wicd scripting: <a href="http://kissmyarch.blogspot.com/2011/09/wicd-network-independent.html">here</a>) that runs this command and does not let wicd to destroy my ad-hoc connection (because it wants to do it) until another connection is set manually in the wicd client. I used a loop that does not let the script end while a lock file exists. Choosing another connection in wicd deletes the lock file, the ad-hoc script ends and gives back the control to wicd.<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
The script lies under <b>/etc/wicd/scripts/preconnect/ad-hoc.sh</b></div>
<br />
<span style="font-family: "Courier New",Courier,monospace;">#!/bin/bash</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">script="$(basename "$0")"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">script_name="${script/.sh/}"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">echo $1 $2 $3 $4 $5 >> "/var/log/wicd/${script_name}.log"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">echo "Running ${script}" >"/var/log/wicd/${script_name}.log"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">exec 2>>"/var/log/wicd/${script_name}.log"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">exec 1>&2</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">connection_type="$1"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">echo "Connection type: ${connection_type}"</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">if [ "${connection_type}" == "wired" ]; then</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> profile="$3"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> echo "Profile: ${profile}"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">elif [ "${connection_type}" == "wireless" ]; then</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> essid="$2"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> bssid="$3"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> echo "ESSID: ${essid}"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> echo "BSSID: ${bssid}"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">else</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> echo "Unknown connection type: ${connection_type}" >&2</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> exit</span><br />
<span style="font-family: "Courier New",Courier,monospace;">fi</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">rm /var/lock/wicd_adhoc.lock</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">case $2 in</span><br />
<span style="font-family: "Courier New",Courier,monospace;">*JoikuSpot*)</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> # When I connect to my phone my ESSID contains JoikuSpot</span><span style="font-family: "Courier New",Courier,monospace;"></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> touch /var/lock/wicd_adhoc.lock</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> ifconfig wlan0 down && iwconfig wlan0 mode Ad-Hoc && iwconfig wlan0 essid $2 key off && ifconfig wlan0 up && dhclient wlan0</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> while [ -f /var/lock/wicd_adhoc.lock ] </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> do</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> sleep 2;</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> done</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">esac</span><br />
<br />
<br />
Waiting for the real bugfix in the newer releases of wicd!<span style="font-family: "Courier New",Courier,monospace;"></span>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0tag:blogger.com,1999:blog-4907337868224969264.post-71585247053517584802011-10-19T11:27:00.000-07:002011-10-19T11:31:13.467-07:00Blueman applet with missing status iconAfter upgrading the <span style="font-family: "Courier New",Courier,monospace;">blueman</span> package to version 1.23.1 the bluetooth icon in my systray showed a "no icon" graphics:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-ZgYHfrBA0oc/Tp8TxIuaYyI/AAAAAAAAMq0/1zViHAI0iEg/s1600/after.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-ZgYHfrBA0oc/Tp8TxIuaYyI/AAAAAAAAMq0/1zViHAI0iEg/s1600/after.png" /></a></div>
<br />
<br />
<br />
<br />
The Statusicon section under the plugins settings can be configured in this new version of blueman. The default setting is "blueman-tray". I tried to simply modify it to "blueman", the form marks it as an acceptable attribute but it did not change anything, the icon is still not there.<br />
<br />
I downgraded to the former (1.21) version from my pacman cache:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
pacman -U /var/cache/pacman/pkg/blueman-1.21-7-x86_64.pkg.tar.xz</div>
<br />
and my status again appears nicely:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-lniPZ_CaQN8/Tp8TxpJ5IuI/AAAAAAAAMq8/iGpPyuZbMVE/s1600/before.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-lniPZ_CaQN8/Tp8TxpJ5IuI/AAAAAAAAMq8/iGpPyuZbMVE/s1600/before.png" /></a></div>
<br />
<br />
<br />
<br />
I hope to see a bugfix soon!György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com7tag:blogger.com,1999:blog-4907337868224969264.post-70331257174636841112011-09-30T12:03:00.000-07:002011-09-30T12:10:03.972-07:00Undocumented dependenciesRecently I decided to clean up my laptop so I reviewed my installed packages and removed quite a nice amount of those that I thougt I do not need any more. After rebooting my system I realised that some programs stopped working. There are some dependencies that are marked as optional or even not marked at all but still if you do not install them your application will not work properly (or at all). I have to admit these problems were very rare and after some time I could resolve the problem. In this post I am collecting such not very well documented dependencies. If I find more I will update the entries below.<br />
<br />
<b>Blueman</b> needs <span style="font-family: "Courier New",Courier,monospace;">gconf</span>, <span style="font-family: "Courier New",Courier,monospace;">gnome-icon-theme</span> and <span style="font-family: "Courier New",Courier,monospace;">libnotify</span> to work properly! Unless you will not have an applet in your systray and/or you cannot connect to any device via bluetooth.<br />
<br />
<b>Wicd</b> client needs <span style="font-family: "Courier New",Courier,monospace;">xfce4-notifyd</span>, other notification daemons (i.e Gnome's <span style="font-family: "Courier New",Courier,monospace;">notification-daemon</span>) do not work with it.György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0tag:blogger.com,1999:blog-4907337868224969264.post-4823376558169629662011-09-23T08:23:00.000-07:002012-01-24T08:24:34.353-08:00Tiling window managersMy first try with tiling window managers was ion3. I
liked it and used it for months. I loved its keystroke-driven
minimalistic approach. Although the Lua config
was too high for me, I could not set things up correctly. It did not
support fancy titlebars nor a systray, it simply worked. I saw its limitations and I was a bit sad that the developers did not support the software any more, so I went back to
Gnome. Nowadays as I started using Arch Linux I needed something
powerful and tiling WMs came to my mind again. So I made some research and tried some of them. Here is my short review of them.<br />
<br />
The WM I need is a tiling window manager with:<br />
- Configurable keyboard shortcuts<br />
- Tag bar (to see which tag I actually use), urgent tag is preferred<br />
- Systray<br />
- Statusbar (with configurable contents of computer state like clock, cpu, battery, etc.) <br />
- Easy-to-use config file (I do not want to learn programming languages to set it up!)<br />
- Dual-head support<br />
- Rules to place different applications where (screen and workspace) I want and how (floating or tiling) I want.<br />
<br />
Here are the ones I tried: <br />
<br />
<b>Awesome</b><br />
Awesome is simply awesome. It has almost everything I need: It handles dual screen (although it was sort of a pain to set it up and still I have problems with it), there is a built-in taskbar and systray: good point! The lua configuration language is too diificult for me. I just do not see logics and simplicity here, there are redundant solutions for things and above all the config syntax changes from one version of Awesome to another. Maybe I will come back later again.<br />
<br />
<b>Subtle</b><br />
Subtle is an easy-to-set-up tiling WM but I could not get dual head working on it properly. Possibly it is my fault, I did not spend too much time with it.<br />
<br />
<b>Xmonad</b><br />
At first sight I liked it but it has a frightening config file written in Haskell and you have to load third-party plugins to access basic features (like statusbar, systray, etc.).<br />
<br />
<b>i3</b><br />
i3 is very close to my expectations. I only have one complaint against it: it does not support a configurable statusbar (although it has a built-in one, it contains too much and useless information but others are missing) nor a native systray. Somehow I could not get third-party statusbars and systrays working in my dual head setup. They always overlapped, windows were ignoring them, etc. I might have done dirty hacks to get it work but I gave it up. Anyway, nice project.<br />
<br />
<b>Scrotwm</b><br />
Simple, very easy to configure but lacks major features like tags and rules.<br />
<br />
<b>Wmfs</b><br />
After quite a lot of experimenting with so much WMs out there I found Wmfs. It has a very straightforward configuration file and you do not have to include plugins or third-party software. Multi-head setup works very well and can be set up as easily as everything else. The "bar" contains a taglist, a layout chooser, the title of the actual window, a message where you can place any text with some formatting (i.e. a static text or a status message updated regularly by a shell script) and a systray. Everything can be driven by keystrokes and rules can be assigned to many different window properties. This is the first tiling WM that I could set up properly with one simple(!) config file and it just works fine with all the main features I expected. I have some minor issues though:<br />
- If I run xrandr, the system crashes. This means that hot-changing of single / dual monitors does not work. For example if I plug in an external display to my laptop and run xrandr to set my dual screen up, all my running applications are killed and the WM hangs. Maybe there will be a solution for this soon, but by that time I have to be careful with this.<br />
<br />
- The titlebar shows only the title of the actual window. Right clicking shows the other clients of the actual tag but it is not convenient to use. A bar with all the windows of the actual tag would be nice with color mark for the actual client (just like in Awesome). This is not a major issue but it would be very informative to have such a feature.<br />
- Using regexps or wildcards in rule definitions would be very handy. This is a nice-to-have feature, I can live without it.<br />
<br />
My Wmfs dual-head GUI looks like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-tNe7RtaH9rc/ToBEB9aX4NI/AAAAAAAAMqw/2ghKPo8LTOM/s1600/2011-09-26-112218_2646x1024_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="123" src="http://2.bp.blogspot.com/-tNe7RtaH9rc/ToBEB9aX4NI/AAAAAAAAMqw/2ghKPo8LTOM/s320/2011-09-26-112218_2646x1024_scrot.png" width="320" /></a></div>
<br />
<br />
You can find my actual wmfsrc config file, wmfs-status message generator script (for indicating the date, time, battery and processor state invoked from .xinitrc regularly) and my .xinitrc file in the right panel under "My actual config files".<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com2tag:blogger.com,1999:blog-4907337868224969264.post-49580511530184051452011-09-21T08:07:00.000-07:002011-12-19T01:04:10.619-08:00Powerful networking with Wicd<a href="http://wicd.sourceforge.net/">Wicd</a> is a very clever network manager. It is independent of any desktop environments meaning that it is compatible with any window managers. It has a daemon running in the background and a client with a ststus icon in the systray and a cool GUI to manipulate your network connections. Wicd handles both wired and wireless connections. You can set it up to automatically connect to the wired network when you plug in your ethernet cable and in other circumstances connect to your preferred wifi access points.<br />
<br />
Installation is easy, just follow the <a href="https://wiki.archlinux.org/index.php/Wicd">Wicd Arch Wiki</a>. I put the wicd daemon in my <span style="font-family: courier new;">/etc/rc.conf</span> (after dbus) and disabled the original networking daemon:<br />
<span style="font-family: courier new;">DAEMONS=(...dbus ... !network ... wicd ...)</span><br />
I edited my <span style="font-family: courier new;">.xinitrc</span> to run the client when X starts:<br />
<br />
<span style="font-family: courier new;">...</span><br />
<span style="font-family: courier new;">wicd-client &</span><br />
<span style="font-family: courier new;">...</span><br />
<span style="font-family: courier new;">exec ck-launch-session wmfs</span><br />
<br />
(<i>See my actual rc.conf and .xinitrc files on the right panel of this blog</i>.)<br />
<br />
Above the basic networking services Wicd gives you scripting possibilities to execute programs on different networking events and different networking environments. This feature is very useful for laptops that are brought from one network to another (home / office / net café, etc.) and the behavior of the machine can be altered according to the network it is connected to. Just some ideas:<br />
- You can automatically mount nfs and/or samba shares when you connect to your office network.<br />
- You can start or stop daemons according to your network connection (i.e. if you use network printers you can set up your cupsd service to start only at places where you use printers).<br />
- You can switch off your wi-fi antenna after disconnecting from a wireless network to gain battery life when your laptop is running on battery power.<br />
<br />
Mainly I use my laptop in my office and at home. In the office I have both wired and wireless networks (at my desk I usually plug in the network cable but when I am at a meeting in another room I use wi-fi). I need the same settings for both cases. At home I use wireless internet, I do not have a printer nor do I use nfs file shares. I want to access samba shares anywhere.<br />
<br />
You can find the preconnect, postconnect, predisconnect, postdisconnect directories under <span style="font-family: "Courier New",Courier,monospace;">/etc/wicd/scripts/</span>. Bash scripts placed in these directories are executed each time the appropriate network event (the nemes of the directories are self-explanatories) occurs. I use two of them but their usage depends only on your creativity.<br />
<br />
I created a <span style="font-family: courier new;">share_mount.sh</span> script that runs after wicd connects to a network and a <span style="font-family: courier new;">share_umount.sh</span> that runs before disconnecting. If the network is wired or the wireless ESSID belongs to my office's wifi router then I start the <span style="font-family: courier new;">rpcbind</span> and <span style="font-family: courier new;">nfs-common</span> daemons to use nfs, the <span style="font-family: courier new;">cupsd</span> daemon for printing and I mount my office nfs shares (defined previously in fstab with noauto option). In all networks I start samba and smbnetfs to automatically mount samba shares after network connection. Logs go to the /etc/wicd/<script_name><script_name>.log file. I used <a href="http://wicd.sourceforge.net/moinmoin/Adding%20pre%20and%20post%20%28dis%29connection%20scripts">wicd's sample scripts</a> to build up my own ones:<br /><br /><span style="font-weight: bold;">Postconnect script ( <span style="font-family: courier new;">/etc/wicd/scripts/postconnect/share_mount.sh</span> )</span>:<br /><br /><span style="font-family: courier new;">#!/bin/bash</span><br /><br /><span style="font-family: courier new;">script="$(basename "$0")"</span><br /><span style="font-family: courier new;">script_name="${script/.sh/}"</span><br /><br /><span style="font-family: courier new;">echo "Running ${script}" >"/var/log/wicd/${script_name}.log"</span><br /><span style="font-family: courier new;">exec 2>>"/var/log/wicd/${script_name}.log"</span><br /><span style="font-family: courier new;">exec 1>&2</span><br /><br /><span style="font-family: courier new;">connection_type="$1"</span><br /><span style="font-family: courier new;">echo "Connection type: ${connection_type}"</span><br /><br /><span style="font-family: courier new;">if [ "${connection_type}" == "wired" ]; then</span><br /><span style="font-family: courier new;"> profile="$3"</span><br /><span style="font-family: courier new;"> echo "Profile: ${profile}"</span><br /><span style="font-family: courier new;">elif [ "${connection_type}" == "wireless" ]; then</span><br /><span style="font-family: courier new;"> essid="$2"</span><br /><span style="font-family: courier new;"> bssid="$3"</span><br /><span style="font-family: courier new;"> echo "ESSID: ${essid}"</span><br /><span style="font-family: courier new;"> echo "BSSID: ${bssid}"</span><br /><span style="font-family: courier new;">else</span><br /><span style="font-family: courier new;"> echo "Unknown connection type: ${connection_type}" >&2</span><br /><span style="font-family: courier new;"> exit</span><br /><span style="font-family: courier new;">fi</span><br /><br /><span style="font-family: courier new;">case $2 in "wired" | "myoffice_essid")</span><br /><span style="font-family: courier new;"> # I am at office:</span><br /><span style="font-family: courier new;"> rc.d start rpcbind nfs-common cupsd;</span><br /><span style="font-family: courier new;"> mount -a -t nfs;;</span><br /><span style="font-family: courier new;">esac</span><br /><span style="font-family: courier new;"> # I am anywhere:</span><br /><span style="font-family: courier new;">rc.d start samba smbnetfs</span><br /><br /><br /><span style="font-weight: bold;">Predisconnect script ( <span style="font-family: courier new;">/etc/wicd/scripts/predisconnect/share_umount.sh</span> )</span><span style="font-weight: bold;"></span>:<br /><br />Before disconnecting a network this script handles the file unmounting and daemon stopping process in the opposite way I used in my connect script.<br /><br /><span style="font-family: courier new;">#!/bin/bash</span><br /><br /><span style="font-family: courier new;">script="$(basename "$0")"</span><br /><span style="font-family: courier new;">script_name="${script/.sh/}"</span><br /><br /><span style="font-family: courier new;">echo "Running ${script}" >"/var/log/wicd/${script_name}.log"</span><br /><span style="font-family: courier new;">exec 2>>"/var/log/wicd/${script_name}.log"</span><br /><span style="font-family: courier new;">exec 1>&2</span><br /><br /><span style="font-family: courier new;">echo umounting nfs and smb filesystems</span><br /><span style="font-family: courier new;">#umount /media/Erba_nfs</span><br /><span style="font-family: courier new;">umount -a -t nfs</span><br /><span style="font-family: courier new;">rc.d stop cupsd smbnetfs samba nfs-common rpcbind</span></script_name><br />
<br />
Wicd's actual (1.7.0) version is not able to handle ad-hoc networking. Scripts can help you again, see the workaround <a href="http://kissmyarch.blogspot.com/2011/10/wicd-cannot-connect-to-ad-hoc-networks.html">here</a>. <script_name><span style="font-family: courier new;"><br /></span></script_name>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com2tag:blogger.com,1999:blog-4907337868224969264.post-51991922576542332382011-09-20T05:51:00.000-07:002011-09-20T06:24:58.965-07:00Kernel panic after upgradeSome weeks ago after <span style="font-family:courier new;">pacman -Syu</span> my system did not boot at all.<br /><br />It said something like "<span style="font-family:courier new;">modprobe: FATAL: Could not load /lib/modules/.../modules.dep: No such file or directory.</span>"<br /><br />After a hard work of recovery described in the <a href="https://wiki.archlinux.org/index.php/Kernel_Panics">Kernel Panics Arch Wiki</a> and rebooting my system all went fine but upgrading the system again caused the same error.<br /><br />After some hours of panicking I found the solution here:<br /><a href="https://bbs.archlinux.org/viewtopic.php?id=96794">https://bbs.archlinux.org/viewtopic.php?id=96794</a><br /><br />My <span style="font-family:courier new;">/boot</span> partition was not mounted when I upgraded my kernel, so the upgrade process could not copy the appropriate files to this area. Instead it created a separate <span style="font-family:courier new;">/boot</span> directory under my mounted root filesystem. The system wanted to boot from the <span style="font-family:courier new;">/boot</span> partition but the upgraded kernel was not there.<br /><br />I propose two solutions (I chose No. 2):<br /><br />1. If you keep your <span style="font-family:courier new;">/boot</span> partition unmounted and you see thet pacman wants to upgrade your kernel then stop the upgrade process, mount your <span style="font-family:courier new;">/boot</span> partition and start the upgrade in this state.<br /><br />2. If you do not want to take care of manual mounting then add a line to your <span style="font-family:courier new;">/etc/fstab</span> to mount your <span style="font-family:courier new;">/boot</span> partition automatically.<br /><br />And another suggestion:<br />Keep an Arch Linux installation medium on a usb stick, it can be very handy to have one at panic time... I wish that you do not need to use it ever though!György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0tag:blogger.com,1999:blog-4907337868224969264.post-23001937843303291642011-09-15T07:24:00.000-07:002012-03-23T01:14:08.425-07:00A simple bluetooth setupI set up bluetooth on my Thinkpad Edge 11 this way:<br />
<br />
<span style="font-family: courier new;"># pacman -S bluez</span><br />
<span style="font-family: courier new;"># pacman -S blueman</span><br />
<br />
I edited my <span style="font-family: courier new;">.xinitrc</span> to start <span style="font-family: courier new;">blueman-applet</span> when X starts:<br />
<br />
<span style="font-family: courier new;">...</span><br />
<span style="font-family: courier new;">blueman-applet &</span><br />
<span style="font-family: courier new;">...</span><br />
<span style="font-family: courier new;">exec ck-launch-session wmfs</span><br />
<br />
The tricky part is to be sure that you run your window manager (my one is <span style="font-family: courier new;">wmfs</span>) with <span style="font-family: courier new;">exec ck-launch-session</span>. If you simply use <span style="font-family: courier new;">exec <<span style="font-style: italic;">yourwindowmanager></span></span> then the <span style="font-family: courier new;">blueman-applet</span> will not work! It will give you ugly exception error messages like this:<br />
<br />
<span style="font-family: courier new;">Exception AttributeError</span><br />
<span style="font-family: courier new;">dbus.exceptions.DBusException</span><br />
<br />
I suffered some hours to get this done but now everything works fine.<br />
<br />
I start bluetooth daemon at boot time by inserting <span style="font-family: courier new;">(...dbus...@bluetooth...)</span> in the <span style="font-family: courier new;">DAEMONS</span> array of my <span style="font-family: courier new;">/etc/rc.conf<span style="font-family: arial;">.</span></span><br />
<br />
and the <span style="font-family: courier new;">blueman-applet</span> icon appears in my systray immediately after starting X, I only need to click on it and manage my bluetooth connection in a nicely built GUI. The bluetooth state (on/off) will be preserved for the next boot, so I do not need to worry about unintentional battery drainage because bluetooth switched itself on at boot time (unless I left my antenna switched on when I stopped my machine).<br />
<br />
WARNING: blueman needs some packages that are marked as only optional to work properly. See my post about <a href="http://kissmyarch.blogspot.com/2011/09/undocumented-dependencies.html">undocumented dependencies</a>.György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com2tag:blogger.com,1999:blog-4907337868224969264.post-52934392361108066622011-09-14T08:06:00.000-07:002011-09-19T07:54:31.112-07:00Networking mystery with Realtek r8169<span style="font-family:courier new;">eth0</span> stopped working. Maybe due to the 3.0 kernel upgrade?<br /><span style="font-family:courier new;">dhcpcd</span> showed "<span style="font-family:courier new;">Link is not ready</span>" and "<span style="font-family:courier new;">no carrier</span>" and I could not get an IP.<br />I tried <span style="font-family:courier new;">dhclient</span> instead of <span style="font-family:courier new;">dhcpcd</span>, no results, although <span style="font-family:courier new;">dhclient</span> seems to be a nicer solution in general (more informative log output and faster connection in my opinion).<br /><br />My ethernet driver according to <span style="font-family:courier new;">lspci -v</span> is:<br /><br /><span style="font-family:courier new;">09:00.0 Ethernet controller:<br />Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)</span><br />S<span style="font-family:courier new;">ubsystem: Lenovo Device 21c5</span><span style="font-family:courier new;"><br />Flags: bus master, fast devsel, latency 0, IRQ 42</span> <span style="font-family:courier new;"> I/O ports at 2000 [size=256]</span> <span style="font-family:courier new;"> Memory at f0804000 (64-bit, prefetchable) [size=4K]</span> <span style="font-family:courier new;"> Memory at f0800000 (64-bit, prefetchable) [size=16K]</span> <span style="font-family:courier new;"> [virtual] Expansion ROM at f0820000 [disabled] [size=128K]</span> <span style="font-family:courier new;"> Capabilities: [40] Power Management version 3</span> <span style="font-family:courier new;"> Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+</span> <span style="font-family:courier new;"> Capabilities: [70] Express Endpoint, MSI 01</span> <span style="font-family:courier new;"> Capabilities: [ac] MSI-X: Enable- Count=4 Masked-</span> <span style="font-family:courier new;"> Capabilities: [cc] Vital Product Data</span> <span style="font-family:courier new;"> Capabilities: [100] Advanced Error Reporting</span> <span style="font-family:courier new;"> Capabilities: [140] Virtual Channel</span> <span style="font-family:courier new;"> Capabilities: [160] Device Serial Number 4e-00-00-00-68-4c-e0-00</span> <span style="font-family:courier new;"><br />Kernel driver in use: r8169</span> <span style="font-family:courier new;"> Kernel modules: r8169</span><br /><br />Google says that the r8169 driver is buggy, if any problem occurs installing a newer driver can help. Ok. How?<br /><br />* If you have the same issue, please go to the end of this post for a possible solution, you might not need to do all these steps I made.<br /><br />AUR's <span style="font-family:courier new;">r8169</span> package did not work for me, the download link had an authentication problem, the driver could not be downloaded.<br /><br />OK. Let's find another source, realtek's homepage:<br /><br /><a href="http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=5&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#RTL8111B/RTL8168B/RTL8111/RTL8168%3Cbr%3ERTL8111C/RTL8111CP/RTL8111D%28L%29%3Cbr%3ERTL8168C/RTL8111DP/RTL8111E%3Cbr%3ERTL8168E/RTL8111F">http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=5&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#RTL8111B/RTL8168B/RTL8111/RTL8168%3Cbr%3ERTL8111C/RTL8111CP/RTL8111D%28L%29%3Cbr%3ERTL8168C/RTL8111DP/RTL8111E%3Cbr%3ERTL8168E/RTL8111F</a><br /><br />Actually this package should install the r8168 driver and remove the native r8169 one.<br />After clicking on several dead links on Realtek's page one moment I could finally download the "LINUX driver for kernel 2.6.x and 2.4.x (Support x86 and x64)" (8.025.00 ) driver package.<br />I unpacked the tarball and went on the way that the README said but again I faced a problem: the r8168 module could not be loaded (modprobe r8168 said: "<span style="font-family:courier new;">FATAL: Module r8168 not found</span>."). At the same time r8169 could not be loaded either (the installation moved it to somewhere else), so now i had no ethernet driver at all. Sad thing, now what?<br /><br />Googling again I found the solution after a day of madness:<br />Download the above mentioned Realtek <link!!!>driver package, untar it, step into the install directory, run the <span style="font-family:courier new;">autorun.sh</span> </link!!!>according to the README<link!!!>. After do this as root (still in the installation directory):<br /><br /><span style="font-family:courier new;">depmod -a</span><br /><span style="font-family:courier new;">insmod ./src/r8168.ko</span><br /><span style="font-family:courier new;">cp ./src/r8168.ko /lib/modules/$(uname -r)/kernel/drivers/net/</span><br /><span style="font-family:courier new;">modprobe r8168</span><br /><br />Now the last two lines of <span style="font-family:courier new;">lspci -v</span> have to say something like this:<br /><span style="font-family:courier new;">Kernel driver in use: r8168</span><br /><span style="font-family:courier new;"> Kernel modules: r8168</span><br /><br />(instead of r8169).<br /><br />Now edit your <span style="font-family:courier new;">/etc/rc.conf</span> and put <span style="font-family:courier new;">r8168</span> into the <span style="font-family:courier new;">MODULES</span> section. If <span style="font-family:courier new;">r8169</span> was there then delete it or restrict it with <span style="font-family:courier new;">(... r8168 !r8169 ...)</span><br /><br />Huh, that was a hard day!<br /><br />* And now I see that <span style="font-weight: bold;">AUR</span> has a <span style="font-weight: bold;font-family:courier new;" >r8168</span><span style="font-weight: bold;"> package</span>. Probably installing this could have solved my problem in one step but it is too late, I have done it in a different - apparently much more difficult - way. Please try this AUR package first if you have a similar problem. You still might need to change your daemons array in your <span style="font-family:courier new;">rc.conf</span> to use the newly installed driver instead of the old one.<br /></link!!!>György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com2tag:blogger.com,1999:blog-4907337868224969264.post-47081388262495947522011-09-06T01:58:00.000-07:002011-09-22T04:34:21.079-07:00Partitioning, installation, first settingsOK, let's start blogging! I conclude how I installed Arch Linux, what issues I faced, what things you might need to consider during the installation and setup process.<br /><br /><span style="font-weight: bold;">Partitioning</span><br /><br />I have a <a href="http://www.techradar.com/reviews/pc-mac/laptops-portable-pcs/laptops-and-netbooks/lenovo-thinkpad-edge-11-inch-intel-core-i3--926084/specification">Lenovo Thinkpad Edge 11</a> laptop and I decided to deploy Arch Linux on it after my first impressive experiences on my desktop PC with Arch. Although there was a nicely installed recovery partition and an OEM Win7 Professional on my new office notebook I deleted everything and repartitioned its hard drive.<br /><br />Now my partition table looks like this:<br /><br /><span style="font-family:courier new;">sda1 Primary /boot 256M ext4</span><br /><span style="font-family:courier new;">sda2 Primary swap 256M swap</span><br /><span style="font-family:courier new;">sda3 Extended (264G)</span><br /><span style="font-family:courier new;"> sda5 / 24G ext4</span><br /><span style="font-family:courier new;"> sda6 /home 237G ext4</span><br /><span style="font-family:courier new;">sda4 Primary 33G fat32<br /></span><br /><span><span>I am not sure that using ext4 for my <span style="font-family:courier new;">/boot</span> partition was the wisest decision but I do not have any problem with it, I do not see any performance loss due to journaling (i.e. the whole partition is only 256M) and I assume that ext4 is mature enough not to leave any reliability leaks for standard use.<br /><br />As you can see I reserved some space on the end of the drive to create a dual boot setup if one day it will be necessary but now I have been using my notebook for several months and I have not installed anything on this partition yet.</span></span> Instead I use a Win7 virtual machine running under Virtualbox for accessing Windows-only applications (MS Office, Nokia PC Suite, Olympus Studio, etc.). Let's talk about it later, now I would like to sum up the installation process:<br /><br /><span style="font-weight: bold;">Installation</span><br /><br />I followed the <a href="https://wiki.archlinux.org/index.php/Beginners%27_Guide">Beginners' Guide</a> and the whole setup procedure went pretty flawlessly. I used a usb stick as installation medium that I have created with <span style="font-family:courier new;">dd</span> on another Linux box. I had some minor issues during the installation but nothing serious, I could solve them easily:<br /><ul><li>Somehow the built-in partition manager (<span style="font-family:courier new;">parted</span>?) of the installation medium could not create the extended partitions I needed so I used the old and reliable <span style="font-family:courier new;">fdisk</span> command to create my partition table. During the installation process I only had to assign the mount points for my pre-created partitions.</li><li>As I remember well the wlan interface did not work during installation so I used eth0 and I set up the wireless networking after installation.</li></ul>I went through the package list of <span style="font-family:courier new;">base</span> and <span style="font-family:courier new;">base-devel</span> categories at the ending part of the installation and I tried to choose only those packages I thought would be useful. My philosophy is not to install anything that I don't need so I did not install packages that I did not know what they were meant for, only those I knew and among them only those that I needed.<br /><br /><span style="font-weight: bold; font-family:courier new;" >/etc/rc.conf</span><br /><br />I put my basic settings to <span style="font-family:courier new;">/etc/rc.conf</span> as per the <a href="https://wiki.archlinux.org/index.php/Beginners%27_Guide">Beginners' Guide</a> according to my preferences, no tricks here. The <span style="font-family:courier new;">MODULES</span> and <span style="font-family:courier new;">DAEMONS</span> sections have changed a lot since I installed some tools. I will publish my actual configuration later.<br /><br /><span style="font-weight: bold; font-family:courier new;" >/etc/fstab</span><br /><br />I set up my <span style="font-family:courier new;">/etc/fstab</span> to mount my file system at boot time:<br /><br /><span style="font-family:courier new;"></span><span style="font-family:courier new;">tmpfs /tmp tmpfs nodev,nosuid 0 0</span><br /><span style="font-family:courier new;">devpts /dev/pts devpts defaults 0 0</span><br /><span style="font-family:courier new;">shm /dev/shm tmpfs nodev,nosuid 0 0</span><br /><span style="font-family:courier new;">UUID=0bcacd6c-8824-4961-bdeb-1ac6f3a94e70 swap swap defaults 0 0</span><br /><span style="font-family:courier new;">UUID=7cca4b59-e71b-4f35-b3de-7eefc813a576 / ext4 defaults 0 1</span><br /><span style="font-family:courier new;">UUID=c43fcb5b-c9e6-4a5f-8dda-85bda0f1b3c0 /home ext4 defaults 0 2</span><br /><span style="font-family:courier new;">UUID=ec7151f4-50af-493a-b479-1722e569dd50 /boot ext4 defaults 0 2</span><br /><br /><br />I don't know if <span style="font-family:courier new;">devpts</span> and <span style="font-family:courier new;">shm</span> are needed or not, they are not very well documented, but I left those lines in the <span style="font-family:courier new;">fstab</span> that was created automatically during the installation.<br /><br />I fulfilled the following settings according to the <a href="https://wiki.archlinux.org/index.php/Fstab">fstab wiki</a>:<br /><br />I inserted the <span style="font-family:courier new;">tmpfs</span> line (see the first row of my <span style="font-family:courier new;">/etc/fstab</span>). Now I am trying these symbolic links as they can improve some performance, at least theoretically:<br /><br /><span style="font-family:courier new;">ln -sf /run/lock /var/lock<br /></span><span style="font-family:courier new;">ln -sf /run /var/run</span><br /><span style="font-family:courier new;">reboot</span><br /><br />I have set the <span style="font-family:courier new;">fsck</span> check priority (i.e. the file system check at every x boots) by the last flag of the /etc/fstab: I set my root (/) partition to be checked first (1), my <span style="font-family:courier new;">/home</span> and <span style="font-family:courier new;">/boot</span> secondly (2), and all the others are left unchecked (0) by <span style="font-family:courier new;">fsck</span>. I need to mention here that ext4 is checked extremely fast compared to ext3 so it seems to be a wise decision to use this file system.<br /><br />You may have noticed that my <span style="font-family:courier new;">/boot</span> partition is in my <span style="font-family:courier new;">fstab</span>. Usually it is not needed because the files here do not change frequently. Although at a kernel upgrade (by <span style="font-family:courier new;">pacman -Syu</span>) your <span style="font-family:courier new;">/boot</span> partition needs to be mounted.<br /><br /><span style="font-weight: bold;">Other settings</span><br /><br />I did not change anything in <span style="font-family:courier new;">/etc/mkinitcpo.conf</span>.<br />After installation my <span style="font-family:courier new;">/etc/hosts</span> file was correctly set up and since I use dhcp I did not need to change <span style="font-family:courier new;">/etc/resolf.conf</span> either.<br /><br />In <span class="mw-headline" id=".2Fetc.2Flocale.gen" style="font-family:courier new;">/etc/locale.gen</span> I activated my Hungarian locales besides the default English ones:<br /><br /><span style="font-family:courier new;">en_US.UTF-8 UTF-8 </span><br /><span style="font-family:courier new;">en_US ISO-8859-1 </span><br /><span style="font-family:courier new;">hu_HU.UTF-8 UTF-8 </span><br /><span style="font-family:courier new;">hu_HU ISO-8859-2 </span><br /><br /><span style="font-weight: bold;">Bootloader settings (</span><span style=" font-weight: bold;font-family:courier new;" >/boot/grub/menu.lst</span><span style="font-weight: bold;">):</span><br /><br />I installed GRUB as my bootloader with these settings in my <span style="font-family:courier new;">/boot/grub/menu.lst</span>:<br /><br /><span style="font-family:courier new;">timeout 1</span><br /><span style="font-family:courier new;">default 0</span><br /><br /><span style="font-family:courier new;"># (0) Arch Linux</span><br /><span style="font-family:courier new;">title Arch Linux</span><br /><span style="font-family:courier new;">root (hd0,0)</span><br /><span style="font-family:courier new;">kernel /vmlinuz-linux root=/dev/disk/by-uuid/7cca4b59-e71b-4f35-b3de-7eefc813a576 ro</span><br /><span style="font-family:courier new;">initrd /initramfs-linux.img</span><br /><br /><span style="font-family:courier new;"># (1) Arch Linux</span><br /><span style="font-family:courier new;">title Arch Linux Fallback</span><br /><span style="font-family:courier new;">root (hd0,0)</span><br /><span style="font-family:courier new;">kernel /vmlinuz-linux root=/dev/disk/by-uuid/7cca4b59-e71b-4f35-b3de-7eefc813a576 ro</span><br /><span style="font-family:courier new;">initrd /initramfs-linux-fallback.img</span><br /><br />Please note that since kernel 3.0 the .img and kernel names have <a href="http://www.archlinux.org/news/changes-to-kernel-package-and-filenames/">changed</a>. On the new installation media of <a href="https://wiki.archlinux.org/index.php/DeveloperWiki:2011.08.19">2011.08.19</a> this will not be an issue any more. If you upgraded your kernel from the older (kernel26) version like me, you can find symlinks to the new files under <span style="font-family:courier new;">/boot</span> so your older version of <span style="font-family:courier new;">menu.lst</span> will still work. I changed these entries in my <span style="font-family:courier new;">menu.lst</span> in order to avoid the symlinks and using the real filenames instead as you can see in my <span style="font-family:courier new;">menu.lst</span> file.György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0tag:blogger.com,1999:blog-4907337868224969264.post-53572628575233761962011-08-22T09:31:00.000-07:002011-08-22T14:29:02.553-07:00Arch Linux at First SightAgain I start a blog for the same reason: to have notes on my experiences about something that fills my everyday life generating accumulated thoughts in my mind - so I write them down for later use mainly for myself but probably others can find some useful stuff among them, too. And this time the topic is Arch Linux, the new operating system I use.
<br />
<br />For some time I had been looking for a minimalist Linux distro on which I have full control. I came from old times' Red Hat, afterwards I used Debian and later Ubuntu. I liked those robust systems but after a while I had a feeling especially with Ubuntu that I could not control things as much as I wanted (i.e. running daemons that I did not even know what they were meant for, unnecessary applications that were installed because they depended on other - anyway necessary - packages, exclusive settings on the GUI without knowing how things worked behind the scenes). I have to mention that I like Ubuntu and their mission to make people closer to open source, congratulations to them (really!) but now its time for me to change and look for new challenges.
<br />
<br />Some years ago I had a try with Gentoo with its brilliant BSD-based idea but I failed to install it, it was too techy for me and I did not find the right documentation how to solve basic problems (like making network available for the installation). I was afraid of Linux From Scratch because of the same reason (sorry, I never tried, maybe one day...). I needed something that I could install and use without any heavy technical knowledge and programming skills. I made some research and found <a href="http://www.archlinux.org/">Arch Linux</a>. It was love at first sight with its "Keep it Simple" philosophy that is in general very close to me - not only in Linux world but in functional architecture, arts, cooking, etc. as well - and I was just looking for something like that to drive my computer.
<br />
<br />Arch Linux has a <a href="https://wiki.archlinux.org/index.php/Beginners%27_Guide">Begginers' Guide</a> that I followed and the installation went pretty fine. OK, I spent at least two whole days to have a working system but in return I got a beautiful clean OS with no garbages, just the things I needed. This is a real DIY distro: you have a set of an amazing number of tools and you put together the parts you need. And above all everything is very well documented, all the important (and also the less important) things have an article in the <a href="https://wiki.archlinux.org/index.php/Main_Page">Arch Wiki</a>, you cannot go wrong, everything is clearly explained. The unique pacman package manager is the best I have ever seen and if something is not in the official repositories you can pick anything, but really anything from the community repo: <a href="https://wiki.archlinux.org/index.php/AUR_User_Guidelines">AUR</a>.
<br />
<br />Now I have been using Arch for about three months and I am really pleased to have such a beautiful, stable and fast system. After my home PC I installed it on my new office laptop (a lovely Thinkpad Edge 11) so now I am as happy with Arch in the office as I am with it at home.
<br />
<br />Later on I am planning to write about laptop and Thinkpad specific settings including dual monitor usage, special battery and HD saving features, the window managers I use, some problems (sure, there are some as everywhere but here they are all solved which was not the case with other distros) I faced during my time spent with Arch.
<br />György Ráthhttp://www.blogger.com/profile/00652775763604737279noreply@blogger.com0