Sunday 25 July 2010

Resume from encrypted swap in Fedora 13 (solved)

Problem: Install Fedora 13 with / and swap on encrypted partitions. Hibernate appears to work, but resume does not: it asks for password and then carries on with normal boot.

Fix: the kernel boot parameters need to include
  • resume=UUID=(uuid of file system device supporting the encrypted swap)
Although Fedora's installer easily and nicely sets up the encrypted partitions, and adds lvm- and luks-related activation parameters to the kernel stanza in grub, it does not add the resume= parameter.

Initially I tried
  • resume=/dev/mapper/swap0
which seemed reasonable, since root=/dev/mapper/luks-whatever is automatically added by anaconda.
However, that doesn't work: the resume boot fails, with a message like "Could not open root filesystem", and it sleeps forever.

Here is an example from a working /boot/grub/menu.lst:

# names and UUIDs
#
#root luks luks-fe45fa34-fbcc-4b0e-e556-3cb453e454f5

#root lv vg_lex/LogVol01
#root /dev/mapper/luks-
fe45fa34-fbcc-4b0e-e556-3cb453e454f5

#swap luks luks-23d23dea-8732-42d2-c319-4568973a74373
#swap lv vg_main/LogVol00
#swap /dev/mapper/swap0
#swap Filesystem 34deffd5-2328-4702-45e5-4532a1fd45e2

# failed:
# resume=/dev/mapper/swap0
# ok:
# resume=UUID=
34deffd5-2328-4702-45e5-4532a1fd45e2

title Fedora (2.6.33.6-147.fc13.i686.PAE)
root (hd0,5)
kernel /vmlinuz-2.6.33.6-147.fc13.i686.PAE ro root=/dev/mapper/
luks-fe45fa34-fbcc-4b0e-e556-3cb453e454f5 rd_LUKS_UUID=luks-fe45fa34-fbcc-4b0e-e556-3cb453e454f5 rd_LVM_LV=vg_main/LogVol01 rd_LUKS_UUID=luks-23d23dea-8732-42d2-c319-4568973a74373 rd_LVM_LV=vg_main/LogVol00 rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=uk rhgb resume=UUID=34deffd5-2328-4702-45e5-4532a1fd45e2 quiet
initrd /initramfs-2.6.33.6-147.fc13.i686.PAE.img


Saturday 17 July 2010

Installing LXDE on Fedora13 - some adventures

Why: installing LInux on laptop, want complete security - encrypt entire disk and swap, and support from the distro to make this easy. And full support for multimedia.

Summary:
  • From the full DVD, do not try to install LXDE or Enlightenment or Openbox or anything other than Gnome (or maybe KDE) as the only desktop. You will spend a lot of time and end up with a half-arsed system.
  • Do install Gnome and then the desktop of choice, and maybe later remove the things you dont need.


The adventure

Which Distro?

I've been using Arch as my main distro for some time, but although the flexibility and support from the wiki and forums is tremendous, the constant need to apply updates has become a complete ball-ache. I've got caught between a rock and a hardplace - the tendency for things to be broken after an update leads me to do fewer and fewer updates, and then suddenly I cant install something because I'm too far behind. Hundreds of megabytes a week, and hours of effort just to stand still. Enough.

Tried Mint, and although it makes life easy on the multimedia front. in Isadora it's taken a very bad route, choosing to standardise on some components that basically just aren't ready, e.g. Grub2. Jeez.

Tried PCLinux, but couldn't get it to boot without disabling acpi. Useless for my laptop.

Briefly tried Mepis / KDE but you have to laugh at KDE4. What a joke. (Aside: I see Gnome Shell is going the same way. Sigh)

I've never had a lot of success with RPM based distros, so it was a bit of a surprise to discover that Fedora 13 looked the best candidate. Package management wih yum has come a long way from the rpm-dependency hell that used to prevail.

Fedora 13:
Pros
  • Can manage and install to LVM
  • Good management of other volumes from the running system via palimpsest
  • Easy setup for full disk encryption, and non-ugly screen while capturing initial passwords during boot.
  • Multimedia works fine, with new codecs found and installed as needed (after adding rpmfusion repos, that is)
  • Can remove components of Gnome that on other distros (e.g. Ubuntu) would cause tantrums and attempts to remove more than you intend.
Cons
  • SeLinux (but it can be disabled)
  • sudo - wont run in batch scripts (but you can fix this)
  • automatic networking needs a bit if a nudge (does work eventually)
  • dependencies for desktops other than Gnome and KDE are a bit broken.
  • no long-term distro stability - another release every 6 months ... will need to see if that is an irritant or whether upgrading is easy

