Friday, June 14, 2013

Set compose key in Xfce

General help can be found on this article on Compose key. It didn't work for me however in Xfce.

The command
setxkbmap -option compose:lwin
works perfectly however. After this, I can for instance type the inverted question mark by pressing the left Windows key, releasing it, and then typing 2 normal question marks.

To make the command run at every startup, I did the following.
Make a file "setcomposekey.sh", put the following text in it:
#!/bin/sh
setxkbmap -option compose:lwin
echo "Compose key set to left Windows key."
sleep 2
and save the file where you can find it afterwards.

Then, in a terminal, navigate to the directory where you saved it, and type the command:
chmod +x ./setcomposekey.sh
to make it executable.
Now, go to Xfce "Applications Menu", choose "Settings" -> "Session and Startup", tab "Application Autostart", and add your little script to the programs to run at startup.

BTW, you have to do this for every user (login as that user and do the same routine).

Disable screen saver in Xfce

Regardless of my screensaver settings in Xfce, even if I disable it completely and power management with it, my screen still goes blank after 10 minutes. (I installed regular Ubuntu 12.04.2 LTS and then Xfce, not Xubuntu).

Before messing with xorg.conf, first back it up:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.orig

A. What DIDN'T work

So, to try to resolve this, I tried the following, but it didn't work.

1) First NOT working solution

I found it in this post.
"This isn't the screensaver's issue. It is actually Xorg's default settings.
Add these lines in your xorg.conf (which is located in /etc/X11/xorg.conf and you must edit the file as superuser).

CODE: SELECT ALL
Section "ServerFlags"
   Option "BlankTime"   "0"
   Option "StandbyTime" "0"
   Option "SuspendTime" "0"
   Option "OffTime"     "0"
   Option "DontZap" "false"
EndSection

So, no luck with this. It didn't have any effect at all.

2) Second NOT WORKING solution

Then I tried adding a "NODPMS" option in xorg.conf (see this post). Didn't work either. That actually broke my system, had to boot from live USB, delete the modified xorg.conf and revert to a copy of my original xorg.conf (which luckily I had backed up, see top of this post).

3) Third NOT WORKING solution

Then I removed the gnome-screensaver package using synaptic. Didn't work. Then I removed also the xscreensaver package. Didn't work either, screen still blanked after 10 minutes.

4) Fourth NOT WORKING solution

(Before editing your /etc/profile, make sure to back it up, for instance by entering in a terminal the following command: sudo cp /etc/profile /etc/profile.orig. In case something goes wrong you can login from live CD or USB, or in recovery mode, and revert back by doing the opposite command from the command line interface: sudo cp /etc/profile.orig /etc/profile, then reboot).

Add to the end of /etc/profile (edit as superuser)
xset s 0 0
xset -dpms
Reboot to make changes take effect.
(See this post, this post and this post)

B. So what the # does work????

Caffeine!! (The program, NOT the substance).


Check hard disk Ubuntu 12.04.2

- Start from live USB
- in terminal, do
sudo fsck -c -v -p /dev/sdb1
where /dev/sdb1 is the partition you need to check. Fsck does not work on disks, only on partitions, so you have to do this for every partition you want to check.
To see your partition, use gparted.

Sunday, June 2, 2013

Ubuntu 12.04 LTS on a HP Envy dv7 7390eb laptop (Windows 8 UEFI)

UPDATE 2014-07-30: Post on Ubuntu 14.04.1 here...

