Sunday, January 13, 2013

Arch Linux on Raspberry Pi Running XFCE

Instructions in this post are no longer valid. Please find the updated post here.

I recently got a Raspberry Pi from RS online store. I wanted one so bad and it took so long before I got to play with it that by the time I got it, I was pretty much drooling over it. I started off by installing Raspbian which worked out of the box (what fun it is! :( ). I then moved on to try Arch and the fun began. Arch Linux install guide at elinux is pretty good but it only helps you to get bare bones Arch up and running. After that you are on your own. So here I am going to discuss how I managed to get Arch up and running with XFCE, a login manager and a web browser.

First off, download the Arch Linux from Raspberry Pi downloads page. Raspberry Pi's processor is ARMv6 so you cannot just use any Arch variant. Once you are done with the download, you need to extract it and transfer the .img file to a sd card. Either use dd command for this or use a tool like ImageWriter. There are more options available. Check out elinux more choices. I'll use dd command here:
# dd bs=4M if=~/archlinux-hf-2012-09-18.img of=/dev/mmcblk0

No, cp command is not supposed to be used here because cp copies over the file system and we have to do something at much more lower level. In case you are wondering how I got the /dev/mmcblk0 bit, I just mounted the sd card and check the output of df -h command. If you are using a sd card of more than 2G memory, then I recommend using gparted or anything else and expand the size of the file system since by default it'll be just about 2G and rest of your space will go unused. Once you are done here, insert the sd card into your Pi and fire it up.

Now you can see the awesome black login screen. The default password for root user is 'root'. Login as root and create pacman, the Arch Package Manager, database.
# pacman-key --init
Some randomness would be helpful here. So hit ALT+F2 to go to another tty and execute some random commands like ls and echo and cd etc. Switch back to the previous tty by hitting ALT+F1 and wait till the initialization of db is done. Now you can update your repositories:
# pacman -Syu

Now first we will install the xorg libraries:
# pacman -S xorg-xinit xorg-server xorg-server-utils
This will install the X server and pull some common dependencies.

To install XFCE now, fire:
# pacman -S xfce4
It'll ask you to "Enter a selection" after giving some packages. I installed all of them since they looked quite necessary like Thunar and the top panel etc but you can be choosy if you want.

Is your GUI working? You may be missing display drivers. Install them:
# pacman -S mesa xf86-video-fbdev xf86-video-vesa

We still need a login manager. I used SLiM, the Simple Login Manager. Remember it is Pi, so we are trying to do everything lightweight.
# pacman -S slim

Reboot after this and you will be shown a GUI interface to enter your user id and password to login. Do that and open a terminal. We'll install a web browser now. You might be tempted to install Firefox or Chrome but remember, this is ARMv6 and none of the main stream browsers support this architecture out of the box. So either you can compile the binary from Firefox or Chromium code or install a browser like Midori or Arora. I installed Midori because I am more familiar with it.
# pacman -S midori

That is it. You got Arch in quite usable state with a working XFCE. Have fun!

PS: The memory footprint with XFCE up and running is about 140m for my Pi.

19 comments:

  1. It is quite usuable with Fedora too!
    http://zenit.senecac.on.ca/wiki/index.php/Raspberry_Pi_Fedora_Remix

    ReplyDelete
  2. Replies
    1. Yeah. I paid about $50 for the Pi including the case.

      Delete
  3. arch + awesomeWM = 65mb
    anyway I have XFCE on my desktop :D

    ReplyDelete
  4. How you normally use it with any type of GUI??? I tried lxde, openbox, i3wm And they were sloooooooow. Raspberry is slow at all, but when you use some sort of gui on top of it, the slowness level increases for over 9000!. Only exception(IMHO) is XBMC. It runs pretty fast. Right now i'm using rpi as media player(xbmc), but for anything else, the best way is web-ui panel + console apps. -_-

    ReplyDelete
    Replies
    1. I think slow is a relative term. Yes, it is slow than our regular work machine but then it is not made to replace that. I think RasPi's major goal is to learn stuff and I don't mind it being slow as long as I have my primary machines in place. I guess that is just me though :)

      Delete
  5. Hi, I've install everything like you, but I'm trying to access Rasp from my laptop in remote mode, but rasp doesn't show me the login manager.

    Can you tell me how to access to login-manager from my laptop?

    Thank you

    ReplyDelete
    Replies
    1. Little more information might help. How are you trying to access the rasp? What protocol?

      Delete
    2. Hi Aditya

      I'm using ssh to activate vncserver in the rasp. Then in my laptop I use tigervnc viewer.

      I can access to rasp but I only can see a gray screen with a croos (the mouse)

      I need to access to GUI because I'm trying to play music from rasp to an icecast server.

      I don't have enough knowledge about linux. I need ALSA, but in raspbian use pulseaudio, but I read that in Arch is implemented in the kernel, or something like that.

      Thank you again

      Delete
    3. I am not sure what you mean by "Arch is implemented in the kernel" but Arch is a distribution much like Fedora and Ubuntu.
      You should first check if the VNC server is even running or not.

      Try telnet to the VNC port from a remote machine and netstat for port on rasp and also monitor the output of top.
      Depending upon the client, vnc server gives jpeg rectangles of certain quality compressed using zlib generally. CPU needs to support this computation.

      Delete
  6. Hi. Thanks for the guide. I already install follow the step that you given. But when I want to login it said failed to execute the login command. Anything that I miss out? Thanks.

    ReplyDelete
    Replies
    1. Can you get me some logs? Try logging in by changing the init level, if possible.

      Delete
  7. Nice post, but unlucky me... this procedure somehow broke, screwed up my internet connection.

    How did you manage to fix this? Or did it work out of the box for you?? I don't understand how could this be possible... we all have exactly the same hardware and possibly the same arch version ??

    I hate when things go wrong.. :(

    ReplyDelete
  8. Don't forget after installing slim you need to run systemctl enable slim and then reboot.

    ReplyDelete
  9. I couldn't get it to work. This gives me failed to execute login command. I searched how to edit the files necessary for SLiM to work properly, but nothing was specific for R-Pi. Tried systemctl enable slim as well

    When I try to exit the login GUI and go to terminal, I try to login with root, and the password and now login says failed. Not sure what is going on anymore.

    ReplyDelete
  10. Initializing built-in extension XFree86-DRI
    Initializing built-in extension DRI2
    Loading extension GLX
    /etc/X11/xinit/xinitrc: line 53: xclock: command not found
    /etc/X11/xinit/xinitrc: line 56: exec: xterm: not found
    xinit: connection to X server lost

    waiting for X server to shut down Server terminated successfully (0). Closing log file.

    no idea lol can you help with this? Followed all your steps to the letter.

    ReplyDelete
  11. http://www.archlinuxuser.com/2013/02/how-to-install-configure-slim-login.html

    is real usable link with first time using slim,

    ReplyDelete
  12. It is funny how much we go back and forth on this one. Sometimes we desperately plead for an “instruction manual” for life. Other times we chafe at the idea of infringement upon our choices and preferences. This is not a conservative versus liberal distinction or a Christian versus pagan difference. This is a pendulum that swings in every human heart. running machine reviews

    ReplyDelete