Jump to content
XPEnology Community

Grub Boot Menu Default Value Changer for Tinycore Redpill


Peter Suh

Recommended Posts

 

tc@box:~$

curl --location "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/grubmenu.sh" --output grubmenu.sh; chmod +x grubmenu.sh;

 

I distribute a simple utility for Tinycore.
Some features are imported from pocopico's rploader.sh.

 

You can use this when you want to change the grub.cfg default boot menu order after rebooting if necessary.

USB <-> Tiny Core Image Build
SATA <-> Tiny Core Image Build

If you want to change in between, you don't have to wait hard in front of the keyboard.

 

Download and use the above command
You can select the latter option from 1, 2, 3 in the order of the menu.

 

tc@box:~$ ./grubmenu.sh 1
tc@box:~$ ./grubmenu.sh 2
tc@box:~$ ./grubmenu.sh 3

 

1. menuentry 'Yet Another Jun`s Mod x RedPill DS1621+ v7.0.1-42218 (USB, Verbose)' {
2. menuentry 'Yet Another Jun`s Mod x RedPill DS1621+ v7.0.1-42218 (SATA, Verbose)' {
3. menuentry 'Tiny Core Image Build' {


tc@box:~$ ./grubmenu.sh 1
Mounting /dev/sda1 to localdiskp1
grub boot partition mounted normally.
Entries in Localdisk bootloader:
==================================================== =======================
menuentry 'Yet Another Jun`s Mod x RedPill DS1621+ v7.0.1-42218 (USB, Verbose)' {
menuentry 'Yet Another Jun`s Mod x RedPill DS1621+ v7.0.1-42218 (SATA, Verbose)' {
menuentry 'Tiny Core Image Build' {

 

Setting default boot entry to USB

 

tc@box:~$ ./grubmenu.sh 2
Mounting /dev/sda1 to localdiskp1
grub boot partition mounted normally.
Entries in Localdisk bootloader:
==================================================== =======================
menuentry 'Yet Another Jun`s Mod x RedPill DS1621+ v7.0.1-42218 (USB, Verbose)' {
menuentry 'Yet Another Jun`s Mod x RedPill DS1621+ v7.0.1-42218 (SATA, Verbose)' {
menuentry 'Tiny Core Image Build' {

 

Setting default boot entry to SATA

 

tc@box:~$ ./grubmenu.sh 3
Mounting /dev/sda1 to localdiskp1
grub boot partition mounted normally.
Entries in Localdisk bootloader:
==================================================== =======================
menuentry 'Yet Another Jun`s Mod x RedPill DS1621+ v7.0.1-42218 (USB, Verbose)' {
menuentry 'Yet Another Jun`s Mod x RedPill DS1621+ v7.0.1-42218 (SATA, Verbose)' {
menuentry 'Tiny Core Image Build' {

 

Setting default boot entry to Tiny Core Image Build

 

------------------------------------------------------------ ----------------------------------

 

If you want to change to Tiny Core Image Build boot in Synology,
Connect with SSH

 

Download the above command to a suitable location in the Synology shared folder.

You can use it like this.

 

sudo ./grubmenu.sh 1
sudo ./grubmenu.sh 2
sudo ./grubmenu.sh 3

 

 

Edited by Peter Suh
  • Like 1
Link to comment
Share on other sites

  • Peter Suh changed the title to Grub Boot Menu Default Value Changer for Tinycore Redpill

It would be nice if such a script was created for synology. You could change the default grub after restarting synology. So to force TCRD to run after synology reboot to update DSM.

 

Now I see it has been done. Thanks!

 

Maybe change

1, 2, 3

to

usb, sata, tcrp

 

Edited by SanKen
  • Like 1
Link to comment
Share on other sites

  • 1 month later...
1 hour ago, phone guy said:

Excellent, I was looking for something exactly like this. I would like to make a request @Peter Suh can you add a way to edit the mac address during a tinycore session? That way when a baremetal build boots to tc, it would have the same ip as it does when it boots usb/sata to DSM, and it will be simple to find.

 

 

 

TCRP must be modified by pocopico.
Let me develop it as an add-on to the M shell.
./my.sh DS918+ editmac 112233445566
If you put the desired MAC address as an option in this way, it seems to be a function to change the value of mac1.

Link to comment
Share on other sites

5 hours ago, Peter Suh said:

 

TCRP must be modified by pocopico.
Let me develop it as an add-on to the M shell.
./my.sh DS918+ editmac 112233445566
If you put the desired MAC address as an option in this way, it seems to be a function to change the value of mac1.

What I need personally is, the DSM has a custom mac and I know which IP it is, or you can find it easy with find.synology.com.

But when the baremetal system boots with TC, it uses the real hardware mac, so the IP changes, and that box is headless, so I can not load terminal and use ifconfig to see ip.  If TC could use the same mac, it would boot with the same ip as dsm, so I would know where it is.  Otherwise I have to search the dhcp server for the genuine hardware mac address to find the ip tc gets.

 

But I understand pocopico has to edit anything with tc. I just need a better way to find the ip of tc when it boots headless. I dont know of any tricks to do that.

Link to comment
Share on other sites

15 minutes ago, phone guy said:

What I need personally is, the DSM has a custom mac and I know which IP it is, or you can find it easy with find.synology.com.

But when the baremetal system boots with TC, it uses the real hardware mac, so the IP changes, and that box is headless, so I can not load terminal and use ifconfig to see ip.  If TC could use the same mac, it would boot with the same ip as dsm, so I would know where it is.  Otherwise I have to search the dhcp server for the genuine hardware mac address to find the ip tc gets.

 

But I understand pocopico has to edit anything with tc. I just need a better way to find the ip of tc when it boots headless. I dont know of any tricks to do that.

 

Have you ever seen an IP address exposed on ARPL's loader boot screen?
This is the first feature I proposed to fabio and added.

 

So, TC has discussed with fabio how to expose the IP address to the console during the loader boot stage in the same way.

However, it was concluded that there was no way to expose the IP address to the console like this because TC's grub handling method was different from ARPL.
I was really sad too.

  • Like 1
Link to comment
Share on other sites

27 minutes ago, phone guy said:

What I need personally is, the DSM has a custom mac and I know which IP it is, or you can find it easy with find.synology.com.

But when the baremetal system boots with TC, it uses the real hardware mac, so the IP changes, and that box is headless, so I can not load terminal and use ifconfig to see ip.  If TC could use the same mac, it would boot with the same ip as dsm, so I would know where it is.  Otherwise I have to search the dhcp server for the genuine hardware mac address to find the ip tc gets.

 

But I understand pocopico has to edit anything with tc. I just need a better way to find the ip of tc when it boots headless. I dont know of any tricks to do that.

 

 

Personally, the easiest way for me to find an IP from REDPILL headless without find.synology.com is to assign a static MAC address and IP address to the router.
The mac address does not matter whether it is a real hardware mac address or a virtual mac address.

  • Like 1
Link to comment
Share on other sites

@Peter Suh To make sure before I start this process, can you verify this will do what I want?

 

I will install this in DSM using SSH.

Update DSM to latest update U4

grubmenu 3 and reboot to TC

SSH to TC and run postupdate command

in TC grubmenu 1 (to boot USB)

reboot back to DSM

and I should be good, am I correct?

 

This is a headless system with no video out, so I will not be able to see the grubmenu - I hope this works the way I expect.  I will wait until I hear back from you before I start the process... THANKS!

Link to comment
Share on other sites

@Peter Suh To make sure before I start this process, can you verify this will do what I want?
 
I will install this in DSM using SSH.
Update DSM to latest update U4
grubmenu 3 and reboot to TC
SSH to TC and run postupdate command
in TC grubmenu 1 (to boot USB)
reboot back to DSM
and I should be good, am I correct?
 
This is a headless system with no video out, so I will not be able to see the grubmenu - I hope this works the way I expect.  I will wait until I hear back from you before I start the process... THANKS!


As described in the guide, you can use it for any operation you want.

Both functions are included so that it can be used both on Synology boot state or on TC Linux.

You may process sudo ./grubmenu.sh 3 in advance before installing update 4 .

Although it is not a function in rploader.sh, if postupdate is processed with my.sh, a function is added to return the default value of grub menu to 1.


Sent from my iPhone using Tapatalk
  • Like 1
Link to comment
Share on other sites

@Peter Suh ./grubmenu.sh says permission denied ... so steps I followed are:

Login to DSM via SSH (windows putty app) using my user credentials. sudo -i and re-enter my password

change dir to tmp (cd tmp) [root@dsm:/tmp]

I downloaded using

 curl --location "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/grubmenu.sh" --output grubmenu.sh; chmod +x grubmenu.sh; 

I tried ./grubmenu.sh 3 and I got permission denied

so I again issued chmod +x grubmenu.sh

I did a ls to list directory, and grubmenu.sh is green

I tried sudo ./grubmenu.sh 3 and again permission denied

 

So I don't know what do to now.

Link to comment
Share on other sites

@Peter Suh Nevermind, I got it.  I did have an issue, but here is what I did for anyone else who may want to use this to update a headless system like this one is. I have included the PuTTY logs for you to review.

 

You have to install grubmenu on the sudo -i root, otherwise I got a permission denied. I had to be in root@dsm:~# to install and execute grubmenu. You can see I had to sudo -i and verify I was at the right level where Xpenology_backup was located. However, ./grubmenu.sh 3 did not make the system boot back to TC - I didn't catch it in PuTTY but it said it was going to reboot to usb - reinstall DSM (see log below)

 

root@DSM:/# cd tmp
root@DSM:/tmp# ./grubmenu.sh 3
-ash: ./grubmenu.sh: Permission denied
root@DSM:/tmp# sudo ./grubmenu.sh 3
sudo: unable to execute ./grubmenu.sh: Permission denied
root@DSM:/tmp# sudo -i
root@DSM:~# ls
Xpenology_backup
root@DSM:~#  curl --location "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/grubmenu.sh" --output grubmenu.sh; chmod +x grubmenu.sh;
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2441  100  2441    0     0   4454      0 --:--:-- --:--:-- --:--:-- 19373
root@DSM:~# ls
grubmenu.sh  Xpenology_backup
root@DSM:~# ./grubmenu.sh 3

Mounting /dev/synoboot1 to /mnt/localdiskp1

grub boot partition mounted normally.

Entries in Localdisk bootloader :
=======================================================================
menuentry 'RedPill DS918+ v7.1.0-42661 (USB, Verbose)' {
menuentry 'RedPill DS918+ v7.1.0-42661 (SATA, Verbose)' {
menuentry 'Tiny Core Image Build' {

Setting default boot entry to USB Re-Install DSM / Tiny Core Image Build

root@DSM:~#

 

So, luckily I waited until I was at the location of this device, I was going to try to do this over a remote session/team viewer, but I waited until I was actually at this location to do this upgrade. After I gave it the command ./grubmenu.sh 3 (and missed the response it was going to boot usb to re-install dsm) and manually installed the 7.1u4 update inside DSM, when it rebooted, it did NOT go to TC - it booted back USB and was stuck in a loop, I used advanced ip scanner to detect it was booting back to it's DSM spoofed mac (the one i configued in user_config.json), so I had to hook up a keyboard (no monitor, this box doesn't have any video out) power cycled the box and continued to hit down arrow ⬇️ for about 10 seconds, then I hit enter, which did boot to TC, again I used advanced ip scanner and found the "real mac" printed on the device and its current ip. I proceeded to TC/SSH and ./rploader.sh backup/update/fullupgrade/postupdate commands, then I had to install grubmenu.sh again using:

 curl --location "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/grubmenu.sh" --output grubmenu.sh; chmod +x grubmenu.sh; 

This installs grubmenu.sh inside TC (because before it's installed on DSM which is not mounted inside TC).  Then I did ./grubmenu.sh 1 and it echo back with the following, I sudo reboot and DSM booted back to an updated DSM 7.1u4 as normal. I am not sure this was necessary, as I did not ls to see if grubmenu.sh was installed? so I made sure it was installed. This may not have been needed?

tc@box:~$  curl --location "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/grubmenu.sh" --output grubmenu.sh; chmod +x grubmenu.sh;
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2441  100  2441    0     0   4158      0 --:--:-- --:--:-- --:--:--  4158
tc@box:~$ ./grubmenu.sh 1

Mounting /dev/sdd1 to /mnt/localdiskp1

grub boot partition mounted normally.

Entries in Localdisk bootloader :
=======================================================================
menuentry 'RedPill DS918+ v7.1.0-42661 (USB, Verbose)' {
menuentry 'RedPill DS918+ v7.1.0-42661 (SATA, Verbose)' {
menuentry 'Tiny Core Image Build' {

Setting default boot entry to USB

tc@box:~$ sudo reboot

 

 

SO: I am not sure why ./grubmenu.sh 3 did NOT make it boot back to TC, but I included the putty log for you to see. Had that worked, this would have been a breeze. Because that didn't do what it was supposed to do, I'm glad I was here to figure it out and fix it, but something went wrong? not sure what. I wanted to tell you and give you the feedback considering I know how hard you work in your scripts. Thank you for your continued efforts!

Edited by phone guy
added correction
Link to comment
Share on other sites

As mentioned above, the Synology boot state and the TC linux boot state should be considered separately.
Among the guide contents of grubmenu.sh at the top, the guide in Synology boot state at the bottom seems to be wrong.

sudo ./grubmenu.sh 1

When I did this, I switched to the root account by asking for the admin password, but if not, I think you should use a more secure method.

 

In Synology, you must have root account privileges when using grubmenu.sh.

In tc linux, the privileges of the tc user are sufficient.

 

admin2@DSM:/# sudo -i

root@DSM:/# sudo curl --location "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/grubmenu.sh" --output grubmenu.sh; chmod +x grubmenu.sh;

 

When downloaded in this way, the grubmenu.sh file will be given root account privileges from the beginning.

Link to comment
Share on other sites

  • 4 months later...

Hi all,

 

 I had a bad luck trying to install DSM7.x on an old hardware.

 I have a MB with ICH7 chipset an a heavily trimmed  BIOS with no option to set SATA to AHCI.

 It would be workaround to edit grub.cfg and setpci -s 0:1f.2 90.b=40 but I have no clue how to do it in TCRP.

Please advise,

 

Thx

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...