Showing posts with label slackware. Show all posts
Showing posts with label slackware. Show all posts

Thursday, August 7, 2014

Some notes about testing network block devices

I tested another random thing: network boot options short of iscsi. The first thing I tried was mounting the root filesystem from the startup environment over network block device. That was extremely simple and worked fine. There is a likely shutdown glitch, but if the root filesystem is synced the effect should be relatively minor. I am using xfs and it recovers quickly from that kind of incomplete shutdown relatively easily; well, at least it did in my limited tests. Another interesting idea for testing is to check if it is somehow possible to mount the root filesystem using ssh+nbd. That introduces some extra complications for the root filesystem, but it could definitely be adapted to encrypt traffic for another mount point, such as /home. I guess this may become practical for those who have fiber optic connections. The technique I tried is similar to sshfs, but uses only the the default tools.

Here is a rough idea of how to do this. First, login at the computer hosting the image that is to be mounted somewhere in the filesystem. Start the network block device accessible only locally. Add more local security here, if necessary.

ssh -K douglas.mayne@somecomputer
losetup -f somefile.img
nbd-server  127.0.0.1@2000 -C /root/non /dev/loop1

Then setup the connection back at the computer that would like to use this network disk:

modprobe nbd
ssh -K douglas.mayne@somecomputer -n -L 2500:localhost:2000
nbd-client localhost 2500 /dev/nbd0
mount /dev/nbd0 /home

For the encrypted traffic for the root filesystem, I am wondering if a strategy based on pivot_root might work.

On Friday, I tested this a bit more. I missed the obvious solution for encrypting the root filesystem using network block device. The obvious answer is to use device mapper on top of a network block device. I tested this and it works in the standard way.

dm-live issue and fix. Also debugging with kexec

I noticed that successful bootup to a root filesystem connected via USB was broken on certain hardware. I initially assumed that the failure might be associated with a kernel bug, or perhaps to do with specific motherboard chipsets, or a flaw in my understanding of udev. I was stumped and invested some time to figure out what was wrong. This screenshot shows a typical bootup failure. Googling the failure shows others are experiencing the same troubles, perhaps for similar reasons. I didn't see any obvious solutions. For the last while I have mostly been working around the problem by using a root filesystem connected directly over SATA.

I stumbled on the solution by chance:

Include the ehci-pci module among those that are loaded at boot. That ensures the best performance for the external drive, be it a flash disc or a magnetic disc.

Because booting to a root filesystem on USB is the heart of a live USB install, it's good to know that it was a case of PEBKAC and not something more endemic.

With that fix out of the way, there are some other changes to my dm-live startup environment including following along with the stable kernel releases in the 3.10.x series. Currently, I am testing with kernel 3.10.51.

By the way, in the debug phase of this problem, I was pointed to kdump. I played around with the kexec utility to see some of the basics of kernel debugging and how it is designed to work. I found right away that the basic kernel configuration that I have been using, which is extremely similar to the basic default Slackware kernel, is configured to not generate symbols, enable boot-time reservation of memory using the parameter crashkernel=, or be arbitrarily relocatable. To use kdump there are a few changes, including adding the full compiler symbols the compiled objects. In general, I agree with Slackware's decision not to include the symbols because they increase the size of the resulting compile by a factor of 5 or 6 times. In the end, throughout my attempt to debug the above problem, I wasn't able to generate the right kind of crash, i.e. one that actually writes its crash data. I was pretty sure I was doing it right because kexec -l and kexec -e were working as expected. The panic code when loaded with kexec -p just wasn't tripped for whatever reason. It was too hard of crash, I guess.

Friday, September 20, 2013

dm-live boot environment updated for pending Slackware 14.1

