LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-24-2014, 03:18 PM   #1
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Rep: Reputation: 17
Run SW14 from USB directly in 32MB


Hello all!

Ok well I guess this is a little bit of an unsual request -- but I'm guessing it is possible. What I am trying to do is to run slackware 14 directly from a USB device in just 32MB of ram.

First of all though I should say I can't unfortunatly upgrade that 32MB of RAM. Though the PC(s) I am trying to run this on are just normal boring average desktop PCs if rather old (think Celeron 466 and a 6GB IDE HDD!). Some have cd rom drives, other don't, one has a bad cd rom drive. They all however have 2 USB ports and a floppy drive.

The reason I'm wanting to do this is so I can back up the contents of the computers onto a USB stick. The computers in question are not mine but ones I use at work. That's why I cannot make any upgrades, not allowed to "open up" the systems.

After trying several ideas (e.g. bootable CD though not all have working or have CD rom drives), old versions of debian, puppy and soforth (none of which worked because 32MB is too small!) I decided to try to revive an old idea I tried a long time ago.

That idea was to run slackware directly off a USB stick. Note not install slackware off a USB stick or run the installer off a USB stick but actually run an install directly straight off a USB stick.

So that makes it twice has hard -- both to have a modern day slackware run in 32 MB *and* off USB!

I know that the first part can be done -- modern (slackware 14) in just 32MB because of this thread.

I followed the instructions and used the .config from that thread on that page in the link above and it worked. On a virtual machine (virtualbox) I managed to boot Slackware 14 with just 32MB of ram and no swapfile. Actually I had about 5MB free - !

The second part however -- booting and running directly from USB appears to be a lot harder. I've tried this before but it was a good long time ago -- back in 2011 to be precise and a lot has changed in slackware or so I'd wadger by now (2014). Here is an old thread about using labels I made, for example.

Another thread with a similar idea (run+boot off USB) but a little older, this time 2010.

My question then unfortunatly is still the same. Using a combination of lilo, mkinitrd, LABEL= and rootdelay= or the sleep command is it possible to boot and run slackware straight off a USB stick?

From memory, a setup might run as follows (boot direct off USB);

- Install slackware 14 to a USB device (e.g. with virtualbox or qemu)

- Label the partition, e.g.
Code:
e2label /dev/sda1 TEST
- Make an initial ramdisk with
Code:
mkinitrd -c -k 3.2.9 -m ext4:ohci-hcd:ehci-hcd
- Modify /etc/fstab to read
Code:
  LABEL=TEST    /   ext4   defaults 1 1
- A LILO config file;
Code:
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
# Append any additional kernel parameters:
append=" vt.default_utf8=0 root=LABEL=TEST"
boot = /dev/sda

# Boot BMP Image.
# Bitmap in BMP format: 640x480x8
  bitmap = /boot/slack.bmp
# Menu colors (foreground, background, shadow, highlighted
# foreground, highlighted background, highlighted shadow):
  bmp-colors = 255,0,255,0,255,0
# Location of the option table: location x, location y, number of
# columns, lines per column (max 15), "spill" (this is how many
# entries must be in the first column before the next begins to
# be used.  We don't specify it here, as there's just one column.
  bmp-table = 60,6,1,16
# Timer location x, timer location y, foreground color,
# background color, shadow color.
  bmp-timer = 65,27,0,255

# Standard menu.
# Or, you can comment out the bitmap menu above and 
# use a boot message with the standard menu:
#message = /boot/boot_message.txt

# Wait until the timeout to boot (if commented out, boot the
# first entry immediately):
prompt
# Timeout before the first entry boots.
# This is given in tenths of a second, so 600 for every minute:
timeout = 1200
# Override dangerous defaults that rewrite the partition table:
change-rules
  reset
# Normal VGA console
vga = normal
# Ask for video mode at boot (time out to normal in 30s)
#vga = ask
# VESA framebuffer console @ 1024x768x64k
#vga=791
# VESA framebuffer console @ 1024x768x32k
#vga=790
# VESA framebuffer console @ 1024x768x256
#vga=773
# VESA framebuffer console @ 800x600x64k
#vga=788
# VESA framebuffer console @ 800x600x32k
#vga=787
# VESA framebuffer console @ 800x600x256
#vga=771
# VESA framebuffer console @ 640x480x64k
#vga=785
# VESA framebuffer console @ 640x480x32k
#vga=784
# VESA framebuffer console @ 640x480x256
#vga=769
# End LILO global section
# Linux bootable partition config begins
image = /boot/vmlinuz
  root=/dev/sda1
  label = Linux
  read-only

