PDA

View Full Version : Unattended mount of persistent image at boot time



omaha64
08-24-2007, 08:28 PM
Hello,

I've done some searches both in this forum and through Google without success.

I've managed to get Knoppix v5.1.1 on a USB thumb drive, and am able to use it successfully. I have also been able to create a persistent image on the same thumb drive (/media/sda4). Whenever Knoppix boots, it finds the image and presents this dialog box:

[X] Mount persistent KNOPPIX-homedirectory
[X] Add as persistent, writeable system area
[ ] Overwrite / update stored system configuration
[X] Start INIT-bootscripts (Network, printer etc.)

< OK > < CANCEL >

Left alone on its own, this dialog defaults to not mounting the image; only after I press the "Ok" button before the timeout period does Knoppix mount this /media/sda4/knoppix.img. I have a need for Knoppix to mount this image without human intervention. Is this possible via some cheat codes, or must I remaster?

Thanks in advance

Double 12
08-28-2007, 08:51 PM
When you add the cheatcode
home=scan at boot, this dialog also appears, but the default option is then mounting the image.
I'm still not sure if the image is being mounted then without pressing ENTER...

omaha64
08-30-2007, 04:40 PM
Double12,

I've tested the "home=scan" option with and without the manual "Enter" press. Without pressing the "Enter" key, the image will not mount, even though the default selection is on the "Ok" button.

The reason I'm doing this is because I use X10 home automation components in my house. I've populated this USB Knoppix boot with some utilities that will simulate a "living" house (lights on/off, radio on/off at certain time). When I leave the house for an extended period, I would just plug this USB drive in my computer and reboot and everything is up and running. The problem is that if there's a power failure while I'm away, this setup would not boot into the right configuration without my intervention (ie "Enter" press). I can do this with the knoppix.cfg script, but thought this way is cleaner.

Double 12
08-30-2007, 08:19 PM
Double12,

I've tested the "home=scan" option with and without the manual "Enter" press. Without pressing the "Enter" key, the image will not mount, even though the default selection is on the "Ok" button.

The reason I'm doing this is because I use X10 home automation components in my house. I've populated this USB Knoppix boot with some utilities that will simulate a "living" house (lights on/off, radio on/off at certain time). When I leave the house for an extended period, I would just plug this USB drive in my computer and reboot and everything is up and running. The problem is that if there's a power failure while I'm away, this setup would not boot into the right configuration without my intervention (ie "Enter" press). I can do this with the knoppix.cfg script, but thought this way is cleaner. When I add cheatcode "home=scan", I have to press ENTER if I want to use the found image as home directory. If I don't press ENTER, the image is mounted and browseable, but not used as home directory.
You indeed will have to write some kind of script or remaster the disk to let Knoppix use the image automatically without human intervention.
But I'm not experienced enough to know how to do that.

xhienne
09-18-2007, 02:36 AM
I'm seeing the same behaviour with Kaella 3.2-DVD-rc1 which is based on Knoppix 5.1.1 (2007-01-04).

This is a bug in the /usr/sbin/knoppix-image script. Here is a patch that works for me :


--- knoppix-image.old 2007-09-18 15:43:56.000000000 +0200
+++ knoppix-image.new 2007-09-18 15:43:56.000000000 +0200
@@ -141,6 +141,7 @@
# Try to mount this filesystem read-write
# trymount device|file mountpoint
trymount(){
+local RC=1
# Check if already mounted
case "$(cat /proc/mounts)" in *\ $2\ *)
checkwritable "$2" && return 0
@@ -229,8 +230,16 @@
[ -n "$FORCE" ] && AUTO="--timeout 10" || AUTO="--timeout 20 --defaultno"
$DIALOG --title "$TITLE" $AUTO --checklist "$DESC1" 22 75 4 home "$MENU1" on system "$MENU2" on overwrite "$MENU3" off init "$MENU4" on 2>"$TMP"
RC="$?"
-if [ "$RC" = "0" ] || [ "$RC" = "255" -a -n "$FORCE" ]; then
- SELECTION="$(<$TMP)"
+if [ "$RC" = "1" ] || [ "$RC" = "255" -a -z "$FORCE" ]; then
+ rm -f "$TMP"
+ umount /KNOPPIX.IMG 2>/dev/null
+ bailout
+else
+ if [ "$RC" = "0" ]; then
+ SELECTION="$(<$TMP)"
+ else
+ SELECTION='"home" "system" "init"'
+ fi
rm -f "$TMP"
# mount base partition rw
BASE="$(dirname "$IMAGE")"
@@ -238,10 +247,6 @@
checkwritable "$BASE" || { umount -l "$BASE"; sleep 2; mount -o rw "$BASE"; }
checkwritable "$BASE" || { $DIALOG --title ERROR --msgbox "$ERRORW" 15 75; bailout; }
trymount "$IMAGE" /KNOPPIX.IMG || { $DIALOG --title ERROR --msgbox "$ERRORW" 15 75; umount /KNOPPIX.IMG 2>/dev/null; bailout; }
-else
- rm -f "$TMP"
- umount /KNOPPIX.IMG 2>/dev/null
- bailout
fi

