Video Screencast Help
Search Video Help Close Back
to help
Not able to make it to Vision this year? Get a sampling in the Best of Vision on Demand group.

Running headless in Linux and modifying initrd

Updated: 21 May 2010 | 6 comments
DaveK's picture
0 0 Votes
Login to vote
This issue has been solved. See solution.

I have many blade computers that I need to sanitize the disks on using "gdisk /dodwipe". These blades are headless (no video). They communicate via Ethernet and through the serial port. I created a Linux USB key using Ghost Boot Wizard. It is unusable in its current form because there is no way to communicate through the serial port.  I modified the syslinux.cfg by adding console=tty0 console=ttyS0,9600 to the APPEND line. I can now see the kernel boot but the first thing it tries to do after booting the kernel and loading the RAM disk is to start up X. At that point i lose I?O.

I would like to modify initrd so that i can change /etc/inittab. I can't mount it using a loopback like I usually can.

How can I modify initrd?

Comments

David_Moore's picture
23
Apr
2009
1 Vote +1
Login to vote

Running headless in Linux and modifying initrd

Hi Dave,

The GSS Linux preOS is built using Thinstation.  The complete source code is available from ftp://ftp.symantec.com/public/english_us_canada/pr....

The inittab is a SquashFS filesystem image.  (Version 3.3 I think)

You should be able to use unsquashfs to extract the data from initrd, edit the initrd, then squashfs it all up again.  Or if you download the source you could rebuild the initrd from scratch.

Hope this helps.  Let me know how you get on.

Cheers,
David.

David_Moore's picture
23
Apr
2009
1 Vote +1
Login to vote

Running headless in Linux and modifying initrd ... followup

Just to let you know, I  tested editing the inittab using the unsquashfs-edit-mksquashfs method, and it worked perfectly.

BTW: the default root password is "password".  And (you probably know this, but) to be able to log in as root from a serial terminal you need to add the tty to /etc/securetty.

The steps I did were:

  • copy the initrd off my USB stick
  • unsquashfs initrd
  • vim /etc/inittab.  Added "tty3::respawn:/bin/getty -h ttyS0 9600"
  • vim /etc/securetty.  Added "ttyS0"
  • mv initrd old.initrd
  • mksquashfs ./squashfs-root initrd -all-root
  • copy the initrd back on to my USB stick
  • boot
  • login via serial cable
DaveK's picture
28
Apr
2009
0 Votes 0
Login to vote

Running headless in Linux and modifying initrd ... thank you

David,
Thanks for working this out and for the precise details on how to do accomplish it. It works perfectly!! The only problem I ran into was that I initially used "unsquashfs" and "mksquashfs" version 4.0 utilities. They produce an "initrd" file file that is incompatible with the Symantec-supplied kernel.  I built version 3.4 of those utilities and they created a compatible version of initrd.  I wouldn't have thought of this version incompatibility if you hadn't mentioned that you were using version 3.3.

Thanks again for sharing your expertise!  As a possible enhancement it would be nice to get a headless mode by simply modifying a data file such as syslinux and have the kernel generate the correct inittab and securetty files.

DaveK's picture
29
Apr
2009
0 Votes 0
Login to vote

Running headless in Linux and inserting a boot time script

david,
How do I insert a script that i would like to run prior to login? I can't figure out what the boot process is. This kernel does not appear to use /etc/rc to boot. I am used to inserting a script into /etc/rc3.d (or 5) but this does not seem to be the case.

Can you tell me how to do this using Thinstation? Thank you.

Dave

DaveK's picture
29
Apr
2009
1 Vote +1
Login to vote

re:Running headless in Linux and inserting a boot time script

David,
My misunderstanding. Ignore my previous post. I put the script into /etc/rc5.d in the "initrd" file and the script runs fine at boot time. Thanks again for all of your help.

David_Moore's picture
30
Apr
2009
0 Votes 0
Login to vote

You're welcome

Glad it is working for you.