Here are the steps I took so far for getting Ubuntu Precise Pangolin 12.04.2 LTS to work on my HP Envy dv7 7390eb laptop. (Take care, I'm not an expert, just an average user sharing his experiences! Always back up important data before installing or tweaking!)
The laptop comes with Windows 8 UEFI pre-installed.

I have to say that, in general, Ubuntu 12.04 works pretty well out of the box on this laptop, but needs a bit of tweaking to get every detail working - still a work in progress that I intend to log here.

So...

Step 1: installing Ubuntu

Pretty straightforward, I encountered no problems. You have to do some extra steps to have a working boot manager because of the UEFI system (see further), but if you follow the instructions you should not encounter any problems.

The laptop comes with two 1 TB hard disks. Disk 1 contains Windows, Disk 2 is partitioned as "DATA". I decided to use disk 1 for Windows + Windows DATA and disk 2 for Linux.

First, from within Windows, I deleted the "DATA" partition, then shrunk the "OS" partition to make room for a new "DATA" partition on disk 1, which I then created. For instructions about all this, see for instance here or do a search on internet with keywords "Windows 8 shrink volume".
Do not create a partition on Disk 2 from within Windows, just leave it "unallocated" (free) and reboot on your Linux Live USB. Linux will take care of everything.

Then just do a standard Ubuntu "install alongside Windows" automatic install (see general installation instructions via the links on the Ubuntu page), then follow the steps outlined in "Installing Ubuntu Quickly and Easily via Trial and Error" on the UEFI-page of help.ubuntu.com. You will have to restart from Live-USB and do a boot-repair, it's all explained on the pages I mentioned.

To install Ubuntu from live USB I did not have to disable SecureBoot; however once installed and the boot-repair executed (as outlined on the Ubuntu UEFI page, see above link), I had to disable it to be able to boot into Windows. Weird, but true. So I just keep SecureBoot disabled for the moment, although with Linux it does work. 

After the install I decided I wanted a bigger swap in linux. Default installed is 16GB, same as RAM and I wanted double for extra safety so as to be sure that suspend would work. This may or may not be necessary or a good idea, but it's what I did and it seems to work. Apparently I could have just installed a swap file - more info and detailed instructions on the SwapFaq page of Ubuntu help.
I didn't write down the steps I took, but, from memory, I did the following.  
  • rebooted with live-USB, 
  • ran Gparted, 
  • right-click on swap partition (16GB at this moment) -> swapoff
  • right-click on swap partition -> delete
  • apply
  • right-click on main linux partition -> resize to about 17 GB less
  • apply
  • new unallocated space is 32 GB, right-click on it -> new -> extended
  • right-click in extended partition -> new, choose type "linux-swap"
  • apply
Now boot into your installed linux (on hard drive) and
  • run Gparted (install first if necessary)
  • right-click on swap partition -> swapon
  • then follow instructions here (chapter "How do I add more swap") to edit /etc/fstab.
I did get an error message on first reboot after the Live-USB, probably because I did "swapon" from within the LiveUSB without editing /etc/fstab, but it didn't cause any further problems, and I never got it again. Which makes sense, as I edited /etc/fstab.

Step 2: adding TLP and Bumblebee

TLP is a tool that runs in the background to optimize battery-life. See installation instructions on the TLP-homepage.

Bumblebee is a package that enables NVIDIA Optimus in Linux. This laptop comes with two graphics cards, one that uses little power but is not very good for 3D, and another one (NVidia) that is a lot better for 3D but consumes more power and generates more heat. The Nvidia Optimus technology is designed to optimize battery life by disabling the NVidia card when not necessary. After installing Bumblebee, if I understand correctly, the default card used is the "simple" one (not Nvidia), unless you start the program in question in a terminal and put "optirun" in front of the program name (see the Bumblebee wiki for all details). More info on the Bumblebee homepage, installation instructions here.
I tested running "glxspheres" and "optirun glxspheres" and there was indeed a notable difference in performance.

Step 3: Wifi

Wifi actually works out of the box (kind of) but you may need to have a look at this thread here to get it up and running. Basically I have to use the command
sudo rfkill unblock all 
at every boot to activate the device, after this I can turn on or off the wifi and bluetooth using the net applet. I also installed wifi-radar.

Step 4: get Beats Audio working

Learning from this thread, I did in a terminal:
gksudo gedit /etc/modprobe.d/alsa-base.conf
and added the following line at the bottom:
options snd-hda-intel model=ref
Save the file. Then reboot, not perfect, but sounds better.

Step 5: non-free codecs / Playing encrypted DVDs

The prime source of information is here: RestrictedFormats/Playing DVDs on Ubuntu help.

What I did was:
Go to medibuntu.org, follow instructions and install especially the lib- and non-free-packages. I installed them almost all. Reboot.
At first I still got error messages when trying to play a certain DVD (Ironman 2 in my case - great movie by the way).
Then I used regionset to set the region of my DVD-player to 2 (Europe). Reboot.
The DVD played, but garbled. Finally I deleted the ~/.dvdcss/ folder (I opened my home folder as root in Thunar), rebooted, and then everything worked.


If you appreciated this article for some reason or another, please share it (see the buttons below), and, of course, don't forget to Flattr! (Why?)