Slackware 14.1 beta Kernel: 3.10.12
BusyBox v1.20.2 (2013-06-22 00:26:51 CDT) multi-call binary.
Copyright (C) 1998-2011 Erik Andersen, Rob Landley, Denys Vlasenko and others. Licensed under GPLv2.
Packages:
  • a/aaa_base-14.0-i486-5.txz
  • a/aaa_elflibs-14.1-i486-2.txz
  • a/aaa_terminfo-5.8-i486-1.txz
  • a/bash-4.2.045-i486-1.txz
  • a/bzip2-1.0.6-i486-1.txz
  • a/coreutils-8.21-i486-1.txz
  • a/cpio-2.11-i486-2.txz
  • a/cryptsetup-1.4.3-i486-1.txz
  • a/devs-2.3.1-noarch-25.txz
  • a/dialog-1.2_20130523-i486-1.txz
  • a/e2fsprogs-1.42.8-i486-2.txz
  • a/elvis-2.2_0-i486-2.txz
  • a/etc-14.1-i486-1.txz
  • a/findutils-4.4.2-i486-1.txz
  • a/glibc-solibs-2.17-i486-7.txz
  • a/grep-2.14-i486-1.txz
  • a/gzip-1.6-i486-1.txz
  • a/kernel-firmware-20130912git-noarch-1.txz
  • a/kernel-generic-smp-3.10.12_smp-i686-1.txz
  • a/kernel-modules-smp-3.10.12_smp-i686-1.txz
  • a/kmod-15-i486-1.txz
  • a/lvm2-2.02.100-i486-1.txz
  • a/mdadm-3.2.6-i486-1.txz
  • a/mkinitrd-1.4.8-i486-1.txz
  • a/pkgtools-14.0-noarch-2.tgz
  • a/procps-3.2.8-i486-4.txz
  • a/sed-4.2.1-i486-1.txz
  • a/tar-1.26-i486-1.tgz
  • a/udev-182-i486-6.txz
  • a/util-linux-2.21.2-i486-6.txz
  • a/which-2.20-i486-1.txz
  • a/xfsprogs-3.1.11-i486-1.txz
  • a/xz-5.0.5-i486-1.tgz
  • l/readline-5.2-i486-4.txz
  • n/gnupg-1.4.14-i486-1.txz
  • n/libgcrypt-1.5.3-i486-1.txz
  • n/libgpg-error-1.11-i486-1.txz
I also tweaked the installed packages to save some space:
  • kernel itself manually removed from this image (boot element specified separately.)
  • compressed the kernel modules with gzip (and depmod)
  • compressed the kernel firmware into an txz archive
  • compressed the /usr/share/locale directories into an txz archive.
If the locale or firmware directories are needed during the boot process for whatever reason, they can be expanded from within the working environment. The basic initrd uses about 134M when expanded with these optimizations. Expanding the locale and kernel firmware requires 189M.

Friday, January 11, 2013

Monitor your UPS using a raspberry pi: apcupsd works under Slackware 14.0

This is very easily done using tools built by others. Simply compile the program using the standard drill using this Slackbuild. Install the package and modify the apcupsd config file to match the cable/communication settings to the device. You can also make an entry in /etc/rc.d/rc.local to start the service automatically at boot up, and you're good to go. Well, at least, it worked for me. I hope it works for you!

Here's the output from the command line utility:

root@rp-1:~#: apcupsd status

APC      : 001,036,0903
DATE     : 2013-01-11 09:39:55 -0700  
HOSTNAME : rp-1
VERSION  : 3.14.10 (13 September 2011) slackware
UPSNAME  : rp-1
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2013-01-11 09:38:58 -0700  
MODEL    : Back-UPS XS 1200 
STATUS   : ONLINE 
LINEV    : 120.0 Volts
LOADPCT  :  12.0 Percent Load Capacity
BCHARGE  : 100.0 Percent
TIMELEFT :  99.8 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 097.0 Volts
HITRANS  : 139.0 Volts
ALARMDEL : 30 seconds
BATTV    : 27.1 Volts
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT  : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x07000008 Status Flag
SERIALNO : JB0609014887  
BATTDATE : 2006-02-22
NOMINV   : 120 Volts
NOMBATTV :  24.0 Volts
NOMPOWER : 780 Watts
FIRMWARE : 8.g1 .D USB FW:g1 
END APC  : 2013-01-11 09:39:55 -0700  

Monday, December 31, 2012

Leafpad is a good default editor for Slackware 14.0, including for raspberry pi

The basic graphical text editor, mousepad, has recently been removed from Slackware in favor of gvim. Personally, that is not my favorite editor. I found that mousepad was actually a derivative of leafpad-- so why not use that instead? A slackbuild is available for Slackware 14.0 here. Also, of note, the same slackbuild works without modification to compile the same source for ARM architecture. The resulting package is compiled and installed using the standard drill. For example, after compiling the package directly on the raspberry pi device, install the package:

# installpkg /tmp/leafpad-0.8.18.1-arm-1_SBo.tgz

The package works natively, but the raspberry pi architecture is a bit challenged by running a full blown X. A leaner alternative is to revert to X-applications forwarded over ssh. To do that configure your ssh server to allow X-apps to be forwarded. In the file, /etc/ssh/sshd_config modify one line:

X11Forwarding yes

Then restart the daemon:

# /etc/rc.d/rc.sshd restart

