Tag: ubuntu

Installing Ubuntu on an Acer C720P chromebook

There is a lot of information available regarding installation of single-boot Ubuntu on an Acer C720P but here I’m posting what works for me in Jan 2017.

I am not going to explain how to prepare the Chromebook for  installation of Ubuntu, I’m just posting notes on certain configurations that work for me:

Basic hardware functionality

  1. Elantech touchpad: the newest kernels recognize the touchpad perfectly (>= 4.8). Previously, only the GalliumOS kernel made the touchpad usable for me.
    1. Download the amd64 kernel from here and install: http://kernel.ubuntu.com/~kernel-ppa/mainline/
    2. For example, for 4.9, you need to download   linux-headers-4.9.0-040900_4.9.0-040900.201612111631_all.deb
      linux-headers-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb
      linux-image-4.9.0-040900-generic_4.9.0-040900.201612111631_amd64.deb
    3. Install using dpkg -i linux-*.deb
  2. Touchscreen: works with any kernel.
  3. Microphone: does not work
  4. Speakers: work with any kernel

Enabling keyboard functions and keys

  1. Install programs to control brightness and map keys:
    1. apt-get install xbindkeys xdotool xbacklight
    2. create ~/.xbindkeysrc with these contents to map keys (customize to your needs)
      "xdotool keyup F1; xdotool key alt+Left"
      F1
      "xdotool keyup F2; xdotool key alt+Right"
      F2
      "xdotool keyup F3; xdotool key ctrl+r"
      F3
      "xdotool keyup F4; xdotool key F11"
      F4
      "xdotool keyup F5; gnome-screenshot -f $HOME/Pictures/Screenshot_$(date +%F_%T).png"
      F5
      "xdotool keyup F6; xbacklight -dec 3"
      F6
      "xdotool keyup F7; xbacklight -inc 3"
      F7
      "xdotool keyup F8; pactl set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo toggle"
      F8
      #"xdotool keyup F9; pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo -10%"
      "xdotool keyup F9; amixer -D pulse sset Master 5%-"
      F9
      #"xdotool keyup F10; pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +10%"
      "xdotool keyup F10; amixer -D pulse sset Master 5%+"
      F10
      
      "xdotool keyup control+shift+Down Arrow; xdotool key Page_Down; xdotool keydown shift"
      control+shift+Down Arrow
      
      "xdotool keyup control+shift+Up Arrow; xdotool key Page_Up"
      control+shift+Up Arrow
      
      "xdotool keyup control+shift+Left Arrow; xdotool key Home"
      control+shift+Left Arrow
      
      "xdotool keyup control+shift+Right Arrow; xdotool key End"
      control+shift+Right Arrow
      
      "xdotool keyup XF86PowerOff; xdotool key Delete"
      XF86PowerOff
    3. Notice that I disable the power button and map it to Del. To shutdown the computer, I use the shutdown button in Gnome panel.

