SliTaz SliTaz Forum

You are not logged in.

#1 2013-10-30 16:22:13

llev
Member
Registered: 2011-12-09
Posts: 568

[rolling] "home=" doesn't work, fix bootopts.sh

Hi,

My USB flash key holds grub4dos, a FAT partition and an ext2 partition.

If I boot with this Grub command:

kernel /boot/vmlinuz-3.2.40-slitaz root=/dev/null home=37b77cca-39c2-4442-a27b-aee302512cd3

the ext2 partition doesn't get mounted on /home.

In a terminal, I replayed step-by-step the lines in bootopts.sh (starting line 40). The UUID is correct, the output of blkid is correct, and DEVID is correctly set to sdf2. But the following lines don't work:

mount /dev/$DEVID /home -o uid=1000,gid=100 2>/dev/null \

|| mount /dev/$DEVID /home

The first line fails to mount the device. Its exit status is 255. The second line is then executed. *It fails, saying the NTFS is incorrect (!), but the exit code is 0!* (I can't check here and now but I seem to remember "mount" gives incorrect output at that point, saying the device is mounted.)

To make it work I manually added "-t ext2" but this is not an acceptable patch of course. Maybe is there a way to parse the output of blkid? Or is this a bug in busybox that should be reported?

I can provide more info if needed.

Offline

#2 2013-10-30 17:18:45

bellard
Administrator
Registered: 2011-03-28
Posts: 657

Re: [rolling] "home=" doesn't work, fix bootopts.sh

Would you mind test something for me ?

Can you change

mount /dev/$DEVID /home -o uid=1000,gid=100 2>/dev/null || mount /dev/$DEVID /home

by

mount /dev/$DEVID /home && mount /home -o remount,uid=1000,gid=100 2>/dev/null

and retry ?

Thanks.

EDIT: or better: try http://hg.slitaz.org/slitaz-boot-scripts/raw-file/5195a3bc63bf/etc/init.d/bootopts.sh

Offline

#3 2013-11-01 20:31:27

llev
Member
Registered: 2011-12-09
Posts: 568

Re: [rolling] "home=" doesn't work, fix bootopts.sh

The single-line change works, thanks a lot! Do you want me to test the whole new script also?

If I understand correctly, mount tries FS types in order: ntfs, ext2, ext3, ext4... It is somewhat misleading that you get error messages on those which didn't work, but not a success message in the end. Maybe you could add something like: mount /dev/$DEVID /home && echo "/dev/$DEVID successfully mounted" && ... ?

Or suppress error messages altogether: mount /dev/$DEVID /home 2>/dev/null && ... ?

Just my 2 cents.

Offline

#4 2013-11-23 06:45:56

mojo
Administrator
Registered: 2011-03-29
Posts: 2,173

Re: [rolling] "home=" doesn't work, fix bootopts.sh

@Bellard

Cmdline home= mount not working on cooking livecd.

If http://hg.slitaz.org/slitaz-boot-scripts/rev/03d0b5dd9213 is reversed home= mount works.

[c]--- bootopts.sh
+++ bootopts.sh
@@ -15,6 +15,36 @@
    echo $i
}

+# Default user account without password (uid=1000). In live mode the option
+# user=name can be used, but user must be added before home= to have home dir.
+# This option is not handled by a loop and case like others and has no
+# effect on an installed system.
+if ! grep -q "100[0-9]:100" /etc/passwd; then
+    if fgrep -q "user=" /proc/cmdline; then
+        USER=$(cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/')
+        # Avoid usage of an existing system user or root.
+        if grep -q ^$USER /etc/passwd; then
+            USER=tux
+        fi
+    else
+        USER=tux
+    fi
+    echo -n "Configuring user and group: $USER..."
+    adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER
+    passwd -d $USER >/dev/null
+    status
+    # Audio and cdrom group.
+    addgroup $USER audio
+    addgroup $USER cdrom
+    addgroup $USER video
+    addgroup $USER tty
+    # Slim default user.
+    if [ -f /etc/slim.conf ]; then
+        sed -i s/"default_user .*"/"default_user        $USER"/\
+            /etc/slim.conf
+    fi
+fi
+
# Parse /proc/cmdline for boot options.
echo "Checking for SliTaz cmdline options..."

@@ -150,36 +180,6 @@
            continue ;;
    esac
done
-
-# Default user account without password (uid=1000). In live mode the option
-# user=name can be used, but user must be added before home= to have home dir.
-# This option is not handled by a loop and case like others and has no
-# effect on an installed system.
-if ! grep -q "100[0-9]:100" /etc/passwd; then
-    if fgrep -q "user=" /proc/cmdline; then
-        USER=$(cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/')
-        # Avoid usage of an existing system user or root.
-        if grep -q ^$USER /etc/passwd; then
-            USER=tux
-        fi
-    else
-        USER=tux
-    fi
-    echo -n "Configuring user and group: $USER..."
-    adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER
-    passwd -d $USER >/dev/null
-    status
-    # Audio and cdrom group.
-    addgroup $USER audio
-    addgroup $USER cdrom
-    addgroup $USER video
-    addgroup $USER tty
-    # Slim default user.
-    if [ -f /etc/slim.conf ]; then
-        sed -i s/"default_user .*"/"default_user        $USER"/\
-            /etc/slim.conf
-    fi
-fi

# If no default WM fallback to Openbox (we never know).
if [ ! -f /etc/X11/wm.default ]; then[/c]

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.017 seconds, 7 queries executed - Memory usage: 1.54 MiB (Peak: 1.77 MiB) ]