You can now login from a remote host, and start leafpad:

$ ssh -Y doug@192.168.1.100

doug@rp-1:~$ leafpad &

This will allow you to edit remote files on the remote computer, the raspberry pi in this instance.

Here is a somewhat fudged screenshot.

Thursday, August 16, 2012

dm-live updated to Slackware -current (v14 release pending)

Slackware 14's release is almost finished. PV marked the latest set of changes as RC2. I looked at my startup environment to see what changes were necessary to prepare to match the next release. Almost all of the packages were updated and module-init-tools was removed in favor of kmod. The busybox toolset that is used for a lot of commands was upgraded, with a few minor additions (lsof, setserial, udhcpc6). Here is the version info:
BusyBox v1.20.1 (2012-07-17 17:49:41 CDT) multi-call binary.
Copyright (C) 1998-2011 Erik Andersen, Rob Landley, Denys Vlasenko
Here is my list of packages, omitting the kernel, kernel modules, and kernel firmware:
  • slackware/a/aaa_base-14.0-i486-4.txz
  • slackware/a/aaa_elflibs-14.0-i486-3.txz
  • slackware/a/aaa_terminfo-5.8-i486-1.txz
  • slackware/a/bash-4.2.037-i486-1.txz
  • slackware/a/bzip2-1.0.6-i486-1.txz
  • slackware/a/coreutils-8.18-i486-1.txz
  • slackware/a/cpio-2.11-i486-1.txz
  • slackware/a/cryptsetup-1.4.3-i486-1.txz
  • slackware/a/devs-2.3.1-noarch-25.txz
  • slackware/a/dialog-1.1_20100428-i486-2.txz
  • slackware/a/e2fsprogs-1.42.4-i486-1.txz
  • slackware/a/elvis-2.2_0-i486-2.txz
  • slackware/a/etc-13.013-i486-2.txz
  • slackware/a/findutils-4.4.2-i486-1.txz
  • slackware/a/glibc-solibs-2.15-i486-4.txz
  • slackware/a/grep-2.13-i486-2.txz
  • slackware/a/gzip-1.5-i486-1.txz
  • slackware/a/kmod-9-i486-3.txz
  • slackware/a/lvm2-2.02.96-i486-4.txz
  • slackware/a/mdadm-3.2.5-i486-1.txz
  • slackware/a/mkinitrd-1.4.7-i486-4.txz
  • slackware/a/pkgtools-14.0-noarch-1.tgz
  • slackware/a/procps-3.2.8-i486-3.txz
  • slackware/a/sed-4.2.1-i486-1.txz
  • slackware/a/tar-1.26-i486-1.tgz
  • slackware/a/udev-182-i486-3.txz
  • slackware/a/util-linux-2.21.2-i486-5.txz
  • slackware/a/which-2.20-i486-1.txz
  • slackware/a/xfsprogs-3.1.8-i486-1.txz
  • slackware/a/xz-5.0.4-i486-1.tgz
  • slackware/l/readline-5.2-i486-4.txz
  • slackware/n/gnupg-1.4.12-i486-1.txz
  • slackware/n/libgcrypt-1.5.0-i486-1.txz
  • slackware/n/libgpg-error-1.10-i486-1.txz
Only these packages from the startup environment based on version 13.37 were not upgraded:
  • slackware/a/aaa_terminfo-5.8-i486-1.txz
  • slackware/a/bzip2-1.0.6-i486-1.txz
  • slackware/a/cpio-2.11-i486-1.txz
  • slackware/a/devs-2.3.1-noarch-25.txz
  • slackware/a/dialog-1.1_20100428-i486-2.txz
  • slackware/a/elvis-2.2_0-i486-2.txz
  • slackware/a/findutils-4.4.2-i486-1.txz
  • slackware/a/procps-3.2.8-i486-3.txz
  • slackware/a/sed-4.2.1-i486-1.txz
  • slackware/a/tar-1.26-i486-1.tgz
  • slackware/a/which-2.20-i486-1.txz
  • slackware/l/readline-5.2-i486-4.txz
The 34 listed packages use approximately 89 MB of RAM when expanded. The gzipped kernel modules use 43 MB and the kernel firmware uses 12 MB for a total of approximately 144 MB. For practical purposes, a machine with 256 MB is the least amount that could be used to successfully load the startup environment. A couple of small optimizations could reduce the required space slightly (1. compress /usr/share/locale, remove redundant copy of busybox in mkinitrd - or remove the package).

