Disabling serial console to allow serial port to be used.

Home Page Forums Network Management ZeroShell Disabling serial console to allow serial port to be used.

This topic contains 10 replies, has 0 voices, and was last updated by  gcams 5 years, 1 month ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #41469

    gcams
    Member

    I have a fairly unusual setup, in that I want to use my Zeroshell ALIX box to pull info from the serial device using a bash script (I have the Alix 1D with VGA console and therefore don’t need a serial console). I note that inittab spawns a serial console which is preventing me from using the serial port for other purposes.

    Is it possible to disable this somehow? I have tried modifying the inittab file, but as it’s pulled from the cdrom image, it get’s re-written on reboot. Is there a way to make this a permanent change?

    Any advise or help most gratefully appreciated!

    #47607

    imported_fulvio
    Participant

    To disable the serial console after the boot you have to comment the line

    7:2345:respawn:/sbin/agetty -i -n -l /root/kerbynet.cgi/scripts/localman 38400 ttyS0

    in the file /etc/inittab

    and execute the command

    init q

    to re-examine it.

    Regards
    Fulvio

    #47608

    gcams
    Member

    Thanks fulvio, that’s a big help! Much appreciated!!

    #47609

    Larry Baker
    Member

    Fulvio,

    It looks to me like the solution you have given here does not survive a reboot. Is there a procedure to make this change permanent? (I tried to edit a copy of /etc/inittab in /Database/etc/inittab, but that did not work.)

    Larry Baker

    #47610

    Larry Baker
    Member

    Fulvio,

    It looks to me like the solution you have given here does not survive a reboot. Is there a procedure to make this change permanent? (I tried to edit a copy of /etc/inittab in /Database/etc/inittab, but that did not work.)

    Larry Baker

    #47611

    ppalias
    Member

    Hi Larry,
    for every change in ZS to be made effective after reboot you have to install it in “System” -> “Setup” -> “Startup/Cron” -> “PreBoot”.
    In that field write the command

    cp /Database/etc/inittab /etc/inittab
    #47612

    Larry Baker
    Member

    In the SYSTEM > Setup page, select the Startup/Cron tab.

    Select the Post Boot script from the pull-down menu

    Edit the Post Boot script:

    >>> SNIP <<<
    # Startup Script

    # Disable the COM1 serial port console

    [ -f /etc/inittab.original ] || cp /etc/inittab{,.original}
    /etc/inittab
    sed /agetty.*localman.*ttyS0$/s/^/#/
    telinit q

    >>> SNIP <<<

    Select Status: Enabled

    Select Save

    Reboot.

    #47613

    Larry Baker
    Member

    My posts seem to be getting garbled. The line starting with </etc should be

    /etc/inittab

    #47614

    Larry Baker
    Member

    This is very frustrating. For some reason, the line will not post correctly. The script redirects the sed command’s stdin to /etc/inittab.original and stdout to /etc/inittab.

    #47615

    ppalias
    Member

    Use the “Code” tags to display the shell code properly. However I think the solution to just copy the inittab in the preboot is more simple.

    #47616

    Larry Baker
    Member

    Thank you for the suggestion to use the Code tags. I did not expect the posting to get mangled (the Preview was correct).

    I wrote the code to make a copy of the original inittab and used sed the way I did so that the code would work with any version of ZeroShell that might be released. If inittab changes, I expect this code will still work.

    #47617

    tls
    Member

    The code did not exactly work for me, so I make it a little cleaner, thus building on your idea:


    [ -f /etc/inittab.original ] || cp /etc/inittab{,.original}
    sed -i 's/(^.*ttyS0.*$)/#1/' /etc/inittab
    telinit q

    Many thanks for posting the initial issue – I had the same problem, wanted to ttyS0 to hook into my edge switch on the serial line so I could always get to my systems.

    –tls

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.