So I've gone and bought a Magic Mouse and Apple Wireless Non-Numeric Keyboard. The magic mouse worked out-of-the-box almost perfectly, except for the forward/back gesture which still isn't functioning, whereas the keyboard didn't.

It has constant trouble with the bluetooth connection. Only the 7, 8 and 9 buttons and volume media keys correspond correctly with the output. Pressing every single key on keyboard has this output: 789/=456*123-0.+

When I use Blueman the keyboard can be setup and shows up in "Devices" but I get a warning when I click "Setup"; "Device added successfully, but failed to connect" (although removing the keyboard and setting it up as a new device doesn't incur this error).

Using gnome-bluetooth I have encountered no error messages but it connects properly less often than Blueman and I can still only type the aforementioned output.

What am I not doing? Where is this going wrong?

EDIT: I have read this http://ubuntuforums.org/showthread.php?t=224673 inside out several times to no avail. It seems these commands don't work for me with the apple peripherals sudo hidd --search hcitool scan

Fortunately I have the luxury of a 1TB hard drive, near limitless patience and no job.

I have installed a fresh Ubuntu 10.10 64bit (albeit smaller than mine) and after updating and restarting for the first time, I set up my devices in exactly the same way as I have learnt on my original install I succeeded once again with the mouse and, to my joy, with the keyboard also. Though I could not seem to find Alt+F2 and had to reconfigure that and several other keyboard shortcuts, the keyboard is working and in a spectacular fashion.

Still, this leaves me with the issue of my original install. I returned to it with some new found knowledge but failed again.

Perhaps I have a missing dependancy? I did uninstall bluetooth after the initial set up and reinstalled it recently for the pupose of these peripherals.

Maybe it's because I'm running 64bit?

This is still not solved, but easily avoided by not changing too much from the original install. Just hide stuff or turn it off, don't uninstall too much.

  • 1
    I've never had this problem, but it looks like Ubuntu is thinking your keyboard is a number pad. Only the keys which exist on a number pad are appearing in your output.
    – Jack M.
    Commented Nov 10, 2010 at 17:33
  • I'm sucessfully using that combination with the built in gnome bluetooth, without having to modify any settings. However, 50% of the time I boot my computer either the mouse or the keyboard don't connect properly. Commented Nov 10, 2010 at 17:50
  • Jack M. in my opinion I think you're on to something. Georg, I have this issue but I believe it's solvable. You have to edit some things in etc so that the peripherals start at boot or grub or whenever.
    – user3140
    Commented Nov 11, 2010 at 0:27
  • Did you try installing Ubuntu 32 bit? Curious if that could be that same issue I am having. (note: see here: askubuntu.com/questions/14236/…) I will attempt a 32 bit install with my Bluetooth issues and get back to you.
    – Nichod
    Commented Jan 23, 2011 at 0:11

4 Answers 4



Press fn-F6 twice to disable numlock. To switch numlock off permanently after log-in go to System -> Preferences -> Keyboard -> Layout -> Layout Options -> Miscellaneous compatibility options -> turn on "Default numeric keypad keys"

For those of you still looking... I had this same problem. Here is the solution!

  • 1
    Nik...YOU NAILED IT. Perfect. Thank you. Worked like a charm.
    – user10862
    Commented Feb 15, 2011 at 14:45
  • I've been trying to work this one out for days! And to read this and find out it was the bloody numlock key being on my default - fuuuuuuu
    – roo
    Commented Mar 12, 2011 at 2:38
  • 1
    Just verified this for precise. Wouldn't work until I set this option.
    – jml
    Commented Feb 3, 2012 at 11:12
  • I spent two days until I found this! Bless you!
    – Ramyad
    Commented Jun 21, 2015 at 2:38
  • This should be the accepted answer. Works in 16.10.
    – oarfish
    Commented Apr 2, 2019 at 11:54

OK folks, I went through a lot of pain to get both my Apple Keyboard and Apple Magic Trackpad working on Ubuntu 10.10. I tried several solutions, including the ones mentioned here and others that required editing files that don't exist (e.g. /etc/default/bluetooth), and while some seemed to work at first, none were stable over time. After much trial and error, here is what I did to get both working, automatically reconnecting after restart and/or powering down the devices, with multi-touch capabilities on the trackpad. Getting each of those to work separately was painful enough, and this is how I finally got them all to work at the same time.

For the record, the bluetooth documentation and support for the "new" bluetooth kernel in 10.10 is junk, and the linux, bluetooth, and ubuntu team needs to do a far better job of providing documentation and support if they want people to take their operating system seriously as a consumer product. It should not be this hard, and it should not require trial and error based on informal community suggestions rather than documentation provided by the people who created the software, to do simple things like this.

Note that this is copied from my original post, with attachments, at https://prodigyone.com/in/doc/docs.php?nid=333&view=1

The problems appeared to be a) conflicting bluetooth software and b) a bug in bluez whereby it was not saving link keys in /var/lib/bluetooth.../linkkeys. Workarounds for both are below.

