# Problem: Freebsd login session to start with unwanted Ã¢Â€ÂœFreeBSD Install menuÃ¢Â€Â



## Maskor (Sep 15, 2012)

*Problem: Freebsd login session to start with unwanted â€œFreeBSD Install menuâ€*

  Hi Friends,

I am a newbie whom using x64 version of FreeBSD 9.1-RC1 which was working fine till a corruption of /boot folder occurred.

After several unsuccessful reboots, I used my FreeBSD LiveCD for having a shell session which allowed me to manually mount the system, delete corrupted boot,  download kernel.txz and base.txz from ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/9.1-RC1/ and copying their /boot related files to / for populating a new /boot.

After that I ran "*make kernel*" from /usr/src for kernel rebuilding. When itâ€™s done I retrieved LiveCD and rebooted the system and got:
- FreeBSD Installer menu (Install - Shell - LiveCD) as default session on ttyv0 instead of normal login session
- ttyv1 (ALT-F2) unavailable
- ttyv2 (ALT-F3) displaying maintenance information by itself
- ttyv3 (ALT-F4) gave a direct access to my normal root session without login and password. X window and all system capabilities are available also
-ttyv4 â€¦ ttyv7 unavailable​
I maybe wrong to think those above mismatches could be fixed without to reinstall the whole system  but I think they might be fixed  through some parameter settings within some configuration or init files involved in the boot and/or login processes or other pending task (like pending install) but I havenâ€™t the needed knowledge for doing that without help.

So I need your advised help for booting no in â€œFreeBSD Install menuâ€ but in a normal FreesBSD session with login and password, and having ttyv0â€¦ttyv7 working normally.

Thanks


----------



## wblock@ (Sep 15, 2012)

You are still booting the installer somehow.  Remove CDs and USB sticks and images of them, if it's in a VM.


----------



## Maskor (Sep 15, 2012)

The system is not in VM but in a secondary hdd /dev/ada1 in /dev/ada1s3 slice.


For information see below output of bsdlabel(8) and df(1) in case of...


```
root@hpfreebsd:/root # bsdlabel /dev/ada1s3
# /dev/ada1s3:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  a:    4194304          0    4.2BSD        0     0     0
  b:    6340608    4194304      swap                    
  c:   75497436          0    unused        0     0     # "raw" part, don't edit
  d:    3145728   10534912    4.2BSD        0     0     0
  e:   10485760   13680640    4.2BSD        0     0     0
  f:   29769728   24166400    4.2BSD        0     0     0
  g:   20971520   53936128    4.2BSD        0     0     0

root@hpfreebsd:/root # df -h
Filesystem      Size    Used   Avail Capacity  Mounted on
/dev/ada1s3a      2G    1.4G    386M    79%    /
devfs           1.0k    1.0k      0B   100%    /dev
/dev/ada1s3d    1.5G     13M    1.3G     1%    /tmp
/dev/ada1s3e    4.8G    384M    4.1G     8%    /var
/dev/ada1s3f     13G    6.6G    6.0G    52%    /usr
/dev/ada1s3g    9.7G    1.1G    7.8G    13%    /home
linprocfs       4.0k    4.0k      0B   100%    /compat/linux/proc
```

I agree with you that I am still booting the installer *but without CD or USB stick or known mounted iso image* when "1. Boot" option is selected from FreeBSD Welcome menu, "5. Safemode" option doesn't work too and ending in an automatic reboot in 1s but "6. Single user" options works normally without FreeBSD Installer menu.

So I think we need to find the file with the instruction loading "FreeBSD Installer menu" as target when "1. Boot" is selected in FreeBSD Welcome menu, in this way we will see the related path and find the image or binary associated to this "FreeBSD Installer menu" which is running without LiveCD or Live USB stick.


----------



## wblock@ (Sep 15, 2012)

Rereading... okay, the problem is that blindly copying files from an installer CD into /boot runs bsdinstall(8) on startup instead of init(8).  Look at /boot/loader.conf.  Does it set the init_path variable?


----------



## Maskor (Sep 15, 2012)

Sorry I'll reread before posting. I search init_path in entire /boot (see command output below):

```
root@hpfreebsd:/root # grep -ri "init_path" /boot | grep -v ko
Binary file /boot/kernel/kernel.symbols matches
Binary file /boot/kernel/kernel matches
/boot/defaults/loader.conf:init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/bin:/stand/sysinstall"
/boot/loader.help:# Tset Sinit_path DSet the list of init candidates
/boot/loader.help:	set init_path=<path>[:<path>...]
```
The only one line of /boot/loader.conf is 
	
	



```
nvidia_load="YES"
```
 but 
	
	



```
init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/bin:/stand/sysinstall"
```
 is found in /boot/defaults/loader.conf


----------



## wblock@ (Sep 15, 2012)

Is there a /boot.config file?  Note that it will be in the root directory, not /boot.

If not, search /boot for bsdinstall.


----------



## Maskor (Sep 15, 2012)

There no /boot.config file in /root and /. There is no bsdinstall in /boot.
I want to know if search /boot for bsdinstall means search bsdinstall in /boot if not explain me how to do.


----------



## wblock@ (Sep 15, 2012)

`% grep bsdinstall /boot/*`


----------



## Maskor (Sep 15, 2012)

```
root@hpfreebsd:/ # grep bsdinstall /boot/*
root@hpfreebsd:/ #
```

There is no bsdinstal reference in /boot


----------



## wblock@ (Sep 16, 2012)

Okay, look for /etc/rc.local.  If it exists, what does it contain?


----------



## Maskor (Sep 16, 2012)

/etc/rc.local exists, its content shows below has parameter settings for bsdinstall including items of the *Welcome menu of FreeBSD Installer*:

```
#!/bin/sh
# $FreeBSD: releng/9.1/release/rc.local 232427 2012-03-03 02:13:53Z nwhitehorn $

: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_HELP=2}
: ${DIALOG_EXTRA=3}
: ${DIALOG_ITEM_HELP=4}
: ${DIALOG_ESC=255}

MACHINE=`uname -m`

kbdcontrol -d >/dev/null 2>&1
if [ $? -eq 0 ]; then
	# Syscons: use xterm, start interesting things on other VTYs
	if [ ${MACHINE} = "pc98" ]; then
		TERM=cons25w
	else
		TERM=xterm
	fi

	if [ -z "$EXTERNAL_VTY_STARTED" ]; then
		# Init will clean these processes up if/when the system
		# goes multiuser
		touch /tmp/bsdinstall_log
		tail -f /tmp/bsdinstall_log > /dev/ttyv2 &
		/usr/libexec/getty autologin ttyv3 &
		EXTERNAL_VTY_STARTED=1
	fi
else
	# Serial or other console
	echo
	echo "Welcome to FreeBSD!"
	echo
	echo "Please choose the appropriate terminal type for your system."
	echo "Common console types are:"
	echo "   ansi     Standard ANSI terminal"
	echo "   vt100    VT100 or compatible terminal"
	echo "   xterm    xterm terminal emulator (or compatible)"
	echo "   cons25w  cons25w terminal"
	echo
	echo -n "Console type [vt100]: "
	read TERM
	TERM=${TERM:-vt100}
fi
export TERM

dialog --backtitle "FreeBSD Installer" --title "Welcome" --extra-button --extra-label "Shell" --ok-label "Install" --cancel-label "Live CD" --yesno "Welcome to FreeBSD! Would you like to begin an installation or use the live CD?" 0 0

case $? in
$DIALOG_OK)	# Install
	# If not netbooting, have the installer configure the network
	dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
	if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then
		BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT
	fi

	trap true SIGINT	# Ignore cntrl-C here
	bsdinstall
	if [ $? -eq 0 ]; then
		dialog --backtitle "FreeBSD Installer" --title "Complete" --yes-label "Reboot" --no-label "Live CD" --yesno "Installation of FreeBSD complete! Would you like to reboot into the installed system now?" 0 0 && reboot
	else
		. /etc/rc.local
	fi
	;;
$DIALOG_CANCEL)	# Live CD
	exit 0
	;;
$DIALOG_EXTRA)	# Shell
	clear
	echo "When finished, type 'exit' to return to the installer."
	/bin/sh
	. /etc/rc.local
	;;
esac
```


----------



## wblock@ (Sep 16, 2012)

That's it.  Delete /etc/rc.local.  If you're lucky, that will be all that's needed.


----------



## Maskor (Sep 17, 2012)

I delete it and great!!! it's worked fine. *wblock you are super, many thanks for your help*. You fixed the problem, please close that post.


----------



## wblock@ (Sep 17, 2012)

It's nice when there's a definite fix to a problem; that doesn't happen all the time.  Sorry about the detour on init; that was a chain of mistaken assumptions on my part.


----------