image = /boot/vmlinuz-test
  initrd = /boot/initrd.gz
  label = test
  read-only

# Linux bootable partition config end
(BTW I have used the above examples/files though it didn't work; I even tried adding rootdelay=30 to the lilo.conf append line above, but no success in fact it was ignored!).

If I can get this part working then (in theroy - !) the idea would be to use the kernel made above (so that it will run in 32MB) and then boot the whole thing right off USB.

Or has a lot changed? Do I still need to use labels or do labels not work now? Or should I only use UUIDs? It's weird, y'know. Is anyone else running slackware off a USB stick or USB hard drive at all? How do you get around the problem of different drives and the kernel detecting which drive contains the OS correctly?

ljones

Last edited by ljones0; 03-24-2014 at 03:20 PM.
 
Old 03-24-2014, 03:57 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Rep: Reputation: Disabled
I don't think it's hard to put Slackware on an USB stick, as it's easy to do on an USB hard disk. I'll try just for fun.

But I think that'd complicate things uselessly if you just want to to save your files on an USB stick.

Try this:
1. Put a Slackware installer (only the installer, no need for the packages) on an USB stick, with another partition on it to store data (read/write). To know how to do that, you can have a look at /usb-and-pxe-installers/usbimg2disk.sh for instance.

2. Boot off the USB installer, but don't run setup.

3. Check the names of the partition on the USB stick and the computer's hard disk with cat /proc/partitions.

I'll assume you want to copy files from /dev/sda1 to /dev/sdb2 as an example.

4. Make the mount points:
mkdir /from /to

5. Mount the partitipons
mount /dev/sda1 /from
mount /dev/sdb2 /to


6. Copy the files:
cp -ar /from /to

7. Umount the partition where you copied the files:
umount /to

That's all there is to it, I think.

Last edited by Didier Spaier; 03-24-2014 at 04:07 PM.
 
Old 03-24-2014, 04:09 PM   #3
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
Intresting idea :-) and I immediately thought of these. So I downloaded a couple and gave 'em a try in qemu (and limiting qemu to 32MB).

(example)
Code:
$ qemu-system-i386 -boot d -cdrom slackware-mini-install.iso -m 32 -enable-kvm
Unfortunatly though the newer ones do not run in just 32MB and the oldest one there (11.0) only seems to support ext2 and I'm thinking on old equipment and USB and soforth -- file corruption x.x

Will give usbimg2disk.sh a go. EDIT: Not enough memory!

If it is easy to put slackware on a USB HDD I wonder how it gets round the problem of finding its own OS/filesystem and avoiding others (eg. imagine if the system already had a HDD or SSD with an OS on it, or already had another USB stick incerted alongside. On one machine it might be (for example) /dev/sdc, another /dev/sde and soforth. Labels and UUIDs get round it I guess, but I can find precious little modern-day info on how to use them alongside something like lilo).

ljones

Last edited by ljones0; 03-24-2014 at 04:27 PM.
 
Old 03-24-2014, 04:25 PM   #4
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Rep: Reputation: 195Reputation: 195
Wuld it be posible to create 3 partitions on the USB disk: 1 with the installer, 1 to where you will install the system and a third for the bootloader?
 
