Change From Loopback

From WebOS Internals
Revision as of 02:59, 25 July 2009 by Rboatright (talk | contribs) (de)
Jump to navigation Jump to search

This method is deprecated. Use the method on the Accessing Linux page instead!

Notes on the old loopback method (deprecated)

We used to use a loopback file on /media/internal to store the contents of /opt. This didn't work well, since as long as the loopback filesystem is mounted, this breaks the Pre's USB/MediaSync modes. When the user tries to enable either mode, webOS will try to umount /media/internal, and as long as the optware.ext3 file is being used, it can't. If you need to migrate from this mode to the new instructions, you need to kill any processes running from that filesystem and umount it, like so:

root@castle:/# initctl stop webos-sshenabler	# this will stop the sshenabler service and kill dropbear
root@castle:/# umount /opt
root@castle:/# losetup -d /dev/loop0		# This command MUST be done—it's not enough to "umount /opt".

To convert from the old loopback method to the /var/opt method without losing SSH access:

root@castle:/var# rsync -va /opt /var/
root@castle:/var# cat > /var/remount.sh
#!/bin/ash -x
initctl stop webos-sshenabler
pkill dropbear
pkill -9 dropbear
umount /opt
losetup -d /dev/loop0
mount -o bind /var/opt /opt
initctl start webos-sshenabler
<CTRL>-D
root@castle:/var# chmod +x /var/remount.sh
root@castle:/var# nohup /var/remount.sh &

This will stop the Dropbear process, mount the new /var/opt, and restart the Dropbear process.

Login again, and check /var/nohup.out for errors. Also check the output of the 'mount' command to make sure it has

/dev/mapper/store-var on /opt type ext3 (rw,noatime,data=ordered)

instead of a reference to "/media/internal/optware.ext3".

Now, you can remove the

/media/internal/optware.ext3    /opt    ext3    loop    0       0

line from /etc/fstab and replace it with

/var/opt /opt bind defaults,bind 0 0

specified in step 2a.

You can also remove the following files upon verifying that everything works after a reboot: /media/internal/optware.ext3 /var/remount.sh /var/nohup.out