Open stroebs opened 5 years ago
Thank @stroebs !
Actually I'm developing a much safer installation script which does not rely on the assumption that the kernel will not panic when we wipe the root filesystem. The script is in the next
branch, but there are still bugs to fix, and I need to test it out on more VPS providers. Would you like to try it out?
Thanks on the information on the partition table changes. I've noticed RouterOS will expand its partition so the code for resizing the partition is no longer here in the next branch. I'll investigate on this when my physical condition is better...
Awesome, thanks @Jamesits I'll check out the next
branch.
Side note, the autorun.scr
doesn't seem to work at all in newer versions of ROS. I believe it was patched to avoid a backdoor that allows installation of a busybox shell and the only way to get it to work now is using Netinstall. Not sure what difference that makes but it does leave us dead in the water if we want to do out-the-box configuration instead of reverting to console/VNC configuration. I've created a forum post on this on the MikroTik forum: https://forum.mikrotik.com/viewtopic.php?f=9&t=151704
Wishing you speedy recovery for your physical condition!
The patch to disable autorun.scr
looks ridiculous to me since as long as you have access to the root filesystem of a RouterOS you basically can do everything...
Someone says /rw/DEFCONF
script will do the job. Source: https://medium.com/tenable-techblog/make-it-rain-with-mikrotik-c90705459bc6
Also there are some interesting scripts at /nova/lib/defconf
, you can grab a routeros-*arch*-*version*.npk
(a.k.a. the main package of any RouterBOARD device) and open them with 7-zip to have a look at.
The script on the next
branch is working except the autorun script. It eats more system memory than the previous version but it is safer to use and provides a better UX. Please check it out.
I dug a little into /rw/DEFCONF
file and found it is not intended to use as an autorun script so I'll leave it here. Maybe we can find some method to trigger the true DEFCONF script just like resetting a RouterBOARD? I'm not sure.
Hey @Jamesits, official answer from MikroTik on this: https://wiki.mikrotik.com/wiki/Manual:CHR#Provisioning
Hi @stroebs , if I'm not getting anything wrong, this means I need to rely on the APIs provided by the hypervisor to provision RouterOS. I think this won't work in most cases where this script will be in need. After all, vps2routeros is designed to run without any access to the console/raw disk/hypervisor.
If this is the only official way MikroTik will be supporting, I'd rather hack my own way through it.
Yeah I'm really not happy with their answer, it really leaves people like us out in the dark and forces us to hack our way in, instead of them just supporting a method of doing this.
Hey @Jamesits I've done some research for my own gist on this: https://gist.github.com/stroebs/54fc09734a3911e91eeeb43434f117df
Newer ROS raw disk images no longer contain two partitions, so this is moot. The updated script simply uses partition 1 and ROS auto-resizes the disk to 16GB on startup.