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

Re: (experimental) Alternative usb installation method

Fri Mar 15, 2013 1:20 pm

Script test done. Using yad 0.19.1-1. 2 minor mods made:

line 92: $USBFULLLIST decapitalised
line 308: remove "!" (causes bash errors)

script called with:
Code:
su-to-root -X -c 'xterm -hold -e bash -x mklukscrypt'

Very many errors like this:

Code:
(yad:15769): GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed
(yad:15769): Gtk-CRITICAL **: IA__gtk_style_render_icon: assertion `pixbuf != NULL' failed
(yad:15769): Gtk-WARNING **: Failed to render icon

Apart from that, everything happend just as expected. Don't know if this log (yad errors cut) is any use in a code box.

Code:
+ disklabel=livecrypt
+ fs_type_home=ext2
+ [[ -f /usr/bin/yad ]]
+ DIALOG=yad
+ INFO=image=gtk-dialog-info
+ QUESTION=image=gtk-dialog-question
+ WARNING=image=gtk-dialog-warning
+ ERROR=image=gtk-dialog-error
+ BUTTON0=button
+ BUTTON1=button
+ BUTTON0NUM=:0
+ BUTTON1NUM=:1
++ id -u
+ [[ 0 -eq 0 ]]
+ '[' -t 0 ']'
++ grep /dev/sd
++ awk '{print $1}'
++ /usr/sbin/hwinfo --usb --short
+ usbdevlist=/dev/sdb
++ /usr/sbin/hwinfo --usb --short
++ awk '{print $0}'
++ grep /dev/sd
+ usbdevfulllist='  /dev/sdb             Verbatim Store '\''n'\'' Go'
+ [[ -z   /dev/sdb             Verbatim Store 'n' Go ]]

+ echo -e '\n\tLIST OF USB DEVICES\n\n  /dev/sdb             Verbatim Store '\''n'\'' Go\n'

        LIST OF USB DEVICES

  /dev/sdb             Verbatim Store 'n' Go

+ select_device_gui
++ yad --width=400 --height=200 --title= --list --separator= --column= '--text=Detected USB devices:\n\n  /dev/sdb             Verbatim Store '\''n'\'' Go \n\nPlease select the correct one to use' /dev/sdb


+ device=/dev/sdb
+ echo /dev/sdb
/dev/sdb
+ [[ -b /dev/sdb ]]
+ partition_gui
++ yad --list --title=Partitioning '--text= You need to have a linux partition ready to create an encrypted volume.
If there isn'\''t already a second partition on the usb drive, you can run
the partition editor now and create one. Recommended format is ext2.' --column Option --separator= --width=600 --height=300 'Run GParted partitioner now.' 'Run cfdisk partitioner in a terminal.' 'No thanks, I already have a partition prepared. Continue.' 'I'\''d like to exit the script now.'

+ partitioner='Run GParted partitioner now.'
+ echo 0
0
++ echo Run GParted partitioner now.
++ grep -q GParted
+ gparted /dev/sdb

======================
libparted : 2.3
======================


++ grep -q cfdisk
++ echo Run GParted partitioner now.
++ grep -q exit
++ echo Run GParted partitioner now.
++ yad --list '--title=/home partition' '--text=Select a partition for the encrypted home.' --multiple --column ' ' --column Partitions --height=380 --width=150
++ awk '{print "\n" $0 }'

++ grep /dev/sdb
++ sort
++ find /dev -mindepth 1 -maxdepth 1 -name '*[sh]d[a-z][1-9]'

+ selection='|/dev/sdb2|'
++ tr -d '|'
++ echo '|/dev/sdb2|'
+ home_dev=/dev/sdb2
+ echo /dev/sdb2
/dev/sdb2
+ [[ -b /dev/sdb2 ]]
++ df -h
++ grep /dev/sdb2
++ sed 's/\"//g'
++ sed s/UUID=//
++ awk '{ print $2 }'
++ /sbin/blkid -s UUID
++ grep /dev/sdb2
+ temp_uuid=ae7280d3-fbe4-4c55-b969-ec95eac81dad
++ grep ae7280d3-fbe4-4c55-b969-ec95eac81dad /proc/mounts
++ /sbin/blkid
++ grep -i fat
++ grep /dev/sdb2
+ isfat=

+ [[ -n '' ]]
+ make_crypt
+ echo '
You will need to create a passphrase.
'

You will need to create a passphrase.

+ cryptsetup luksFormat /dev/sdb2

WARNING!
========
This will overwrite data on /dev/sdb2 irrevocably.

Are you sure? (Type uppercase yes):: YES

Enter LUKS passphrase:
Verify passphrase:
+ echo 'Encrypted partition created. Opening it...'
Encrypted partition created. Opening it...
+ cryptsetup luksOpen /dev/sdb2 homecrypt
Enter passphrase for /dev/sdb2:
+ home_part=/dev/mapper/homecrypt
+ mke2fs -t ext2 /dev/mapper/homecrypt
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
35120 inodes, 140288 blocks
7014 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=146800640

5 block groups
32768 blocks per group, 32768 fragments per group
7024 inodes per group
Superblock backups stored on blocks:
        32768, 98304

Allocating group tables: done                           
Writing inode tables: done                           
Writing superblocks and filesystem accounting information: done

+ e2label /dev/mapper/homecrypt livecrypt
+ mkdir -p /tmp/disk2
+ mount /dev/mapper/homecrypt /tmp/disk2
+ copy_iso_home
++ yad --file-selection --width=640 --height=640 '--title=Select Live ISO' '--text= Files need to be copied to your encrypted home directory.
Select the CD image file you want to use as the source of the home files.
This will probably be the same file you used for the live system.'

+ isofile=/media/tera/bootstrap/refracta-beta9/refracta-wheezy-beta9-20130129_1700.iso
+ [[ -z /media/tera/bootstrap/refracta-beta9/refracta-wheezy-beta9-20130129_1700.iso ]]
+ image_mountpoint=/tmp/isomount
+ mkdir -p /tmp/isomount
+ mount /media/tera/bootstrap/refracta-beta9/refracta-wheezy-beta9-20130129_1700.iso /tmp/isomount
mount: warning: /tmp/isomount seems to be mounted read-only.
+ squash_mountpoint=/tmp/squashmount
+ squashfile=/live/filesystem.squashfs
+ mkdir -p /tmp/squashmount
+ mount /tmp/isomount//live/filesystem.squashfs /tmp/squashmount
+ rsync -av /tmp/squashmount/home/ /tmp/disk2/
sending incremental file list

#### SNIP ################

sent 171976345 bytes  received 6817 bytes  4144172.58 bytes/sec
total size is 171927474  speedup is 1.00
+ umount /tmp/squashmount
+ umount /tmp/isomount
+ rmdir /tmp/squashmount
+ rmdir /tmp/isomount
+ echo ' Copied /home to /dev/sdb2.
Cleaning up...
'
Copied /home to /dev/sdb2.
Cleaning up...

+ umount /tmp/disk2
+ rmdir /tmp/disk2
+ cryptsetup luksClose homecrypt
+ echo Done..
Done..


EDIT That done, used refracta2usb on the first (FAT) partition of the same device with the extra menu entry as in the "readme" file (uuid changed to suit) Reboot.. lukshome working as expected.

Re: (experimental) Alternative usb installation method

Sat Mar 16, 2013 12:53 pm

I tried your patch this morning, and it worked nicely. Just to make sure I understand correctly, booting with the custom initrd and 'basemountmode=rw,noatime,umask=000' boot options allows me to write to files in /lib/live/mount/medium, but it does not allow me to write to any files inside the squashfs. So it doesn't take the place of persistence, but it could be used if someone wanted to edit their boot menu, for instance, and they didn't have another running linux to plug in the stick and edit the file. I haven't tested this one with persistence yet, but I did it manually a few weeks ago, and it worked.

I've been running the mkusbcrypt script from a root terminal (just "su") separately from refracta2usb. Not sure if I'm going to join them or what.

Re: (experimental) Alternative usb installation method

Sat Mar 16, 2013 2:35 pm

The actual live-media volume normally gets mounted "ro,noatime" with no way to change.. "basemountmode" is an (experimental) extra parameter to override that, that's all it does. You can't write inside a squashfs under any circumstances.

"umask=000" (VFAT mounts only) allows all-users RW else only root can write

Juggling 2x partitions on smaller devices, e.g. 2GB, is a limitation. This way a persistence loopback file on the same partition can be used, as well as editing of normal files and normal data storage from the live session. The entire free space of the device is available to use.

The patch also includes support for LUKS persistence files, wherever they reside, previously not working. Luks loopback files can be very useful for persistence (or other personal data), they are transferrable, not fs-dependant, can be any size you want and don't require a dedicated partition.

EDIT multiple persistence files can exist, set with " persistence-path=path/to/file" e.g. for multiboot or alt configurations

I've been running the mkusbcrypt script from a root terminal (just "su")

but yad is graphical, surely root must have "X" authority to use it?
Last edited by dzz on Sun Mar 17, 2013 12:22 am, edited 1 time in total.

Re: (experimental) Alternative usb installation method

Sat Mar 16, 2013 4:44 pm

Using 'su' in a terminal allows you to run graphical programs.
Using 'su -' does not.
Starting the root script from within the non-root script is trickier. I didn't try 'su-to-root' yet, because I had trouble with it in the past with the installer and snapshot.

Re: (experimental) Alternative usb installation method

Mon Mar 25, 2013 9:15 am

I failed again.
I had a USB-sd card i used recently.
/dev/sdc1 # a Gig or so
/dev/sdc2 # 3 Gigs or so
Started the script, bash refracta2usb, picked the iso, rebooted.
First i saw the old refracta grub-menu.
It then booted into the right distribution, but to the login-screen (which is wrong, it should autostart the GUI.
I might look at this the wrong way. All i need is a quick way to put a iso to a card or stick.

Re: (experimental) Alternative usb installation method

Mon Mar 25, 2013 1:42 pm

If grub was installed on the sd card before, you might need to run install-mbr first, or you might need to zero it and make a new partition table. I'm not sure.

Re: (experimental) Alternative usb installation method

Mon Mar 25, 2013 7:01 pm

What is sdb? Another syslinux or /live could cause a conflict

What distribution? refracta? other Debian? a custom snapshot?

(should be obvious) make sure the machine is set to boot the right device

If grub has been in sd's mbr you do need to clear it manually (install-mbr)

Re: (experimental) Alternative usb installation method

Mon Mar 25, 2013 8:32 pm

Well: All of that matters?
Using unetbootin i just point it to the iso and am ready to go ...

sdb is the second internal hard-disk.
distribution was crunchbang.
yes, it boots from SD-card
no, i didn't install-mbr

Re: (experimental) Alternative usb installation method

Mon Mar 25, 2013 8:50 pm

nadir wrote:distribution was crunchbang.

I think hell just froze over....nadir using openbox.... :shock:

Re: (experimental) Alternative usb installation method

Mon Mar 25, 2013 9:48 pm

Well: All of that matters?

It matters to help you get it running and to help improve/debug refracta2usb

One more: what version of refracta2usb? The latest I think uses the menus straight off the iso, older ones had only refracta-specific menu configs, unsuitable for most other debian-live

Take a look in /syslinux on the device and compare it to /isolinux on the iso, it should not be very different (please let us know)

Refracta has a preconfigured live user, most others don't, they need "config" or "live-config" enabled for user-setup and other things.

I won't use unetbootin because I prefer a humanly-readable bash script to someone else's mystical and uneditable binary (WTF is a "ubkernel"?)
Post a reply