Näytetään tekstit, joissa on tunniste Linux. Näytä kaikki tekstit
Näytetään tekstit, joissa on tunniste Linux. Näytä kaikki tekstit

sunnuntai 15. maaliskuuta 2015

Installing Ubuntu 15.04 on Surface Pro 3

UPDATE: see my experiences with release version from http://pedanttinen.blogspot.fi/2015/08/installing-dual-boot-ubuntu-1504-on.html

Here's my experiences on installing Ubuntu 15.04 from daily build. This is not the official release version try out!

By following these instructions, you get Ubuntu 15.04 installed on Surface Pro 3, but at least at the moment everything does not work right. The older instructions based on 14.10 do not help to overcome the issues.

I'm using Surface Pro 3 i5/256GB/8GB version. I wanted to keep pre-installed Windows 8.1 as secondary operating system, because Ubuntu still has many known issues. So, I'm creating a dual boot setup.

Before installingn Linux, you have to make some space for it. I used Windows tools to reduce the partition size. I left 50GB for Windows partition, which means that there's about 20GB of free space before anything else than default software has been installed.

Reducing Windows partition size

  1. Start diskmgmt.msc tool
  2. Try to reduce the size of the Windows partition
  3. In my case, I had to remove Bitlocker from the Windows partition before I was able to reduce the size

Booting from USB stick

  1. Remove secure boot. Shutdown Surface and restart it by first holding down volume up button and then the power button.
  2. Disable secure boot.
  3. Shutdown Surface
  4. Start Surface by holding volume down button and then power button

