2015-08-18

Slitaz -- Loop Install summary

/dev/sdb1: LABEL="slitaz-318" UUID="b9f5cf75-b3a0-4c86-bd48-3933094a7551" TYPE="ext4" PARTUUID="02190218-01"


1. slitaz-rolling-preinit.iso 2015-Aug-16
root@slitaz:~# grep slitaz-boot /var/lib/tazpkg/installed.md5
b43d9dd85ec1a41643a47d4856096a4c slitaz-boot-scripts-409.tazpkg


2. blkid: sda and sdb
root@slitaz:~# blkid
/dev/loop0: UUID="3bff2dfa-99d7-4e18-850e-3701b2ec017e" TYPE="ext3" PTTYPE="dos"
/dev/sda1: LABEL="win" UUID="000534FA0002617A" TYPE="ntfs" PARTUUID="329e43ff-01"
/dev/sda2: LABEL="rolling" UUID="e9594d18-8d01-4cf3-9e9c-bdcf9ca64060" TYPE="ext3" PARTUUID="329e43ff-02"
/dev/sda3: LABEL="slitaz-ff" UUID="724023ae-b6a9-4b54-9cd8-2b76a510a463" TYPE="ext4" PARTUUID="329e43ff-03"
[..]
/dev/sdb1: LABEL="slitaz-318" UUID="b9f5cf75-b3a0-4c86-bd48-3933094a7551" TYPE="ext4" PARTUUID="02190218-01"

root@slitaz:~# dmesg | grep -A 7 SanDisk
scsi 8:0:0:0: Direct-Access SanDisk Cruzer Switch 1.26 PQ: 0 ANSI: 5
sd 8:0:0:0: Attached scsi generic sg1 type 0
sd 8:0:0:0: [sdb] 31266816 512-byte logical blocks: (16.0 GB/14.9 GiB)
sd 8:0:0:0: [sdb] Write Protect is off
sd 8:0:0:0: [sdb] Mode Sense: 43 00 00 00
sd 8:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sdb: sdb1
sd 8:0:0:0: [sdb] Attached SCSI removable disk


3. mount=/dev/sda3...
root@slitaz:~# cat /proc/cmdline
mount=/dev/sda3 loopfs=slitaz.fs

root@slitaz:~# head -7 /var/log/boot.log
Mount /dev/sda3...
Into file slitaz.fs...
[ Done ]
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]
Mounting devtmpfs filesystem on: /dev [ Done ]
Starting udev daemon...

root@slitaz:~# df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 3.6G 232.0K 3.6G 0% /run
/dev/sda3 484.2M 112.9M 346.4M 25% /mnt
/dev/loop0 484.2M 112.9M 346.4M 25% /
devtmpfs 3.6G 0 3.6G 0% /dev
tmpfs 3.6G 0 3.6G 0% /dev/shm
tmpfs 3.6G 0 3.6G 0% /var/lock

root@slitaz:~# mount
tmpfs on /run type tmpfs (rw,relatime)
/dev/loop0 on / type ext3 (rw,relatime,user_xattr,barrier=1,nodelalloc,data=ordered)
proc on /proc type proc (rw,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=3798508k,nr_inodes=949627,mode=755)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime)
tmpfs on /var/lock type tmpfs (rw,relatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime)
root@slitaz:~#


4. Mount /dev/sda3 (slitaz-ff)...
root@slitaz:~# cat /proc/cmdline
mount=slitaz-ff loopfs=slitaz.fs

root@slitaz:~# head -7 /var/log/boot.log
Mount /dev/sda3 (slitaz-ff)...
Into file slitaz.fs...
[ Done ]
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]
Mounting devtmpfs filesystem on: /dev [ Done ]
Starting udev daemon...

root@slitaz:~# df -h | head -4
Filesystem Size Used Available Use% Mounted on
tmpfs 3.6G 228.0K 3.6G 0% /run
/dev/sda3 484.2M 112.8M 346.4M 25% /mnt
/dev/loop0 484.2M 112.8M 346.4M 25% /

