Closed moralrebuild closed 4 years ago
You can use a smaller system or roll your own (e.g. debootstrap something). Just find some similar rescue live environments you may want to try, unpackage them, and chroot in and see if they work well.
Thanks for your instructions. I have installed minibase of Debian 10 (buster) as the rescue OS. But I failed to run the scripts under my existing Debian 9 (stretch, virtualbox guest as experiment):
root@stretch:/# sh /takeover/takeover.sh
Please set a root password for sshd
New password:
Retype new password:
passwd: password updated successfully
Setting up target filesystem...
Mounting pseudo-filesystems...
Checking and switching TTY...
/takeover/takeover.sh: 40: /takeover/takeover.sh: cannot open /takeover//dev/pts/1: No such file
Could you please have a look? Thanks.
PTS/1? Try it over ssh. See if it works?
On Fri, Jul 12, 2019, 1:11 PM Capmus Banon notifications@github.com wrote:
Thanks for your instructions. But I failed to run the scripts under my Debian 9 (stretch):
root@stretch:/# sh /takeover/takeover.sh Please set a root password for sshd New password: Retype new password: passwd: password updated successfully Setting up target filesystem... Mounting pseudo-filesystems... Checking and switching TTY... /takeover/takeover.sh: 40: /takeover/takeover.sh: cannot open /takeover//dev/pts/1: No such file
Could you please have a look? Thanks.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/marcan/takeover.sh/issues/9?email_source=notifications&email_token=AA6RJGPZSYTZ6PYOM5IGCJDP7C3L3A5CNFSM4H7RHVLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ2KZSY#issuecomment-510962891, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6RJGO3BHMPNCVBEJITVW3P7C3L3ANCNFSM4H7RHVLA .
In fact, it indeed ran over ssh session:
root@stretch:/# tty
/dev/pts/1
root@stretch:/# uname -a
Linux stretch 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64 GNU/Linux
root@stretch:/# cat /etc/debian_version
9.9
It looks got broken at this line:
exec <"${TO}/${TTY}" >"${TO}/${TTY}" 2>"${TO}/${TTY}"
To be honest, I don't fully understand this command but often use below one in my own scripts:
exec command <> /dev/pts/1 2>&1
This is the fix I used to make it work for modern Debian/ArchLinux:
sed -i 's|^./busybox mount -t devpts devpts dev/pts|./busybox mount --bind /dev/pts dev/pts|' ${TO}/takeover.sh
Additionally, need to manually create a directory for ssh daemon. Otherwise you get failure by "Missing privilege separation directory: /run/sshd"
I'm trying to evaluate if it can be used for my Xen based VPS since the vendor provides neither custom ISO nor rescue image interfaces. But the VPS has only 1GB RAM and the recommended System Rescue CD takes more than 2.7GB after unsquashfs.