Install Ubuntu 15.04

  1. To speed up installation process, do not let installer to access internet
  2. During installation, choose manual partitioning
  3. I created the following partitions 
    1. Primary 30GB for root (the / mount point)
    2. Primary (actually not sure whether you can choose between logical and primary for swap) 8GB swap
    3. Primary partition for /home with rest of the space
  4. I installed Linux boot loader on /dev/sda. Many posts in internet say that it would be better to install it on the Windows EFI partition i.e. /dev/sda2, but I got it working this way, so I cannot tell whether it's a good idea or not
  5. After installation is ready, boot Surface and you will end up back in Windows. Ubuntu is nowhere to find
  6. To fix the problem, you have to use boot-repair tool
    1. To run boot-repair, boot Linux from USB stick and run the following commands in shell (these instructions are based on the official guide: https://help.ubuntu.com/community/Boot-Repair)
      1. sudo add-apt-repository ppa:yannubuntu/boot-repair
      2. sudo apt-get update
      3. sudo apt-get install -y boot-repair && boot-repair
      4. Accept default recommended repair
      5. Remember to note down the link boot-repair is giving you
      6. Check the last lines generated by the tool, because they are needed later
    2. Most likely because my Ubuntu 15.04 is from daily build, I wasn't able to execute the boot-repair tool from Ubuntu 15.04 USB stick, so I had to use 14.04 Ubuntu to do this. Since Ubuntu 14.04 does not support Surface type cover keyboard out-of.the-box, you have to use the Ubuntu's default virtual keyboard Onboard, which you can access from the application menu.
  7. After reboot, you still end up in Windows automatically. To make GRUB 2 working, you have to go to Windows CMD as administrator and then execute the command boot-repair tool gave you in the end of its generated output. Most likely it's the one below
    1. bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi
  8. Shutdown the system and boot by pressing volume up + power button. Enable secure boot (if you don't enable it, Surface will keep on booting to Windows)
  9. Now after reboot, GRUB 2 should show you the menus for selecting Windows or Ubuntu dual boot.
  10. At this point, I made Windows my default boot option
    1. Boot to Linux
    2. sudo vi /etc/default/grub
    3. Change line with GRUB_DEFAULT=0 to GRUB_DEFAULT=2 (you can calculate the correct number by checking which line in boot menu has Windows. Indexing starts from 0). Save changes.
    4. sudo update-grub
    5. Next time Windows will be selected automatically, if user does not select anything else in the boot menu
  11. It's worth to notice that if you don't have type cover attached to Surface during boot, you can still use on-screen keyboard to select the right operating system from boot menu. Nice!

What works and what doesn't

Working out-of-the-box
  • Type cover
  • Surface pen as a mouse / pointing device (buttons do not work however)
  • Touch screen (sometimes stops working for a while and has some strange behaviour at times)
  • WLAN
  • Bluetooth
Not working out-of-the-box
  • Cameras
  • Touch pad
  • Ubuntu does not recognize that it's running on laptop with battery. At least the desktop software cannot show the state of the batter
The biggest problems in running Ubuntu 15.04 on Surface at the moment is the lack of touch pad support. It would be nice also to get the touch screen working without random problems. I will keep on using Windows as long as I'm not able to solve the touch pad issue. Otherwise the system seems to run ok.

lauantai 24. toukokuuta 2014

How to make Ubuntu play music over bluetooth

After installing latest Ubuntu version 14.04 (Trusty Tahr) I found out by accident that Ubuntu is able to play music from bluetooth source. Here's how it works on my laptop (Sony Vaio VPCEA2S1E, perhaps there's differences in the bluetooth adapters?).

Check has PulseAudio already loaded module-bluetooth-discover.
$ pactl list | grep -i module-bluetooth-discover

If this command does not return anything, you should load the module with the following command.
$ pactl load-module module-bluetooth-discover

Now the first command shows that the module is loaded.
$ pactl list | grep -i module-bluetooth-discover
Name: module-bluetooth-discover

After executing the command, you should be able to add your for example your phone as the source of audio. In my Windows Phone Lumia 1020, I navigate to Settings -> Accessories -> add using bluetooth. If you have music playing on your phone and you connect to your Ubuntu via bluetooth, your phone will show text connected music. And the music is coming out of your computer's speakers!

I also discovered that in the latest Ubuntu version my bluetooth keyboard Logitech diNovo Edge settings have to be adjusted manually. The mouse pointer does not move fast enough when using keyboard's touchpad. In the previous version Ubuntu 12.04 I was able to set the speed and acceleration of pointer fast enough from System Settings UI. In 14.04, I cannot. However, it's easy to change the acceleration and speed of pointer from command line. Here's the command.
$ xset m 3 1

All in all, I'm very happy with the latest Ubuntu release!

perjantai 25. toukokuuta 2012

Encrypting SWAP partition and taking previously encrypted home partition into use

Due to my personal Ubuntu release update process, I have to configure encryption of my boot and home partition manually every now and then. Because I do this regularly, I'm documenting my process here in my blog...

Here's my Ubuntu release update process.
  1. Make Ubuntu installation program to format the partition that held the previous Ubuntu version
  2. Format and configure existing boot partition as the new boot partition
  3. Configure existing swap partition as the new swap partition
  4. Install Ubuntu normally without dedicated home partition
After installation, my encrypted home partition is not accessible anymore, because it was not configured as part of the installation process. I haven't been able to configure either normal installer or alternative installer to take previously encrypted partitions into use. So, it has to be done after installation.

After installation has finished, install cryptsetup.

$ sudo apt-get install cryptsetup

Then configure /etc/fstab file by adding configuration for swap and home. For example.

/dev/mapper/sda7_crypt /home           ext4    defaults        0       2
/dev/mapper/sda5_crypt none            swap    sw              0       0

The actual values depend on your hard disk partitioning. Here's example from my laptop.

$ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7250e0b9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    24588287    12293120   27  Hidden NTFS WinRE
/dev/sda2        24588288    24793087      102400    7  HPFS/NTFS/exFAT
/dev/sda3   *    24793088    26746879      976896   83  Linux
/dev/sda4        26748926   976773119   475012097    5  Extended
/dev/sda5        26748928    34559999     3905536   82  Linux swap / Solaris
/dev/sda6        34562048   132216831    48827392   83  Linux
/dev/sda7       132218880   976773119   422277120   83  Linux

The next step is to configure /etc/crypttab by adding appropriate encryption setup. In my case it looks like this.

sda5_crypt /dev/sda5 /dev/urandom cipher=aes-cbc-essiv:sha256,size=256,swap
sda7_crypt UUID=5a9c38c3-2aa9-433b-9efd-c0e9357d0811 none luks

The swap partition setup is "universal" and it should work on any computer (of course the correct partition may differ from this example). The swap is encrypted with a key that is randomly generated on each system startup.

For the home partition you have to know the UUID of the partition. Here's one way to find it.

$ sudo blkid 
/dev/sda1: LABEL="Recovery" UUID="78F82CACF82C6A98" TYPE="ntfs" 
/dev/sda2: LABEL="System Reserved" UUID="62ACA8E6ACA8B5C7" TYPE="ntfs" 
/dev/sda3: UUID="7d526d52-018a-4b0c-9e26-64f1143cf0da" TYPE="ext4" 
/dev/sda5: UUID="0d0178b1-ade5-416f-8535-82455a8febd5" TYPE="swap" 
/dev/sda6: UUID="b0d7a0b7-0bb8-4cf9-978a-f7c6ebb2126f" TYPE="ext4" 
/dev/sda7: UUID="5a9c38c3-2aa9-433b-9efd-c0e9357d0811" TYPE="crypto_LUKS" 
/dev/sdb1: LABEL="siirtoNTFS" UUID="494640E516B11A6B" TYPE="ntfs" 
/dev/sdb2: LABEL="siirto" UUID="570857a6-4ab3-4d4b-99a2-88d383d3e588" TYPE="ext4" 

With this configuration, the system should ask for home partition's encryption key during system startup and everything should work as before.