root@slitaz:~# mount | head -2
tmpfs on /run type tmpfs (rw,relatime)
/dev/loop0 on / type ext3 (rw,relatime,user_xattr,barrier=1,nodelalloc,data=ordered)


5. Mount /dev/sda3 (724023ae-b6a9-4b54-9cd8-2b76a510a463)...
root@slitaz:~# cat /proc/cmdline
mount=724023ae-b6a9-4b54-9cd8-2b76a510a463 loopfs=slitaz.fs

root@slitaz:~# head -7 /var/log/boot.log
Mount /dev/sda3 (724023ae-b6a9-4b54-9cd8-2b76a510a463)...
Into file slitaz.fs...
[ Done ]
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]
Mounting devtmpfs filesystem on: /dev [ Done ]
Starting udev daemon...

root@slitaz:~# df -h | head -4
Filesystem Size Used Available Use% Mounted on
tmpfs 3.6G 228.0K 3.6G 0% /run
/dev/sda3 484.2M 112.8M 346.4M 25% /mnt
/dev/loop0 484.2M 112.8M 346.4M 25% /

root@slitaz:~# mount | head -2
tmpfs on /run type tmpfs (rw,relatime)
/dev/loop0 on / type ext3 (rw,relatime,user_xattr,barrier=1,nodelalloc,data=ordered)
root@slitaz:~#


6. Mount /dev/sdb1...
root@slitaz:~# cat /proc/cmdline
mount=/dev/sdb1 loopfs=slitaz.fs

root@slitaz:~# head -8 /var/log/boot.log
Mount /dev/sdb1...
mount: mounting /dev/sdb1 on /mnt failed: No such device or address
Sleep 2 seconds...Into file slitaz.fs...
[ Done ]
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]
Mounting devtmpfs filesystem on: /dev [ Done ]
Starting udev daemon...

root@slitaz:~# df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 3.6G 240.0K 3.6G 0% /run
/dev/sdb1 484.2M 112.9M 346.4M 25% /mnt
/dev/loop0 484.2M 112.9M 346.4M 25% /
devtmpfs 3.6G 0 3.6G 0% /dev
tmpfs 3.6G 0 3.6G 0% /dev/shm
tmpfs 3.6G 0 3.6G 0% /var/lock

root@slitaz:~# mount
tmpfs on /run type tmpfs (rw,relatime)
/dev/loop0 on / type ext3 (rw,relatime,user_xattr,barrier=1,nodelalloc,data=ordered)
proc on /proc type proc (rw,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=3798504k,nr_inodes=949626,mode=755)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime)
tmpfs on /var/lock type tmpfs (rw,relatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime)


7. Mount slitaz-318...
root@slitaz:~$ cat /proc/cmdline
mount=slitaz-318 loopfs=slitaz.fs

root@slitaz:~$ head -11 /var/log/boot.log
Mount slitaz-318...
mount: mounting /dev/slitaz-318 on /mnt failed: No such file or directory
Sleep 2 seconds...mount: mounting /dev/slitaz-318 on /mnt failed: No such file or directory
Into file slitaz.fs...
losetup: /mnt/slitaz.fs: No such file or directory
Switching / to tmpfs...
[ Done ]
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]
Mounting devtmpfs filesystem on: /dev [ Done ]
Starting udev daemon...


8. Mount b9f5cf75-b3a0-4c86-bd48-3933094a7551...
root@slitaz:~$ cat /proc/cmdline
mount=b9f5cf75-b3a0-4c86-bd48-3933094a7551 loopfs=slitaz.fs

root@slitaz:~$ head -11 /var/log/boot.log
Mount b9f5cf75-b3a0-4c86-bd48-3933094a7551...
mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
Sleep 2 seconds...mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
Into file slitaz.fs...
losetup: /mnt/slitaz.fs: No such file or directory
Switching / to tmpfs...
[ Done ]
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]
Mounting devtmpfs filesystem on: /dev [ Done ]
Starting udev daemon...
root@slitaz:~$

http://forum.slitaz.org/topic/init-patch-fix-tazusb-writefs-tazlito-writeiso-issues#post-38925

2015-08-12

Slitaz -- PS1


root@slitaz:~$
root@slitaz:~$ grep Red -A 2 /etc/profile
# Red and blue for root
PS1="\[\e[1;31m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\\$ "
#PS1='\u@\h:\w\$ '

root@slitaz:~$ . /etc/profile
root@slitaz:~#

Slitaz -- Loop install / UUID-2


slitaz-rolling-preinit.iso 2015-Aug-09

mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory

/bin/sh: tazpkg: not found


1.
root@slitaz:~$ cat /proc/cmdline
mount=b9f5cf75-b3a0-4c86-bd48-3933094a7551 loopfs=slitaz.fs


2.
root@slitaz:~$ grep slitaz /var/lib/tazpkg/installed.md5
370f8b89f84bdea6d148dcde164794af slitaz-base-files-282.tazpkg
d217df7d7f46042afd4d54879170c53d slitaz-boot-scripts-408.tazpkg


3.
root@slitaz:~$ head -28 /var/log/boot.log
$root:

Mount b9f5cf75-b3a0-4c86-bd48-3933094a7551...

r=$(blkid|sed):

${r:-$root}: b9f5cf75-b3a0-4c86-bd48-3933094a7551

${r#/dev/}: b9f5cf75-b3a0-4c86-bd48-3933094a7551

{/dev/$(r%%/*)}: /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551

${root#*$r}: b9f5cf75-b3a0-4c86-bd48-3933094a7551

mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
Sleep 2 seconds...

$r : /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551

mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
Into file slitaz.fs...
losetup: /mnt/slitaz.fs: No such file or directory
Switching / to tmpfs...
[ Done ]
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]
Mounting devtmpfs filesystem on: /dev [ Done ]
Starting udev daemon...


4.
root@slitaz:~$ diff /init-orig /init
--- /init-orig
+++ /init
@@ -89,18 +89,26 @@
got $1 && msg "$1 $root"
}
+echo -e "\$root: $root\n"
+
mnt()
{
r=$(blkid 2> /dev/null | sed "s|\"||g;/$(echo $root | tr / .)/!d;s|:.*||;q")
+echo -e "\nr=\$(blkid|sed): $r\n"
r=${r:-$root}
+echo -e "\${r:-\$root}: $r\n"
r=${r#/dev/}
+echo -e "\${r#/dev/}: $r\n"
r=/dev/${r%%/*}
+echo -e "{/dev/\$(r%%/*)}: $r\n"
d=${root#*$r}
+echo -e "\${root#*\$r}: $d\n"
busybox mount $r $1 && return
w=$(cat /sys/module/usb_storage/parameters/delay_use)
w=$((1+${w:-2}))
echo -n "Sleep $w seconds..."
sleep $w
+echo -e "\n\$r : $r\n"
busybox mount $r $1
}


5.
root@slitaz:~$ tazpkg
/bin/sh: tazpkg: not found

root@slitaz:~$ ls -l /usr/bin/taz*
ls: /usr/bin/taz*: No such file or directory

2015-08-02

Slitaz -- Loop install


Loop install

 
If you want to install SliTaz on a disk (not a frugal install), and you don't want to create a partition for SliTaz, but you have enough room in a feature-poor filesystem (FAT32 or NTFS)…
… create a loop file and install SliTaz into it!
The problem is: what size? 200MB should be the minimum. Imagine, you could like it and install many more packages!

Loopfile creation

You can create the loop file with mountbox (click loop, enter the file name, then click create, enter the size, the units, click create) or with the command line:
# dd if=/dev/zero bs=1M count=200 of=slitaz.fs
You now need to create a filesystem in this loopfile:
# yes | mke2fs -j slitaz.fs
Later, if the loopfile is too small you can extend it (assuming you don't boot from the loopfile, but a Slitaz Live CD for example):
# dd if=/dev/zero bs=1M count=100 >> slitaz.fs
# resize2fs slitaz.fs

Root filesystem files installation

Copy files from the rootfs.gz archive of a cdrom into the loopfile:
# mount /dev/cdrom /media/cdrom
# mount -o loop,rw slitaz.fs /mnt
# unlzma -c /media/cdrom/boot/rootfs.gz | ( cd /mnt; cpio -idmu )
# umount -d /mnt
# umount /media/cdrom

Boot setup

Get a preinit iso file with same version (the kernel version must match the modules version in the root filesystem). The partition storing the loopfile (say /dev/hda1) and its path into the partition (say /data/slitaz.fs) is defined by the mount and loopfs arguments:
 
title SliTaz cooking
  map (hd0,0)/boot/slitaz-preinit.iso (hd1)
  map --hook
  kernel (hd1)/boot/bzImage mount=/dev/hda1 loopfs=data/slitaz.fs
  initrd (hd1)/boot/rootfs.gz
 
The loop install does not use exotic packages from preinit. You can use any SliTaz flavor (except lorams).
 
You can built an up-to-date preinit iso anytime with
# tazlito get-flavor preinit
# tazlito gen-distro
title SliTaz cooking in loop file
  map (hd0,0)/boot/slitaz-cooking.iso (hd1)
  map --hook
  kernel (hd1)/boot/bzImage mount=/dev/hda1 loopfs=data/slitaz.fs
  initrd (hd1)/boot/rootfs.gz
  
title SliTaz cooking in RAM (like the Live CD)
  map (hd0,0)/boot/slitaz-cooking.iso (hd1)
  map --hook
  kernel (hd1)/boot/bzImage rw root=/dev/null autologin
  initrd (hd1)/boot/rootfs.gz

Or, you can replace the device name of the mount variable by the UUID or LABEL returned by blkid:
 
title SliTaz cooking
  map (hd0,0)/boot/slitaz-preinit.iso (hd1)
  map --hook
  kernel (hd1)/boot/bzImage mount=a4b346ee-4c7b-46aa-9fd4-6bc39ab4fa96 loopfs=data/slitaz.fs
  initrd (hd1)/boot/rootfs.gz
 
You can extract the bzImage and rootfs.gz from the iso image to avoid map commands and defragmentation.

Slitaz -- Loop install / LABEL


Or, you can replace the device name of the mount variable by the UUID or LABEL returned by blkid:
mount: mounting /dev/slitaz-318 on /mnt failed: No such file or directory

tmpfs: Bad value '90%' for mount option 'nr_inodes'
 
1.
root@slitaz:~# cat /proc/cmdline
mount=slitaz-318 loopfs=slitaz.fs

2.
root@slitaz:~# head -12 /var/log/boot.log
Mount slitaz-318...
mount: mounting /dev/slitaz-318 on /mnt failed: No such file or directory
Sleep 2 seconds...mount: mounting /dev/slitaz-318 on /mnt failed: No such file or directory
Into file slitaz.fs...
losetup: /mnt/slitaz.fs: No such file or directory
Switching / to tmpfs...
mount: mounting tmpfs on /mnt failed: Invalid argument
[ Skipped ]

Loading module: squashfs
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]
Mounting devtmpfs filesystem on: /dev [ Done ]

3.
root@slitaz:~# grep tmpfs /var/log/dmesg.log
tmpfs: Bad value '90%' for mount option 'nr_inodes'
root@slitaz:~# blkid | grep sdb
/dev/sdb1: LABEL="slitaz-318" UUID="b9f5cf75-b3a0-4c86-bd48-3933094a7551" TYPE="ext4" PARTUUID="02190218-01"

4.
root@slitaz:~# df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 3.6G 212.0K 3.6G 0% /run
devtmpfs 3.6G 0 3.6G 0% /dev
tmpfs 3.6G 0 3.6G 0% /dev/shm
tmpfs 3.6G 0 3.6G 0% /var/lock

5.
root@slitaz:~# mount
rootfs on / type rootfs (rw,relatime)
tmpfs on /run type tmpfs (rw,relatime)
proc on /proc type proc (rw,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=3798496k,nr_inodes=949624,mode=755)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime)
tmpfs on /var/lock type tmpfs (rw,relatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime)

6.
root@slitaz:~# grep -A 13 'mnt()' /init
mnt()
{
r=$(blkid 2> /dev/null | sed "s|\"||g;/$(echo $root | tr / .)/!d;s|:.*||;q")
r=${r:-$root}
r=${r#/dev/}
r=/dev/${r%%/*}
d=${root#*$r}
busybox mount $r $1 && return
w=$(cat /sys/module/usb_storage/parameters/delay_use)
w=$((1+${w:-2}))
echo -n "Sleep $w seconds..."
sleep $w
busybox mount $r $1
}

7.
root@slitaz:~# grep -A 4 rootfsinodes /init
got rootfsinodes && inodes=$root
root=90%
got rootfssize
[ $(busybox free|busybox awk '/Mem:/{print int(($4*100)/$3)}') -ge $r ] &&
busybox mount -t tmpfs -o size=$root,nr_inodes=$inodes tmpfs /mnt &&
root@slitaz:~#


Slitaz -- Loop install / UUID


Loop install
http://doc.slitaz.org/en:guides:uncommoninst#loop-install
Boot setup
[..]
title SliTaz cooking in loop file
map (hd0,0)/boot/slitaz-cooking.iso (hd1)
map --hook
kernel (hd1)/boot/bzImage mount=/dev/hda1 loopfs=data/slitaz.fs
initrd (hd1)/boot/rootfs.gz
title SliTaz cooking in RAM (like the Live CD)
map (hd0,0)/boot/slitaz-cooking.iso (hd1)
map --hook
kernel (hd1)/boot/bzImage rw root=/dev/null autologin
initrd (hd1)/boot/rootfs.gz
Or, you can replace the device name of the mount variable by the UUID or LABEL returned by blkid:
title SliTaz cooking
map (hd0,0)/boot/slitaz-preinit.iso (hd1)
map --hook
kernel (hd1)/boot/bzImage mount=a4b346ee-4c7b-46aa-9fd4-6bc39ab4fa96 loopfs=data/slitaz.fs
initrd (hd1)/boot/rootfs.gz
mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
tmpfs: Bad value '90%' for mount option 'nr_inodes'


1.
root@slitaz:~# cat /proc/cmdline
mount=b9f5cf75-b3a0-4c86-bd48-3933094a7551 loopfs=slitaz.fs

2.
root@slitaz:~# head -11 /var/log/boot.log
Mount b9f5cf75-b3a0-4c86-bd48-3933094a7551...
mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
Sleep 2 seconds...mount: mounting /dev/b9f5cf75-b3a0-4c86-bd48-3933094a7551 on /mnt failed: No such file or directory
Into file slitaz.fs...
losetup: /mnt/slitaz.fs: No such file or directory
Switching / to tmpfs...
mount: mounting tmpfs on /mnt failed: Invalid argument
[ Skipped ]

Loading module: squashfs
Processing: /etc/init.d/rcS...
Mounting proc filesystem on /proc [ Done ]

3.
root@slitaz:~# grep tmpfs /var/log/dmesg.log
tmpfs: Bad value '90%' for mount option 'nr_inodes'

4.
root@slitaz:~# blkid | grep sdb
/dev/sdb1: LABEL="slitaz-318" UUID="b9f5cf75-b3a0-4c86-bd48-3933094a7551" TYPE="ext4" PARTUUID="02190218-01"

5.
root@slitaz:~# grep -A 7 'mnt()' /init
mnt()
{
r=$(blkid 2> /dev/null | sed "s|\"||g;/$(echo $root | tr / .)/!d;s|:.*||;q")
r=${r:-$root}
r=${r#/dev/}
r=/dev/${r%%/*}
d=${root#*$r}

6.
root@slitaz:~# grep -A 4 rootfsinodes /init
got rootfsinodes && inodes=$root
root=90%
got rootfssize
[ $(busybox free|busybox awk '/Mem:/{print int(($4*100)/$3)}') -ge $r ] &&
busybox mount -t tmpfs -o size=$root,nr_inodes=$inodes tmpfs /mnt &&
root@slitaz:~#

http://hg.slitaz.org/slitaz-boot-scripts/rev/d6c818f35639