BTS

Issue1287

Title script to run commands in target system
Priority wish Status resolved
Superseder Nosy List joerg1
Assigned To Topics

Created on 2013-12-04.10:06:23 by joerg1, last changed 2013-12-04.10:52:28 by mika.

Messages
msg4694 (view) Author: mika Date: 2013-12-04.10:52:28
No problem :)

hf && regards,
Mika
msg4693 (view) Author: joerg1 Date: 2013-12-04.10:44:29
On Wed, Dec 04, 2013 at 10:16:02AM +0000, Michael Prokop wrote:
> Michael Prokop <mika@grml.org> added the comment:
> 
> grml-chroot does that, just use that instead of chroot :)

So then thanks for the hint and sorry for the noise.

Bye,

Joerg
msg4692 (view) Author: mika Date: 2013-12-04.10:16:01
grml-chroot does that, just use that instead of chroot :)
msg4691 (view) Author: joerg1 Date: 2013-12-04.10:06:23
Hello,

I am often in a situation to use grml to correct booting problems
or when the package system has been messed up beyond working.
Some of the commands work simplest when run from within the
target system, i .e. first chroot into it. However typically
there is more to it than just chroot: commands need /proc, /dev is
handled by udev, /var/run now is /run on tmpfs, and while at it
/sys might proove usefull as well.

So I am wondering whether it is possible to include a small
script in grml (e.g. named grml-rescuechroot)

#!/bin/sh
# mount all things a remote root needs and chroot into it
mount $1
cd $1
for i n proc sys dev run; do
  mount --rbind /$i $i
done
# Sorry - zsh in not common everywhere
exec chroot . /bin/bash

Bye,

Joerg
History
Date User Action Args
2013-12-04 10:52:28mikasetstatus: chatting -> resolved
messages: + msg4694
2013-12-04 10:44:29joerg1setmessages: + msg4693
2013-12-04 10:16:01mikasetstatus: unread -> chatting
messages: + msg4692
2013-12-04 10:15:47mikasetpriority: wish
title: Wishlist: script to run commands in target system -> script to run commands in target system
2013-12-04 10:06:23joerg1create