Showing posts with label headless. Show all posts
Showing posts with label headless. Show all posts

Sunday, May 9, 2010

Going headless again

After the launch of Ubuntu 10.04 I decided that I have to upgrade to this LTS.
On laptop it was easy but on my server I had a problem. No keyboard and no screen were attached to it - so again I had to do a headless install.
Last time I made a hack with a USB stick but it was quite ugly.
Now I decided to do something cleaner.
The outcome was simple I modified the file isolinux/isolinux.cfg to accommodate aserial console. My file looks like:

serial 0 115200
console 0
prompt 1
timeout 30
default install
label install
menu label ^Install Ubuntu Server
kernel /install/vmlinuz
append console=ttyS0,115200n8 file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz quiet --
label minimal
menu label Install ^Minimal Server
kernel /install/vmlinuz
append console=ttyS0,115200n8 file=/cdrom/preseed/ubuntu-server-minimal.seed initrd=/install/initrd.gz quiet --
label minimalvm
menu label Install Minimal ^VM
kernel /install/vmlinuz
append console=ttyS0,115200n8 file=/cdrom/preseed/ubuntu-server-minimalvm.seed initrd=/install/initrd.gz quiet --
label rescue
menu label ^Rescue a broken system
kernel /install/vmlinuz

With this modification in place I have rewrtten the CD and everything worked as a charm.

Saturday, October 31, 2009

Upgrade 9.04 to 9.10 headlessly

I did those steps from SSH (although not recommended).

1. apt-get update -> all repos updated
2. apt-get dist-upgrade -> somehow not necessary
3. do-dist-upgrade - the magic begins here
Respond to the questions according to the customizations you've done on your system.
In my case I've chosen to keep my locally installed versions.
At the end DO NOT REBOOT the system (do not answer Y at the final question).
4. Edit the /boot/grub/menu.lst and check if the serial console lines are still present. If not add them by hand before the beginning of "AUTOMAGIC KERNEL" section.
5. Now it would be safe to reboot... Good luck.

If you want to upgrade to grub2 (as I did) do the following:
1. apt-get install grub2
2. Edit the /etc/defaults/grub to something as:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT="3"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=serial

GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"

The bolded lines are my modifications for the file.

3. Run /usr/sbin/update-grub as advised.

Monday, July 20, 2009

Headlessly install Ubuntu 9.04 on a headless server



This information is quite old and I have found another method, more reliable, since I have first published this.
For details please see this post: http://dvoina.blogspot.com/2010/05/going-headless-again.html
I will post also the remaster script I've done for the CD.



Basically it is not a server. It is a 2nd hand Dell GX520 on that I've put an 1 TB drive and 1 GB of RAM. I needed a machine on that I can test drive SAP/Netweaver.
I have no monitor home (although I have a spare keyboard) so when I got to install something on the machine I realised that it won't work.
I solved this issue with this trick:

1. I have installed Ubuntu Server 9.04 on my laptop using a 4 GB slash USB stick as target drive.
2. I have modified the GRUB bootloader on the stick to offer a serial console during the boot:
serial --unit=0 --speed=38400 --word=8 --parity=no --stop=1   
terminal --timeout=10 serial console
defopts=console=tty0 console=ttyS0,38400n8


3. I have created the file /etc/event.d/tty0 with the following content:
start on runlevel 1
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5

stop on runlevel 0
stop on runlevel 6

respawn
exec /sbin/agetty ttyS0 38400 vt100


4. I have rebooted the server from the stick. The serial was connected via a null modem cable and a PL2303 serial2usb adapter to my laptop.
5. After boot I have created the same partition scheme as on stick to the main drive. I've put labels on the created partitions in order to mount the easily and to have a human readable fstab
6. I have transferred all the files from the partitions of the stick to hard drive
7. I have modified the /etc/fstab in order to reflect the changes
8. I have modified again the file /boot/grub/menu.lst to take into account the new disk.
9. As root I have ran the command grub-install /dev/sda in order to update the MBR and make the drive really bootable.
10. Reboot from the first hard drive.
11. It seems taht the trick worked. Hourray!

I have used some information from http://www.howtoforge.com/setting_up_a_serial_console. You can get more info there.