WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Grub2 boot with default sshd enabled boot toram for iso  (Read 4597 times)

Offline as247

  • Newbie
  • *
  • Posts: 8
Grub2 boot with default sshd enabled boot toram for iso
« on: May 01, 2021, 06:43:40 AM »
Hello everyone
Purpose: I want to use tinycore as installer/rescue script, that help to install other os or backup partitions/disk
Env: A vps with ubuntu installed. No VNC console.
So that I create new boot menu (grub2) on current os
Something like this
Quote
menuentry "CorePure64" {
    linux /root/tc/vmlinuz64
    initrd /root/tc/corepure64.gz
}
My problem:
How to make tc start with sshd service and make it available to access from remote (because no VNC console)
Any boot param can i used?
Like this?
Quote
menuentry "CorePure64" {
    linux /root/tc/vmlinuz64 toram sshd sshd_password=123abc
    initrd /root/tc/corepure64.gz
}

Thank you all
« Last Edit: May 01, 2021, 06:45:11 AM by as247 »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14801
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #1 on: May 01, 2021, 06:53:29 AM »
piCore is configured by default to start like this.

You need to set openssh "onboot", enter the commands you require in /opt/bootlocal.sh and make a backup

Offline as247

  • Newbie
  • *
  • Posts: 8
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #2 on: May 01, 2021, 09:08:35 AM »
you mean Raspberry PI? but Raspberry has ARM cpu, will it work on x86, x64 or qemu kvm?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14801
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #3 on: May 01, 2021, 09:10:16 AM »
piCore is only for RPi - I was just giving an example of how it could be done..

Offline as247

  • Newbie
  • *
  • Posts: 8
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #4 on: May 01, 2021, 11:41:45 AM »
Hi, thank for your suggestion
I have make it work by extract iso file and create grub2 menu entry.
Now have only one small issue, if reboot tinycore with reboot command boot loader code write to hard disk and after reboot it say operating system missing.
Here is detail steps:
1. Extract tinycore to /tce,
2. Update grub menu and boot to tinycore
3. Install windows with wget -O- http://linkto-raw-disk.gz | gunzip | dd of=/dev/vda
4. Reboot (by command line) -> OS missing
(if Reboot with web panel -> can boot to windows)
Any way to reboot tinycore from command line without overwrite MBR?

Offline as247

  • Newbie
  • *
  • Posts: 8
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #5 on: May 01, 2021, 12:21:45 PM »
ok i found it
reboot -nf

thank so much

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #6 on: May 01, 2021, 01:15:44 PM »
That's not really safe, you're overwriting a mounted disk! And telling reboot not to sync means your Windows disk image may not make it to disk fully either.

You should run TC in RAM, so that the disk you're operating on is not mounted. Then you can reboot normally, not with the force or no-sync options. See copy2fs.flg on the forum and wiki.
The only barriers that can stop you are the ones you create yourself.

Offline as247

  • Newbie
  • *
  • Posts: 8
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #7 on: May 01, 2021, 09:40:40 PM »
That's not really safe, you're overwriting a mounted disk! And telling reboot not to sync means your Windows disk image may not make it to disk fully either.

You should run TC in RAM, so that the disk you're operating on is not mounted. Then you can reboot normally, not with the force or no-sync options. See copy2fs.flg on the forum and wiki.
Hi curaga, how to run TC in RAM with grub2? (note need enable ssh after boot automatically - because there is no VNC console or screen)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #8 on: May 01, 2021, 10:40:41 PM »
Hi as247
...  how to run TC in RAM with grub2? ...
Create an empty file called  copy2fs.flg  in your  /tce  directory. That will tell Tinycore to load everything into RAM.

Quote
... (note need enable ssh after boot automatically - because there is no VNC console or screen)
You need to install  openssh.tcz  and its dependencies.
You need to make sure the  onboot.lst  file in your  /tce  directory contains the line  openssh.tcz.
You will need to edit your  /opt/bootlocal.sh  file to add whatever commands you need to start  openssh.
You will need to run a backup after editing  /opt/bootlocal.sh  like this:
Code: [Select]
filetool.sh -bI recommend you boot into an environment with a keyboard and screen to set that up.

Offline as247

  • Newbie
  • *
  • Posts: 8
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #9 on: May 01, 2021, 11:24:37 PM »
Thank you. Now i got another issue that mydata.tgz not loaded
I boot tce via grub2

Quote
menuentry "TinyCore" {
    linux /tce/boot/vmlinuz
    initrd /tce/boot/core.gz
}



It not load mydata.tgz file and also not able to backup. :(

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #10 on: May 01, 2021, 11:57:43 PM »
Hi as247
It looks like you are still receiving kernel messages at the command prompt. Run this:
Code: [Select]
dmesg > dmesg.txtand attach  dmesg.txt  to your next post.

Offline as247

  • Newbie
  • *
  • Posts: 8
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #11 on: May 02, 2021, 12:36:43 AM »
Hi Rich, Here is my dmesg
Please help to check.
You also can login to server by ssh to check
Quote
107.173.84.27
tc
tce123
tce root: /mnt/vda1/tce
path grub config files: /mnt/vda1/boot/grub
Thank you.
« Last Edit: May 02, 2021, 12:43:47 AM by as247 »

Offline as247

  • Newbie
  • *
  • Posts: 8
Re: Grub2 boot with default sshd enabled boot toram for iso
« Reply #12 on: May 02, 2021, 11:46:13 AM »
I have checked around and found that /dev/vda1 is not mounted at boot time then mydata.tgz not restored
I tried to add waitusb=5 to boot option and it's working now