Is that a giant PDA?

No. Yes. Maybe.

Monday, March 1, 2010

Fresh, Minty Taste!

Linux Mint Fluxbox CE seems to just rock. I haven't actually done much practical work with it, but it behaves nicely and has an aesthetic and a beautiful organization to it. There aren't too many services started, and what are seem to be right out in the open. More later as I play with it, but I've always wanted to use Fluxbox, and here is a modern distribution that just works.

So, for the "reboot" of this howto blog, here are the steps I've taken, and you can too!

  1. Download the Fluxbox CE iso. Use the torrent, it's faster and cheaper.
  2. Use UnetBootin to make a bootable Live USB thumbdrive. It's available in any recent Ubuntu distribution.
  3. Boot the thumbdrive and play with it for a while - stuff just works, including bluetooth, sound, suspend/hibernate, touchscreen (basic) and wireless.
  4. Commit! and install the OS. Use three partitions, as I described in an earlier post.
  5. Reboot to the installed OS. Update the OS with Synaptic.
  6. Use Jockey (called Hardware Drivers in the menu) to install the video driver. Or use Synaptic to install the nvidia-glx-96 driver. You can uninstall Jockey after this, as your hardware is unlikely to change. (jockey-gtk, jockey-common and fglrx-modaliases)
  7. Use this page to update your /etc/X11/xorg.conf and /usr/share/hal/fdi/policy/20thirdparty/10-linuxwacom.fdi files, and to add tc1100-wmi to your /etc/modules file. There's more on that page, and I'll be using some of it.
  8. Reboot. Pen should work now (button will be right-click instead of middle-click) and rotation will work -- use the nVidia X Server Settings utility in the System|System Tools menu to test it.
And that basically will catch you up to where I was yesterday morning. This still leaves fun tweaks, like screen-orientation and screen-pen-buttons and the like. I'll get to all that, maybe later today.

What I spent most of yesterday on, though, was getting a login screen with a virtual keyboard, so you don't have to login with the keyboard attached to the TC1100.

It's pretty easy to do with GDM, the standard Gnome Desktop Manager that comes with standard Ubuntu. And I could just install GDM and maybe the Accessibility menu would update with the proper utility to enable it at boot. And maybe not. And it would also drag in a lot of Gnome dependencies, which we all hate with a vigorous and manly passion, right?

Linux Mint comes with SLiM, the Slim Login Manager. Which is great, and I use it on my other machines -- it's themeable, which has been done beautifully on LMFCE. But I spent hours trying to get a virtual keyboard to launch, and just couldn't do it. You can laugh at my struggles, and desperate pleas for help here. I am not sure what stopped the windows from opening, but it has to do with getting access to the local display.

I finally settled on learning how to get XDM to do it, and then on how to get a basic, not ugly, login screen that fit the Mint theme. The guys on the Mint forum were supportive.

Now that I've managed to get that very modern virtual keyboard with this most ancient of DMs, and spent hours doing so -- I've learned that WDM is a somewhat updated, slightly less ugly and a little more capable login manager based on XDM. Also from the Paleolithic Age of Linux, it nonetheless has abilities like choosing sessions and users that XDM doesn't. It should work pretty well with what I've done, and adapt easily. Future Post™. XDM will do for now; Mint has only a Fluxbox session at default install, and most TC1100s have only one user.

