Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Sunday, 26 January 2014

Triple boot MacBook Pro late 2013

Install Ubuntu

Follow instructions here.
How to solve some issues.

Install Windows 7

Making USB ports work

The main challenge of installing Windows 7 on a MacBook Pro with only USB 3.0 ports is that the Windows 7 installer does not have USB 3.0 drivers. Initially I tried to bypass using Bootcamp to install Windows because I've already partitioned the disk and the Bootcamp doesn't work with partitioned hard disk. I tried several methods, including slip streaming USB 3.0 drivers to the Windows installer, but it didn't work. The mouse and keyboard wouldn't work so I couldn't progress in the installation process. Finally as the last resort, I deleted all the partitions including the Recovery HD, so that Bootcamp can work again.

Before deleting the Recovery partition though, I tried to copy it to a USB stick (just to be safe). However, I had a lot of trouble backing up the Recovery HD partition to a USB stick. It turned out that the main reason was that the size of my USB stick was not big enough. It requires a USB of 2GB+ memory.

After restoring the hard disk to 1 partition, Bootcamp works again and the keyboard and mouse works during the Windows installation process. However, after I booted into Windows 7, the USB ports still didn't work so I couldn't access all the Windows support drivers (network adapters, graphic card drivers etc) downloaded in the USB stick. As the network was not working either, I couldn't access the Internet either. Finally, I solved the problem by install VMware Fusion and created a virtual machine from the BootCamp partition. Then I did the following:

  1. Share the driver folders from the host OS to the guest OS (BootCamp and $WinPEDriver$ folders) and copied these folders into the Windows partition.  
  2. Reboot into Windows and install the drivers using the "setup.exe" file in the BootCamp folder (Note that you can't do the setup in the virtual machine because the setup program will report that the computer is not compatible with the drivers).

Other standard steps

  1. If haven't already done son, install rEFInd boot manager. After downloading the program, just go to its folder and run
    $ ./install.sh
    Every time after a major OS update, the program seems to be affected and you need to install the program again.

Resources:
http://clc.its.psu.edu/UnivServices/itadmins/mac/blastimageconfig/createasrrecoveryhdimage10.7
http://lifehacker.com/5823096/how-to-burn-your-own-lion-install-dvd-or-flash-drive
http://www.iclarified.com/entry/?enid=2672
Add triple boot OSes to virtual machines: https://www.youtube.com/watch?v=zNYXWEdVivo

Tuesday, 14 January 2014

Linux

X Window System (X11) is the windowing system for bitmap display, common on UNIX-like OSes. X provides the basic framework for a GUI environment. It does not mandate the user interface - this is handled by individual programs, such as window managers. A window manager controls the placement and appearance of application windows. Examples of window managers include GNOME 2, KDE and Awesome.

Monday, 31 December 2012

Mount DVD drive in Ubuntu

mount /dev/cdrom [dir]
In my case, I mount it in the existing media directory.

Monday, 10 December 2012

Playing videos in Ubuntu

Recently I've been having a problem playing videos in Ubuntu: all I see is a green screen. This happens for Totem Movie Player, mplayer and VLC. So far I fixed the problem in VLC. What I need to do is  to go to Tools > Preferences > Video and choose X11 video output (XCB) under Display Output. Un-checking the "Accelerated video output (Overlay)" works too. Using Xvideo as the output will cause the green screen.

Another useful tool for converting ogv file to high definition mp4 file is Arista Transcoder. You can install it from Ubuntu Software Center.

Also I installed all the libraries for media support mentioned in this post: 3 things to do after installing or upgrading to Ubuntu 12.04. Now I can also play mp4 file in the Chrome browser.

Wednesday, 29 August 2012

Awesome WM configuration

Today I started to use Awesome on my desktop in the office. I've been using it for 3 months during my internship at Google and it was awesome! It requires a little bit of configuration at the beginning.

To make Awesome appear as a choice of WMs in the Ubuntu login screen, delete "NoDisplay=true" in /usr/share/xsessions/awesome.desktop. Apparently this is a bug in Ubuntu.

To create a user configuration file, copy the default one to the ~/.config folder:
$cd ~
$mkdir -p .config/awesome
$cp -r /etc/xdg/awesome/* .config/awesome
Note that there are some other files under /etc/xdg/awesome besides rc.lua, and you need to copy all the files. Otherwise there will be errors and the user configuration will be ignored (I tripped over this).

Configure screen locking
Install xscreensaver. Add the following lines to rc.lua.
# In globalkeys = ...
awful.key({ modkey }, "F12", function() awful.util.spawn("xscreensaver-command -lock") end)
# At the end of the file:
awful.util.spawn_with_shell("xscreensaver -no-splash")

Shortcuts

  • Close dialog windows: meta+shift+c

Monday, 11 June 2012

Shortcuts

Ubuntu

  • Ctr+Alt+Del Brings up the logout dialog window.

Unity
  • Alt+Space Brings up window menu with with 'Always on Top' and 'Minimise' and 'Maximise' and above commands.

Wednesday, 2 May 2012

Common routines after reinstalling Ubuntu

The following routines may be necessary after reinstalling Ubuntu to reconfigure your environment.

  1. Activate additional drivers in "Additional Drivers" for your GPU.
  2. Display
    • For AMD's (formerly ATI) graphics card, you can use AMD Catalyst Control Center (Administrative) to configure for multi-display. However, when I used it today, it didn't work. Using command line works though.
      $ sudo aticonfig --initial # This reinitializes your xorg.conf.
      # Then when you reboot, you should be able to configure multi-display with
      $ sudo gksu amdcccle
      
    • Use ARandR do configure display
  3. Install Chrome dev release.
  4. Install Sun Java 6 and OpenJDK Java SDK
    sudo apt-add-repository ppa:flexiondotorg/java
    sudo apt-get update
    sudo apt-get install sun-java6-jre sun-java6-plugin
    
    sudo apt-get install openjdk-6-jdk
  5. Install git.
  6. Install OpenAFS.
  7. Install Latex.
    $ sudo apt-get install texlive-full
    Update Texlipse's preference in Eclipse by giving the bin directory of Tex distribution: /usr/bin
  8. Install ssh server.
    $sudo apt-get install openssh-server
    

Saturday, 18 February 2012

Ubuntu 11.10 boot freezing at Checking Battery State

My Ubuntu on my laptop was not functioning correctly for a week. After login, the resolution is wrong using Unity and I couldn't change the resolution because all the interaction (mouse clicking) was not working. When I switch to GNOME, the resolution is better (usable) but still not correct. So I changed the resolution using the Nvidia setting tool and saved the configuration file (this is a mistake).

After restarting, it froze during boot. I tried a lot of thing, rebooting, going to recovery mode etc. All didn't work. If I end 'e' at the GRUB menu and the enter Ctl+x, it froze at the line "Checking battery state..." After some searching online, I found a solution.

First enter TTY1 by holding down Ctl+Alt+1 when you see it freezes at "Checking battery state...". Then in the command line, redo the nvidia configuration:
$sudo nvidia-xconfig
The output said there were errors in the xconfig settings and a new file is generated. So the problem is really with the Nvidia settings.

Saturday, 5 November 2011

Show table of contents in Mendeley

If you want to view the table of contents of pdfs in Mendeley, you can start the application with the following option:
mendeleydesktop --pdf-toc
To make a shortcut in your launcher in Ubuntu 11.10, you can open the Main Menu application and add a new item with the command to start Mendeley. Note that if Main Menu does not respond after clicking the buttons, it is possible that the gnome-desktop-item-edit binary is missing. You can confirm this by running alacarte from the terminal and see if there are any errors. To install gnome-desktop-item-edit, you can run the following command:
sudo apt-get install --no-install-recommends gnome-panel

You can find the icon for Mendeley in /usr/share/icons/hicolor/. Choose the appropriate resolution you want for the icon. I used 48x48.

Wednesday, 26 October 2011

Using Kinect with OpenNI on Ubuntu 11.10

I recently upgraded to Ubuntu 11.10 and then my Kinect stopped working. I'm using OpenNI library for getting data from the Kinect.

At the beginning, when I ran the sample program NiViewer from the OpenNI libaray, I got the following error:

Open failed: failed to set USB interface.

I found the solution on OpenNI Google group discussion. You need to remove the gspca_kinect kernel module that comes with the upgrade by doing:
rmmod gspca_kinect
It seems to work even though it says "cann't find the module gspca_kinect". However, every time you restart the computer or replugin the Kinect USB, the module will be loaded again. To permanently remove the module, you can change the name of the module file:
sudo mv /lib/modules/3.0.0-12-generic/kernel/drivers/media/video/gspca/
gspca_kinect.ko /lib/modules/3.0.0-12-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko.BAK

A better way may be blacklisting the module as suggested by this post. In this way, even after a kernel upgrade, the module will not be loaded.
$sudo gedit /etc/modprobe.d/blacklist.conf
Then add the following line to the end of the file and reboot:
blacklist gspcs_kinect

After this, the program could run, but I only got the RGB image data and the depth image was blank. Someone find out that this is due to the wrong use of memcpy in the OpenNI library. The line of code that causes the problem is in "/Source/OpenNI/Linux-x86/XnUSBLinux-x86.cpp" function "XN_THREAD_PROC xnUSBReadThreadMain(XN_THREAD_PARAM pThreadParam)" around line 1057. Instead of using memcpy, it should be:
memmove(pTransfer->buffer + nTotalBytes, pBuffer, pPacket->actual_length);
The difference between memcpy and memmove is that with memcpy, the destination cannot overlap the source at all, while with memmove, it can. For example, memcpy might always copy addresses from low to high. If the destination overlaps after the source, this means some addresses will be overwritten before copied. memmove would detect this and copy in the other direction - from high to low - in this case. However, checking this and switching to another (possibly less efficient) algorithm takes time.

The previous version of memcpy in libc6 may not make the difference so distinct, but in the new updated version of libc6 version 2.13, it might copy memory backward in some conditions, which causes issues if the source and destination overlap. You can read more about the changes in the new version in "/usr/share/doc/libc6/NEWS.Debian.gz".

Tuesday, 4 October 2011

Desktop Recorder for Ubuntu and Conversion

A good desktop recording software for Ubuntu is gtk-recordMyDesktop. Installation and usage instructions can be found here. To select a portion of the desktop to record, click Select Window button. Next click the mouse, hold and drag to select the portion in the preview window (note you don't do this on the actual desktop). It may be easier to instead right-click on the red circle in the system tray and click Select Area On Screen. In this way, you can select the portion actually on the desktop.

The video produced is in .ogv format. To convert the video format, you can use mencoder. You can install it using the command:
$ sudo apt-get install mencoder
To convert the recorded out.ogv file to recorded.avi of AVI format, you can use the following command:
$ mencoder out.ogv -o recorded.avi -oac mp3lame -ovc lavc
-ovc sets the video encoder. lavc refers to libavcodec.

Saturday, 27 August 2011

Remote Accessing Ubuntu Desktop

Today my Macbook Pro didn't boot up with stripes on the initial gray screen. I took it to the Apple Store and the technician told me that it is a specific failure on the Main Logic Board. However the replacement is covered even thought it is already out of warranty, so I don't need to pay anything for the replacement. :D

But I'll be without my laptop for 5-7 days. :( I have a Chrome notebook with Ubuntu installed on it, but I'm afraid it's going to be laggy if I run Eclipse on it, so I looked into remote accessing my desktop in my lab. I tried the default Remote Desktop Viewer application that came with Ubuntu, but it didn't work: my notebook doesn't refresh the screen after I clicked something on the remote display. I also tried the guide on using x11vnc, but was also out of luck. I used TightVNC's vncviewer. It asked for a password and I wasn't sure what password to use. I tried a few, but all failed.

Finally, I installed the NX free edition and client and it works pretty well. The installation and configuration are very easy too.

Wednesday, 22 June 2011

Adding printers at CSAIL on Ubuntu

1. Go to Printing and click "Add".
2. Under Network Printer, choose LPD/LPR Host or Printer.
Host: cups.csail.mit.edu
Queue: [Printer Queue Name] (i.e. xerox2)
3. Choose the option to provide the driver yourself. You can download the driver here.

Friday, 20 May 2011

Recovering grub boot-loader after installing Windows

Installing Windows after Ubuntu will wipe out the boot-loader. To recover the boot-loader, follow the instructions here:
https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

This worked great for me, except once. After doing the steps in that website, it directly booted into Ubuntu without listing Windows. Then I typed the following command, and it worked:
$ sudo update-grub

Wednesday, 18 May 2011

4-Projector Display under Ubuntu 11.04

For my tabletop interaction research project, I need to create a large extended display with 4 projectors in a 2x2 configuration. I could not make all 4 projectors to display at the same time with the original 2 Nvidia GeForce 8600GT graphics cards. Turns out it is especially hard to do this, if not impossible. Also, the Nvidia cards are kind of old, so I switched to a new graphics card, ATI Radeon HD 6870 with two DVI ports, 2 Mini DisplayPorts and 1 HDMI port.

After connecting the projectors to the 2 DVI ports and 2 Mini DisplayPorts, all 4 projectors can display now, however the displayed areas are not well-aligned as before. Specifically, the two displays from the projectors connected to the DVI ports are smaller with black area around them.

The problem is with underscan. The Catalyst Control Center does have the underscan and overscan option for HDMI but it doesn't always show up. It is supposed to be under "Display Manager" -> <a particular projector/monitor> -> Adjustment, but the "Adjustment" tab does not always appear. For me, it appears for one projector and I changed the scaling to 0% underscan. This did expand the displayed area for that projector. But I couldn't do the same for the other projector.

Finally, what worked is using the command line to disable underscan:
sudo aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0

Monday, 18 April 2011

Setting permissions of a Windows partition in Ubuntu

My Windows partition is in NTFS format which does not support chmod or chown for changing file permissions and ownership. These are set at the time of mounting. If I click the partition icon to mount it, the default permission does not allow execution. To change the mount settings, you need to edit the /ect/fstab file which is a system configuration file and is used to tell the Linux kernel which partitions (file systems) to mount and where on the file system tree.

Here is an example of a configuration to add to the fstab file:
/dev/sda4 /media/WinData ntfs uid=<user_name>,exec,fmask=037,dmask=027 0 0

fmask and dmask change the permissions of files and directories respectively. The numbers represent the permissions to turn off, and  4, 2, 1 represents read, write and execute respectively.

After setting this, the partition needs to be mounted by root using mount command line.

For more details, see this post: http://ubuntuforums.org/showthread.php?t=283131

Tuesday, 22 March 2011

Change primary display in Ubuntu 10.10

My desktop at my office doesn't use NVidia graphics card, but uses ATI Radeon. So I don't have the monitor setting application from NVidia I usually use for my laptop. So I searched a bit, and found a way to do it through command line.

The command to use is xrandr. It is the command line interface to the RandR X extension which is used to configure which display ports are enabled, and to configure display modes and properties such as orientation, reflection and DPI.

Usage:
# To query what screens are connected, type the following:
$ xrandr -q
# Using the name of the output from the query, you can set 
# a display output as the primary display:
$ xrandr --output CRT2 --primary
To make this run at the startup, go to System=>Preferences=>Startup Applications
Click Add
Name: XRANDR
Command: xrandr --output CRT2 --primary
Source: http://www.thinkwiki.org/wiki/Xorg_RandR_1.2