Solved Desktop login loop in xfce and kde

After an abrupt power disruption, freebsd 13.0 got into an xfce login loop; When I tried to select a different hard drive from BIOS with Ubuntu, the boot process went into disk 0, disk 1, disk 2 selection process which fell back to the same freebsd nvme with the login loop issue. I have also forgotten root password, root prompt from single user mode does not accept a password change.

mount -u -a passwd: pam_chauthtok(): Error in service module

This part resolved. The code was wrong. Got the correct syntax from Section 10.11 of the Freebsd 12&13 FAQ which is
mount -urw on single user boot, root prompt followed by
mount -a

Could change my root and user password, got to xfce login screen, still user login didn't work, logged in as root, had to again start browser with --no -sandbox. This I try to fix.

Tried by adding user to wheel and video again, reboot brought up xfce root login worked but user login with correct password did not work, there was the xfce login loop for the user again.

But how did the bios get corrupt? The other hard disk with Ubuntu 21.10 has been working fine till date, but after the abrupt power interruption, if the ubuntu hard disk is selected from the bios, the system seems to ignore the selection and gets to freebsd, which now works!

(In trying to fix the bios I changed some settings today, bios still works, there are some wrong settings. Are there a recommendations for BIOS settings for freeBSD printed somewere?
 
Last edited:
I tried some more fixes based on forum and other posts on this problem, nothing worked so far. I also tried deleting the user, deinstalling xfce and then reinstalling it with xdm, the same problem, root could log in, user gets into a loop, not only in the console and xfce login screen, but also in the login shell.

Is this probably something to do with the shell change gone wrong?

After installing another shell, use chsh(1) to change a user’s default shell. It is recommended that the root user’s default shell remain unchanged since shells which are not included in the base distribution are installed to /usr/local/bin. In the event of a problem, the file system where /usr/local/bin is located may not be mounted. In this case, root would not have access to its default shell, preventing root from logging in and fixing the problem.
 

No, I didn't, but I was learning Poudriere, in the process of setting up Poudriere, nginx was being port installed. nginx might have made some changes to dbus. I looked at the link you shared, but don't understand much. If this has something to do with language settings for the user, or the shell for the user, please tell me how to edit the relevant files.

Thank you.
 
Did you choose ZFS when you installed FreeBSD?

Yes I did.

gpart show

=> 40 488397088 nvd0 GPT (233G)
40 532480 1 efi (260M)
532520 1024 2 freebsd-boot (512K)
533544 984 - free - (492K)
534528 4194304 3 freebsd-swap (2.0G)
4728832 483667968 4 freebsd-zfs (231G)
488396800 328 - free - (164K)

I didn't manually allocate partitions, the 13.0 installer did everything.

Thank you.
 
I also checked /etc/group and /etc/passwd and also cross checked. There are some inconsistencies. Don't know how to resolve them, if any.

/etc/group

Code:
wheel:*:0:root,myusername
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:[/COLOR]
operator:*:5:root,myusername
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
ftp:*:14:
staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
guest:*:31:
video:*:44:root,myusername

/etc/passwd
Code:
pop:*:68:6:post Office Owner:/nonexistent:/usr/sbin/nologin
auditdistd:*:78:77:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologin
www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
ntpd:*:123:123:NTP Daemon:/var/db/ntp:/usr/sbin/nologin
_ypldap:*:160:160:YP LDAP unprivileged user:/var/empty:/usr/sbin/nologin
hast:*:845:845:HAST unprivileged user:/var/empty:/usr/sbin/nologin
tests:*:977:977:Unprivileged user for tests:/nonexistent:/usr/sbin/nologin
nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin
_tss:*:601:601:TCG Software Stack user:/var/empty:/usr/sbin/nologin
messagebus:*:556:556:D-BUS Daemon User:/nonexistent:/usr/sbin/nologin
avahi:*:558:558:Avahi Daemon User:/nonexistent:/usr/sbin/nologin
polkitd:*:565:565:polkit Daemon User:/var/empty:/usr/sbin/nologin
cups:*:193:193:Cups Owner:/nonexistent:/usr/sbin/nologin
colord:*:970:970:colord color management daemon:/nonexistent:/usr/sbin/nologin
cyrus:*:60:60:the cyrus mail server:/nonexistent:/usr/sbin/nologin
pulse:*:563:563:pulseAudio System User:/nonexistent:/usr/sbin/nologin
_sndio:*:702:702:sndio privsep:/var/empty:/usr/sbin/nologin
git_daemon:*:964:964:git daemon:/nonexistent:/usr/sbin/nologin
myusername:*:1001:1001:myfullname M:/home/myusername:/bin/sh

Code:
id myusername
uid=1001(myusername) gid=1001(myusername) groups=1001(myusername),0(wheel),5(operator),44(video)

Code:
id root
uid=0(root) gid=0(wheel) groups=0(wheel),5(operator),44(video)

Code:
pw usershow -P -a | grep wheel
Login Name: root              #0            Group: wheel             #0
    Groups: wheel,operator,video
Login Name: toor              #0            Group: wheel             #0
    Groups: wheel,operator,video
Code:
pw usershow -P -a | grep video
    Groups: wheel,operator,video
Groups: wheel,operator,video
 
I'll try with the very basic...

Uninstall XFCE and all its dependencies, clean the packages, update the packages, reinstall XFCE, also try lightdm or slim as login-manager.

I prefer start Xfce manually with startx and therefore this is my .xinitrc:

Code:
[ -f ~/.xsession-errors ] && mv ~/.xsession-errors ~/.xsession-errors.old
exec startxfce4 --with-ck-launch > ~/.xsession-errors 2>&1
 
I'll try with the very basic...

Uninstall XFCE and all its dependencies, clean the packages, update the packages, reinstall XFCE, also try lightdm or slim as login-manager.

I prefer start Xfce manually with startx and therefore this is my .xinitrc:

Code:
[ -f ~/.xsession-errors ] && mv ~/.xsession-errors ~/.xsession-errors.old
exec startxfce4 --with-ck-launch > ~/.xsession-errors 2>&1

All these errors persist after I deinstalled xfce which was with slim, then reinstalled it with xdm, I also deleted the user, added user again, the errors persist. Now running

Now running portupgrade -a when it finishes, will try logging in, then will once again deinstall xfce, this time try it with lightdm.

Update: Port upgrade finished, couldn't login to xfce as user, but only as root, will try deinstalling xfce once again.

Thank you.
 
Try:
  1. pwd_mkdb -p /etc/master.passwd
  2. cap_mkdb /etc/login.conf

pwd_mkdb(8)

cap_mkdb(1)

Thank you for these commands.

Copied and pasted the commands, the terminal retuned an empty line after each of the commands, then checked /etc/spwd.db and /etc/pwd.db both are files which appeared to be of encrypted or machine-readable content. /etc/master.passwd showed user password in hashes, no entry for root.

After a reboot, the login loop remained unchanged.
 
… checked /etc/spwd.db and /etc/pwd.db both are files which appeared to be of encrypted or machine-readable content.

Code:
root@mowa219-gjp4-8570p-freebsd:~ # file /etc/spwd.db
/etc/spwd.db: Berkeley DB 1.85 (Hash, version 2, big-endian)
root@mowa219-gjp4-8570p-freebsd:~ # file /etc/pwd.db
/etc/pwd.db: Berkeley DB 1.85 (Hash, version 2, big-endian)
root@mowa219-gjp4-8570p-freebsd:~ #

file(1)

/etc/master.passwd showed user password in hashes, no entry for root. …

Hmm.

grep root /etc/master.passwd

I should expect the first of three lines to be for the root user (Charlie).
 
Code:
root@mowa219-gjp4-8570p-freebsd:~ # file /etc/spwd.db
/etc/spwd.db: Berkeley DB 1.85 (Hash, version 2, big-endian)
root@mowa219-gjp4-8570p-freebsd:~ # file /etc/pwd.db
/etc/pwd.db: Berkeley DB 1.85 (Hash, version 2, big-endian)
root@mowa219-gjp4-8570p-freebsd:~ #

file(1)



Hmm.

grep root /etc/master.passwd

I should expect the first of three lines to be for the root user (Charlie).

Yes, it shows as follows:

Code:
# file /etc/spwd.db
/etc/spwd.db: Berkeley DB 1.85 (Hash, version 2, big-endian)

Code:
# file /etc/pwd.db
/etc/pwd.db: Berkeley DB 1.85 (Hash, version 2, big-endian)

Code:
# grep root /etc/master.passwd
root:xxxxxx[masked while posting].c0qNGzwDR1M$YMCyLArsgGLvwb6FgewxFImZMTtTqxxxxxuqbzaicRNTgxVdSfqU1mylz0YUBbyEQlgyxxxxSK1:0:0::0:0:Charlie &:/root:/usr/local/bin/bash
toor:*:0:0::0:0:Bourne-again Superuser:/root:daemon:*:1:1::0:0:Owner of many system processes:/root:/usr/sbin/nologin

my user shell is /bin/sh #Is this variation between root's bash shell and user's shell somehow makes it possible for root to login, while user's login from sh gets into a loop? ( I read somewhere: "It is recommended that the root user’s default shell remain unchanged since shells which are not included in the base distribution are installed to /usr/local/bin. In the event of a problem, the file system where /usr/local/bin is located may not be mounted." )

Thank you.
 
You must also add this line to /etc/fstab:

Code:
proc            /proc    procfs    rw        0    0

and

Code:
dbus_enable="YES"
xdm_enable="YES"

On your /etc/rc.conf since you elected XDM as login manager.
 
You must also add this line to /etc/fstab:

Code:
proc            /proc    procfs    rw        0    0

and

Code:
dbus_enable="YES"
xdm_enable="YES"

On your /etc/rc.conf since you elected XDM as login manager.

Thank you. Went through some other trouble, reinstalled all ports including xfce will chose another display manager after rebuilding ports tree.

Thank you
 
To understand the ports system. Doing this without any background in any of the programming languages / programming.
Trying to learn the ports system and getting a working desktop at the same time is a lot to chew for anyone, but definitely a bit much for someone with no background in programming. Get a desktop working with packages first, and then play around with the ports system on a VM or a different machine.
 
I see... The problem here is that you are adding complexity and therefore is difficult to solve your issue, you should try at least checking if is going to work with packages. It it works the issue may lies in the way you built your ports, also you should try to login from TTY to see if it allows your regular user...
 
I prefer start Xfce manually with startx and therefore this is my .xinitrc:
Have you actually looked at the startxfce4 script? It starts console kit for you.
No need for any of that stuff.
Just install and run the startxfce4 script.

/usr/local/bin/startxfce4
Code:
[SNIP]
if test "x$OPT" = "x--help"
    then
      # print help and exit
      echo "Usage:"
      echo "  startxfce4 [OPTIONS...]"
      echo
      echo "Options:"
      echo "  --help                   Show help options"
      echo "  --with-ck-launch         Start xfce4-session inside a"
      echo "                           ConsoleKit session"
      echo
 
Thank you freezr, Phisfry, Jose and Grahamperin. Before I saw what freezr and Jose suggested, I deinstalled xfce and xorg, rebuilt the ports tree and installed kde5 as narrated here .
 
Thank you freezr, Phisfry, Jose and Grahamperin. Before I saw what freezr and Jose suggested, I deinstalled xfce and xorg, rebuilt the ports tree and installed kde5 as narrated here .

In kde plasma I experienced the login loop issue after a major pkg update. I have experienced an xfce login loop problem, and now a kde plasma login loop problem. On both instances, none of the fixes worked, the problem seemed to relate to bash not working in login after an update of some sort. This is to say that xfce login screen or the plasma login screen and also the F1 F2 console accessed with Alt+Ctl+F1 ( from the plasma login screen that didn't work) seemed to expect the user to be on the sh shell. I was on bash when the xfce login issue arose. I changed back to sh, then installed kde plasma, the plasma login as user worked the first time as I was in sh shell. Then I changed to bash, plasma login continued to work. After that I went through some kind of a major update, and on reboot, user login did not work on plasma, nor on the console screen. I tried fixes, nothing worked, changed back to sh, I could login.
 
Back
Top