Here's how to make XDM work with CellWriter:

  1. Install XDM, ImageMagick and Cellwriter from the repository. When XDM installs, you need to look at the terminal output (the little drop-down arrow in the Synaptic dialog) and hit OK and select XDM. Use your keyboard, not the mouse. Arrows, tab and enter key. (Easier to see/recognize if you do sudo apt-get install xdm imagemagick cellwriter from the command line.)
  2. Find or make a PNG background image at 1024x768 pixels (for this machine's resolution). Name it background.png. Find or make an XPM logo no bigger than 128x128 (for this theme's layout). Name it logo.xpm. You might want these to be in the green color scheme to match Mint, and the login screen settings in the files below.
  3. As root, copy/paste the following content to their appropriate files (check the content and layout when copying -- there's no CODE tag available in Blogspot, and it might mess it up -- particularly line-breaks.):
    • /etc/X11/xdm/Xresources:
      xlogin*login.translations: #override \
      CtrlR: abort-display()\n\
      F1: set-session-argument(failsafe) finish-field()\n\
      Delete: delete-character()\n\
      Left: move-backward-character()\n\
      Right: move-forward-character()\n\
      Home: move-to-begining()\n\
      End: move-to-end()\n\
      CtrlKP_Enter: set-session-argument(failsafe) finish-field()\n\
      KP_Enter: set-session-argument() finish-field()\n\
      CtrlReturn: set-session-argument(failsafe) finish-field()\n\
      Return: set-session-argument() finish-field()\n\
      BackSpace: delete-previous-character()

      ! Can root user log in?
      xlogin.Login.allowRootLogin: false

      ! Allow Null Password?
      xlogin.Login.allowNullPasswd: false

      !Xcursor themes are in /etc/X11/cursors on a standard Ubuntu. Not Mint.
      !Xcursor.theme: whiteglass

      !use xfontsel to help pick X fonts

      ! LOGIN BOX
      xlogin*geometry: 550x170+570+685
      xlogin*borderWidth: 0
      xlogin*background: DarkGreen

      ! BEZEL HIGHLIGHTS AND SHADOWS
      xlogin*hiColor: Gray75
      xlogin*shdColor: Black
      xlogin*Login*sepWidth: 0
      xlogin*frameWidth: 1
      xlogin*innerFramesWidth: 1

      !USER TYPED TEXT
      xlogin*foreground: White
      !xlogin*font: -*-courier-bold-r-*-*-12-*-*-*-*-*-*-*
      xlogin*face: Courier-11

      ! LOGO
      xlogin.Login.logoFileName: /etc/X11/xdm/theme/mint/logo.xpm
      xlogin*logoPadding: 25

      ! GREETING
      ! variable CLIENTHOST gives hostname
      xlogin*greeting: =|=|=|=|=|=|= Fluxbox CE on CLIENTHOST
      xlogin*greetFace: Serif-8:italic
      !xlogin*greetFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1
      xlogin*greetColor: grey60

      ! PROMPTS
      xlogin*namePrompt:Username
      xlogin*passwdPrompt:Password
      xlogin*promptFace: Sans-11:bold
      !xlogin*promptFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1
      xlogin*promptColor: Black

      ! FAIL MESSAGE
      xlogin*fail: Login Incorrect
      xlogin*failFace: Sans-11:bold
      !xlogin*failFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1
      xlogin*failColor: Yellow Green
      xlogin*Login*failTimeout: 0

    • /etc/X11/xdm/Xsetup:
      #!/bin/sh
      #
      #
      # This script is run as root before showing login widget.

      #xsetroot -solid green

      display -window root /etc/X11/xdm/theme/mint/background.png &

      /usr/bin/cellwriter --keyboard-only --show-window --dock-window=1 &

      exit 0
    • /etc/X11/xdm/Xstartup:
      #!/bin/sh
      #
      # This script is run as root after the user logs in. If this script exits with
      # a return code other than 0, the user's session will not be started.

      # Kills the virtual keyboard before the user's session starts
      # as it is running as root, not the user
      pkill -u root cellwriter

      # Reset the keyboard map after killing the virtual keyboard
      # as killing it causes the physical keyboard to not work
      /usr/bin/setxkbmap

      PATH="$PATH:/usr/bin/X11"

      if [ -e /etc/nologin ]; then
      # always display the nologin message, if possible
      if [ -s /etc/nologin ] && which xmessage > /dev/null 2>&1; then
      xmessage -file /etc/nologin -geometry 640x480
      fi
      if [ "$(id -u)" != "0" ] && \
      ! grep -qs '^ignore-nologin' /etc/X11/xdm/xdm.options; then
      exit 1
      fi
      fi

      # Insert a utmp entry for the session.
      if grep -qs '^use-sessreg' /etc/X11/xdm/xdm.options \
      && which sessreg >/dev/null 2>&1; then
      exec sessreg -a -l "$DISPLAY" -u /var/run/utmp \
      -x /etc/X11/xdm/Xservers "$USER"
      # NOTREACHED
      fi

      exit 0
  4. Make a directory named /etc/X11/xdm/theme/mint and put your two image files from #2 there.
  5. Reboot. Should work.
Also, we need to update our grub, to set the display depth to 1024x768. Well, we don't need to, but I did -- and while I was at it, I made the grub boot screen a little more beautiful.

The distro has a custom grub layout, but it's not enabled, and it's not at the optimal size. So let's fix it!

Make another PNG background image at 1024x768 pixels (for this machine's resolution). Save it as /usr/share/backgrounds/GrubBackground.png. You'll be seeing this at every boot, so you might want to consider the theme you're using, or what you'd like to see all the time. It's a little harder to change this than your desktop background, but not too difficult (and we could script it pretty easily.)

As root, edit /etc/grub.d/06_mint_theme and change the following:

  • Line 16: for i in {/boot/grub,/usr/share/images/desktop-base}/linuxmint.{png,tga} ; do should become for i in {/boot/grub,/usr/share/backgrounds}/GrubBackground.{png,jpg} ; do
  • Line 39: set color_normal=white/black should become set color_normal=green/black
That will tell grub whenever it updates itself -- like when you upgrade the kernel -- to look for a file named either GrubBackground.png or GrubBackround.jpg in the system backgrounds folder.

Now, let's change the startup defaults for grub, since we're working on it. For speed, grub just boots the first kernel/OS in its list. Which is fine, until you have a problem. You can access the grub menu by holding down the shift key, but I always forget that. So let's put a small delay and show the menu -- and see that pretty picture!

As root, edit /etc/default/grub and change lines 5 through 10 as follows:

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=3
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
Also, uncomment and change line 18 to:
GRUB_GFXMODE=1024X768
which should be pretty obvious. The larger change above basically unhides the menu, and puts the first kernel/OS on a 5 second delay. Change GRUB_TIMEOUT to suit yourself.

Now, open a terminal and type:

sudo update-grub

and give it your password. It'll do some nice magic, and then when you reboot, PRESTO! a sweet picture and a slightly more attractive menu. When Grub2 is finalized, there will be a GUI, and many, many more options for themeing the boot menu. This will have to do for now.

Whenever you want to change the background, change /usr/share/backgrounds/GrubBackground.png and do sudo update-grub.

BTW, if you want to remove the memtest entry from the boot menu, as root go to /etc/grub.d and remove the executable bit from 20_memtest86+ by right-clicking the file, selecting Properties | Permissions | Program and unticking the checkbox. Then sudo update-grub again.

More later,

m a r

No comments:

Post a Comment

All this madness started...