Oct 28, 2013

Fedora: Booting Fedora LIVE to RAM

Fedora live images do not include the "Boot to RAM" option any more. This is not a big problem as the scripts needed to boot to RAM are still there.

You just need to add rd.live.ram as boot option.

To do that, highlight "Start Fedora Live" using the keyboard keys and press TAB to edit boot command line. Add rd.live.ram and press Enter.

Press TAB to edit boot command line

Add: rd.live.ram 


Oct 20, 2013

Fedora: Creating Arch Linux chroot with ssh server

I made a fork of a clone detection tool named CCFinderX. Two days ago I got a message from an user telling that the compilation was not working on Arch Linux. As some Kernel developers, such as Greg KH, has mentioned Arch Linux as being nice, I decided to try it.

I prefer chroots over virtual machines due higher performance, and due the fact that I do not need insulation between my chroots. As for Debian, Fedora provides all tools needed to create chroots for Arch Linux. This is "very" nice, as one can setup the Arch Linux chroot in just a few minutes.

The steps will cover installing Arch Linux tools on Fedora, creating the Arch Linux chroot, and configuring it with a new user and ssh server.

Some data:
Target directory for the chroot: /opt/arch
Package groups to be installed: base base-devel (More groups available here)
User: peter
ssh server port of the chroot: 2227

Note that the text refers to "[fedora] $" and "[arch] $", but this strings will not show up. If you want it is possible to configure bash prompt for showing different strings. Here is guide on how to do it.

Installing Fedora packages:
[fedora] $ sudo yum install arch-install-scripts gpg

Setting up Arch Linux Keys:
[fedora] $ sudo pacman-key --init
[fedora] $ sudo pacman-key --populate archlinux
Create the target directory:
[fedora] $ sudo mkdir /opt/arch

Creating the Arch Linux chroot:
[fedora] $ sudo pacstrap -d -i /opt/arch base

Prepare chroot directory (Hint: Save this to a script, or check my start/stop chroot scripts). Note that lines with -o bind mount the host directory inside the chroot. So if you delete something there, it will affect the host:
[fedora] $ sudo mount /tmp /opt/arch/tmp -o bind
[fedora] $ sudo mount /lib/modules /opt/arch/lib/modules -o bind
[fedora] $ sudo mount proc /opt/arch/proc -t proc -o nosuid,noexec,nodev
[fedora] $ sudo mount sysfs /opt/arch/sys -t sysfs -o nosuid,noexec,nodev
[fedora] $ sudo mount devtmpfs /opt/arch/dev -t devtmpfs -o mode=0755,nosuid
[fedora] $ sudo mount devpts /opt/arch/dev/pts -t devpts -o gid=5,mode=620
[fedora] $ sudo cp -a /etc/resolv.conf /opt/arch/etc/resolv.conf

Entering the chroot:
[fedora] $ sudo chroot /opt/arch su -
[arch] #

Changing root password:
[arch] # passwd

Adding a new user:
[arch] # useradd -m -g users -G wheel,storage,power -s /bin/bash peter
[arch] # passwd peter

Installing base-devel group:
[arch] # pacman -Sy base-devel

Installing openssh tools, configure server port:
[arch] # pacman -Sy openssh
[arch] # vi /etc/ssh/sshd_config
[arch] # cat /etc/ssh/sshd_config |grep 2227
Port 2227

Create ssh keys:
[arch] # /usr/bin/ssh-keygen -A

Start ssh server:
[arch] # /usr/bin/sshd -f /etc/ssh/sshd_config

Exit chroot
[arch] # exit
[fedora] $

ssh to chroot:
[fedora] $ ssh localhost -p 2227
[arch] $

Nice resources:
 - How to install Arch Linux, while keeping it simple
 - Arch Linux Website
 - My start/stop chroot scripts

Aug 17, 2013

Script to add custom display resolution on Linux / X / Gnome

Toshiba R830-10P is a nice notebook as it lightweight, and very powerful, but the Graphics are poor. The integrated LCD has miserable resolution of 1366 x 768, and as it uses Intel HD Graphics 3000 it do not officially support high resolution displays such as 2560 x 1440.

See the problems I've faced to use high-res monitor here.

I made a script to help people with similar problem. If you have a monitor that is not officially supported by your video card, you can try this approach. You need to tune the Hz parameter to find one value that is supported by the hardware, that is comfortable and stable. For comfort the higher the Hz the best.

Please note that there is no warranty that this script works for you, and there is no warranty that this script is safe for your hardware. I'm quite sure that playing with Modelines can burn some old CRT monitors. I've never heard that you can burn LCD / LED monitors, but I'm not sure.

The script is available at:


Jul 24, 2013

New monitor and old notebook

When I arrived at the office today there was a new monitor on my desk. Acer PB278Q 27” 16:9 2560 x 1440 WQHD LED-backlit Monitor. It is very nice monitor.

My notebook uses the second generation Core i7 processor i7-2620M. The embedded Intel HD Graphics 3000 officially has as maximum resolution 1900x1200 for 60 Hz refresh rate.

If using lower refresh rate, it is possible to use higher resolution. One good source of information is the page:


I was not able to use more than 40 Hz as refresh rate when they say 55 Hz worked with Intel HD Graphics 3000. I can set modes up to 44 Hz but then the image is not stable and goes black for one second some times.

What I did:

