It was evening, there was nothing to do, or how to install Gentoo without a keyboard
A humorous story based on real events.
It was one boring evening. My wife is not at home, alcohol is over, DotA is not connected. What to do in this situation? Of course, collect Gentoo !!!
So, let's begin!
Given: an old server with 2Gb RAM, AMD Athlon Dual, two 250Gb hard drives, one of them has a system and a non-working BIOS battery. Also Sony Bravia TV with VGA input and mouse. As well as a Wi-Fi router and a working laptop with Manjaro Arch Linux and the i3 environment.
Requires: install Gentoo.
21:00 I get out of the closet an old dusty servachek. From there I get a box with wires and other junk and an old telly (a wardrobe in the hallway is large, everything fit exactly there). I rummage in a box, unravel the wires, get a patch cord, a VGA cable, a mouse, a power cable and a set of screwdrivers (I suddenly need it).
21:15 I begin to look at all this and reflect on the question, “How to do this?” After all, the main attribute for installing Gentoo - the keyboard, I did not have it!
21:20 I think, “But what if you remove the screw from the server, plug it into the usb port and deploy the system on it? Not kosher, it is necessary to collect the core on the same hardware ... ". While I was thinking about this option, I managed to pull out the screw and put it into the carrier, but when I twisted the last bolt into the box, I decided that it wouldn’t work!
21:30 I unscrew the bolts back, put the screw in place in the server. I ponder further: “There is only one option - SSH access. Maybe there is such a LiveUSB with sshd already running? ”
21:35 I go to the official website of Gentoo . I’m downloading the “Minimal Installation CD” habit. I cancel it. Without a keyboard, it's a dead number! Below is a link to the Hybrid ISO (LiveDVD). Yeah, I think, there everything is there! I download and deploy to a USB flash drive .
21:50 I bring the server, telly, wires, mouse from the kitchen, where my thoughts and preparations took place, to a distant corner room. The server is noisy like an industrial vacuum cleaner, so the policeman would definitely come to visit! All connected and started the car.
22:00 The previous OS is loading! I turn off the server and start thinking: “The battery is dead, you don’t have to go into the BIOS (there is no keyboard), but you need to boot from the flash drive at all costs!” I disassemble the server, turn off one screw. I'm starting it up. The previous OS is loading! Turn the screw back on, turn off the other! Works!
22:10 And here is the long-awaited screen for choosing the option to boot from LiveUSB! The time remaining until the automatic selection of the first boot option runs, "Now everything will be, you just have to wait a bit", I rejoice! The treasured 30 seconds pass, the screen goes blank, and nothing happens. “Okay, while I'm loading, I'll go smoke ...”, decided to take a break and take a break from this noise.
22:15 I am returning to the "room of noise." The screen is black and nothing happens either! “Strange ...”, I thought, “In any case, it would have already loaded!”. By the way, everything is aggravated by the fact that my telly does not always show what is happening on the screen, it does not perceive some modes and refuses to broadcast a picture of what is happening ... I reboot the server. I'm sitting, watching ... Again, a black screen, all the same. Well, I freaked out, and started poking on the mouse buttons ... And, oh God, it turned on and the download went. Later, I discovered that the download continues only after clicking the small button on this miracle mouse! Do not be this button, God knows how this evening would end !? After all, the goal is set, and we must achieve it in any way!
22:20 It rings in my ears, but I continue to go towards my goal! Gentoo has booted! Colors are pleasing to the eye! A mouse walks around the screen! And below it says “No password needed for login”, it’s just good, because I don’t have a keyboard! There are two fields on the screen: the choice of the working environment and password, well, and the login button. Gentoo's LiveDVD offers a fairly extensive selection of environments, including Fluxbox, Openbox, rat (xfce), plasma, etc. Option with the choice of "rat", it seemed to me, a great choice! I go into the working environment of the "rat." Perfectly! There is a terminal, but why do I need it, I don’t have a keyboard!
22:25 I'm starting to look for some kind of on-screen keyboard or something. Found only "Character Map". “Well, great, here it is my way out!” I thought. But it was not there! You can stick the text, copy, paste, but how to press Enter !? Let me remind you that the task is to start sshd, which boils down to typing in the terminal “ sudo /etc/init.d/sshd start ” and pressing the Enter button , which I don’t have! What to do? But there is a way!
22:30 Rest time from the noise. I go to the kitchen and sit down at the laptop. Any terminals, if you paste the copied text with a line feed into them, will execute the command, because perceive the line feed as Enter . So, the solution is found! You need to upload the HTML page with the command and line feed to the Internet. It is HTML, because, a simple text file, the browser will open in one line, "devouring" all the transitions to a new line. So my page looks like this:
sudo /etc/init.d/sshd start
"1" is needed so that you can copy the transition to a new line, otherwise only one line is copied, how many "br" do not set. I upload the file to a certain site using the link " mydomen.ru/1.htm ".
22:40 I am returning to the "room of noise." The main thing is to have time to get back before turning on the screensaver, which when you exit it says that it will not let the old version back in the system with an empty password! I open with anticipation of success the browser and the symbol table! I'm typing " mydomain ". Looking for a point ...
22:50 Found a point! You must select the viewing mode "By Unicode Block". I dial the address further, the benefit of “/” and the numbers were found with a dot! I copy the text, paste it into the address bar, click go. Due to the dead battery of the BIOS, the time in the system is set to “01.01.2002”, and under these conditions SSL certificates do not work!
23:00 I am in the kitchen, resting from the noise. The main thing is not to rest for a long time, otherwise the screensaver will turn on! I configure NGINX to upload my file without HTTPS to the address " mydomain.ru/2.htm ", because the old address was redirected and cached by the browser.
23:05 Having a little rest from noise and with an anticipation of success, I am re-typing the link, because the Backspace button cannot be emulated! Well, this is for laughs, but in fact I just press in the symbol table “2”, select, copy and replace in the address bar. Go! “Really!” I thought. With pride, I copy two lines from the page and put it in the terminal. The SSH server is running, it's time to try to connect by looking at the IP address in the web-based management interface on a Wi-Fi router! Actually, no, it's too early! It’s a pity, I didn’t understand this right away ...
23:15 I return to the "mouse", adding a line to this
and updating the HTML file on the server. Fortunately, nothing more to enter! I am updating the page. Well, according to the old scheme, I copy the lines to the terminal to run “ sudo passwd ” and separately twice to enter and repeat the password.
23:17 Connected! Now I am not afraid of screensaver and noise!
01:00 About the process that I went through from the moment the ssh connection was established and up to now there is a detailed description in many sources, the most complete is presented in the Gentoo Handbook . I compiled the kernel, installed grub and the assembled kernel into it. Set up network and SSH on the new system. Done, reboot !
Day 2 - day off
10:00 I returned to my task. Turned on the server. Nothing happens on the screen, there is no server on the network! Thought network problems. Having booted from LiveDVD, I configured the network, but it did not help ...
10:30 Decided that it would be nice to study the download logs. There are no logs! “Yeah, then it didn’t get to loading the system! But what is written on the screen? ”I thought. Having thought a little about the reasons why the television does not show anything, put forward the hypothesis that it can not show the resolution in which the console output is located. On the screen, in fact, it is written ...
11:00 I changed the settings of GRUB to the output of 640x480. It helped. It says "Loading Linux 4.19.27-gentoo-r1 ...". It turned out that he screwed up when assembling the kernel.
11:30 I put genkernel, with manual tuning of the kernel I will experiment later. Not set! It turns out a jamb with a date. It is better to update it at each start, a lot depends on this date. I would put it in the BIOS, but for this I need a keyboard ... I change the date to the current one.
14:00 Hurray! The kernel has compiled! Filled the kernel into the bootloader, rebooted. Finally it worked!
The first goal is achieved!
Further I am going to put on the second CentOS hard drive also without the keyboard, but already from a gent! But I will write about this in the second part. In the third part I will conduct load testing of a web server with a simple application on both of these systems and compare RPS.