debirf - boot Debian into RAM

Share your own howto's etc. Not for support questions!

debirf - boot Debian into RAM

Postby mzilikazi » 2009-01-17 06:32

CMRG wrote:debirf is a system that will create diskless, all-in-ram images (kernel and initramfs) that boot entirely into ram and leave the user in a fully functional Debian system.


In other words, using the debirf tool you build a kernel and initrd. The initrd is also the root filesystem. Everything gets loaded into RAM and your hard drives are untouched.

What I've documented here are just my own experiences. I'm certainly no expert on debirf. This howto only proves that I'm able to read a manual. The intention here is to start a discussion on what might just be the El Dorado of RAM booting.

This is all done as $USER with the exception of apt-get and editing menu.lst.

Getting started
Code: Select all
apt-get install debirf

Primary places to read about debirf usage:
Code: Select all
nano  /usr/share/doc/debirf/README
man debirf
debirf help

From there you get the basc idea of how to use debirf. I'll just repost a fraction of that here for simplicitys sake.

Code: Select all
$ mkdir ~/debirf
$ cd ~/debirf
$ tar xzf /usr/share/doc/debirf/example-profiles/xkiosk.tgz
$ debirf make xkiosk


Configuration
Have a look at debirf/<module>/debirf.conf. There you will find some possibility of customization e.g. mirror and distro (Lenny, Sid)
Also of interest would be debirf/<module>/modules.

If you're booted to Lenny you should automatically get the default Lenny kernel. I was booted into sidux and decided to use the sidux kernel so I utilised the -k switch.

Code: Select all
debirf make -k /var/cache/apt/archives/linux-image-2.6.28-0.slh.10-sidux-686_2.6.28-10_i386.deb xkiosk


Now debirf will proceed to bootstrap Debian and build an initrd.

/snip/
Code: Select all
debirf: modules complete.
debirf: creating debirf initrd ('nested')...
222 blocks
2529 blocks
292 blocks
debirf: creating rootfs.cgz...
637062 blocks
debirf: creating wrapper cgz...
271538 blocks
debirf: debirf initrd created.
debirf: kernel: xkiosk/vmlinuz-2.6.28-0.slh.10-sidux-686
debirf: initrd: xkiosk/debirf-xkiosk_lenny_2.6.28-0.slh.10-sidux-686.cgz


Now you just add it to menu.lst

Code: Select all
title           Debirf w/ sidux kernel
kernel          /home/glenn/debirf/xkiosk/vmlinuz-2.6.28-0.slh.10-sidux-686 vga=791
initrd          /home/glenn/debirf/xkiosk/debirf-xkiosk_lenny_2.6.28-0.slh.10-sidux-686.cgz



*Notes*
There is no root in this menu.lst entry as it is unnecessary.
There is no root password on the minimal build.
You will be prompted for a root password on the xkiosk build.
/snip/
Code: Select all
Set password for debirf-xkiosk superuser:
Enter new UNIX password:
Retype new UNIX password:


That's it. Reboot and say 'Wow that was easy.'

More to come.......
Last edited by mzilikazi on 2009-01-19 05:51, edited 2 times in total.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Postby mase » 2009-01-17 10:36

I'm getting the following error, using your instructions

[...]
I: Extracting sysvinit...
I: Extracting sysvinit-utils...
I: Extracting tar...
I: Extracting tzdata...
I: Extracting util-linux...
I: Extracting zlib1g...
I: Installing core packages...
W: Failure trying to run: chroot /media/data/debirf/xkiosk/root dpkg --force-depends --install var/cache/apt/archives/base-files_5_amd64.deb var/cache/apt/archives/base-passwd_3.5.19_amd64.deb


The command works if i execute it manually (as root).
mase
 
Posts: 362
Joined: 2008-06-18 07:38

Postby mzilikazi » 2009-01-17 14:55

Not sure what to tell you about that as I haven't yet done any 64 bit builds myself. here are some know issues, one of which shows some commands failing on AMD64.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Postby mase » 2009-01-17 16:52

Not sure about that error, I'm currently testing debirf in my sid
VM.

However while searching i found a useful debirf command:

Code: Select all
debirf enter /path/to/profile


That will chroot you into the environment. It looks like you have to specify an absolut path otherwise apt-get might fail.
mase
 
Posts: 362
Joined: 2008-06-18 07:38

Re: debirf - boot Debian into RAM

Postby llivv » 2009-01-17 20:22

mzilikazi wrote: This howto only proves that I'm able to read a manual.

If that is all this HowTo proves all I can say is that you sure read some interesting manuals my friend.
I've been doing bits and pieces of what debri does, manually for the last couple of weeks.
ie: building a custom ramfs image and I was working on bootstrap staging when I read this.
Thinking to myself "If I could only do that" :wink:
User avatar
llivv
 
Posts: 5484
Joined: 2007-02-14 18:10
Location: cold storage

Postby mzilikazi » 2009-01-18 13:41

mase wrote:Not sure about that error, I'm currently testing debirf in my sid
VM.