I have been using this as part of my working day-to-day setup for over a year now. It's a good rescue and all purpose startup environment. That includes booting to an encrypted root filesystem, booting to root filesystem on external USB, or the combination: encrypted root filesystem on external USB device. USB flash memory devices are now hitting the 32 GB level at affordable prices. I've noticed some performance issues on the larger flash disks that are not present on external magnetic USB drives. Another problem have been several glitches introduced with changes to the Linux kernel itself in the past year. The glitches manifest differently on different hardware. I am using kernel version 3.2.26 on an Intel Atom CPU powered netbook, and that combination has had the fewest glitches. I will probably update to PV's 3.2.27 kernel soon and try to use lzma compressed modules to see if any slight gains in free space can be made. That said, the gains are extremely marginal on today's hardware because I don't use computers with less than 256MB anymore. Also, the gains are transient because the environment is discarded when the startup environment gives control to the actual root filesystem.

Update: 2012-08-18: PV's kernel for 3.2.27 has a significantly larger firmware footprint than what I had been using. It jumps to 45M from 12M. I did some simple comparisons to look for differences. I found a direct overlap of 8M and the rest different. These are the biggest directories in the firmware packaged by PV:

6.5M ./ti-connectivity
4.8M ./bnx2x
2.2M ./libertas
1.6M ./brcm
2.2M ./ueagle-atm
1.5M ./bnx2

Saturday, April 28, 2012

Cut Slackware some slack...

This recent Slashdot headline noted there was some recent downtime at Slackware.com, .. Slackware, like a lot of free software / open source coding projects, relies a lot on unpaid volunteers. What is unique about Slackware is that it is very much the vision of one man, Patrick Volkerding. He coordinates every new release with a small team of developers worldwide, including Robby Workman and Eric Hamleers. Workman, I believe, does a lot of work on the website, Slackbuilds.org, while Hamleers is a long time developer who is the person most responsible for porting the Slackware to 64-bit Intel processors, and now is working on an important port to the ARM architecture. That will be very important going forward as cellular sized devices continue to displace the personal PC as the platform of choice. The Raspberry Pi devices could change the world! Slackware, as the oldest Linux distribution still being actively maintained and used, is going to be a part of that. As far as lags in development, from my own experience, most of the recent snags have been due to component pieces of the gnu/linux platform being deficient, notably pieces of X and the kernel itself. The shift towards different graphical paradigms caused some disruption, too. Look to those issues before blaming Patrick Volkerding.

Oh, one other thing, allow me to point out one fact about Slackware's perceived lack of popularity. Why does it appear to shine less brightly than the newer, and perceived rising stars of the Linux world? Well, for one thing, it does have a learning curve. That means it can be off-putting to some. However, once it is mastered, it provides the basis for a lean, mean, fighting machine! It is deployed in quantity by people in the know. For example, at some of the linux conferences I have attended, a few devout followers from certain industries, governments, etc. where stability is a primary asset have stated it is their primary go-to tool. And for what it's worth, those agencies may not desire to have their deployments counted.

Saturday, January 28, 2012

Strip audio track from a video file using mplayer

Let's say there is a large file encoded into mp4 and the audio is what is of most interest. Because I am not very familiar with mplayer/mencoder/sox this was a problem in the sort of hard category. First, I tried using mencoder, but I think some frame synchronization data is included in the stream and causes a metronome-like ticking. I tried using mplayer instead, and finally found the right sequence with some googling and trial and error. I'll save my work here for future reference.

Command line sequence to strip audio from an mp4 using an intermediate named fifo buffer
$ mkfifo fifo.wav
$ mplayer -quiet t.mp4 -ao pcm:fast:file=fifo.wav -vc dummy -vo null -channels 2 &
$ cat fifo.wav | sox -t raw -r 44100 -e signed -b 16 -c 2 - -t ogg audio.ogg
$ rm fifo.wav

For my test file, the resulting ogg file was about 5% as big as the mp4 file that includes the video. YMMV

Also, in fooling around with sox, I stumbled upon this misc information. I think this may be equivalent to the "play" command:

$ sox audio.ogg -d

Monday, January 16, 2012

Minor Update to My Live USB

I have been using a live USB based system, off and on, for the last few months. I am impressed with how well it actually works! There have been a few glitches on my hardware, and have switched to the bleeding edge linux kernel, v3.2.1. I've also upgraded to Firefox 9. It moves a few toolbars around by default, but they can be swapped back to look more like v.3.6.x. The root filesystem is prepopulated with an almost full base install of Slackware 13.37, with a few updates beyond, including the kernel. A few useful packages are also installed including the evince document viewer, and some browser plugins. The space used from the outset is about 3.9G.