Step 1: Remove all bluetooth software and reboot

1a: Make a copy of your /etc/init.d/bluetooth script. You will need it if you choose option B in step 2 below. If you don't have it, you can use the one attached here

1b: Purge any installed package with the term "blue" in it

sudo apt-get purge bluez blueman gnome-bluetooth bluez-utils

1c: Remove or rename any config files that still remain

mv /var/lib/bluetooth /var/lib/bluetooth.old

1d: Remove any software repositories other than the normal 10.10 repositories (i.e. don't use brian-rogers or other builds)

Step 2- Option A: To connect without auto re-connect

This will allow you to connect without saving the link keys (I am guessing that it's a bluez bug that is failing to write the link keys to /var/lib/bluetooth/.../linkkeys, as the instruction to save the key there is contained in the bluez code). In other words, every time you end your connection, or reboot the computer, you will have to reconnect.

sudo apt-get install bluez blueman

Note that I did not install gnome-bluetooth, bluetooth-compat, bluez-utils, etc. I believe you'll be fine if you install gnome-bluetooth INSTEAD of blueman, but do not install both. It wouldn't work for me if both were installed.

After installation, reboot.

Step 2- Option B: Build bluez and blueman from scratch

This will allow you to connect and to automatically reconnect after reboot or after powering down the devices, which is everything I wanted to do (note that I was unable to get "hcitool putkey" to work-- not sure if that's a bug or a user error-- but it appears that I didn't needed it).

Step 2 Option B: First: Download, unpack, compile and install bluez and blueman from source.

I used the attached source code bluez 4.87 and blueman 1.21

wget xxx.tar.gz (where xxx.tar.gz is the location of the source tarball)

tar zxf xx.tar.gz

cd to the directory created from above step



sudo make install

During the configure step, pay attention to the output, because it may require installation of other packages. You can install these using the synaptic package manager, or using sudo apt-get install. Just make sure that in doing so, you do not install any package with "blue" anywhere in its name.

Originally, I had thought that I would fix the bluez code that was failing to write the /var/lib/.../linkkeys file. However, it appears to be working in the latest source (4.87 as of today), so I didn't need to fix anything.

Note: I'm not sure it is necessary to install blueman from source. If you can install it without overwriting / undoing your source-build of bluez, I would think that should work fine. But I didn't try that.

Step 2 Option B: Second, configure your system to start bluetoothd automatically

Chown and chmod the script from step 1a, then copy it to /etc/init.d

sudo chown root bluetooth

sudo chmod bluetooth 755

sudo cp bluetooth /etc/init.d

Now link it to each of the startup modes

sudo ln -s /etc/init.d/bluetooth /etc/rc5.d/S25bluetooth

sudo ln -s /etc/init.d/bluetooth /etc/rc0.d/K74bluetooth

sudo ln -s /etc/init.d/bluetooth /etc/rc2.d/S25bluetooth

sudo ln -s /etc/init.d/bluetooth /etc/rc4.d/S25bluetooth

sudo ln -s /etc/init.d/bluetooth /etc/rc6.d/K74bluetooth

sudo ln -s /etc/init.d/bluetooth /etc/rc1.d/K74bluetooth

sudo ln -s /etc/init.d/bluetooth /etc/rc3.d/S25bluetooth

Step 2 Option B: Finally, reboot

Step 3: Configure the keyboard

3a: Prepare to connect

The blueman applet should appear after your installation + reboot. Click on it and leave its window open

3b: Connect

Turn off all bluetooth devices except for your computer. Then hold the power button on the keyboard down for several seconds, until the green light turns off. Wait a moment, and if the green light doesn't start flashing, hit the power button once quickly.

If at any point it says that the keyboard is asking for authorization, choose to always give it permission.

Once you see the keyboard in the blueman window (hit Search if you do not-- this may take a few tries; you basically have to have blueman searching for the keyboard at the same time that the keyboard green light is flashing), click on it and choose pair.

During this time, it may help to hit the Return button a few times on the keyboard. I would advise against hitting other keys, however, as they may mess up the pairing process.

When prompted to pair, type in any 4 or 6 digit pin, hit return, and then do the same on your Apple keyboard. It should say "success". At this point, your keyboard may or may not work, for one of two reasons:

PROBLEM #1: keyboard was connected as a number pad only (e.g. it would type numbers instead of 'j', 'k', etc)

Solution, from How do I get the Apple Wireless Keyboard Working in 10.10?:

Press fn-F6 twice to disable numlock. To switch numlock off permanently after log-in go to System -> Preferences -> Keyboard -> Layout -> Layout Options -> Miscellaneous compatibility options -> turn on "Default numeric keypad keys"

PROBLEM #2: keyboard won't type anything at all, even after it is successfully connected

Solution: restart bluetooth, or, reboot. See below on restarting bluetooth.

3c: confirm that your link key is saved for next time

check that /var/lib/bluetooth/.../linkkeys contains your device with some string of hex values next to it. If it does not, the device will not be recognized after reboot.

Step 4: Configure the magic trackpad

Step 4a: Follow the same steps as step 3, except use a PIN of '0000' (and obviously you won't need to type the matching pin in on the mouse).

Step 4b: multi-touch driver

You should have basic mouse functionality now. To use multi-touch functionality, you need to override the default driver in xorg.conf. This is described in "https://wiki.ubuntu.com/Multitouch/AppleMagicTrackpad#Support on Ubuntu 10.04 (Lucid Lynx)", and I have copied some of the key steps below:

sudo lsinput

note the vendor and product. my Apple trackpad vendor/product is: 0x5ac/0x30e. Then, edit /etc/X11/xorg.conf and add the following to the bottom of it (change the matchUSBID value if your vendor/product is different):

Section "InputClass"

     Identifier "Magic Trackpad"

     MatchUSBID "05ac:030e"

     Driver "synaptics"


Step 4c: Reboot the computer so it reloads the xorg settings.


Below are some instructions for generic bluetooth-related functions:

Generic Bluetooth Functions: Restarting Bluetooth

  1. Easiest option (if your startup scripts are set up)

    /etc/init.d/bluetooth start|stop|restart

  2. Harder option (without scripts):

    sudo bluetoothd --udev not sure what the udev does, but that's what the default install does killall bluetoothd

  3. If all else fails, reboot

Generic Bluetooth Functions: using hciconfig and hcitool

  1. hciconfig --help
  2. hcitool --help
  • Thank you. The uninstall/reinstall of the bluetooth packages worked.
    – Steve Tjoa
    Commented Jun 15, 2011 at 7:23
  • Anyone knows if this will work on Natty (11.04) ? Commented Oct 17, 2011 at 0:41

I managed to make this work, by updating bluez to a newer version found in Brian Rogers repository.

add-apt-repository ppa:brian-rogers/ppa
apt-get update
apt-get install bluez

After this it paired at first time, however it looked like there ware multiple keypresses. After a reboot, it is working flawlessly.

  • It appears that the repo is no longer up :/
    – mitjak
    Commented Jun 12, 2012 at 18:02

solution for your problem is here: http://ubuntuforums.org/showthread.php?t=224673 (probably near last posts where people write about latest model apple keyboards )

  • That was on of the first Google results. I tried and read through everything, nothing worked. It's extremely outdated, as is the Ubuntu Community Documentation. Why are these not updated anymore? Thank you anyway though.
    – user3140
    Commented Nov 11, 2010 at 0:10
  • Your answer would profit from having the content included, most people know how to use google themselves. Commented Nov 21, 2010 at 8:48

You must log in to answer this question.