OLDHOMEDIR=""

johnrw
02-13-2008, 10:11 PM
Well... I've got to thank omaha64 for starting this thread. It describes the situation accurately, and was always a small peeve of mine. The presense of the knoppix.img should create the assumption that it is there to be used... and without interaction. Then I could turn on the pc and go and get some coffee.

I wish there was a way to get this to work without having to remaster knoppix. If knoppix.sh executed first then we could just copy over the culprit script with a better version more to our liking. By the time I could make a remaster, knoppix 6.0 will be out!

Thanks to both xhienne and Double 12 for adding their info to this one. I guess this may be the thing that gets me to try and remaster knoppix.

Harry Kuhman
02-13-2008, 11:11 PM
You guys seem to be discussing something that I asked for years ago, see this thread (http://www.knoppix.net/forum/viewtopic.php?t=12704). Unfortunately, while many of us think that this would be the natural way that Knoppix should operate, the developers have what I consider to be rather paranoid views that prevent them from giving us this feature. Unless common sense prevails, and that hardly seems likely, yes, you will have to remaster to get this very desirable feature.

johnrw
02-13-2008, 11:52 PM
Hi Harry,

Wow... all the way back in 2004! Yeah, like I said... it was a small peeve I had. What say we make a iso with the one small change and call it knoppix-home. I think I may try and do the CD version. We could put it up on torrent for mass consumption.

Time for something to happen with this problem.
I am also trying to figure out what is wrong with my persistent home in this discussion.
In this thread (http://www.knoppix.net/forum/viewtopic.php?p=116749)
Fsck always gives an error when I boot up... saying the partition was not cleanly unmounted. Does anyone else have this problem with their persistent home dirs?

I would hate to remaster a knoppix and find out that I needed to use a later version of something like aufs afterword.

johnrw
02-16-2008, 10:58 AM
You guys seem to be discussing something that I asked for years ago, see this thread (http://www.knoppix.net/forum/viewtopic.php?t=12704). Unfortunately, while many of us think that this would be the natural way that Knoppix should operate, the developers have what I consider to be rather paranoid views that prevent them from giving us this feature. Unless common sense prevails, and that hardly seems likely, yes, you will have to remaster to get this very desirable feature.

Hey Harry,

I actually made an iso that now has the patch above... and it works. The iso is my first one, and since I used the knoppix-remaster script I can't tell you alot about what I did right and wrong. lol.

I did boot with the DVD when I ran it and it did not make the KNOPPIX2 cloop file, but it booted when I booted it using grub and the bootfrom= option using Gilles Ryumbeke's minirt_511a.gz.

I made just 2 mods.
The patch above in knoppix-image.
I modified knoppix-halt to not exclude pump from being killed off... which means I now don't get fsck errors when I mount my persistent home... and has the side benefit of much faster shutdowns, Hooray!

It is not really necessary to remaster to fix the later... as changing the file in your persistent home is enough to correct it.

Harry, you are right... it is necessary to remaster to fix the problem discussed here for the topic. Damn. Well it was not so hard with the scripts and enough disk space. I will get better at this. If you'd like an iso image it is around 2Gb, but I could put it on my webspace in a few pieces. It is really just half of the DVD version.

hey xhienne,
Thanks again for the patch!