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

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 9:35 am

At the MBR-FA prompt, type the number, 1 and hit ENTER. It should then boot the first partition. If you didn't already do it, zeroing the first 2mb of the drive and starting over might help.

I guess you already found this:
Code:
$ apt-file search install-mbr
mbr: /sbin/install-mbr
mbr: /usr/share/man/man8/install-mbr.8.gz

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 10:23 am

Looks like fuseiso must be installed too.

Device free space is wrong ( 12 Gigs instead of 4)

Then fails with this:
Code:
/dev/sdc1
sending incremental file list
./
rsync: failed to set times on "/media/sdc1/.": Operation not permitted (1)
rsync: failed to modify permissions on "/media/sdc1/.": Operation not permitted (1)
README.diskdefines
md5sum.txt
ubuntu
.disk/
rsync: recv_generator: mkdir "/media/sdc1/.disk" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
casper/
rsync: recv_generator: mkdir "/media/sdc1/casper" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
preseed/
rsync: recv_generator: mkdir "/media/sdc1/preseed" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: mkstemp "/media/sdc1/.README.diskdefines.qidhqU" failed: Permission denied (13)
rsync: mkstemp "/media/sdc1/.md5sum.txt.5XiYOu" failed: Permission denied (13)
rsync: mkstemp "/media/sdc1/.ubuntu.m1AJd5" failed: Permission denied (13)

sent 2073 bytes  received 84 bytes  4314.00 bytes/sec
total size is 2801598846  speedup is 1298840.45
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]
sending incremental file list
rsync: mkdir "/media/sdc1/live" failed: Permission denied (13)
rsync error: error in file IO (code 11) at main.c(605) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
sending incremental file list
syslinux/
rsync: recv_generator: mkdir "/media/sdc1/syslinux" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***

sent 422 bytes  received 16 bytes  876.00 bytes/sec
total size is 761831  speedup is 1739.34
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]


Reformat.

-
Reformatting didn't help. Edited fstab and removed the entry for my stick. I got rid of the last error by that.

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 10:38 am

And that seems to have worked.

Not that sure what the problem was (or is), because i also did it from a refracta-live-CD
(and i did empty the first MB's with dd).
For sure a mixture of missing dependencies and pmount/fstab problems. I think.

Oh, i edited the log to go into the current dir instead of ~/


-
Assuming that it might be that others use SD-cards too:
If possible without trouble adding the option to simply add a device name might be useful.
All that plugging and unplugging of the usb-card-reader and inserting/removing of the SD-card, from laptop to card-reader was a bit of trouble. Else i could have simply done it from the laptop, leaving the card in the port.

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 12:06 pm

The script uses pmount.. which cannot work for devices configured in fstab

It's worth including a check for that in the script, I thought I did that in later versions of snapshot2usb (now discontinued in favour of fsmithred's simplified version) That is a bit awkward to do as it could be label, device, uuid or any of those commented out.

Also used is fuseiso (mounts iso images) which requires user to be in "fuse" group.. if it was a deb that would be resolved automatically. Till then a dependency note in the "readme" file might help (or a check in the actual script)

To do these things any other way requires root.. this runs as normal user (much safer)

Note that unetbootin also uses syslinux (not sure but probably requires root for mounting) I don't use unetbootin because it's all binary stuff (WTF is a ubkernel?), you're stuck with someone else's defaults you can't do much about.. normal bash scripts are always preferred here.

As far as I know, "MBR-FA" shows if you forget to flag the partition as "boot"

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 12:51 pm

The original snapshot2usb included an optional initrd patch to allow custom mount options for a live boot device.

If mounted RW, advantages include persistence without multiple partitions, ability to store data and menu editing while in the live session.

That probably no longer works with more recent versions of live-boot. I'm now doing this seperately and it is updated to suit all versions up to 4.0~a7, the current one in experimental (but not squeeze)

Also included is a patch to allow use of a LUKS persistence file located in a non-luks partition (can be in the live-media partition or not)

The new patch is posted here http://exegnulinux.net/refracta/experim ... trd.tar.gz Instructions are included. No changes are made to existing system files. So far totally untested except by me.

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 1:43 pm

