Monday, August 30, 2010

Note about permissions in VirtualBox physical hard disk usage in Linux host

From VirtualBox manual: "Starting with version 1.4, as an alternative to using virtual disk images, VirtualBox can also present either entire physical hard disks or selected partitions thereof as virtual disks to virtual machines...
...this type of access is called "raw hard disk access"; it allows a guest OS to access its virtual hard disk without going through the host OS file system."
Do read the manual (part 9.7.1 at now) and do it at your own risk! Here we will talk only about permission problem you can get in Linux host. That, you will need read/write access for the entire disk (or selected partitions). For example:

$ VBoxManage internalcommands createrawvmdk -filename $HOME/.VirtualBox/HardDisks/sda2.vmdk -rawdisk /dev/sda -partitions 2

set up an image for access /dev/sda2 in Linux host. User needs read/write access to this partition. Otherwise, we will get some messages like this while adding sda2.vmdk to a virtual machine:

NS_ERROR_FAILURE (0x80004005)
IHardDisk {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
IVirtualBox {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

Check the physical disks properties:

$ ls -l /dev/sda*

brw-rw---- 1 root disk 8, 0 2010-08-30 21:53 /dev/sda
brw-rw---- 1 root disk 8, 1 2010-08-30 12:22 /dev/sda1
brw-rw---- 1 root disk 8, 2 2010-08-30 21:31 /dev/sda2
brw-rw---- 1 root disk 8, 5 2010-08-30 12:22 /dev/sda5

We can see one solution to grant permissions is adding username to the disk group, for example, by editing /etc/group file. And don't forget to re-login.

Friday, August 27, 2010

Very short about using transmission-daemon

The transmission-daemon program is a daemon-based Transmission session that can be controlled via IPC commands by transmission-remote(1) [1]. This program is used by default in FreeNAS, and maybe you want to use it on Linux box. It's very likely you distribution come with transmission by default. In that case, you need to install transmission-daemon only:

# apt-get install transmission-daemon

Configuration file is /var/lib/transmission-daemon/info/settings.json (it's quiet safe to add *.*.*.* to rpc-whitelist option). After editing (user, password, paths, etc), we need to reload the daemon itself:

# /etc/init.d/transmission-daemon reload

Using remote client was discussed before [2].
Note: transmission-daemon configuration is very well documented on this web site. You are recommended to read (at least to feel the power of FreeNAS's web interface).

1. man transmission-daemon
2. Cross-platform transmission-remote-gui

Sunday, August 22, 2010

Boot from USB Flash Without BIOS Support Using Plop via GRUB2

As result of an accident the netbook has gone to the heaven in the crisis time, so I've turned FreeNAS box to a normal PC with dual boot (Linux and FreeNAS) for working. Unfortunately, the DVD ROM has gone to the heaven, too. There are not to much options:
  1. Dual boot, each OS on their disk. Needs 2 devices, not my case.
  2. Dual boot on the same disk, still available, but requires skill and time [1].
  3. Boot FreeNAS from USB stick.
The last choice is the most convenient, but BIOS doesn't support booting from USB. Fortunately, there are boot managers, which fill this hole. Plop [2] has many features, many options and well-documented, so I chose it.
The system is running Linux, booted via GRUB2. If you like me don't want to destroy GRUB(2), you can run Plop from GRUB(2). You need to download the program, unzip and copy the boot manager binary program plpbt.bin to /boot, then add the following entry to GRUB2 configuration file (/boot/grub/grub.cfg):

# Boot Plop Boot Manager
menuentry "Plop Boot Manager" {
set root='(hd0,3)' #Change to your boot partition
linux16 /boot/plpbt.bin

Hold down Shift key while GRUB2 is booting to get its menu, then you can run Plop, from where FreeNAS on USB Flash can be booted.

See [3] for FreeNAS installation on USB Flash. Get the "embedded" (img) file instead of iso.

P.S. of course this is temporary solution. The better is CF to IDE adapter usage.

1. FreeNAS forum on
2. Plop boot manager
3. FreeNAS USB installation

Friday, August 20, 2010

Disable unused console (tty) when using Upstart init daemon

There are not /etc/inittab anymore, but /etc/init/ttyN.conf (N from 1 to 6). Just comment out the last line in each file you desire. For example (in /etc/init):

$ cat tty1.conf
# tty1 - getty
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

exec /sbin/getty -8 38400 tty1

$ cat tty1.conf | wc -l

$ sed -i '10 s/^/#/' tty{2,3,4,5,6}.conf

Please tell me other command lines to do the last job.
P.S. in an Ubuntu box Ctrl+Alt+Backspace now is Right Alt (Alt Gr) + Print Screen + k.

Wednesday, August 18, 2010

Boot System Rescue CD from ISO image on the disk with Grub2

"SystemRescueCd is a (Gentoo) Linux system rescue disk available as a bootable CD-ROM or USB stick for administrating or repairing your system and data after a crash." The latest version include many administration tool of both CLI and GUI. If you frequently use SystemRescueCd, you may want to boot it directly from Grub2.
From version 2 GRUB can provide the GREAT loopback option, in co-junction with whom some Linux Live CD distributions (grml, SystemRescueCd, etc) provide direct boot (iso9660) ISO via their options — isofrom, findiso, isoloop and some others. Option isoloop is only supported in SystemRescueCd from version 1.4.0.
The ISO is in (hd0,3)/ISOs/. grub.cfg has the following entry:

# Boot system rescue CD from ISO
menuentry "System Rescue CD from ISO" {
loopback loop (hd0,3)/ISOs/res-1.5.8.iso
linux (loop)/isolinux/rescuecd isoloop=/ISOs/res-1.5.8.iso setkmap=us
initrd (loop)/isolinux/initram.igz

grub.cfg contains the global option set root='(hd0,3)', so boot script will search the ISO image in /dev/sda3 partition in the path specified after isoloop option.

Read more:
1. Boot the SystemRescueCD ISO image from the disk using Grub2
2. Boot an ISO via Grub2
3. MultiBoot USB with Grub2 (boot directly from iso files)