Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

debirf - boot Debian into RAM

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

debirf - boot Debian into RAM

#1 Post by mzilikazi »

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

mase
Posts: 362
Joined: 2008-06-18 07:38

#2 Post by mase »

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).

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#3 Post by mzilikazi »

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

mase
Posts: 362
Joined: 2008-06-18 07:38

#4 Post by mase »

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.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: debirf - boot Debian into RAM

#5 Post by llivv »

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
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#6 Post by mzilikazi »

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

mase
Posts: 362
Joined: 2008-06-18 07:38

#7 Post by mase »

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/

infinitycircuit
Posts: 1137
Joined: 2007-07-24 03:31
Location: California

#8 Post by infinitycircuit »

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.

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

#9 Post by NearlyALaugh »

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.

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#10 Post by mzilikazi »

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

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

#11 Post by NearlyALaugh »

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~

mase
Posts: 362
Joined: 2008-06-18 07:38

#12 Post by mase »

Yes it creates a new system.

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#13 Post by mzilikazi »

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

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

#14 Post by NearlyALaugh »

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:

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#15 Post by mzilikazi »

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
layr
Posts: 86
Joined: 2011-10-11 15:07
Has thanked: 1 time

Re: debirf - boot Debian into RAM

#16 Post by layr »

Is this tutorial valid to date? Say using with Wheezy.

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: debirf - boot Debian into RAM

#17 Post by mzilikazi »

layr wrote:Is this tutorial valid to date? Say using with Wheezy.
It looks to me that debirf hasn't seen any development activity for some time. I've not tried using it for a while now.
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

aab
Posts: 19
Joined: 2010-10-08 17:44

Re: debirf - boot Debian into RAM

#18 Post by aab »

I use it from time to time... It's working on squeeze, haven't tried on wheezy.

Post Reply