Using a lightweight Desktop (Openbox):

  1. Even Gnome 2 uses too much memory for my likings. Openbox uses < 350 MB idle and Gnome ~ 600 MB idle. 250 MB in a 2 GB system is a lot for me. With Openbox I get a light Gnome-like desktop.
  1. Install Openbox:
    sudo apt-get install openbox
  2. Install gnome-session-fallback:
    1. sudo apt-get install gnome-session-fallback
    2. I use some Gnome applications.
    3. Also, Chromebooks don’t have a “Super” key, which is required in Openbox to add buttons to gnome-panel. In Gnome, you can add buttons by clicking the right mouse button and Alt only. So I login to Gnome, configure gnome-panel, logout and login to Openbox.
    4. Alternatively, plug in a keyboard and click Super+Alt and the right mouse key on the Gnome panel in Openbox to add items). But this means you always depend on an external keyboard to configure Gnome panel in Openbox.
  3. Install volti to control the sound volume. Gnome’s won’t work:
    sudo apt-get install volti
  4. Configure gnome-panel. The native Gnome indicator applet won’t work in Openbox, which means no network manager, no clock, etc.To configure Gnome panel in Openbox without plugging an external keyboard: login to Gnome (metacity) and configure the gnome-panel with the mouse, adding:
    1. A custom application launcher that will be the shutdown button. Select a shutdown icon to be displayed.
      1. Create this script and configure the shutdown button in Gnome panel to call this script:
        #!/bin/bash
        gmessage "Are you sure you want to shut down your computer?" -center -title "Take action" -font "Sans bold 10" -default "Cancel" -buttons "_Cancel":1,"_Log out":2,"_Reboot":3,"_Shut down":4,"_Suspend":5 >/dev/null
        case $? in
        1)
        echo "Exit";;
        2)
        killall openbox;;
        3)
        shutdown -r now;;
        4)
        shutdown -h now;;
        5)
        pm-suspend
        esac
      2. Remove the bottom panel bar for more screen real estate.
      3. Add a window selector to the top panel bar.
      4. Add desired application shortcuts.
      5. Add a clock.
    2. Logout from Gnome and login to Openbox.
    3. In a terminal, create .config/openbox/autostart.sh
    4. Install gxmessage to show the shutdown dialog when you press the shutdown button:
      apt-get install gxmessage
    5. Configure sudoers to allow any user to shutdown:
      1. sudo visudo
      2. Insert this at the end of the file:
        %users ALL=NOPASSWD: /usr/bin/shutdown
    6. I’m still working on how to make pm-suspend work without sudo.
  5. Configure start up applications: Edit .config/openbox/autostart.sh to start several applications upon login:
    gnome-panel & # openbox has no panels, you need to start one
    volti & # sound control
    nm-applet & # for network management
    xbindkeys # for key mapping to the weird Chromebook keyboard
    xscreensaver &
    synclient ClickFinger3=2 # to enable right click on the touchpad (tap the touchpad with 2 fingers simultaneously)
    synclient TapButton3=2 # to enable pasting with the touchpad (tap the touchpad with 3 fingers simultaneously)
    earlyoom # aggressively kill programs when there's no RAM available, see below
    
  6. Enable a screensaver:
    1. gnome-screensaver doesn’t work.
    2. Install xscreensaver instead and remove gnome-screensaver:
      sudo apt-get remove gnome-screensaver
      sudo apt-get install xscreensaver
    3. run xscreensaver-demo to configure the screensaver.
  7. Backup .config/ so anytime you have to reinstall you don’t need to reconfigure Gnome panel and start up applications.

