Stuff that has not yet gone into the official build.
Post a reply
dzz

- dzz
- Posts: 647
- Joined: Wed Apr 27, 2011 11:53 am
- Location: Devon, England

## Re: (experimental) Alternative usb installation method

Mon Jan 28, 2013 5:29 pm

Previous URL's for this script are no longer current also it was recently updated to suit Wheezy.
Current version: http://exegnulinux.net/refracta/experim ... +1_all.deb
Deps: syslinux, gparted, live-boot, live-config, yad | zenity, mtools, fuseiso, pmount, pv, xterm, hwinfo
BTW "mtools" (msdos-type filesystem manipulation, 341.0 kB installed) seems not in Refracta Beta6. Inclusion request!
The recent erratic state of live-boot is settling out now. The initrd patches are working again for write access to the live-media partition ("works" = "for me" unless others test it and say what is wrong)
Persistence works with a ext2 loopback file in the same partition. The script will optionally create one. The preferred way to boot is "findiso", now officially supported in wheezy/sid.
One pendrive here has 8 menu selectable live systems, some with dedicated persistence , the official debian netinstaller, up-to-date clamav defs and still room for music and vids! The addition of grub4dos enables it to boot other OS's or find and load grub-pc elsewhere.
Syslinux and FAT (yes, that horrible FS) are used simply for multi-platform data transfer compatability.. The same method is probably easily adapted for ext2 with extlinux or even grub.
The drive must be prepared first (it may or not already be) One FAT32 primary partition flagged "boot" is required. Also a proper MBR:

Code:
  `/sbin/install-mbr /dev/sdx`

If isohybrid "dd" has been previously used it is first necessary to zero the device (at least beyond the first 2048)

Code:
  `dd if=/dev/zero of=/dev/sdx`

To detect the drive the script now uses hwinfo, dmsg was found unreliable.
The device must not be configured in fstab because the script uses pmount.
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: (experimental) Alternative usb installation method

Wed Jan 30, 2013 4:09 am

I added mtools. That was an oversight. There may be others.
The new snapshot2usb looks good. I like the usb identification. It makes me feel secure when I can read the name next to the device.
Did this with refracta-wheezy (beta9?). Two partitions on the usb stick. First fat32 and bootable, second ext2.
Chose the third option on the first screen, chose the third option on the second screen.
First time through I missed the screen for setting up persistence. Not sure if it was blocked with another window or if if never came up. Stick did not boot, so I zeroed it and reformatted the same way.
Second time through with same choices, the persistence setup window came up. I chose home persistence, and when it asked me for the size of the loopback file, I canceled. I want to use the second partition. Finished that install, and that one doesn't boot, either. It looks like all the files are there, including syslinux.cfg. Log is copied below.
I was about to try it again, this time with the second partition labeled "persistence" but I thought I'd wait, in case you want more info about what's on the stick.