Tests for the device that are in the current version -
usb device exists
device not mounted
device is FAT

Free space and file system (mounted iso) size are not working right. Here's the function, in case anyone has ideas. The commands seem to work properly on the command line, but not in the script.
Code:
# Show free space on usb device and size of filesystem to copy to it.
check_size () {
device_freespace=$(df -h $usb_mountpoint | awk '/dev/ { print $4 }')

filesystem_size=$(du -sh "$image_mountpoint"| awk '{ print $1 }')
alternate_size=$(ls -lh "$isofile" | awk '{ print $5 }')

TEXT="Device free space should be greater than image size

Device free space:\t\t$device_freespace
Image size:\t\t\t\t$filesystem_size
or maybe:\t\t\t\t$alternate_size
"


$DIALOG --$QUESTION --width=480 --height=220 --title="$TITLE" --${BUTTON0}="Continue"${BUTTON0NUM} --${BUTTON1}="Exit"${BUTTON1NUM} --text="$TEXT"

   if [[ $? != 0 ]] ; then

      echo " Exiting at check_size"
      pumount /dev/${DEVICE}1
      if [[ -d $image_mountpoint ]] ; then
         fusermount -u "$image_mountpoint"
      fi      
      exit 0
   fi
}


I'll take a look at the patch. It might be worth doing that. Right now, if you want to make an encrypted, rw home, you have to drop to console, log in as root, and run another script. And if you want to use the uuid number for lukshome in cmdline, you have to plug the stick into a running system to edit the boot menu.

I'm thinking of trying to combine the two scripts, so that you can do it all from a terminal, and the boot menu can be edited before you ever boot into the live system. That will involve being root and non-root at different times in the same script. I'm not sure if that's possible.

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 4:25 pm

The commands seem to work properly on the command line, but not in the script.

You sure about that? I just tried a fuseiso mount on a 637MB image.

Code:
:~$ du -h "$image_mountpoint"| awk '{print $1}'
185K
159M
4.0K
159M


Code:
:~$ du -sh "$image_mountpoint"| awk '{print $1}'
159M


Looks like du doesn't handle fuse mounts properly. This one gets it near enough right though:

Code:
:~$  du -h "$isofile"|awk '{print $1}'
638M

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 4:56 pm

I guess I wasn't sure about that. Didn't work here, either. But I think I solved the problem. Image_size gets defined differently if you're using an iso file vs. copying from live system. It
Code:
If using iso file:
image_size=$(ls -lh "$isofile" | awk '{ print $5 }')  # or du -h $isofile works, too. Not sure why I don't need the awk when it's in the script.

if copying a running live system:
image_mountpoint="/lib/live/mount/medium"
image_size=$(du -sh "$image_mountpoint")



And here's the function. Device size now reports the whole line from df, so you can decide if you have enough room or not. Free space is meaningless if you're going to replace an existing image with a new one.
Code:
check_size () {
device_freespace=$(df -h $usb_mountpoint) #| awk '/dev/ { print $4 }')

TEXT="Make sure you have enough space on the device to hold the image.

Device size:

$device_freespace

Image size:\t$image_size
"


$DIALOG --$QUESTION --width=680 --height=220 --title="$TITLE" --${BUTTON0}="Continue"${BUTTON0NUM} --${BUTTON1}="Exit"${BUTTON1NUM} --text="$TEXT"

   if [[ $? != 0 ]] ; then

      echo " Exiting at check_size"
      pumount /dev/${DEVICE}1
      if [[ -d $image_mountpoint ]] ; then
         fusermount -u "$image_mountpoint"
      fi      
      exit 0
   fi
}

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 5:10 pm

Free space is meaningless if you're going to replace an existing image with a new one

Unless.. like me, you're replacing it with a monster xz-compressed 3.5GB snapshot!

Which BTW works flawlessly and fast on usb

Re: (experimental) Alternative usb installation method

Mon Mar 11, 2013 5:21 pm

Well, now du without the awk shows the iso filename, but that's ok. I like that.
Here's my working copy. No big changes yet, just the size reporting problem fixed, I think.
https://gist.github.com/fsmithred/5135856
Post a reply