Other configurations

  1. SSD settings: configure /etc/fstab with configurations that are more gentle on your SSD: Add discard,noatime,errors=remount-ro to /dev/sda1:
    /dev/sda1   /               ext4    discard,noatime,errors=remount-ro 0       1
  2. Swap: I used to disable swap completely and let programs crash if they used too much memory. However, there seems to be a bug in 16.04 and sometimes kswapd0 runs at 100% CPU for several minutes when there’s not swap. So now I:
    1. create a very small swap (10 MB)
    2. decrease swappiness (sudo sysctl vm.swappiness=10)
    3. use earlyoom (https://github.com/rfjakob/earlyoom) to aggressively kill programs. I add it to .config/openbox/autostart

Creating a ChromeOS recovery drive using Ubuntu

The way to reinstall ChromeOS using Linux is to download a script from Google and run it.

Running sudo linux_recovery.sh failed with an error about the config file:

ERROR: The config file isn't valid.

linux_recovery.sh downloads /tmp/tmp.crosrec/config.txt which contains the URL of the image to download.

The entry for my Chromebook in /tmp/tmp.crosrec/config.txt is:

name=Acer C720 Chromebook
version=8172.62.0
desc=Acer C720 Chromebook
channel=stable-channel
hwidmatch=^PEPPY .*
hwid=
md5=a04e467b5a7727aee51c0079f4bd33cb
sha1=8cecc85e044b363f0b96e096619e24f8dfd96525
zipfilesize=585977912
file=chromeos_8172.62.0_peppy_recovery_stable-channel_mp-v2.bin
filesize=1535082496
url=https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_8172.62.0_peppy_recovery_stable-channel_mp-v2.bin.zip
/tmp/tmp.crosrec/config.txt

I downloaded the image and used dd to create the USB drive:

wget https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_8172.62.0_peppy_recovery_stable-channel_mp-v2.bin.zip
unzip chromeos_8172.62.0_peppy_recovery_stable-channel_mp-v2.bin.zip
sudo dd bs=4194304 of=/dev/sdb if=chromeos_8172.62.0_peppy_recovery_stable-channel_mp-v2.bin conv=sync

Installing Ubuntu on a Mac Pro 6,1 (late 2013) and 5,1 (mid 2010)

Thanks to many resources online I was able to install full single-boot Ubuntu on a Mac Pro that I was given at work. Normally I would not buy an unnecessarily expensive computer like this, but since it was free and it had 64 GB of RAM, I decided to keep it.

Initially, I used a third party LiveUSB creator, but later I realized that creating a regular LiveUSB works just fine. All I needed to do was boot with “nomodeset” as a boot parameter and edit the EFI bootloader.

The easiest and most functional procedure was to:

  1. Create a LiveUSB as usual, for example using Startup Disk Creator.
  2. Boot the LiveUSB (boot with option nomodeset) and install Ubuntu on a hard drive.
  3. In the Live USB, use efibootmgr to allow EFI to boot Ubuntu.
  4. Boot Ubuntu with option nomodeset.

Procedure:

  1. Create a LiveUSB Ubuntu as usual. I used Startup Disk Creator in Ubuntu.
  2. Boot Mac OS X and hold Alt while booting. You should see two icons, one saying “Macintosh HD” and another “EFI”.
  3. [Only 6,1] Press “e” and edit the boot command, adding “nomodeset”. This was only necessary on the 6,1. 5,1 booted fine without “nomodeset”.
    setparams 'Install Ubuntu Server'
        set gfxpayload=keep
        linux /install/vmlinuz file=/cdrom/preseed/ubuntu-server.seed nomodeset quiet --
        initrd /install/initrd.gz
  4. [Only 6,1] Press F10 to boot the Ubuntu LiveUSB. Skip this step if installing on 5,1.
  5. Install Ubuntu. I installed it to a USB 3.0 external hard drive because I wanted to preserve Mac OS X in case somebody else inherited this computer later. Install the bootloader on the desired device.
  6. Still in Ubuntu LiveUSB, modify EFI to boot Ubuntu. Follow the steps in this tutorial to get Ubuntu to boot in EFI mode (no need for refind). I did try to use rEFInd but while Ubuntu did boot, it couldn’t use the monitor, even setting nomodeset. Here are the commands I used:
    sudo apt-get update

    Install efibootmgr:

     sudo apt-get install efibootmgr

    Check your EFI to see what Ubuntu is called:

    sudo efibootmgr

    Set Ubuntu to boot first:

    sudo efibootmgr -o 0,80
  7. [Only 6,1] Now it should be possible to reboot and Ubuntu should present the boot screen where different kernels can be chosen. If you see that screen, add “nomodeset” to the boot parameters by pressing “e” in the boot screen. Add “nomodeset” to the end of line starting with “linux”, similarly to step 3.
  8. [Alternative to 7.] In case you don’t see the boot screen, boot the LiveUSB again. Mount the freshly installed / (replace sdc3 by the partition that contains /)
    mkdir fix
    sudo mount /dev/sdc3 fix
    cp fix/boot/grub/grub.cfg fix/boot/grub/grub.cfg.old
    sudo nano fix/boot/grub/grub.cfg

    This file shouldn’t be edited manually, but for the first boot it’s OK. Add nomodeset to the first entry so it looks like this:

    linux /boot/vmlinuz-3.19.0-66-generic.efi.signed root=UUID=242526b7-2821-473d-b0dc-9e9a48ea6364 ro nomodeset quiet splash $vt_handoff
  9. Reboot the LiveUSB Ubuntu, remove the pendrive and Ubuntu should boot normally. It does take a long time to boot and a purple screen (desktop edition) is shown for a while. Eventually it does boot to a full Ubuntu.
  10. [Only 6,1] Insert a USB WiFi adapter, update apt-get. Install Broadcom drivers to use the built-in WiFi:
    sudo apt-get install bcmwl-kernel-source
  11. [Only 6,1] After the first boot, permanently add nomodeset as a boot parameter: Edit file /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
    sudo update-grub; sudo update-grub2

The computer still boots Mac OS X. I just need to hold Alt while booting and I can choose “Macintosh HD” to boot. Not that I care about having Mac OS X there, but this way I can easily restore the computer back to its original state. I haven’t tested, but it should be a matter of using efibootmgr to reset EFI to boot Mac OS X only:

sudo efibootmgr -o 80

Note 1:

In this setup, Ubuntu is on /dev/sdb but mounts /dev/sda1 (the original Mac SSD), which contains /boot/, a vfat partition. On a Mac Pro 5,1 (late 2010), I physically removed the hard drive containing Mac OS X and installed Ubuntu to a new drive. I created a 200 MB vfat /dev/sda1 as /boot and installed Ubuntu as usual. I was able to single boot Ubuntu without any hiccups.

By the way, installation was easier than in the 6,1 because I didn’t need to use nomodeset; once I had the LiveUSB drive it was just like installing Ubuntu on a regular PC.

Note 2:

I later installed Ubuntu server. The process is the same as the one for the desktop edition.

Note 3:

Due to some bug in Xorg, when running a desktop Ubuntu on the Mac Pro 6,1 and disconnecting the VGA cable, I would get 100% CPU usage caused by kworker. The command below fixed the problem.

sudo sh -c "echo disable > /sys/firmware/acpi/interrupts/gpe16

When I removed Xorg, the problem went away and I could disconnect and connect the VGA cable without any increase in CPU activity. The server edition doesn’t present this problem.

Note 4:

I find the design of the Mac Pro the cheesiest thing ever. Apple designers: “Let’s put as many round edges as possible on this computer because round is cool, right?” No, it looks like an expensive trash can on my desk or a futuristic food processor. Tacky, tacky.

Compiz black screen

Disappointingly, Compiz didn’t run well on my Ubuntu 9.04, giving me a black screen. Of course I couldn’t undo the Compiz setting in the black screen.

To undo the setting and deactivate Compiz, you have to delete .gconf/apps/compiz/ from your home directory.

First, kill X:

Login in the command prompt by pressing Ctrl + Alt + F1. Login in this screen with your username.

sudo kill `cat /tmp/.X0-lock`

Then remove the Compiz config:

rm -rf .gconf/apps/compiz/

Press Ctrl + Alt + F7 to go back to the graphical interface. You should have your non-Compiz desktop back.

Recording video+audio with webcam (Linux)

WxCam 1.0.2 is a simple and neat application for recording video and audio with a webcam.

My webcam is a Logitech Quickcam Communicate STX that worked out of the box in my Ubuntu Linux 7.04 on a Dell Inspiron 1420N laptop.

I downloaded the .deb, installed and voilà. After quickly configuring wxcam to record compressed video in xvid (Settings -> Preferences -> Video), I was able to record video+audio while seeing what was being recorded.

Another alternative is using memcorder:

mencoder tv:// -tv driver=v4l:width=320:height=240:device=/dev/video0:forceaudio:alsa:adevice=hw.U0x46d0x8d7,0 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o $1

but the problem is that you can’t see what is being recorded. If you start Cheese, you can, but then you can’t record at the same time. WxCam does both at the same time.

URL: http://wxcam.sourceforge.net/

Installing VMplayer on Ubuntu 7.10

After upgrading the kernel to 2.6.22-15, VMware-server stopped working. The easiest solution I found was to use VMplayer, instead. However, running vmware-install.pl didn’t work, because it said that a few vmware modules were installed. I tried to remove them to no avail.

The solution is to edit the scripts vmware-install.pl and /usr/bin/vmware-config.pl, changing:

From:
if (scalar(@modules) > 0) {
To:
if (scalar(@modules) == 0) {

Credit goes to Marcelo Sales: http://ubuntuforums.org/showthread.php?t=516916

UPDATE: VMplayer runs very slowly on both my Duo 2.66 Mhz, 2 Gb RAM and Inspiron laptop. I tried VirtualBox (http://www.virtualbox.org/) and I really like it. It is much faster and lighter than VMplayer, I strongly recommend it in place of VMware software. See my post about my experience with VirtualBox here.

VirtualBox

I tried to use VMware/VMplayer to run Window$ under Linux and my experiences with it in both my laptop (Inspiron 1.66 Ghz, 2 Gb RAM) and Core Duo II (2.66 Ghz, 2 Gb RAM) were horrid.

VMplayer was very slow and took me some time to figure out how to install the network, and file sharing never worked.

Now I use Sun’s VirtualBox, which I strongly recommend:

  1. download .deb for Gusty at http://www.virtualbox.org/
  2. install with dpkg -i and that’s it. No compilation, no kernel modules, no tons of configuration.
  3. no painful registration
  4. run VirtualBox and install your OS. It allows for a resizable disk, unlike VMplayer
  5. network was recognized immediately, unlike VMplayer
  6. file sharing requires installing “Guest additions” (Devices menu in the tool bar), which is painless and quick. Then go to Devices -> Shared folders… and share your Linux folder
  7. VirtualBox (as VMplayer) deals with the mouse pointer seamlessly. Really cool.
  8. I haven’t tried to enable USB, but I’ve found recipes on the internet.
  9. I allocated 700 Mb for Window$ and I think I could use even less (unlike VMplayer)