Here is a screenshot of the live USB running, with the firefox about box appended:
1.

The system is running in true live mode- all changes to the system are stored in RAM only. A persistent mode is also available. The system's root filesystem is using the same layout as discussed previously on an 8G flash drive.

edit: Here are the steps I use to finalize the boot of a pristine Slackware install in live mode.


  • login as root

  • run pkgtool, select the slackware scripts to run again. Select the relevant choices.

  • add a non-root user using adduser

  • add the above non-root user to the sudoers list, using visudo

  • setup wifi connection parameters, if applicable, using wicd-curses, or similar

  • login as non-root user and begin customizing user environment as desired


    • set screensaver; I dislike the default selection, random screensaver

    • customize xfce's main toolbar

    • start firefox to initialize user directory, .mozilla

    • install adobe flash

    • install other plugins: greasemonkey, reddit enhancement suite




Update 2012-02-02: There were a lot of slackware patches in the recent official slackware changelog. Here is a screenshot showing Firefox 10.

2.

Monday, October 24, 2011

Good Default Printer for Slackware

I just noticed this slackbuild that creates a virtual pdf printer. This printer could be useful when used on live-usb system as the default printer. One improvement would be the ability to query the user for the filename to use. That would be very similar to "print to file" on other OSs.

Sunday, October 16, 2011

Updated Google Talk plugin for Slackware

I finally got around to checking if google voice was working any better than it had been in the past. When I first tried it last year, the quality was lacking, especially when compared to skype. Now that Microsoft has completed their acquisition of Skype, I thought that it was time to see if any improvements have been made to google's offering. I did some simple tests and I think it's now working on par with Skype. Yeah! That's good news because it allows free video calling from computers to other google users, and free voice-only calls from computers to real telephone numbers in the United States, and other voice calls to real telephone numbers at rates comparable, or cheaper than skype (YMMV). Skype offers the same, except at $0.02 for calls in the US, and other rates worldwide.

