SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2011-01-11 04:25:58

ugh
Member
Registered: 2011-01-10
Posts: 29

Boot #! squashfs from hard drive - now with persistence!

This is just like booting the image from CD only from hard drive.  Assuming you've already got GRUB on your hdd and you have the #!.iso image, all that needs done is to copy some files and write a new GRUB entry.

Edits

13 Jan 2011 Corrected omission of noprompt boot parameter. 
Added a post for persistence

10 March 2012 Updated to reflect latest crunchbang-10-20120207 iso.

$ sudo su
# mkdir /live
# mkdir loopmount
# mount -o loop crunchbang-10-20120207-amd64.iso loopmount
# cp -a loopmount/live/* /live
# ls /live
filesystem.packages filesystem.squashfs initrd1.img memtest vmlinuz1

That's it for the squashfs.  Now you need a grub entry.

# nano /etc/grub.d/41_CB_squashfs
#!/bin/sh
exec tail -n +3 $0
menuentry 'Crunchbang-10-20120207 squashfs' --class debian --class gnu-linux --class gnu --class os {
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos1)'
    linux /live/vmlinuz1 boot=live live-media-path=/live splash vga=791 config quiet noprompt
    initrd    /live/initrd1.img
}
update-grub

That's all.  Time for a reboot and test boot of the CrunchBang squashfs from your local hard drive.

I really like this type of installation on almost any system you can afford < 1G of partition space. 
Why?
1) As long as you have GRUB you have an OS even if you hosed up your system beyond the ability to boot.
2) #! squashfs living on its own partition gives you a complete system recovery tool outside of your installed OS
3) It's unbreakable (more or less)
4) No CD or USB drive required
5) MUCH faster booting from hdd than CD or USB
6) No extra discs/drives to carry around
7) You can boot from and install to the same hard drive.

Last edited by ugh (2012-03-11 17:14:31)


Toshiba laptop - 1.86GHz x 2
3 G RAM
Crunchbang Statler upgraded to Sid
2.6.XX-X.dmz.X-liquorix-amd64

Offline

Help fund CrunchBang, donate to the project!

#2 2011-01-11 16:03:50

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 3,693

Re: Boot #! squashfs from hard drive - now with persistence!

That's smart, a rescue environment waiting to rescue on your HDD. Nice, gotta try that some time.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Online

#3 2011-01-11 19:23:48

anonymous
The Mystery Member
From: Arch Linux Forums
Registered: 2008-11-29
Posts: 9,371

Re: Boot #! squashfs from hard drive - now with persistence!

Is this for grub-legacy or grub2?

Offline

#4 2011-01-11 23:31:53

jeffreyC
#! Junkie
Registered: 2010-09-02
Posts: 420

Re: Boot #! squashfs from hard drive - now with persistence!

A set-up like this is offered on the Debian Live DVD's  with grub 2.

Online

#5 2011-01-12 03:52:32

ugh
Member
Registered: 2011-01-10
Posts: 29

Re: Boot #! squashfs from hard drive - now with persistence!

anonymous wrote:

Is this for grub-legacy or grub2?

Above is grub2 but grub-legacy can do the same only with /boot/grub/menu.lst, e.g.

title      CrunchBang 
root       (hd0,0)
kernel       /live/vmlinuz1 boot=live live-media-path=/ive quiet splash vga=791
initrd      /live/initrd1

Additionaly, you can use UUIDs (or not) and boot the squashfs from a USB drive.


Toshiba laptop - 1.86GHz x 2
3 G RAM
Crunchbang Statler upgraded to Sid
2.6.XX-X.dmz.X-liquorix-amd64

Offline

#6 2011-01-12 03:58:50

ugh
Member
Registered: 2011-01-10
Posts: 29

Re: Boot #! squashfs from hard drive - now with persistence!

jeffreyC wrote:

A set-up like this is offered on the Debian Live DVD's  with grub 2.

That I did not know. 

You can actualy boot quite a few distros this way, each with their own specificities.  It's always the same - extract the kernel, initrd and filesystem.  Then point your bootloader at it.  The tricky part is getting the right parameters.  Tinycore Linux is similar however has no extra filesystem as it is all contained within the initrd.  It's also only 10 or maybe a fat 11M these days for an entire OS!


Toshiba laptop - 1.86GHz x 2
3 G RAM
Crunchbang Statler upgraded to Sid
2.6.XX-X.dmz.X-liquorix-amd64

Offline

#7 2011-01-12 05:02:26

Neil
#! CrunchBanger
From: Paragould AR USA
Registered: 2010-05-01
Posts: 201

Re: Boot #! squashfs from hard drive - now with persistence!

I'm used to installing Puppy Linux this way.  It's what they call a "frugal" install.  With Puppy you can also have a "save" file so that any setting, or changes, etc., can be saved for the next boot.  Is there any way to install #! squashfs as your only OS, with persistence?

Offline

#8 2011-01-13 04:21:01

ugh
Member
Registered: 2011-01-10
Posts: 29

Re: Boot #! squashfs from hard drive - now with persistence!

Neil wrote:

Is there any way to install #! squashfs as your only OS, with persistence?

Sure - this is Debian Live afterall so anything that applies there should apply here.  The fine manual is here:
http://live.debian.net/manual/en/html/3.html
OR

apt-get install live-manual

Then point your browser to
/usr/share/doc/live-manual/html/en/index.html (or your preferred language). 
This is a snippet of the part we're interested in:

