Total access to *BSD ufs partition on linux

That’s worked on ArchLinux with FreeBSD, but I thinks it’s worked for all Linux and BSD (ufs).

You can damage your system, please if you don’t understand something are if you are not sure about the result, don’t do anything. I’m not responsable of the damages.

Since few times, I’m interested by a compatibility of the 2 systems. The last week I try to compiling my kernel on Arch Linux to enable UFS write support but I never compiling a kernel and I had some problems.

So today I try again and it’s run, the problems I had it’s with depmod, the name of System.map, vmlinuz26 and the configuration of grub…

By default The Linux Kernel can’t read on UFS partition, but not write. You should change the default configuration for enable the write support.

Create a directory for the building
mkdir ~/kernel

cd ~/kernel

I download the Latest Stable Kernel here => http://www.kernel.org/
In the kernel directory decompress the kernel archive (in my case the version was 2.6.32.7).
The following commands not required to be root.
tar -jxvf linux-2.6.32.7.tar.bz2

cd linux-2.6.32.7
Cleaning the directory.
make mrproper

And if you want save the old configuration of the kernel.
zcat /proc/config.gz > .config

make oldconfig

Now you can launch menuconfig for enable the UFS writing support.
make menuconfig

Select the file sytem section.

Select miscellaneous filesystems.

And finally enable the UFS writing support.

You can compile the Kernel.
make
Please remember the last line with DEPMOD, get the name of your personnal kernel (the word after DEPMOD) it’s important for the end.
For example in my case it was  something like this:

DEPMOD              2.6.32.7-ARCH-perso

Now you have to be root for the followings operations.
su

make modules_install

cp -v arch/x86/boot/bzImage /boot/vmlinuz26-perso

cp -v System.map /boot/System.map26-perso

mkinitcpio -k 2.6.32.7-ARCH-perso -g /boot/kernel26-perso.img
Where 2.6.32.7-ARCH-perso is the DEPMOD argument.

The details for kernel compilation are found here => http://wiki.archlinux.org/index.php/Kernel_Compilation_From_Source

Now we need to add the entry in /boot/grub/menu.lst for booting on the new kernel.
With your favorite text editor edit the file and add something like this :
You have juste to copy and past the part of the existant line for the old kernel. (don’t remove the old if the kernel-perso don’t want to boot it’s usefull),
and modify the number of entry, name, path to kernel.img and vmlinuz.

# (4) Arch Linux Perso
title Arch Linux Perso
root (hd0,4)
kernel /vmlinuz26-perso root=/dev/disk/by-uuid/658d9411-a8ac-4398-a852-efb21af45dba ro vga=794 quiet
initrd /kernel26-perso.img

Reboot on the new kernel…

Now I want reconstitute the arborescence of FreeBSD system something like that :
/
swap
/var
/tmp
/usr
/home

su

mkdir /mnt/freebsd

Now execute this command for know the bsd partition disposition.
dmesg | grep bsd

sda3: <bsd: sda10 sda11 sda12 sda13 sda14 sda15 >

In my case sda3 is the “/” partition, so I mount it first.
mount -t ufs -o ufstype=ufs2 /dev/sda3 /mnt/freebsd/

sda10 and sda3 are the same partition.
Change /dev/sda3/ by your / FreeBSD partition.
I don’t want to mount the swap and it’s not a ufs partition so sda11 is forget.
In order :
I mount sda12 in /mnt/freebsd/var
mount -t ufs -o ufstype=ufs2 /dev/sda12 /mnt/freebsd/var/
I mount sda13 in /mnt/freebsd/tmp
mount -t ufs -o ufstype=ufs2 /dev/sda13 /mnt/freebsd/tmp/
I mount sda14 in /mnt/freebsd/usr
mount -t ufs -o ufstype=ufs2 /dev/sda14 /mnt/freebsd/usr/
I mount sda15 in /mnt/freebsd/home
mount -t ufs -o ufstype=ufs2 /dev/sda15 /mnt/freebsd/home/

If all is good and if you can create file or editing an existing file, etc…you can edit the fstab for automounting the partition at boot.
In my case the fstab look like that :

#
# FreeBSD Partitions
#
/dev/sda3 /mnt/freebsd ufs ufstype=ufs2 0 0
/dev/sda12 /mnt/freebsd/var ufs ufstype=ufs2 0 0
/dev/sda13 /mnt/freebsd/tmp ufs ufstype=ufs2 0 0
/dev/sda14 /mnt/freebsd/usr ufs ufstype=ufs2 0 0
/dev/sda15 /mnt/freebsd/home ufs ufstype=ufs2 0 0

I change the permission of the /mnt/freebsd/home/MY_USER
chown -R LOGIN /mnt/freebsd/home/MY_USER

Not a good idea, that’s modify the bsd partition and I couldn’t start x…

Everything it’s ok.
Bye

Pidgin – Netsoul for *unix 32/64 Bits

Netsoul is a IM protocol use in Epitech, Epita, without Netsoul the student can’t access to the networks resources.
So when I’ve install my Arch Linux 64bits, I had a little problem, the Pidgin plugin for Netsoul found here didn’t work.
On the Sourceforge project page we can see how to solved this problem.

Before starting you should install Pidgin on your computer.
On FreeBSD :
# cd /usr/ports/net-im/pidgin

#make

# make install clean
Or
# pkg_add -r pidgin

On ArchLinux :
$ yaourt -S pidgin
Or
# pacman -S pidgin

Download the plugin source on Sourceforge : http://downloads.sourceforge.net/project/gaim-netsoul/gaim-netsoul/0.2.2/gaim-netsoul-0.2.2.tar.gz

Decompress source :
tar zxvf gaim-netsoul-0.2.2.tar.gz

If you have a 64Bits version you need to modify a line in ns_utils.c(change emacs by your favorite text editor. i.e : nano, vi, gedit…)
cd gaim-netsoul-0.2.2/src/

emacs +243 ns_utils.c
Change
unsigned len;
By
size_t len;

Now you have just to compiling the source.
cd ../

./configure --prefix=/usr

make

sudo make install

make clean

Restart pidgin, normally you have the Netsoul protocol in the list.

Install Openbox

Why Openbox ?

When I leave Ubuntu (with gnome) for a more configurable and lightweight distribution (even if I know Ubuntu can do that), I wanted to change my desktop environment too. On the (French) forums of Archlinux many people using Openbox and at this time I followed the #! CrunchBang Linux forums a Linux distribution based on the Openbox + tint2 environment. CrunchBang user make beautiful configuration for the duo.

I was also interesting by pekwm & Bmpanel (maybe in the future?), I don’t remember the others…

Install

I think they are on the depot of your distribution, for example on :

Archlinux

For Openbox :
yaourt -S openbox

Extra (not on all distrib) – Graphic applications for configuration :

yaourt -S obconf obmenu obkey openbox-themes obtheme

FreeBSD

For Openbox :
# cd /usr/ports/x11-wm/openbox/

# make install clean

If you need a ~/.xinitrc for launch a session you can add that. (I use Slim for launch X session and I need it)

echo "exec ck-launch-session openbox-session" > ~/.xinitrc

I had ck-lauch-session because of ConsoleKit (it’s useful for mounting automatically a usb key for example without root right), on FreeBSD ck-launch-session doesn’t work, you have juste to put :

echo "exec openbox-session" > ~/.xinitrc

You need create configuration files :

Archlinux

mkdir -p ~/.config/openbox

cp /etc/xdg/openbox/* ~/.config/openbox

FreeBSD

mkdir -p ~/.config/openbox

cp /usr/local/share/etc/xdg/openbox/* ~/.config/openbox

It’s all for today…tonight maybe.

I will explain the configuration of Openbox later, and the panel, and others usefull utilities.

Search command in Shell

I like the Zsh shell, I saw so many compliment about this shell in planets, or blogs. So I want to try the “monster”. In the configuration file .zshrc (take at school) I have a useful function name clean.

It’s look like that :
[franky] clean

removed: ./lib/toto~

removed: ./lib/.tata~

removed: ./toto~

The function look like that :
clean()

{

SEARCH='.'

if [ ${1} ]

then

SEARCH=${1}

fi

find ${SEARCH} -type f \( -name "*~" -or -name ".*~" -or -name "\#*" -or -name "\#.*" \) -exec rm -fv {} \;

}

So, I want to make a function, who works with the same method but it’s have to find word (or grep pattern) occurrences in file recursively and indicate the line number.

I find few solutions, I prefer the first (I’m not sure but it’s the faster I think).

The default PATH is the current directory ” . “.

grep -nr $PATTERN $PATH

grep -n $PATTERN `find $PATH -type f`

find $PATH -type f -exec grep -n $EXPRESSION {} +

But I’m not satisfying by the result, I learn few things about awk utilisation, and it was great for this case. The problem with awk is it can’t interpret the colour variable, so the awk line is not pretty.

search()

{

SEARCH="."

if [ $# = 0 ]

then

echo -e "Usage: search PATTERN [DIRECTORY]"

else

if [ $# = 2 ]

then

SEARCH=${2}

fi

grep -nI ${1} `find ${SEARCH} -type f 2>&/dev/null` 2>&/dev/null |\

grep '^\'${SEARCH} |\

grep -v '/\.' |\

awk -F: ' {print "\033[1m\33[7;33m"$2 "\033[0;39m" "\033[3m
\
033[1m " $1 "\033[0;31m \033[3m\n\t" $3"\33[0;39m"}'

fi

}

Maybe you should delete the “&” one bash.
The result look like that. (click to see large view)

For Archlinux user maybe you see the colour look like yaourt
That’s works on bash, zsh, and I haven’t test others for the moment, you can try and inform me of the comportment.
If you have emacs, nano, vi installed you can open the file with line option easily.
Example :
emacs, vi or nano +52 minishell/my.h

Traditionnal first post…

Hi everyone,
I’m 18 french student in first year at Epitech, a computer science school.
I want to create a blog for a long time about the *unix system (configuration, tips, discoveries…) for me and all people who are interrested.I create my blog now because our english teacher want we make a blog in english, I hope you will notify me about my grammatical errors.

I have so many things I want to do, for exemple I decided to make / install a LFS (Linux From Scratch) system on my old pc. I don’t how much time was required for doing that.

I like lightweight and highly configurable softwares, I using Arch Linux and FreeBSD.