Getting it working
Here is the procedure I followed to get this working.

  • Downloaded the Debian 32-bit package from google talk/chat.

  • -- verify md5sum: c6d5d8f881960483f6cb9a84d955a8e9 google-talkplugin_current_i386.deb

  • Downloaded the slackbuild for Slackware 13.37, as maintained by Erik Hanson.

  • -- The slackbuild repackages the Debian package, and it worked without incident- including automatically building the 2.3.2.0 version without modifying the slackbuild.

  • Installed the package, per the normal slackware drill

  • Restarted firefox, and voila, the talk plugin with video capability is now present in a google mail window (it is on the left, with the chat the sidebar


When firefox is restarted, you should see the google-talk addin listed:

Configuration tweaks
It can be tricky to find where to setup your devices, especially because the phone works as plugin within a browser. The phone is part of the "chat" component. I've seen it shown on the lefthand sidebar within two windows: google mail and google+ (when viewing "stream" content). To setup your devices, look for "options -> chat settings." You can change your device settings from that page.


By the way, I ran these tests while using a live USB version of Slackware 13.37. Let me know if you'd like my prebuilt package to apply directly to your devices.


  • 19faaaa2752fda7eaf555f67b2b931bd google-talkplugin-2.3.2.0-i386-1_SBo.tgz



Update: 2011-11-27 The talk plugin has been updated to version 2.5.6. The same installation drill applies. Also, let me know if you'd like a slack package.


  • fda69b2b6d1b59f080b9c5c84ae5f9cd google-talkplugin-2.5.6.0-i386-1_SBo.tgz

Monday, September 5, 2011

New Firefox for Slackware 13.x

Here is a screenshot of Firefox 3.6.22 running on my dm-live project (Slackware 13.37 based)
. Apparently, it's so new, that it's an unknown version of Firefox.

Let me know if you'd like a link to a slackware package to update your live-usb devices.

Update: The official slackware package has been released. You can get it here or another slackware mirror. Check valid signature here

Update: 2011-09-27 Mozilla has released Firefox 3.6.23. As before, let me know if you'd like a link to a slackware package to update your live-usb devices.

Monday, May 9, 2011

Claim AC Comment

I recently wrote this and posted it anonymously to Slashdot. The links in that comment lead back to this blog, to posts about my startup environment, dm-live.

Thursday, April 28, 2011

New Slackware Version Released

I've been running Slackware -current for the last few months, with mixed success due to issues with the kernel on my hardware. I hope those have been resolved because -current has just been marked as the next stable version, 13.37. This new version updates version 13.1, but is more elite.


  • Choice of kernel version
    2.6.37.6 in the "a" series, or
    2.6.38.4 in testing

  • gcc 4.5.2 compiler toolset

  • glibc-2.13

  • XFCE 4.6.2

  • Firefox 4.0



I will probably go with a 2.6.38.x kernel. Also, I am sticking with Firefox 3.6.x for now. The new Firefox version "moves the furniture around" quite a bit, and will take some getting used to.

Tuesday, April 5, 2011

dm-live rescue/boot environment

A few packages from a Slackware base repository can be used to setup a nice rescue or generic boot environment. Simply, build the environment and save in the proper initial ramdisk format using the standard cpio sequence. Next, build a boot disk by combining the bootloader, kernel, the initrd image that is described here. By the way, I use the grub bootloader. I call the resulting environment "dm-live" (device mapper -live) because it relies heavily on device mapper for various modes of operation (booting live-usb's or live-cd's, booting encrypted filesystems, etc.) Note: I have also replaced the standard "init" program, with my own variant.

I will probably move this to its own web page in the future as it "fleshes out." I want to use it to record the packages I used in the environment for each matching Slackware release. For now, here's a graphic showing the relative space used by the environment
.


Update: 2011-04-08
I have updated the packages in this environment to match Slackware -current to this timestamp in the official Slackware change log: Fri Apr 8 06:58:48 UTC 2011
Here is the updated package list.

Update: 2011-04-25
I have updated the packages in this environment to match Slackware -current to this timestamp in the official Slackware change log: Sun Apr 24 03:20:33 UTC 2011
Here is the updated package list. I am also testing with both Slackware compiled kernels: 2.6.37.6 and 2.6.38.4 (with the latter working a bit better. YMMV.)


By the way, this project is an unofficial derivative work based on Slackware Linux.

Trademarks and Copyrights



Slackware is a registered trademark of Patrick Volkerding and Slackware Linux, Inc.

Linux is registered trademark of Linus Torvalds.

Tuesday, December 28, 2010

DIY: Slackware on USB Flash (8G)

As mentioned in my previous post, it is possible to use an 8G flash drive, instead of the larger (and pricier) 16G version.

Misc. Notes
This layout still gives the option to boot into one of two modes: either the live mode where changes are written to RAM only, or the persistent mode where changes are written to the flash drive (to partition 5). The user is advised to watch the amount of free space left in the snapshot. For the live mode, the amount of free space depends on the amount of RAM installed on the hardware. For the persistent mode, I have set the size of partition 5 to allow for roughly 4G of changes. I think that should work because 4G of changes plus 4G of static data in the base layer equals 8G total in the root filesystem. However, use this project at your own risk! For example, if you need files from the persistent snapshot, then it is possible to back them up externally. You can save them using a simple backup method, say, login as root and use tar to backup the files in question. If you want to hear about other possible backup methods, then just ask.

Here is my previous graphic, updated to show the new layout, setup on an 8G flash drive.

1.

An 8G file on a 4G partition seems to be impossible at first glance. The trick is to store the base layer on a sparse file. XFS supports sparse files, that means blocks are not allocated until they are actually used. The file is first allocated with the command sequence:


# dd if=/dev/zero of=8g.xfs bs=1024 count=0 seek=8000000


If you want to directly install the base layer into this container, then it is probably a good idea to limit the initial extent to 4G. This will prevent running out of space prematurely, and we can fix it up later.


# losetup /dev/loop0 8g.xfs
# echo 0 8000000 linear /dev/loop0 0 | dmsetup create 4g
# mkfs.xfs /dev/mapper/4g
# mount /dev/mapper/4g /mnt/floppy


Install the packages you want using installpkg (with the specified root.) Then after the base layer contains all the expanded packages, you can resize it.


# umount /mnt/floppy
# dmsetup remove 4g
# mount /dev/loop0 /mnt/floppy
# xfs_growfs /mnt/floppy
# umount /mnt/floppy
# losetup -d /dev/loop0


From now on, make minimal changes to the file holding the image. If you make too many changes, you could really run out of space. Also, if you attempt to backup the file with tar, the OS provides data for the sparse blocks- in effect expanding it on the fly. This may present another problem and may not be what you want. I used a slightly different tactic to avoid that problem. In any case, don't change the file if you have started using the persistent snapshot on partition 5! This is because the base layer must remain constant and changes go to the "top" layer. Restated, if you change the base layer, you must also reinitialize the persistent snapshot! Be careful!

Update: 2010-12-31
Here is some introductory documentation for the set of test devices that I have been working on.

Update: 2011-04-07
I have added this post which discusses my startup environment in more detail.

Monday, December 20, 2010

DIY: Slackware on USB Flash on old PC

I was curious how well the project (booting Slackware-current on a USB flash drive) would work when booted on an old PC- or even if it would work at all. I pulled an old PC out of the closet for the test. I found an old Dell Latitude CPt laptop (service tag: 4AQI6). I found some spare memory for it, topping out both slots for a total of 512MB. That should help a lot, but I know other limitations might still make it unusable or cause the test to fail. The limitations include low CPU power and its v1.1 USB interface. Significantly, the USB v2.0 interface increased top speeds by a factor of 43.6x over the predecessor (480 vs. 11). That could be a serious limitation! I decided to go forward with the test anyway. To my surprise, it booted just fine- albeit a bit slow compared to modern hardware; probably mostly due to the USB speed and its CPU- a Celeron 400Mhz (Mendocino - P6 class).


More Details
I don't think this hardware will boot from USB. I booted from a CD-ROM. Also, I couldn't find any PCMCIA wireless cards, but I did find a Viking 56k modem card. I connected to my ISP and started running Firefox. Here are a couple of screenshots. Notice that the download speed is 5 kB/s, i.e. 56k max speed. Here are the startup logs and some stats while running. Note times referenced in the log are wrong because I didn't set the clock before booting and it had reverted to its default time due to a dead motherboard battery.

.

Final Word
People are constantly upgrading hardware and that means there are a lot of spare computers lying around. If you have a spare P4-class computer, or a spare P3/Celeron computer, then consider using it with a secure OS: GNU/Linux. This is especially true because Windows 95/98/Me/NT/W2k are all "expired." Meanwhile, the hardware lives on.

Update: 2010-12-21
For "desktop" use, I think the above hardware may be just a bit too low, especially in "live" mode relying on the USB bus. I left the PC running for the day, and it experienced some serious hiccups and performance degradation over time. I think this hardware would work better with an actual magnetic hard disk instead of the USB flash drive; and perhaps finding a system with a 650MHz P3 processor, instead of a 400MHz Celeron. I noticed some minor hiccups even on more modern hardware, but on hardware of this vintage the hiccups were much more severe. Maybe, I'll run some more tests later on other low-level hardware.

Possible next test bed:






MotherboardDFI CM33-TL/G
CPUSingle slot: Celeron 1.3GHz
Memory512M to 1G PC133
Videoonboard ATI 8M
USBBelkin USB 2.0 on PCI bus


One common problem of P3 vintage hardware is that the builtin USB is v1.1, not v2.0. That means it is usually necessary to find a USB 2.0 add-in card. The P4 generation (and later) motherboards usually do have builtin USB v2.0 slots. The other problem causing "premature" death of hardware is failing motherboard capacitors. That problem seems to be very prevalent on certain brands.

Thursday, December 9, 2010

Wednesday, December 1, 2010

DIY: Slackware on USB Flash

This post supplements my earlier post on this topic. That tested fairly recent desktop class hardware when using a CF memory module on a SATA bridge adapter as the primary storage/boot media. In this test, I perform a very similar test, but using a common laptop (Dell D610) to boot Slackware on flash memory on a USB 2.0 interface (aka, "jump drive," "thumb drive," etc.) This test confirmed the concept of having a "system in your pocket" is now a reality. Note: This is a full install; the current generation of flash storage gives more than enough space to comfortably hold the full set of standard software, with no cutdowns or compromises required. R/W cycle lifetime of the hardware has also improved, but YMMV. I started this test with a 16G capacity flash drive, but more testing showed that an 8G capacity drive could be substituted in a pinch.

Update: 2010-12-28
I added this post to document a few of the tricks that make this possible using the smaller flash drive.

More later. For now, here are a couple of screenshots.

1.

This mode of operation places the "top" layer of the persistent snapshot on its own partition on the flash drive. An alternate mode uses RAM as the top layer. When the "top" layer is allocated from RAM, the snapshot is not really persistent, but it has the advantage of not incurring R/W delays associated with flash media, and it will not use finite R/W cycles associated with the media itself. Because the snapshot is generalized, there are other modes of operation which can be setup with minimal extra effort. Here are some options off the top of my head:

  • top layer encrypted

  • top layer stored on other device on other filesystem (for example, NTFS)

  • top layer on RAID 1

  • etc.



  • Of course, using a device mapper snapshot is completely optional. The current size of flash memory devices allows a "normal" install without too many tricks required. In that mode, an 8G flash device would work fine, allocating about 4G for system software and 4G as free user space. The only tricks are building the initrd with the required modules to get USB functional and setting up the bootloader. I am using my own "startup environment" which is a bit different than the standard Slackware initrd.

    2.

    Installed software includes:

  • Slackware-current (2010-11-29) -- post v13.1

  • Linux kernel 2.6.35.9

  • XFCE window manager

  • Firefox

  • Open Office 3.2.1

  • Skype

  • Gimp

  • grub bootloader

  • and, of course, it is possible to install more software, per standard tools



  • The latest X window system should also "just work" and not require tweaking /etc/X11/xorg.conf to enable startup. YMMV.

    Update: 2010-12-04
    Here is a package of files with some misc. information including statistics when running in live mode on a Dell D620 laptop. There is also a list of installed packages.

    Update: 2010-12-14
    Some more testing showed that both of the possible startup modes (live or persistent) will work on a single flash drive as small as 8G. One trick is to use a "sparse" file to hold the base install image. Specifically, an 8G XFS filesystem image can be stored on a 4G partition. This works because the 8G image is only about half full. This frees up the other half of the device for changes. This may not be quite as flexible as the 16G device because the amount of changes that can be made to the base device does not perfectly match the underlying base filesystem. However, 8G may provide enough space to make it a viable option; that is, at least until 16G devices are commonplace. Be aware that when using this mode, the user should keep an eye on the remaining space available in the snapshot because it could be exhausted first, i.e. the snapshot is exhausted even though there is extra space on the filesystem. This problem is avoided when using the 16G size.

    Update: 2010-12-15
    You should keep an eye on the space used in the snapshot image, especially when the snapshot is smaller than the target device. Here is a nice little hack:

    #!/bin/bash
    [ ! -e /dev/mapper/top ] && exit 1
    v=$(echo "scale=4;$(dmsetup status top| cut -f4 -d\ )*100"| bc -l)
    printf "Snapshot Used: %04.2f%%\n" $v


    Update: 2010-12-16 Startup Notes
    Goal: Boot to runlevel 3 in "live" mode
    Steps:
      (1) Select appropriate choice from boot menu

    This will load the kernel and initrd. I have noticed this takes a variable amount of time depending on the hardware, and possibly the mode that the BIOS uses to interface with USB. I have seen this step take between 5 and 20 seconds.

      (2) When the above step completes the kernel takes over and the login prompt should appear in less than a minute.

    Start time is somewhat dependent on specific hardware. On my hardware I observed a time of 48 seconds. The specific boot details are as follows. First, there will be a slight pause while the kernel unpacks the initrd. There is a prompt asking the user to select which display mode to use. Second, the familiar "penguin" logo will be displayed as other startup facts scroll by as the kernel performs basic initializations. Third, control will transfer to my startup environment. It probably won't be obvious when the switch takes place, but it will include a step to load the kernel USB modules and include a 7 second delay while the USB bus stabilizes. Next, a reference to the license terms is displayed and asks the user to press "enter" to indicate acceptance (or ctl-alt-del to terminate). Upon acceptance, final setup of the snapshot in the desired mode is performed. When complete, control transfers to Slackware's default init program on the target root filesystem. The initialization requires certain keys/certificates to be generated and a "graphic" fingerprint is displayed for each. Finally, the login prompt will appear.

      (3) In live mode, login as root and perform final initializations.

    The user should set the root password and run "pkgtool" and choose, "Setup: Choose the Slackware installation scripts to run again."

    When complete, add your non-root user. There are a few steps to perform here to make the user a "power" user. Add your name(s) to the appropriate groups, and possibly sudoers.

    You can install other packages. Skype is included as a Slackware package in the root directory. Install it with the command:

    $ installpkg skype-2.1.0.81-i486-1_SBo.tgz

    The above steps can be a bit tedious, and can be avoided by using the "persistent" mode.

      (4) Login as your non-root user and start a graphic session.


    $ startx

    From here, you are running GNU/Linux. You can install more software. For example, download and install the latest Adobe flash plugin for Linux.

    Update: 2010-12-20
    I performed a test where I booted on hardware at the lowest end of the possibly usable spectrum, i.e. when using at least a computer with a P6 class CPU. I documented my test separately here because this post is getting a bit cluttered.

    Sunday, October 24, 2010

    DIY: Add kerberos support to Slackware 13.1

    I created this webpage to document a project I have been working on. I also posted for comments to aols here.