Tuesday, December 29, 2009

Mount disk in non-root account

If you want to mount a device, ordinarily, you have to have a root privilege to mount and access the device by root account. But in daily use, login in by root account is danger and unnecessary. You can use sudo to access root privilege and don't need to endure the stake of damaging your computer. But it's the same situation that you need a root privilege to read/write the device. There is other way to do it. Use merely mount.

Edit /etc/fstab:
device mountpoint mounttype option ....
modify the option:
user: If you set option to user, then you can use non-root account to mount the device. To set to users means you can umount the device by other account
group: every account which have a group matching the group of the device can mount the device. So you need to use root account to change the group ownership of the device.
chown -R :group mountpoint

Friday, December 25, 2009

Openbox windows manager

Openbox windows manager is a lightweight X11 windows manager. It is high-configurable. I use it for an alternative for fluxbox. It seems to use less cpu power. I would use it with wmii because wmii is not convenient and awkward to run applications like VirtualBox and wine-related. (Or the floating style in wmii seems to work. Press MOD-Space or MOD-SHIFT-Space to handle the classical way instead of tiling managed way. Read more...)

Install: sudo apt-get install openbox

Configure:
cp /etc/xdg/openbox/rc.xml, /etc/xdg/openbox/autostart.sh to ~/.config/openbox/

edit ~/.config/openbox/autostart.sh
VirtualBox &
(sleep 5 && xterm -e screen) &
google-chrome &
Use xprop WM_CLASS to check the name and class of applications that you want to custom their behaviors after executing. Then edit ~/.config/openbox/rc.xml in applications part

Useful commands:
Alt + Tab:switch windows
Win + (F1 - F4): switch to desktop 1 - 4
Ctrl + Alt (<- ->): switch desktops sequentially
Alt + F4: close window

Reference:

窗口管理器 Openbox 入门指南


Thursday, December 17, 2009

Reconstruct MBR by GRUB

When you install Windows after the installation of Linux, Windows would install its own boot loader on MBR and it would ignore other system in your computer. If you previously install your boot loader of Linux on MBR, your boot loader of Linux would be replaced and you can't boot your Linux system. The following are some solutions.

(Method 2, 3 seem to fail in Windows 7, the alternative way is use other grub substitute for Windows 7, then edit manually to retrieve Linux system. For my computer, when entering the grub menu of grub windows-substitute, press e or c, then edit
root (hd0,2)
kernel (hd0,2)/boot/vmlinuz-... root=/dev/hda3 ro
initrd (hd0,2)/boot/initrd-...img
boot
then press b to boot. It will boot Linux system. Use root privilege to reinstall grub boot loader on MBR.
$ grub
grub > root (hd0,2)
grub > setup (hd0)

I didn't test Method 1 because my Debian CD failed to be loaded by my computer. Ubuntu DVD failed by that Ubuntu installation DVD recognize HD partition as SCSI partition. I don't know how to do it for GRUB.


Method 1:
  1. Use a debian installation CD to boot computer
  2. Select install option
  3. After entering the installation menu, use Ctrl+F2 to access the shell
  4. chroot your Linux environment
  5. Use grub-install /dev/hda (or grub-install --root-directory=prefix '(hd0)' )
  6. Restart computer
Method 2
  1. Download GRUB for DOS
  2. Uncompress and copy grldr and grub.exe in C root drive
  3. Edit C:boot.ini (in CMD, msconfig -> choose boot.ini)
  4. Add C:grldr="grub" in the last line

Method 3
  1. Download wingrub
  2. After finishing installation, install grub -> boot.ini, drive: C: -> install
  3. Restart computer
  4. There are two options in the boot menu: windows, mygrub
  5. Entering mygrub, choose YourLinuxSystemLabel, press c
  6. Edit GRUB: grub>root (hdX,Y); grub>setup (hd0)

Wednesday, December 16, 2009

Useful wget commands

Useful wget commands

$wget -r http://example.com/packages/
Download all files in the directory of packages and fabricate all the structure of the site, http://example.com

$wget -r -np -nd http://example.com/packages/
The same as above, but don't recursive for parent directory (-np), don't reconstruct directory structure in local machine (-nd)

$wget -i filename.txt
filename.txt includes all needed download address, then wget would automatically download all file

wget -c http://example.com/really-big-file.iso
the option -c means wget would resume last download process in the case the last download didn't finish

wget -m -k (-H) http://www.example.com/
mirror a site, and convert the links in the mirror automatically. -H enable across site recursive retrieving

Tuesday, December 15, 2009

Cloud operating system for Netbook



Linux Instructions for installing Chromium OS to USB.

Extract ChromeOS-Cherry.img and run the following command in the same directory as the file, where X is the device name of your USB drive.
sudo dd if=ChromeOS-Cherry.img of=/dev/X bs=4M
Once the command finishes, you can then boot from the USB drive.






Create a Jolicloud USB key
  1. Open a Terminal and go to the directory where you downloaded the file: cd /the/path/to/your/directory
  2. Change the script permissions: chmod a+x jolicloud-usb-creator-1.2.0.sh
  3. Run the program (at this stage you will be asked to enter your administrator password): ./jolicloud-usb-creator-1.2.0.sh
  4. Connect your USB key to your computer.
  5. In the Jolicloud USB Creator window, click <em>Browse</em> to find and select the <em>jolicloud-robby-alpha2c-live.iso</em> in your system.
  6. Select your target device: The USB key you have inserted should be automatically detected.
  7. Click <em>Create</em> to create your Jolicloud USB.

Monday, December 14, 2009

Remember The Milk

the best way to manage your tasks

username: XXXXXXXXX
Inbox email address: XXXXXXXXX+a01402@rmilk.com (anything email this will become a task in Remember The Milk Inbox)


a handy guide to getting started with Remember The Milk at: http://www.rememberthemilk.com/help/guide/