$ gtf 2560 1440 40

  # 2560x1440 @ 40.00 Hz (GTF) hsync: 58.92 kHz; pclk: 200.80 MHz
  Modeline "2560x1440_40.00"  200.80  2560 2712 2984 3408  1440 1441 1444 1473  -HSync +Vsync


$ xrandr --newmode "2560x1440_40.00"  200.80  2560 2712 2984 3408  1440 1441 1444 1473  -HSync +Vsync

$ xrandr --addmode HDMI3 "2560x1440_40.00"

$ xrandr --output HDMI3 --mode "2560x1440_40.00"

But I would like to increase the refresh rate. Do you have the 55Hz ModeLine for Acer PB278Q?

Also, how can I tell Gnome display settings about the new resolution? See my question here.

See how cool it is! :-)

Jul 23, 2013

CCFinderX, the new CCFinder

Finding code clones is far from trivial. For a nice explanation about the challenges of finding clones in source code, I suggest reading: "Comparison and evaluation of code clone detection techniques and tools: a qualitative approach". You can start by reading sections 2 and 6.

There are at least two tools with source code available under permissive free software licenses. Deckard and CCFinderX. CCFinderX is an evolution of CCFinder, made by the same author.

Deckard is easy to build and test, however CCFinder was not. For Linux users, I made a fork from gpoo/ccfinderx, and made some changes to simplify the build on Linux. The main change is to separate the core from the GUI. I have now two repositories:




Both are clones from gpoo/ccfinderx, but I've spited things. At the moment the GUI do not work but you can build CCFinderX-core without wired OpenJDK dependencies. And it works producing textual output. My goal with this repositories is provide source code that can be compiled, packed, and distributed.

Jun 14, 2013

Creating 32 bits chroot on 64 bits system

I use Fedora 64 bits on my workstation but I need 32 bits chroot of Debian. It is easy to do.

Create the chroot following the instructions from: http://blog.parahard.com/2013/03/creating-debian-chroot-inside-fedora.html

The first difference is that you need to add --arch=i386 to the debootstrap command.

Then for entering the chroot add linux32 as the first argument after sudo. Something like:

$ sudo linux32 chroot debian-wheezy

After that even uname -a will show 32 bits instead of 64. The linux32 tool is on the util-linux Fedora package.

Mar 27, 2013

Fedora: Creating Debian chroot with ssh server

I use Fedora on the Desktop but I need to do some development on Debian. chroots gives you no performance overhead, while virtual machines gives you CPU and memory insulation. Also the chroot is only a directory on my development tree.

I'm using Fedora 17 on my workstation and Debian 7 inside the chroot. The debootstrap command will save the files on the directory debian7-chroot/ under the current directory.

1 - Install debootstrap and dpkg on Fedora:
Fedora # yum install debootstrap dpkg

2 - Create the basic Debian:
Fedora # debootstrap wheezy debian7-chroot/ http://ftp.fr.debian.org/debian

3 - Enter your new Debian:
Fedora # chroot /path/to/destdir

4 - Install additional useful packages:
debian-chroot: # apt-get install locales less vim openssh-server sudo aptitude

5 - Configure openssh server to start server on port 2222:
debian-chroot: # vi /etc/ssh/sshd_config

Port 22

Port 2222

6 - Change root password
debian-chroot: # passwd

7 - Return to your desktop distro:
debian-chroot: # exit

8 - Create start and stop script for your chrooted Debian:
Fedora # cat start.sh

umount debian7-chroot/tmp debian7-chroot/proc debian7-chroot/sys debian7-chroot/dev/pts debian7-chroot/dev
umount debian7-chroot/tmp debian7-chroot/proc debian7-chroot/sys debian7-chroot/dev/pts debian7-chroot/dev

mount /tmp debian7-chroot/tmp -o bind
mount proc debian7-chroot/proc -t proc -o nosuid,noexec,nodev
mount sysfs debian7-chroot/sys -t sysfs -o nosuid,noexec,nodev
mount devtmpfs debian7-chroot/dev -t devtmpfs -o mode=0755,nosuid
mount devpts debian7-chroot/dev/pts -t devpts -o gid=5,mode=620

chroot debian7-chroot /etc/init.d/ssh stop
chroot debian7-chroot /etc/init.d/ssh start

Fedora # cat stop.sh

chroot debian7-chroot /etc/init.d/ssh stop

umount debian7-chroot/tmp debian7-chroot/proc debian7-chroot/sys debian7-chroot/dev/pts debian7-chroot/dev
umount debian7-chroot/tmp debian7-chroot/proc debian7-chroot/sys debian7-chroot/dev/pts debian7-chroot/dev

9 - Start the ssh server inside the Debian chroot:
Fedora # ./start.sh

10 - Connect over ssh to Debian chroot:
Fedora # ssh root@localhost -p 2200

Jan 17, 2013

Toshiba R830 and 16GB of RAM

The datasheet of Toshiba R830-10P mentions that the maximum memory capacity is 8GB. See it here.

But Intel says that the i7-2620M supports up to 16GB of RAM. See it here.

I have asked for help on Toshiba Forums. Nothing useful from there. See it here.

I was curious as I have a very particular need for 16GB of RAM. Today I decided to give it a try. I bought two Patriot PSD38G13332S (8GB PC3 - 10600 1333MHz CL9 SoDimm) and installed it on the notebook. It just worked.

Bios screen showing 16384 MB of RAM.

Memtest86+ and some info about performance.

So if you have the need for 16GB of RAM and a similar notebook from Toshiba, you can install 16GB of RAM.