Old 03-24-2014, 04:35 PM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Rep: Reputation: Disabled
Quote:
Originally Posted by ljones0 View Post
Labels and UUIDs get round it I guess, but I can find precious little modern-day info on how to use them alongside something like lilo).
Let me quote "man lilo.conf" for you:
Code:
 root=<root-device>
              This specifies the device that should be mounted as root.  It may be specified as a global  option.   If
              the  special name current is used, the root device is set to the device on which the root file system is
              currently mounted. If the root has been changed with  -r , the respective device is used. If  the  vari‐
              able `root' is omitted, the root device setting contained in the running kernel image is used.  Warning:
              This can induce to an unbootable system!

              The root filesystem may also be specified by a LABEL= or UUID= directive, as in '/etc/fstab'.   In  this
              case,  the  argument to root= must be enclosed in quotation marks, to avoid a syntax error on the second
              equal sign, e.g.:

                   root="LABEL=MyDisk"
                   root="UUID=5472fd8e-9089-4256-bcaa-ceab4f01a439"

              Note:  The command line root= parameter passed to the kernel will be: 'root=LABEL=MyDisk'; i.e., without
              the  quotation  marks.  If  the root= parameter is passed from the boot time boot: prompt, no quotes are
              used.  The quotes are only there to satisfy the requirements of the boot-installer parser, which  treats
              an equal sign as an operator.  The kernel command line parser is very much simpler, and must not see any
              quotation marks.  Simply stated, only use the quotation marks within /etc/lilo.conf.
 
Old 03-24-2014, 04:55 PM   #6
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
>Wuld it be posible to create 3 partitions on the USB disk: 1 with the installer, 1 to where you will install the system and a third for the bootloader?

It would be though that 32MB of RAM is going to be the biggest limitation.





>Let me quote "man lilo.conf" for you:

That's intresting. In it, it says to use
Code:
root="LABEL=MyDisk"
though I had it as root=LABEL=TEST and I've seen other posts/websites say it should be written as root=LABEL=TEST . How confusing(!) wonder if the quotes in this respect are that important? BTW was thinking the append line in lilo.conf was global so it would always use (or try to!) root=LABEL=TEST. Will modify and give it a go.

ljones

Last edited by ljones0; 03-24-2014 at 04:57 PM.
 
Old 03-24-2014, 05:07 PM   #7
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
Modified and gave it a go. It nearly worked -- but not quite.

I got this partway through;

Code:
mount: can't find /mnt in /etc/fstab
ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahead.
       You can try to fix it. Type 'exit' when things are done.

/bin/sh: can't access tty; job control turned off
/ #
might possibly have to put something like a sleep command (e.g. sleep 10) in the initrd (init) file.

EDIT: Might now be working. Added this

Code:
echo "Waiting for 20 secs"
sleep 20
Just before
Code:
if [ "$RESCUE" = "" ]; then 
  # Initialize RAID:
..
..
in /boot/initrd-tree/init, and then ran
Code:
mkinitrd
only 1 minor problem now and I believe its a kernel problem -- won't see old ide hard drives! But it booted off usb .... :-)

ljones

Last edited by ljones0; 03-24-2014 at 05:56 PM.
 
Old 03-24-2014, 05:41 PM   #8
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,055

Rep: Reputation: Disabled
Quote:
mount: can't find /mnt in /etc/fstab
That's interesting. Please show your /etc/fstab and the relevant part of your /etc/lilo.conf.
 
Old 03-24-2014, 06:04 PM   #9
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
Well it looks like it is booting after I modified the init file and added in the sleep command. It might just be I have the slowest USB stick in the universe(!). But here's the files;

/etc/fstab
Code:
LABEL=TEST        /                ext4        defaults         1   1
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
/etc/lilo.conf
Code:
append = " rootdelay=30"
boot = /dev/sda

image = /boot/vmlinuz-test
  label = A
  root = "LABEL=TEST"
  initrd = /boot/initrd.gz
  read-only
ljones
 
Old 03-25-2014, 05:25 PM   #10
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
In the end I may have it all working. Though no garauntees! Managed to get ide/hard disk working a little better.

Here are some files that I made.

ljones

Last edited by ljones0; 03-25-2014 at 05:29 PM.
 
Old 03-27-2014, 10:05 AM   #11
anscal
Member
 
Registered: Apr 2011
Distribution: Slackware, RHEL
Posts: 31

Rep: Reputation: 15
Quote:
Originally Posted by ljones0 View Post
Well it looks like it is booting after I modified the init file and added in the sleep command.
I think the "sleep" modification can be replaced by use of the -w command line option when invoking mkinitrd:

Code:
       -w     The  -w  option  specifies  how  long  to wait in seconds before
              assuming that all the drives are spun up and ready to go.
 
Old 03-27-2014, 11:55 AM   #12
qunying
Member
 
Registered: Jun 2002
Distribution: Slackware
Posts: 257

Rep: Reputation: 147Reputation: 147
For rescue work, I normally go to
http://www.sysresccd.org/SystemRescueCd_Homepage

You may get idea for it on how to run live off the USB.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access USB barcode scanner data directly from USB port using C/C++ bhangale1013ashish Linux - Hardware 3 01-08-2014 01:37 AM
Need a Distribution to run on 32mb RAM, Pentium MMX & Edimax EW-7711UTn Zagreus_92 Linux - Newbie 6 12-28-2010 02:08 PM
how to run a .sh file directly kamesh156 Linux - Software 7 10-10-2005 05:27 AM
USB LexarMedia 32MB Data-Key + KDE 3.2=USB/HD Access problems that_guy Slackware 0 02-03-2005 08:27 AM
linksys 32mb usb key - basic kernel issue d_t_baker Linux - Hardware 1 10-23-2003 04:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration