www.zeroshell.org Forum Index www.zeroshell.org
Linux Distribution for server and embedded devices
 
 SearchSearch  RegisterRegister  UsergroupsUsergroups 
 ProfileProfile  Log inLog in  Log in to check your private messagesPrivate Message 

Disabling serial console to allow serial port to be used.

 
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell
View previous topic :: View next topic  
Author Message
gcams



Joined: 11 Jan 2009
Posts: 20

PostPosted: Thu Feb 12, 2009 2:55 pm    Post subject: Disabling serial console to allow serial port to be used. Reply with quote

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!
Back to top
View user's profile Send private message
fulvio
Site Admin


Joined: 01 Nov 2006
Posts: 1070

PostPosted: Sat Feb 14, 2009 10:57 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
gcams



Joined: 11 Jan 2009
Posts: 20

PostPosted: Sat Feb 14, 2009 1:32 pm    Post subject: Reply with quote

Thanks fulvio, that's a big help! Much appreciated!!
Back to top
View user's profile Send private message
Larry Baker



Joined: 27 Apr 2010
Posts: 9

PostPosted: Tue Apr 27, 2010 12:38 am    Post subject: Permanently disable serial console Reply with quote

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
Back to top
View user's profile Send private message
Larry Baker



Joined: 27 Apr 2010
Posts: 9

PostPosted: Tue Apr 27, 2010 12:39 am    Post subject: Permanently disable serial console Reply with quote

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
Back to top
View user's profile Send private message
ppalias



Joined: 17 Dec 2008
Posts: 1151
Location: Athens, Greece

PostPosted: Tue Apr 27, 2010 6:47 am    Post subject: Reply with quote

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
Code:
cp /Database/etc/inittab /etc/inittab
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Larry Baker



Joined: 27 Apr 2010
Posts: 9

PostPosted: Thu Apr 29, 2010 11:37 pm    Post subject: Permanently disable serial console Reply with quote

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>/etc/inittab \
sed /agetty.\*localman.\*ttyS0\$/s/\^/\#/
telinit q

>>> SNIP <<<

Select Status: Enabled

Select Save

Reboot.
Back to top
View user's profile Send private message
Larry Baker



Joined: 27 Apr 2010
Posts: 9

PostPosted: Thu Apr 29, 2010 11:41 pm    Post subject: Permanently disable serial console Reply with quote

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

</etc>/etc/inittab \
Back to top
View user's profile Send private message
Larry Baker



Joined: 27 Apr 2010
Posts: 9

PostPosted: Thu Apr 29, 2010 11:44 pm    Post subject: Permanently disable serial console Reply with quote

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.
Back to top
View user's profile Send private message
ppalias



Joined: 17 Dec 2008
Posts: 1151
Location: Athens, Greece

PostPosted: Fri Apr 30, 2010 6:36 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Larry Baker



Joined: 27 Apr 2010
Posts: 9

PostPosted: Fri Apr 30, 2010 6:50 am    Post subject: Permanently disable serial console Reply with quote

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.
Back to top
View user's profile Send private message
tls



Joined: 09 Jul 2011
Posts: 17

PostPosted: Fri Mar 21, 2014 2:04 am    Post subject: Reply with quote

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


Code:

[ -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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group