Code:
  `sending incremental file list
  cd+++++++++ snapshot2usb/
  >f+++++++++ snapshot2usb/9990-misc-helpers.sh
  >f+++++++++ snapshot2usb/9990-overlay.sh
  >f+++++++++ snapshot2usb/live
  >f+++++++++ snapshot2usb/live-helpers
  >f+++++++++ snapshot2usb/readme.txt
  >f+++++++++ snapshot2usb/splash.jpg
  >f+++++++++ snapshot2usb/syslinux.cfg
  sent 149992 bytes received 149 bytes 300282.00 bytes/sec
  total size is 149479 speedup is 1.00
  process 3610: arguments to dbus_move_error() were incorrect, assertion "(dest) == NULL || !dbus_error_is_set ((dest))" failed in file ../../dbus/dbus-errors.c line 282.
  This is normally a bug in some application using the D-Bus library.
  libhal.c 3483 : Error unsubscribing to signals, error=The name org.freedesktop.Hal was not provided by any .service files
  process 3636: arguments to dbus_move_error() were incorrect, assertion "(dest) == NULL || !dbus_error_is_set ((dest))" failed in file ../../dbus/dbus-errors.c line 282.
  This is normally a bug in some application using the D-Bus library.
  libhal.c 3483 : Error unsubscribing to signals, error=The name org.freedesktop.Hal was not provided by any .service files
  /dev/sda
  /dev/sdb
  /dev/sdb
  sdb
  /dev/sdb1
  `./syslinux.cfg' -> `/media/snapshot2usb_1/syslinux/syslinux.cfg'
  `/usr/lib/syslinux/vesamenu.c32' -> `/media/snapshot2usb_1/syslinux/vesamenu.c32'
  `./splash.jpg' -> `/media/snapshot2usb_1/syslinux/splash.jpg'
  15.6MB 0:00:01 [15.6MB/s] [> ] 2% ETA 0:00:41
  32MB 0:00:02 [16.4MB/s] [> ] 4% ETA 0:00:39
  48.2MB 0:00:03 [16.3MB/s] [=> ] 7% ETA 0:00:38
  <snip>
  659MB 0:01:20 [7.66MB/s] [==================================> ] 99% ETA 0:00:00
  664MB 0:01:20 [8.23MB/s] [==================================>] 100%
  `isomount/live/initrd.img' -> `/media/snapshot2usb_1/snapshot/initrd.gz'
  `isomount/live/vmlinuz' -> `/media/snapshot2usb_1/snapshot/vmlinuz'
  There is 2073MB free space on the device
  sed: can't read /media/snapshot2usb_1/syslinux.cfg: No such file or directory
  sed: can't read /media/snapshot2usb_1/syslinux.cfg: No such file or directory
  debugfs 1.42.5 (29-Jul-2012)
  /media/snapshot2usb_2/persistence: No such file or directory while opening filesystem
  write: Filesystem not open
  `

fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: (experimental) Alternative usb installation method

Wed Jan 30, 2013 4:24 am

Oops. Forgot to run install-mbr. Did that, labeled the second partition "persistence" and ran snapshot2usb again, same choices. This time I took the loopback file. It still doesn't boot.
dzz

- dzz
- Posts: 647
- Joined: Wed Apr 27, 2011 11:53 am
- Location: Devon, England

## Re: (experimental) Alternative usb installation method

Wed Jan 30, 2013 2:41 pm

This is tested so far only in a real hardware install using an iso on disk.
Tree of the usb (persistence is optional, can always be added later):

Code:
  `/media/snap-live
  ├── DATA
  ├── snapshot
  │ ├── initrd.gz
  │ ├── persistence
  │ ├── snapshot.iso
  │ └── vmlinuz
  └── syslinux
  ├── ldlinux.sys
  ├── splash.jpg
  ├── syslinux.cfg
  └── vesamenu.c32
  3 directories, 8 files`

Here the package "hal" is installed, on beta6 it is not. The log shows hal/dbus errors. I remember reading somewhere a bug about this affecting hwinfo.
Here user 1000 is in these extra groups: adm disk lp dialout users crontab ssh powerdev scanner
I will be doing a clean beta 6 install later, too much has got changed, then I will see what happens. Maybe groups are a problem, the script does not run as root. In the meantime, try (as root, sdx umounted):

Code:
  `/sbin/install-mbr /dev/sdx
  syslinux -d syslinux /dev/sdx`

Easy to forget: flag it "boot", I use gparted
Except if a bios (or hardware) problem or misconfig you should see on screen that mbr then syslinux load, even if syslinux.cfg isn't found or there is a later error. Is there anything at all, at first boot screen?
With probably dozens of pendrives done here, some worked with no fs or mbr changes at all; others were quite stubborn (mostly the ones that had been dd'd). I was defeated by none.
More later
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: (experimental) Alternative usb installation method

Wed Jan 30, 2013 3:12 pm

I'm doing this on hardware, running from a live-usb. All I get is a flashing cursor on a black screen. I just noticed that there's a SYSLINUX directory instead of syslinux.
Just did it again, this time with a single fat32 partition, skipped the persistence setup, and it works. And looking at the files on the stick again, I notice something I didn't notice before. In the snapshot directory, I've got kernel, initrd and iso. Before, I had filesystem.squashfs instead of iso. Didn't notice it, because that's what I'm used to seeing. Going to try again. Also going to fire up irc. Ping me if you want to talk live.
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: (experimental) Alternative usb installation method

Wed Jan 30, 2013 3:47 pm

Did it again with two partitions, skipped persistence, and it worked. Again, I've got filesystem.squashfs instead of iso. This was with choosing third option on both screens. (Sorry, I can't remember what it says. First one is "wheezy blah" second screen is "Debian method blah".)
One more time - two partitions, set up home persistence, booted US English with persistence, created a file in my home, rebooted, and the file is not there. 'df -h' shows only one mounted partition. No separate /home.
I think the boot problem was with the mbr. It seems to be working now.
"Debian method from iso on hard disk" is supposed to put filesystem.squashfs on the stick instead of the iso?
Why does the persistence setup look like it's going to make a loopback file instead of using my second partition?
dzz

- dzz
- Posts: 647
- Joined: Wed Apr 27, 2011 11:53 am
- Location: Devon, England

## Re: (experimental) Alternative usb installation method

Wed Jan 30, 2013 11:38 pm

The "debian method" options use only the extracted squash. This needs reviewing because wheezy/sid now support "findiso" (find and use an iso image direct) Only the original initrd is used.
Alternatively, the script will patch the initrd to (optionally) support mounting the partition containing the live-media RW (otherwise not possible) (and use findiso) That option is activated by "basemountmode=rw,noatime" on cmdline
This has some advantages, e.g. a persistence loopback file on the same partition can be used and a multiboot setup can have separate persistence for each OS. Data files kept on the pendrive but outside the OS have RW access (and menus can be edited) while in the live session.
It might be an idea, , to write both original and patched initrd in. The menu is simple to edit.
To use an existing second persistence partition, run the script without enabling persistence and add "persistence" to the menu cmdline. It might default to a loopback only otherwise, that will be reviewed later.
Re setting up: I deliberately replaced partitioning options from the script with notes. It's up to the user to get the device prepared, I reckon it's too dangerous and error-prone to script stuff like install-mbr and partitioning for this. And yes, getting a normal bootloader working for a pendrive is in some cases difficult.
It's possible that an ailing drive, although seemingly still ok for data transfer, is not up to the job. They have a limited life of write cycles.
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: (experimental) Alternative usb installation method

Sat Feb 09, 2013 12:25 am

I'm working on a simplified version of snapshot2usb that's specific to refracta.
Options:
- Use contents of .iso file
- Use live media mount (if you're running live)
- Update the live folder on the stick wtih contents of a different iso, don't mess with syslinux.
No persistence, no fromiso, copies syslinux folder from a template that's mostly a copy of the isolinux folder in snapshot. You get the same boot menu as the iso. Plus the option to use hooks, which get added to the usb stick.
It works. Will look at it tomorrow, assuming the electricity doesn't get knocked out. Northeast US gets a snow day.
One oddity -
From main system running on hardware, using real usb stick, unprivileged user can run syslinux.
From live iso in vbox, using virtual hard drive instead of usb stick, syslinux complains about permissions if user tries to run it Works with su or sudo. Drive is fat32.
dzz

- dzz
- Posts: 647
- Joined: Wed Apr 27, 2011 11:53 am
- Location: Devon, England

## Re: (experimental) Alternative usb installation method

Sat Feb 09, 2013 2:10 pm

A simplified snapshot2usb probably is the best way to go.
Other, more advanced options like persistence, initrd patching and creating loopback files could be split into one or more separate scripts to enhance or convert an existing "basic" setup, e.g. for multiboot..
Some more advanced stuff is difficult or impossible to script for; there are so many different permutations (hooks and persistence) Although the official docs can be confusing; for wheezy they are unfinished and in some cases incorrect.
BTW "fromiso" is not to be confused with the much more useful and quite simple to use "findiso"
RE syslinux menu templates and Debian compatibility: Note that standard debian-live images need "config" on the cmdline, refracta does not. Official images may have more than one kernel. It would probably work to copy directly most of /isolinux from the cd image, renaming isolinux to syslinux.
I can't test anything with virtualbox here, it's unusably slow, on more than one machine. Is a core2 with 2GB ram not enough?
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: (experimental) Alternative usb installation method

Sat Feb 09, 2013 3:12 pm

Your hardware should be enough. I'm using a 2GHz dual-core athlon and 2G ram, about six years old, and vbox works fine. Well, until I use up 3/4 of my ram, then things get sticky. Anyway, I wrote up directions for using "refracta2usb" to make a live usb and use hooks for an encrypted /home partition. I'll try to post those in reply. Will upload a tarball later. It can be unpacked in your home and run by user. Later for deb.
Edit: Nope. The directions must remain secret. I'll include a readme in the tarball.
Post a reply
Jump to:

Powered by phpBB © phpBB Group.

phpBB Mobile / SEO by Artodia.