Search the web with Google

Android install

Android installation weblog

Enter your email address:

Jeroen´s weblog

Ubuntu install

Ubuntu installation weblog

Saturday, May 29, 2010

GRSYNC: Make backups with file synchonisation

Till recently I used DirSyncPro to make backups from my home partition to USB harddrives. It works. But the program has some major disadvantages. It didn't work on my networkdrive and it's written in java, what makes it slow. Since Ubuntu 10.4 changed from Sun java to Open JDK. The program isn't working OK anymore. The GUI is somewhat scrambled. It still seems to work, but I'm not sure if it doesn't make any errors.
Before DirSyncPro I used Unison. But that program has a very weak GUI and is slowly to. I used Synkron (that's also avauilable on Windows and Mac) But that program has many options, but is slow too.

Now I discovered Grsync. It's in the standard repositories form Ubuntu and installs with just one command:

sudo apt-get grsync

And it's fast. really fast.

A small tutorial:

Start Grsync from the menu

I select the options and start syncing. The first time takes some time and after that ons it's really fast. Allows you to propragate deletions. Make the syncing compatible with windows drives, forget timestamps (becomes handy if some seconds difference in files make the system think that a file is an update, while it isn't).

Well, thats all there is to do. You can make a set of different syncronisation protocols to select from. Alas it doesn't allow multi sync at a time. You need to make to sets of sync protocols and run them after each other. That0s fime with me.


I found an interesting tutorial about AppArmor.

Sunday, May 16, 2010

Install Palm programs in Ubuntu

When installing programs to my Palm device it turns out, I need to drag the file to the tiny gpilot applet on my deskbar. This isn't documented, but there you go, it can be done.
To those still using the archaic Palm OS, that’s the trick.

In synaptic install gnome_pilot and gnome_pilot-conduits

Add the palm applet to the taskbar

configure the apples using the right USB or COM port and drag the files to the apples before pressing the hotsync button on the cradle of the palm device.

Saturday, May 8, 2010

File ownership in Ubuntu

File ownership in Unix

Just to give you a quick reminder, I'd like to confirm that every single file in Unix belongs to some user and some group. There simply isn't a way to create a file without assigning ownership. I've briefly touched the topic of confirming file ownership in Unix before, so today I will simply build on that and show you how to change ownership of files.

Here's a setup for today: I have created a temporary directory with a few files and made myself the owner of all the files:

ubuntu$ ls -al /home/greys/example/
total 12
drwxr-xr-x 3 greys admin 4096 Feb 9 03:55 .
drwxr-xr-x 13 greys greys 4096 Feb 9 03:54 ..
drwxr-xr-x 2 greys admin 4096 Feb 9 03:55 dir1
-rw-r--r-- 1 greys admin 0 Feb 9 03:54 file1
-rw-r--r-- 1 greys admin 0 Feb 9 03:55 file2

As you can see from this listing, the owner (third field in each line) is my username – greys. The next field is a Unix group of each file's owner – admin in my example.

Changing owner of a file in Unix

Changing file ownership means only updating the association between a Unix user and a file, and nothing else. When you're changing the owner of a file, no data contained in a file is changed.

To change the owner of a file, you need to use the chown command (easy enough to remember: CHange OWNer – chown), with the following syntax:

ubuntu$ chown nobody file1

In this command, nobody is the username of the new owner for a list of files. In my example, the only file we'd like to change ownership for is file1.

It is important to realize that you can only change file ownership as a super-user (root). Any regular Unix user cannot change the ownership of any file, and I'd like to explain why.

Indeed, some people are surprised: if I'm the owner of a given file, why can't I change the ownership for it? That's because transferring the ownership will mean some other Unix user will become the owner of the file(s) in question. So changing ownership is like making a decision not only for yourself, but for the new owner of the files.This is only something a super-user – special administrative account in Unix – can do.

The same logic applies to other people not being able to become owners of your files, even if they're willing to assume the new responsibilities of owning files. They cannot revoke your ownership, because each Unix user is only allowed to make decisions and take actions on his/her own behalf.

That's why you will probably see an error like this if you attempt to change ownership of a file as your own regular Unix user:

