31 January 2013

ChrUbuntu: VirtualBox *with* KVM extensions on an Acer C7 Chromebook

tl;dr: ubuntu-kernel-for-acer-c7.sh. Works for Ubuntu 12.04 and Ubuntu 12.10.

I followed Jay Lee's instructions and installed ChrUbuntu on my Acer C7 Chromebook, after having upgraded the RAM and replaced the hard drive with an SSD.

Out of curiosity, I ran the command kvm-ok, which reported that the machine was able to make use of the KVM extensions:


Then I proceed to install VirtualBox itself. Part of the installation process involves compiling and installing the host kernel modules. The process failed because no suitable kernel headers could be found on the system.

I then followed olofg's instructions in order to create Ubuntu packages for linux-image and linux-headers. The process finished successfully, but now kvm-ok reported that KVM extensions were not supported on the system.

It turns out that by adding the parameter disablevmx=offto the kernel command line, the KVM extensions are supported.

I've compiled a shell script, based on olofg's instructions  which updates the boot partition with a KVM-enabled kernel, and installs the generated Ubuntu kernel packages (kernel image and headers), so that compiling VirtualBox kernel modules is possible:

30 comments:

  1. Thanks!!!! thanks!!! Now it's possible run Virtualbox software.

    Thanks!!!

    ReplyDelete
  2. After running the script, during reboot it now says it can't find a patch for Atheros chip and then indicates Bluetooth can't be enabled before booting so quick I can't makeout what file it's complaining about. The system is working and I have kernel-headers...just no more Bluetooth :(

    ReplyDelete
  3. @Anonymous: I normally don't use Bluetooth devices on the Acer, so I haven't had the chance to address that :( I'll have a look in the next days.

    ReplyDelete
  4. Hi, yeah the C7 has both USB3 and Bluetooth3 ...there are many reviews out there claiming the contrary, so I have to presume some of the early prototypes or perhaps the first shipment had USB2 and no Bluetooth.

    ReplyDelete
  5. Bootup errors are:

    Bluetooth: Patch file not found ar3k/AthrBT_0x11020000.dfu
    Bluetooth: Loading patch file failed

    and after bootup the Bluetooth icon is no longer illuminated in the top bar on Unity

    Apparently, since at least January, they've been shipping the mainboard in the C710-2847 that was just announced in the new model that is $80 more expensive (but comes with an extra 2GB RAM and larger battery). Those new features are USB3, Bluetooth3, etc.

    ReplyDelete
  6. It turns out this is a bug in Ubuntu 12.04 (#1024884) which the ChrUbuntu guys apparently worked around but which is reset when reloading the fresh kernel with this script. After your script runs, Bluetooth can be restored by doing this in a Terminal window:

    user@ChrUbuntu~$ cd /lib/firmware/ar3k
    user@ChrUbuntu~$ sudo wget https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1024884/+attachment/3244421/+files/AthrBT_0x11020000.dfu
    Password:
    user@ChrUbuntu~$ sudo wget https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1024884/+attachment/3244422/+files/ramps_0x11020000_40.dfu
    user@ChrUbuntu~$ sudo reboot

    After the system comes back, you'll find the Bluetooth icon illuminated again in the top bar on Unity and/or you can go to the Bluetooth panel in the System Settings. Some models of C7 might not have the AR3K chip so these directions might not do anything useful (but shouldn't hurt). Hopefully they can be incorporated into the above script.

    ReplyDelete
  7. Thank you for this - great work. However, doesn't seem to get virtual box or vmware working on my chrubuntu. I have the model just before they upgraded ram etc, c710-2847. While the compiled kernel seems to work fine, the vmmon and vmnet extensions (vmware) and the extensions for virtualbox fail to compile. I will try to post the respective information later when I'm running the netbook... but I'm at 12.10 (with the 3.4). I'm also trying to get the 3.8.3 kernel loaded up with the "drivers" needed for this machine - that may fix my problem as well...

    ReplyDelete
    Replies
    1. VMware Player 5.02 or VMware Workstation 9 install like butter after the script on 12.04 (just follow the standard instructions for Ubuntu); however, when they launch, they fail to detect hardware accelerated graphics or 3D drivers. Also, the sound is crackly/unusable.

      Delete
  8. I updated the script for kernel 3.8 running on Acer C7 Chrubuntu 13.04

    https://gist.github.com/Computertechgurus/5565382

    ReplyDelete
  9. The above script from NYC Tech Wizards works great to get VirtualBox going in 13.04. However, the display won't wake up after suspend with the new kernel.

    I found what looked like promising information here:
    http://cgit.freedesktop.org/~danvet/drm-intel/commit/?h=drm-intel-nightly&id=cf0a6584aa6d382f802f2c3cacac23ccbccde0cd

    I tried porting these changes nto the 3.8.0 kernel source that the script loads into kernel-next and then re-ran the script to build with my modified intel_panel.c.

    $ diff intel_panel.orig intel_panel.c
    324,325c324,330
    < if (dev_priv->backlight_enabled)
    < intel_panel_actually_set_backlight(dev, level);
    ---
    >
    > // Mod to attempt to fix unable to wake up screen from sleep
    > // remove the conditional and hard-set it
    > dev_priv->backlight_enabled = true;
    > // if (dev_priv->backlight_enabled)
    > intel_panel_actually_set_backlight(dev, level);
    >
    397,402c402,410
    < /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
    < * BLC_PWM_CPU_CTL may be cleared to zero automatically when these
    < * registers are set.
    < */
    < dev_priv->backlight_enabled = true;
    < intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
    ---
    > // mods below to fix display unable to wake up from sleep issue
    > /* Check the current backlight level and try to set again if it's zero.
    > * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically
    > * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written.
    > */
    > // dev_priv->backlight_enabled = true;
    > // intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
    > if (!intel_panel_get_backlight(dev))
    > intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);


    Unfortunately this doesn't seem to fix the suspend issue. It doesn't seem to break anything either, so I am going to stick with it.

    Any clues on how best to fix the suspend/backlight (?) issue on a C7 (i915)?

    ReplyDelete
  10. Note that a commit on 5/17 requires a gcc with the -fstack-protector-strong flag, which even Raring's doesn't have. You'll have to manually back out the patch to arch/x86/Makefile by changing the line defining the flag to read "-fstack-protector" (line 85) or just revert the diff from the github

    ReplyDelete
    Replies
    1. For -fstack-protector errors, I added

      s/CONFIG_CC_STACKPROTECTOR=y/CONFIG_CC_STACKPROTECTOR=n/

      to the sed command patching config.

      I found a few other problems (still am trying to get the script to run to completion and build the kernel, so I could run into other issues soon)

      1. Apparently, /dev/sda3 is only one of the candidate partitions, I guess ChromeOS alternates between /dev/sda3 and /dev/sda5 (ROOT-A and ROOT-B). In my case, /dev/sda3 did not mount, complaining that it couldn't find a filesystem there. /dev/sda5 mounted successfully.

      2. Minor: the script keeps plugging ahead on errors. Adding 'set -e' causes it to quit if a step fails.

      3. Minor: If you try to re-run it (after a failure), 'git clone' can complain when it finds the kernel directory from the previous run's 'git clone'. I added a simple check to skip the clone if the kernel directory exists.

      Delete
  11. after sorting out the fstack-protector flag, the 3.8 script still fails with thi:


    + vbutil_kernel --verify /dev/sda6 --verbose
    + tail -1
    + sed -e s/$/ disablevmx=off/ /config-2013-05-22-2259-orig.txt
    + vbutil_kernel --pack /newkernel --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/config-2013-05-22-2259.txt --vmlinuz /boot/vmlinuz-3.8.0 --arch x86_64
    ERROR: Error reading kernel file.
    + vbutil_kernel --verify /newkernel
    ERROR: Unable to stat /newkernel: No such file or directory
    + dd if=/newkernel of=/dev/sda6
    dd: opening ‘/newkernel’: No such file or directory
    >>

    Is that due to the changes I made in the Makefile?

    ReplyDelete
    Replies
    1. Where is /newkernel supposed to appear from? I'm getting a failure there too. There is no /newkernel file or directory at this point in the process. Up to this, with a few workarounds for gcc compiler compatibilty (using Ubuntu 14.04 here), things seemed good.

      Delete
    2. Ah, of course, it's a different vmlinuz by now. Works when adjusted to what's in /boot.

      Delete
    3. Just a quick note, I used the 3.8 version of the script to get a kernel working on a chrubutu Acer to match the video demands of 14.04. Had to get old_bins in place, like this:

      mount -o ro /dev/sda3 /mnt
      cd /usr/bin
      cp -a /mnt/usr/bin/old_bins/ .

      And in kernel_next/Makefile comment out the halt-on-warning instruction:

      # KBUILD_CFLAGS += -Werror

      and to KBUILD_CFLAGS add:

      -fno-tree-vrp

      and ended up with a 3.8.11 kernel that's working well. The kid's Minecraft is happy again.




      Delete
    4. I am still running into issues with this. I tried the reply above, but still a no go.

      + vbutil_kernel --verify /dev/sda6 --verbose
      + tail -1
      + sed -e s/$/ disablevmx=off/ /config-2013-05-22-2259-orig.txt
      + vbutil_kernel --pack /newkernel --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/config-2013-05-22-2259.txt --vmlinuz /boot/vmlinuz-3.8.0 --arch x86_64
      ERROR: Error reading kernel file.
      + vbutil_kernel --verify /newkernel
      ERROR: Unable to stat /newkernel: No such file or directory
      + dd if=/newkernel of=/dev/sda6
      dd: opening ‘/newkernel’: No such file or directory
      >>

      Delete
  12. Hey this migh sound stupid but i dont know how to run this script? please can some one help me?

    ReplyDelete
  13. I am getting the following errors after I run these sequence of commands on the ACER C7 with 12.04LTS
    # mkdir -p /usr/share/vboot
    # mount -o ro /dev/sda3 /mnt
    # cp /mnt/usr/bin/vbutil_* /usr/bin
    # cp /mnt/usr/bin/dump_kernel_config /usr/bin
    # rsync -avz /mnt/usr/share/vboot/ /usr/share/vboot/
    # umount /mnt
    # apt-get install libc6:i386 libssl1.0.0:i386
    # apt-get install git kernel-package
    # cd /usr/src
    # git clone https://git.chromium.org/git/chromiumos/third_party/kernel.git
    # cd kernel
    # git checkout origin/chromeos-3.4
    # ./chromeos/scripts/prepareconfig chromeos-intel-pineview
    # yes "" | make oldconfig
    # make-kpkg kernel_image kernel_headers
    This is the errors I get

    make[2]: Entering directory `/usr/src/kernel'
    SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_32.h
    SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_64.h
    SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_x32.h
    SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h
    HOSTCC arch/x86/tools/relocs
    CHK include/linux/version.h
    UPD include/linux/version.h
    CHK include/generated/utsrelease.h
    UPD include/generated/utsrelease.h
    CC kernel/bounds.s
    cc1: error: unrecognized command line option '-fstack-protector-strong'

    make[3]: *** [kernel/bounds.s] Error 1
    make[2]: *** [prepare0] Error 2
    make[2]: Leaving directory `/usr/src/kernel'
    make[1]: *** [debian/stamp/conf/kernel-conf] Error 2
    make[1]: Leaving directory `/usr/src/kernel'
    make: *** [debian/stamp/conf/minimal_debian] Error 2
    Failed to create a ./debian directory: No such file or directory at /usr/bin/make-kpkg line 984.
    Please advise as I really need to be able to run VirtualBox on my Acer C7.

    Thanks for your help
    Paul Ouellette

    ReplyDelete
    Replies
    1. "Note that a commit on 5/17 requires a gcc with the -fstack-protector-strong flag, which even Raring's doesn't have. You'll have to manually back out the patch to arch/x86/Makefile by changing the line defining the flag to read "-fstack-protector" (line 85) or just revert the diff from the github"

      What he's saying is cd into /usr/src/arch/x86/ from the terminal then,
      sudo gedit makefile

      Next, replace -fstack-protector-strong with -fstack-protector

      That should fix it.

      Delete
    2. Sorry that should be:
      sudo gedit Makefile

      Delete
  14. Is this script compatible with the latest version of the Chrubuntu script (which installs 32bit Ubuntu on the C7)?

    ReplyDelete
  15. In my experience, with the Acer C710-2847, the script disables PAE and the OS can no longer access my upgraded ram (16GB total). Looking at the way the guys changed the script for 13.04 I'd assume that there's a way to tweak the script to use the PAE version of the kernel. Anyone have any suggestions? They would be greatly appreciated. Also, seeing as VTx is disabled on the C710-2847, is anyone aware of a work around that allows virtual machines to be run on the system?

    ReplyDelete
    Replies
    1. Did you ever figure out how to change the script to enable PAE? I also have upgraded to 16GB of RAM and, after running the script on 13.04, Virtualbox is working but System Monitor says there is only 2.7GB of RAM available...

      Delete
  16. Hello everyone I have a problem, last script aparese me this:

    vbutil_kernel - verify / dev/sda6 - verbose
    futility failed to exec / usr / bin / old_bins / vbutil_kernel: No such file or directory
    + Sed-es / $ / disablevmx = off / / config-2013-10-11-1538-orig.txt
    + Vbutil_kernel - pack / newkernel - keyblock / usr / share / Vboot / devkeys / kernel.keyblock - version 1 - signprivate / usr / share / Vboot / devkeys / kernel_data_key.vbprivk - config = / config-2013-10-11-1538.txt - vmlinuz / boot/vmlinuz-3.4.0 - arch x86_64
    futility failed to exec / usr / bin / old_bins / vbutil_kernel: No such file or directory
    + Vbutil_kernel - verify / newkernel
    futility failed to exec / usr / bin / old_bins / vbutil_kernel: No such file or directory
    + Dd if = / newkernel of = / dev/sda6
    dd: opening '/ newkernel': No such file or directory

    at the end practically saying there is no file or directory indicacarme someone could do this properly as the??

    ReplyDelete
  17. Have a look at
    http://www.reddit.com/r/chrubuntu/comments/1e7gjs/i_need_help_compiling_kernel_modules_eg/cay5tx8
    as there's a fix for this there - you need to copy the old_bin directory from the /mnt created at the start of this script.

    Also, if you're targeting a 32 bit build, you don't want the --arch parameter. It defaults to x86.

    ReplyDelete
    Replies
    1. Thanks everyone for the great information. I'm still stuck on the same problem as David A above.

      Can someone explain in detail how to complete the fix described on Reddit and by Howard T? I'm new to this and would appreciate the for dummies instruction.

      Delete
  18. This script here is much easier to use, and it only downloads 100 kB for the linux-headers.
    There may be some errors but you should get the general idea.
    http://goo.gl/TNRMjK

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. Ok, I have Ubuntu 14.04 too, when I ran the script I gave this error and I have not idea about what went wrong, anyone can tell me some clues to resolve this please?

    Where can I found the sources for the .debs and why the compiler enters on loop?

    TIA
    ...
    CC kernel/seccomp.o
    CC kernel/rcutree.o
    kernel/rcutree.c: In function ‘rcu_init_one’:
    kernel/rcutree.c:2946:13: error: array subscript is above array bounds [-Werror=array-bounds]
    rsp->level[i] = rsp->level[i - 1] + rsp->levelcnt[i - 1];
    ^
    cc1: all warnings being treated as errors
    make[2]: *** [kernel/rcutree.o] Error 1
    make[1]: *** [kernel] Error 2
    make[1]: se sale del directorio «/usr/src/kernel-next»
    make: *** [debian/stamp/build/kernel] Error 2
    ++ date +%Y-%m-%d-%H%M
    + tstamp=2015-06-12-2108
    + dd if=/dev/sda6 of=/kernel-backup-2015-06-12-2108
    32768+0 registros leídos
    32768+0 registros escritos
    16777216 bytes (17 MB) copiados, 0,250529 s, 67,0 MB/s
    + cp -Rp /lib/modules/3.4.0 /lib/modules/3.4.0-backup-2015-06-12-2108
    + dpkg -i '/usr/src/linux-*.deb'
    dpkg: error al procesar el archivo /usr/src/linux-*.deb (--install):
    no se puede acceder al archivo: No existe el archivo o el directorio
    Se encontraron errores al procesar:
    /usr/src/linux-*.deb
    + vbutil_kernel --verify /dev/sda6 --verbose
    + tail -1
    + sed -e 's/$/ disablevmx=off/' /config-2015-06-12-2108-orig.txt
    + vbutil_kernel --pack /newkernel --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/config-2015-06-12-2108.txt --vmlinuz /boot/vmlinuz-3.8.0 --arch x86_64
    ERROR: Error reading kernel file.
    + vbutil_kernel --verify /newkernel
    ERROR: Unable to stat /newkernel: No such file or directory
    + dd if=/newkernel of=/dev/sda6
    dd: No se puede abrir «/newkernel»: No existe el archivo o el directorio
    ...

    ReplyDelete