Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    [Debian] Running Debian in a chroot

    Reply
    Page 29 of 34 | Prev | 19   27     28   29   30     31   | Next | Last
    Benson | # 281 | 2008-08-07, 17:33 | Report

    So have you (qole, or actually anyone) tested that yet with a non-broken iceweasel? I'd like to know if it's working correctly.

    (And I think I may have been a bit over-the-top with that post, actually. I'd forgotten about posting that when I went to set up my own chroot scripts from scratch on a clean flash (I was off-line, and hadn't got my backups handy), and even having looked at and tweaked your version previously, I only got perhaps over half the mounts and file clones right before I gave up a couple hours later. Major hat-tip for your success!)

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Benson For This Useful Post:
    qole

     
    qole | # 282 | 2008-08-07, 17:55 | Report

    Originally Posted by Benson View Post
    I will warn that iceweasel now looks horrible here, but I think that's because I clobbered something else, not from debbie.
    Looks fine here. Thanks a lot.
    (...I won't ask what you've clobbered now... )

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to qole For This Useful Post:
    Benson

     
    qole | # 283 | 2008-08-09, 23:34 | Report

    EDIT: Script attachment removed. See below for better scripts.

    Ok, here are the new chroot scripts for beta testing.

    The big news is that the chroot script is now BOOTABLE-DEBIAN-SAFE.

    I have taken out all of the file copy commands and put them into a separate script, called "synchroot" which makes a unique backup of all copied files. This script is only run when the user creates an empty file called ~/.synchroot (which is deleted when the script completes). This way, the files are only copied into the chroot when the user requests it, which may be never, in the case of those with custom setups.

    This will allow you to chroot into your OS2007 partition, for example, or into your bootable beta3 partition, without worrying about copying over any files. All you do is modify your ~/.chroot file.

    I have also included a closechroot script, which closes all chroot apps and unmounts the chroot. This is useful for changing chroots, etc.

    This also includes Benson's fixed debbie script.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by qole; 2008-08-12 at 02:38.

     
    qole | # 284 | 2008-08-10, 06:39 | Report

    Originally Posted by Matan View Post
    About unmounting: I found that killing all chrooted programs like this:


    for i in [0-9]* ; do if ls -dl $i/root | grep -q /opt ; then kill $i ; fi ; done


    And then unmounting in the correct order (basically reversed order of mounting), works everytime.
    I used that line in my closechroot script, but it doesn't work. All I get is,
    Code:
    ls: [0-9]*/root: No such file or directory
    What is that line supposed to do?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Stskeeps | # 285 | 2008-08-10, 06:52 | Report

    Originally Posted by qole View Post
    I used that line in my closechroot script, but it doesn't work. All I get is,
    Code:
    ls: [0-9]*/root: No such file or directory
    What is that line supposed to do?
    Can't you use 'fuser' or the likes instead of some voodoo solution of killing processes in chroot?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Stskeeps For This Useful Post:
    qole

     
    qole | # 286 | 2008-08-10, 07:37 | Report

    Originally Posted by Stskeeps View Post
    Can't you use 'fuser' or the likes instead of some voodoo solution of killing processes in chroot?
    I don't know, can I? Please post the proper command.

    EDIT: Thanks for the tip! I figured it out, it is really straightforward and "non-voodoo"

    Code:
    fuser -m "$CHROOT" -k
    It's as simple as that, all chroot processes are killed!

    EDIT2: For those of you trying this at home: DO NOT RUN THIS IF YOUR CHROOT IS NOT MOUNTED! The fuser command will say, "Oh, I need to kill all processes in the filesystem that the empty /debian directory is in. That would seem to be, um, everything."

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by qole; 2008-08-10 at 09:02. Reason: Figured it out

     
    qole | # 287 | 2008-08-10, 08:56 | Report

    HOORAY!

    Here are even better scripts. I have fixed closechroot so it works every time (thanks Stskeeps!), and, thanks to a new USB drive, I finally cleaned up the external device mounting routine in debian; now it gets the list of devices mounted under /media and mounts them all in Debian, creating the directory if needed first. I believe that this closes the "FIXME" that Benson put on this section of the script.

    Code:
     #Any external devices
      MNTD=`cat /proc/mounts | grep ' /media/' | awk '{print $2}'`
      for MDRV in $MNTD ; do
        if [ ! -d "$CHROOT$MDRV" ] ; then
          mkdir "$CHROOT$MDRV"
        fi
        mount -o bind "$MDRV" "$CHROOT$MDRV"
      done
    For the sake of completeness, I've included the /home/user/.chroot file, too, so in theory you can untar this as root into your root directory, and you are good to go.

    Everything I said above applies here, too:
    Originally Posted by qole View Post
    The big news is that the chroot script is now BOOTABLE-DEBIAN-SAFE.

    I have taken out all of the file copy commands and put them into a separate script, called "synchroot" which makes a unique backup of all copied files. This script is only run when the user creates an empty file called ~/.synchroot (which is deleted when the script completes). This way, the files are only copied into the chroot when the user requests it, which may be never, in the case of those with custom setups.

    This will allow you to chroot into your OS2007 partition, for example, or into your bootable beta3 partition, without worrying about copying over any files. All you do is modify your ~/.chroot file.

    I have also included a closechroot script, which closes all chroot apps and unmounts the chroot. This is useful for changing chroots, etc.

    This also includes Benson's fixed debbie script.

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Files
    File Type: gz debscripts.tar.gz (3.2 KB, 217 views)

     
    qole | # 288 | 2008-08-10, 19:31 | Report

    I guess the next thing to do is make the debian script check to see if $CHROOT and other variables are already there (perhaps set before running the script), and if they are, use those values. It would need to be crafted such that you could define one or more variables and only undefined variables are retrieved from the ~/.chroot file. However it is done, it would have to also be integrated into the closechroot script... Also, the "chroot-complete" marker file would have to be chroot-specific, so the debian script will properly mount multiple chroots.

    I would like to be able to do something like:
    Code:
    sudo 'CHROOT=/debian IMGFILE=/dev/mmcblk0p4 debbie iceweasel'
    This would run Debian Iceweasel.

    And then, later, I could do...

    Code:
    'CHROOT=/os2007 IMGFILE=/dev/mmcblk0p3 debbie xmame froggers.zip'
    This would run my OS2007 version of xmame to let me play frogger...

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by qole; 2008-08-10 at 19:35.

     
    qole | # 289 | 2008-08-11, 19:29 | Report

    Ok, found another problem... Tried to use the scripts to mount the internal flash. It doesn't know the jffs2 file system type, so it falls back to ext2. Sigh...

    WORKAROUND: mount the partition ahead of time, then run the script. It fails to mount, but it is already mounted, so the chroot proceeds as normal.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    midwinter | # 290 | 2008-08-12, 00:35 | Report

    Hi all. I'm trying to track down some digitizer errors (presses not registering, presses registering in the wrong place) and would like to uninstall Debian. Can I just do it through the application manager, or do I need to do anything fancy?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 29 of 34 | Prev | 19   27     28   29   30     31   | Next | Last
vBulletin® Version 3.8.8
Normal Logout