However while searching i found a useful debirf command:

Code: Select all
debirf enter /path/to/profile


That will chroot you into the environment. It looks like you have to specify an absolut path otherwise apt-get might fail.

Wonder how I missed that the first time round? Guess that's what happens when your squinting at the screen @ 12 am. :)

This does work BTW and although you still cannot mount /proc /dev & /sys it does not seem to matter.

To date I've managed to build an initrd w/ Openbox, b43 firmware and Nvidia drivers as well as a customized xorg.conf. (See xkiosk/modules/xkiosk to customize xorg.conf). I simply copied xkioxk module over and edited to include nuking all of the automated browser stuff. Once completed I'll post that module here - it still needs some fine tuning.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Postby mase » 2009-01-18 14:11

You can mount proc,dev etc from outside the chroot


Code: Select all
mount -t proc proc /path/to/profile/root/proc/


Code: Select all
mount -o bind /dev/ /path/to/profile/root/dev/


Code: Select all
mount -o bind /sys/ /path/to/profile/root/sys/
mase
 
Posts: 362
Joined: 2008-06-18 07:38

Postby infinitycircuit » 2009-01-18 17:47

Last night I used this to make a basic xkiosk module. It is a pretty interesting concept. I want to try making a very minimal installation to put on the /boot partition of some of my systems.
I am currently a Debian Maintainer. I am also in the New Maintainers' Queue.
infinitycircuit
 
Posts: 1137
Joined: 2007-07-24 03:31
Location: California

Postby NearlyALaugh » 2009-04-10 20:59

I know this is a late post, but I was wondering whether debirf is functionally equivalent to the steps taken in IsaacKuo's tutorial, HOW-TO: New and Improved RAMboot for speed and silence. The documentation seems a bit lacking.
NearlyALaugh
 
Posts: 24
Joined: 2008-12-15 08:45

Postby mzilikazi » 2009-04-11 01:51

NearlyALaugh wrote:I know this is a late post, but I was wondering whether debirf is functionally equivalent to the steps taken in IsaacKuo's tutorial, HOW-TO: New and Improved RAMboot for speed and silence. The documentation seems a bit lacking.


Here's your documentation:
Code: Select all
file $(which debirf)
/usr/bin/debirf: Bourne-Again shell script text executable
nano /usr/bin/debirf
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Postby NearlyALaugh » 2009-04-11 03:56

Thanks, but I don't have it installed and I'm not running testing currently; I was just was having trouble gathering whether debirf creates a totally new system to run on RAM or whether one could make a customized version based on the current system. Based on some of the other pages online, I assume that it creates a totally new system to be ram-booted.

Thanks~
NearlyALaugh
 
Posts: 24
Joined: 2008-12-15 08:45

Postby mase » 2009-04-11 06:28

Yes it creates a new system.
mase
 
Posts: 362
Joined: 2008-06-18 07:38

Postby mzilikazi » 2009-04-11 13:52

NearlyALaugh wrote:Thanks, but I don't have it installed and I'm not running testing currently; I was just was having trouble gathering whether debirf creates a totally new system to run on RAM or whether one could make a customized version based on the current system. Based on some of the other pages online, I assume that it creates a totally new system to be ram-booted.

Thanks~

If you wanted to make a live disc from an installed system Remastersys might fit the bill.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Postby NearlyALaugh » 2009-04-12 05:21

I've been meaning to play with Remastersys for a while. I was just hoping that debirf were somehow a magic solution to creating a ramboot image!

Thanks! :wink:
NearlyALaugh
 
Posts: 24
Joined: 2008-12-15 08:45

Postby mzilikazi » 2009-04-13 02:35

NearlyALaugh wrote:I've been meaning to play with Remastersys for a while. I was just hoping that debirf were somehow a magic solution to creating a ramboot image!

Thanks! :wink:

Well it is pretty easy. Keep in mind that you can reuse your chroot build. This means you can customize it to your liking and rebuild the image as often as you like. Look at the -s switch. ;)

Code: Select all
$ debirf help
Usage: debirf <subcommand> [options] [args]
Debirf system tool.

subcommands:
  make [options] PROFILE    build debirf profile (make kernel and initramfs)
    -c|--check-vars           check variables before make
    -n|--new                  create new root, even if old one exists
    -o|--overwrite            debootstrap on top of old root if it exists
    -s|--skip                 skip debootstrap step if old root exists
    -r|--root-build           use real chroot to build instead of fakechroot
                              (requires superuser privileges or CAP_SYS_CHROOT)
    -w|--no-warning           skip superuser warning
    -d|--no-initrd            do not make initramfs
    -i|--initrd-only          just remake initramfs from existing root
    -k|--kernel=KERNEL        install KERNEL .deb, instead of default kernel
  enter PROFILE [CMDS]      enter shell in debirf profile root changes
                            (optional execute CMDS in root and exit)
  makeiso PROFILE           create a bootable ISO using the given profile
                            (requires GRUB)
  help                      this help
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Next

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

fashionable