Tried installing from Live spins of Gnome and XFCE. These worked ok, but I've used openbox as a window manager before, so I thought it would be good to have a look at LXDE. Installing it after Gnome (or XFCE) seemed to work (except for some issues with function keys, which I'll get to later), so I set out to do a full install from DVD of only LXDE.

This was a mistake.

And why was I not content with the install from Live?
Because all the Live spins insist on installing the root filesystem to ext4. I think it's a bit early to jump on that particular bandwagon. I don't like the developers' attitude (as I perceive it) that data security is the responsibility of the programmer rather than the file system.


more to come ...

some notes on things installed:
  • groupinstall "LXDE"
  • sylpheed
  • gconf-editor (so we can modify behaviour of Nautilus - which unfortunately is required by palimpsest
  • imlib2
  • conky
  • feh
  • qt3 (for dvbcut)
and remove
  • evolution

Building tint2 panel on fedora13

Why: trying to make LXDE usable on Fedora13.
Want: try tint2, e.g. howto replace lxpanel with tint2 trayer
Because: I've observed the window list extending behind other items (the system tray or pager) in my lxpanel.

Starting from:
  • install Fedora13 from DVD (not a Live disk) choosing default Gnome desktop.
  • Add LXDE by yum groupinstall LXDE

This might or might not be overkill, but it works:
  • Add development tools:
yum groupinstall "Development Tools" "Legacy Software Development"
Download, build and install cmake
  • from cmake
  • tar zxf , cd into cmake directory:
./bootstrap
gmake
sudo make install
Download tint2 sources,
  • in my case from tint2
  • tar jxf, cd into tint2 directory
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../
and at this point discover that many dependencies are not met.
sudo yum install imlib2-devel glib2-devel cairo-devel pango-devel libXcomposite-devel libXdamage-devel libXinerama-devel libXrandr-devel gtk2-devel
then
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../
make
sudo make install
Now then: trayer?
sources for this came from fbpanel but have migrated to fvwm-crystal.
Hmm not sure about that; it's pretty ancient, and doesn't compile; and doesn't attempt to build a program, its only a plugin for fvwm.
Source and executables are available from debian repositories; comments note that someone has hacked a standalone app from the fvwm code.
I unpacked the debian sources, applied the patches, and attempted the build, but there were some problems that I didn't pursue.
Unpacked the debian binary which is just /usr/bin/trayer and some man pages.
Copied trayer to my own /usr/local/bin, and it works.

Applied the config changes described in the link given at the start of this page.
Sort of - my installation of openbox doesn't have an autostart as described, so I added lines to /etc/xdg/lxsession/LXDE/autostart instead - without the sleep instructions.
@tint
@trayer --expand true --transparent true --alpha 255 --edge bottom --align right --expand true --SetDockType true --widthtype request --margin 130
Hmm. tint fails. It isn't called tint anymore, it should be tint2.
Now it starts, but two problems
  1. an error is issued about a tray already running.
  2. tint2 and trayer do not work well together. Each can expand until they meet - and after they meet, so that eventually tint2 obscures trayer.
Turns out I've started from an old document. The most recent tint2 contains its own system tray, so trayer is not required. I've used it as part of fvwm, where it works quite well, but it has no place with lxpanel or tint2.
Also, the tint configuration file has moved to .config/tint2/tint2rc, and usefully a default version is created by tint2 itself. The documentation in the current tint website is pretty good too. See the wiki page here

Finally, I'm starting tint2 and lxpanel from ./config/lxsession/LXDE/autostart (which I created myself, instead of editing the global /etc/xdg/lxsession... )
@lxpanel --profile LXDE
@tint2
@conky
This is set up so that the lxpanel is top of screen, and contains a pager and various app starters, while tint2 is at the bottom and has only a window list and a tray.

So, time to return to the initial requirements: is tint2 better than lxpanel?
I'm not sure. It doesn't really have a pager, although the window list can be split to show windows on different screens simultaneously - this clutters the panel too much. Similar windows can't be grouped. The clock has no calendar function.
Running with lxpanel is an interesting compromise.

I've tried reverting to lxpanel top and bottom, and strangely now I can't repeat the original problem where the window list and pager items overlap.

I still have an issue with lxpanel where the "show desktop" button hides one of the panels as well as the open windows. But I can live without that feature.

tint2 might become more interesting as it matures. Not sure if its ready for prime time yet.