ubuntu$ id
uid=1000(greys) gid=113(admin) groups=33(www-data),113(admin)
ubuntu$ chown nobody file1
chown: changing ownership of `file1': Operation not permitted

But if we become root:

ubuntu$ sudo -i
[sudo] password for greys:

… we'll have no problem changing owners for any files:

ubuntu# cd /home/greys/example
ubuntu# chown nobody file1
ubuntu# ls -l file1
-rw-r--r-- 1 nobody admin 0 Feb 9 03:54 file1

Changing owner for multiple files

If you're going to change owner of a few files, this can easily be done using either a full list of files or a mask.

First, here's an example of updating ownership for a specified list of files (and as you can see, directories as well):

ubuntu# chown nobody file2 dir1
ubuntu# ls -al
total 12
drwxr-xr-x 3 greys admin 4096 Feb 9 03:55 .
drwxr-xr-x 13 greys greys 4096 Feb 9 03:54 ..
drwxr-xr-x 2 nobody admin 4096 Feb 9 03:55 dir1
-rw-r--r-- 1 nobody admin 0 Feb 9 03:54 file1
-rw-r--r-- 1 nobody admin 0 Feb 9 03:55 file2

IMPORTANT: here's one thing which is often forgotten: when you're changing an owner of a directory, this DOES NOT automatically change owner of all the files which already exist in this directory. So, if we check the file3 in dir1 after the example above, we can see that even though dir1 now belongs to user nobody, file3 in it still belongs to me:

ubuntu# ls -l dir1/file3
-rw-r--r-- 1 greys admin 0 Feb 9 03:55 dir1/file3

If your intention is to change ownership of all the files and directories of a certain location in your filesystem, you need to use a -R option of the chown command, which means recursive ownership change:

ubuntu# chown -R nobody dir1
ubuntu# ls -l dir1/file3
-rw-r--r-- 1 nobody admin 0 Feb 9 03:55 dir1/file3

And just to further demonstrate this, I'm going to change owner of all the files and directories in /home/greys/example directory back to my own username, greys:

ubuntu# chown -R greys /home/greys/example/
ubuntu# ls -l /home/greys/example/
total 4
drwxr-xr-x 2 greys admin 4096 Feb 9 03:55 dir1
-rw-r--r-- 1 greys admin 0 Feb 9 03:54 file1
-rw-r--r-- 1 greys admin 0 Feb 9 03:55 file2

This posting is originally found here.

Sunday, May 2, 2010

secure remote desktop

Leo cardinaals weblog about secure tunneling for a remote desktop:

click here

Chainloading Grub legacy to Grub2

I've installed a dedicated Grub partition on my system. It's working fine until I installed Ubuntu 9.10 and 10.4 on my system. The dedicated grub legacy just wouldn't chainload the new Ubuntu.

I used to have these entries in my dedicated GRUB legacy menu.lst file:

title Ubuntu 8.04.3
root (hd0,4)
chainloader +1

This works fine as long as the Grub that´s installed in the target partiton is grub legacy. One modern systems this chainloading works fine. Older machines sometimes report error 13 or 15.

Some googling finally gave me two solutions. The first works, but needs manually updates when Ubuntu updates it's kernel. It´s booting the Ubuntu kernell directly without using the grub2 bootloader that is installed on the partition Ubuntu is in.

title Ubuntu 10.4
root (hd0,8)
kernel /boot/vmlinuz-2.6.32-21-generic root=UUID=ad518371-1bcc-43c1-994c-54cb14751bbb ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic

The second just works.

title Ubuntu Linux 10.4 NL
root (hd0,8)
kernel /boot/grub/core.img

I didn´t test any kernelupdate yet, but I see the Grub2 boot menu. We´ll see.



Finally found some actual information on the grub 2 failure to install to proper partition boot sector:

google search: how to determine which boot sector grub2 installs to partition boot sector

debian bug: [link]

:: Code ::
$ sudo mount /dev/sda7 /1
$ sudo grub-install --root-directory=/1 /dev/sda7

and this:

:: Code ::
$ sudo mkdir /mnt/linux
$ sudo mount -t ext4 /dev/sda1 /mnt/linux
$ sudo mount -t proc proc /mnt/linux/proc
$ sudo mount -t sysfs sys /mnt/linux/sys
$ sudo mount -o bind /dev /mnt/linux/dev
$ sudo chroot /mnt/linux

If /boot is on a separate partition, this partition must also be mounted:

$ sudo mount -t ext4 /dev/sdaX /boot

Then, the following command should resolve the issue. :

$ sudo grub-install --recheck /dev/sda5

these are just debugging tools.

:: Code ::
In the report you only said grub-install /dev/sda6 and grub-setup "(hd0,6)"
but you can even use grub-install "(hd0,6)"

NOTE: none of these methods fixes the bug. This system has 3 sata hard drives, and the grub 1.5 is in mbr, chainloading to /dev/sda9 / (hd0,8).

Tests show that grub 1.5 in partition /dev/sda9 is chainloaded fine, grub2 from ubuntu does not work at all, always results in the error 13 message.

More on this grub 2 bug on [link]

ubuntu grub 2 docs: [link]
note that these are not very useful since they contradict themselves.

This thread: [link]
seems to show the same issues with grub 2.

Clearly grub 2 was put into production use FAR too early, and is not at all robust enough yet to actually be trusted for mainstream desktop/server use. Why they feel the need to rush out core tools in this way is absolutely beyond me.

here's an interesting method, but doesn't help this case since grub2 doesn't seem to install to /dev/sda9 in the first place: [link]
:: Code ::
title Chainload to grub2
find --set-root /boot/grub/core.img
chainloader /boot/grub/core.img

and finally I got in with this added to grub 1.5 menu.lst master in mbr, after running the above:
:: Code ::
root (hd0,8)
kernel /boot/grub/core.img

in other words, instead of using the failed install of grub2 img to partition boot sector, I'm getting it directly from /boot/grub/core.img