# How do I recover login after installing xdm?



## lucky7456969 (Oct 10, 2012)

I can't login to FreeBSD after installing xdm. I used 'root' as the user when I changed ttys
file. As I log back in using single user mode, there is no text editor that I can use to change it back to its normal condition.
How to make myself loginable to the system again?
Thanks
Jack


----------



## SirDice (Oct 10, 2012)

Boot to single user mode then:

```
fsck -y
mount -u /
mount -a -t ufs
swapon -a
```
After that the editors should be available and you should be able to edit /etc/ttys.


----------



## lucky7456969 (Oct 10, 2012)

Thanks Expert SirDice, it is okay now.
But how do I avoid login failure after installing xdm, is the 'root' account the key?
Thanks
Jack


----------



## SirDice (Oct 10, 2012)

Try logging in with a 'regular' user account. See if that works. But I don't think XDM prevents root from logging in, not recommended but it should work.

Did you perhaps install x11/xorg-minimal instead of x11/xorg? The latter contains the default window manager TWM. If it's not installed you will have to install an alternative and make sure it's started from your ~/.xinitrc (or was it ~/.xsession, symlink the two to make sure).


----------



## lucky7456969 (Oct 10, 2012)

SirDice said:
			
		

> Try logging in with a 'regular' user account. See if that works. But I don't think XDM prevents root from logging in, not recommended but it should work.
> 
> Did you perhaps install x11/xorg-minimal instead of ~/.xinitrc (or was it ~/.xsession, symlink the two to make sure). port" href="http://www.freshports.org/x11/xorg[/port? The latter contains the default window manager TWM. If it's not installed you will have to install an alternative and make sure it's started from your ~/.xinitrc (or was it ~/.xsession, symlink the two to make sure).">x11/xorg[/port? The latter contains the default window manager TWM. If it's not installed you will have to install an alternative and make sure it's started from your ~/.xinitrc (or was it ~/.xsession, symlink the two to make sure).



			{
				"lightbox_close": "Close",
				"lightbox_next": "Next",
				"lightbox_previous": "Previous",
				"lightbox_error": "The requested content cannot be loaded. Please try again later.",
				"lightbox_start_slideshow": "Start slideshow",
				"lightbox_stop_slideshow": "Stop slideshow",
				"lightbox_full_screen": "Full screen",
				"lightbox_thumbnails": "Thumbnails",
				"lightbox_download": "Download",
				"lightbox_share": "Share",
				"lightbox_zoom": "Zoom",
				"lightbox_new_window": "New window",
				"lightbox_toggle_sidebar": "Toggle sidebar"
			}
			





 port" href="http://www.freshports.org/

Permission changed 777 to ttys
Login as other user
Change the file
Can't login still.






">

Permission changed 777 to ttys
Login as other user
Change the file
Can't login still.


----------



## SirDice (Oct 10, 2012)

lucky7456969 said:
			
		

> Permission changed 777 to ttys


Don't ever do that again!


----------



## lucky7456969 (Oct 10, 2012)

When I turn on xdm, I am still unable to login.
Either by "regular" user or "root"
Any further advices?
Thanks
Jack


----------



## adamk (Oct 10, 2012)

Explain what you mean by "unable to login."  Does the graphical login screen not come up?  Does X work if  you don't use xdm?


----------



## lucky7456969 (Oct 10, 2012)

adamk said:
			
		

> Explain what you mean by "unable to login."  Does the graphical login screen not come up?  Does X work if  you don't use xdm?



When I type the user name on the graphical login screen and password, it says the username/password is not correct. When I change it back (tyvs, off xdm), I can login thru the text login prompt.
Thanks
Jack


----------



## SirDice (Oct 10, 2012)

Do you have a different keyboard layout? It might have reverted back to a US layout.


----------



## lucky7456969 (Oct 11, 2012)

Dear SirDice,
I have the default keyboard layout, as far as I recall, I did not change anything when I installed the system.
Thanks 
Jack


----------



## gpw928 (Oct 12, 2012)

Hi Jack,

The login process is handled by xdm.  So try restarting xdm, and login via X as a normal user.  If that fails, log back in as root via the console and tell us what the following show.

Run this:

```
grep "xdm:" /var/log/messages
```

Then look in:

/var/log/xdm.log; and
$HOME/.xsession-errors for that user
for any error messages indicating any reason for a login error.

If that provides no leads, we would expect this to show no differences:

```
diff /usr/local/share/examples/xdm/xdm-config /usr/local/lib/X11/xdm/xdm-config
```

Finally, it may help for us to see the output of the following:

```
ls -laR /usr/local/lib/X11/xdm
```

Cheers,


----------



## lucky7456969 (Oct 24, 2012)

I start commenting out the Xconsole line of the Xsetup_0 file.
It works for "root" and it doesn't work for other accounts. (can't login)
And The system becomes very unstable


----------



## fluca1978 (Oct 24, 2012)

If works for root than it is probably a permission problem, even if it is still not clear to me what the problem is. You cannot login as normal user into the console (text-mode), into the display manager, or what? Please provide also the logs information as suggested in a previous post.


----------



## lucky7456969 (Oct 24, 2012)

Here is the xdm.log
I don't have an .xsession-errors file in my $HOME/ directory
This is just the root one


----------



## SirDice (Oct 24, 2012)

```
xdm info (pid 1524): sourcing /usr/local/lib/X11/xdm/Xsetup_0
/usr/local/lib/X11/xdm/Xsetup_0: !#/usr/local/bin/bash: not found
```

Install shells/bash. If it's installed open that file, the first line should begin with '#!' not '!#'.


----------



## lucky7456969 (Oct 24, 2012)

I've got his however. This is the returned message after I typed in the login name and password


----------



## gpw928 (Oct 25, 2012)

Hi Jack,

As SirDice points out, the xdm log shows a serious error in the file /usr/local/lib/X11/xdm/Xsetup_0.  You must correct this (but see below).

The logs you posted suggest to me that there's been a fair bit of hackery to the standard X11 setup.  I can't see what version of FreeBSD you are running, but it seems odd to me that Xsetup_0 is running a bash script (I would expect /bin/sh).

Mine (which is admittedly old) looks like this, and unless you have a good reason, yours probably should too:

```
#!/bin/sh
# $Xorg: Xsetup_0,v 1.3 2000/08/17 19:54:17 cpqbld Exp $
xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail
```

Also the diff you sent of xdm-config shows "DisplayManager*authorize" has been set "false".  I would expect this to be "true" on a clean system.  The default xdm-comfig is a really good place to start.  So unless you know better, you should (as root):


```
cp -p /usr/local/lib/X11/xdm/xdm-config /usr/local/lib/X11/xdm/xdm-config.bad
cp /usr/local/share/examples/xdm/xdm-config /usr/local/lib/X11/xdm/xdm-config
```
While we are here, you should check that rest of the files in /usr/local/lib/X11/xdm for modifications.  Investigate anything you find with this:

```
cd /usr/local/share/examples/xdm/
for f in *
do
  echo "=== $f"
  diff $f /usr/local/lib/X11/xdm/$f
done
```

Cheers,


----------