By 'full persistence' it is meant that instead of using a tmpfs for storing modifications to the read-only media (with the copy-on-write, COW, system) a writable partition is used. In order to use this feature a partition with a clean writable supported filesystem on it labeled "live-rw" must be attached on the system at boot time and the system must be started with the boot parameter 'persistent'. This partition could be an ext2 partition on the hard disk or on a usb key created with, e.g.:

505
   # mkfs.ext2 -L live-rw /dev/sdb1

* Note that there are several ways and means to do persistence, all documented in the FM.
I did it like so....

Make a single partition on your hard drive.  Set it up for crunchbang squashfs as above.  Boot into it.  Once booted, as user crunchbang do this:

$ dd if=/dev/null of=live-rw bs=512M seek=1
$ /sbin/mkfs.ext2 -F live-rw
$ sudo su
# mount -o remount,rw /live/image
# mv /home/crunchbang/live-rw /live/image

User crunchbang should own the live-rw file:

# ls -al /live/image
total 134312
drwxr-xr-x 4 root       root            4096 Jan 13 03:27 .
drwxrwxrwt 4 root       root              80 Jan 13 03:34 ..
drwxr-xr-x 2 root       root            4096 Jan 13 02:44 live
-rw-r--r-- 1 crunchbang crunchbang 536870912 Jan 13 03:43 live-rw
drwx------ 2 root       root           16384 Jan 13 01:42 lost+found

Now add some boot time parameters to your 41_CB_squashfs file.

menuentry 'CrunchBang sda3, Statler Linux 2.6.32-5-amd64 squashfs' --class debian --class gnu-linux --class gnu --class os {
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos3)'
        echo    'Loading Linux 2.6.32-5-amd64 ...'
        linux /live/vmlinuz1 boot=live live-media-path=/live splash vga=791 config quiet union=aufs ip=frommedia persistent noprompt keyboard-layouts=en
        echo    'Loading initial ramdisk ...'
        initrd  /live/initrd1.img
}

Of course you'll need to 'update-grub' to have those changes recognized by GRUB2.  That can be done 2 ways:
1) Boot into your primary OS, edit /etc/grub/41_CB_squashfs and run update-grub
OR (easy and faster)
2) Do it while booted to your live squashfs.  e.g.

$ sudo su
# mkdir sda2
# mount /dev/sda2 sda2
# mount -o bind /dev sda2/dev
# mount -o bind /proc sda2/proc
# chroot sda2
# update-grub

You should probably look at your grub.cfg before leaving the chroot

more boot/grub/grub.cfg

If it looks ok leave chroot then umount dev and proc from the chroot

CTRL+D
# umount sda2/dev/
# umount sda2/proc

You can apt-get packages and they are retained between boots.  Your network configuration (yes wireless too) is preserved, wallpaper etc.

Notes My partition is 1.5G which was more than ample for booting and keeping configs and even some packages installed.

Persistence should work from this point on.  Reboot and have a go.

Last edited by ugh (2011-01-13 05:32:58)


Toshiba laptop - 1.86GHz x 2
3 G RAM
Crunchbang Statler upgraded to Sid
2.6.XX-X.dmz.X-liquorix-amd64

Offline

#9 2011-10-30 18:03:39

ubuntulistener
New Member
Registered: 2009-05-10
Posts: 2

Re: Boot #! squashfs from hard drive - now with persistence!

Hello,  - Thanks for the instructions...

By following the post's instructions, I've managed to "install the latest #! and Ubuntu 10.04 on an exclusive partition (ext4) for ISOs.

I'm only slightly literate insofar as some of the above directions are concerned, and I'm wondering if a bit of help is available to establish "persistence" for the 2 ISOs.

The specifics of my setup are as follows:

I've got Ubuntu Lucid installed as my main OS - /boot -primary partition (sda1), then swap(sda3), then / (sda5), and /home (sda6), with an  extended partition.  Then follows the ISO partition - a primary partition, ext4, which holds the actual ISOs.

I'm UNCOMFORTABLE with using dd, since I've not used it before and realise that dd is a dangerous command where hdds are concerned.

So I'm wondering how to direct the  #! and 10.04 ISOs to use the live-rw and casper-rw files/folders as /home.


My grub.cfg listings for the isos:

menuentry "Crunchbang" {
    set root='(hd0,2)'
    insmod ext2
    linux /live/vmlinuz1 boot=live live-media-path=live  config splash noprompt
    initrd   /live/initrd1.img
}

menuentry "Lucid-live" {
set isofile="/ubuntu-10.04.3-desktop-i386.iso"
loopback loop (hd0,2)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet noeject noprompt splash --
initrd (loop)/casper/initrd.lz



Thanks

Last edited by ubuntulistener (2011-10-30 18:27:01)

Offline

#10 2013-05-13 07:20:39

sigfrido
New Member
Registered: 2013-05-03
Posts: 2

Re: Boot #! squashfs from hard drive - now with persistence!

I tried this method with #! Waldorf. I made some adjustments to your code and was able to run the live image from hard drive. I still have some questions. Would you clarify please why you use msdos in these lines

insmod part_msdos
set root='(hd0,msdos1)'

If I do that, I would never be able to boot the image. Instead, as I have /live on (hd0,1) and write it on the script accordingly . The partition is formatted as ans ext4 file system, so I use insmod part_gpt, instead. In this way, I can get the live OS to run. Is that choice of file system in your code related to the version of #! that you are exemplifying? Also, it should be mentioned that the script has to be flagged as executable, so that update-grub actually runs the script.

Last edited by sigfrido (2013-05-13 23:35:27)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo