Change root shell in Single user mode ("broken current shell")

Hi all,

I have /usr/local/bin/bash set for both user and root. While installing gnome2-lite, bash seems to be corrupt. And I am not able to login to user/root. In single user mode, following are the errors to change the shell.

Code:
chsh: unknown user: uid 0
passwd: who are you?
passwd: root: no such user

I know that problem solves if I change the default shell of root, but not able to do so. How can I change do the same?
Any help appreciated.
Thanks in advance..
 
Try if # vipw can still edit /etc/master.passwd and then rebuild the necessary database files in /etc. And yes, never change root shell, the toor account is for that.
 
Boot from mfsBSD, mount the problem drive, fix the root shell to be csh (vipw(8)'s -d option might help), then never change it again.

If you really want bash as root, then run it manually after logging in, or from root's .cshrc. When it fails, at least it won't make the machine unfixable.
 
v_mallikarjun said:
In single user mode, following are the errors to change the shell

Code:
chsh: unknown user: uid 0
passwd: who are you?
passwd: root: no such user
In single user mode only the root (/) filesystem is mounted read-only.

Boot to single user mode, press enter to accept /bin/sh as the shell. Then:
Code:
fsck -y
mount -u /
mount -a -t ufs
swapon -a

Then try to change your shell. Leave root's shell set to /bin/csh and never change it again.
 
@SirDice
I have mounted / as rw. Even then I got the same error.
@kpa:
vipw solved my problem. Thank you.

Also, is it so bad to install packages and ports along side? This reason for this crash was I installed gnome-lite package and all others as ports...

Lessons Learnt: never change root shell to fancy ones. :)
 
v_mallikarjun said:
@SirDice
I have mounted / as rw. Even then I got the same error.
The other filesystems need to be mounted too. Normally /usr/ is a separate filesystem. /tmp/ and /var/ need to be mounted too. Hence the # mount -a -t ufs
(That's assuming you're using the traditial UFS layout)
 
Installing a port or package should not mess up /etc/master.passwd, maybe you ran out of disk space on root filesystem?

As long as you don't change the compilation options for ports it's reasonably safe to mix ports and packages, once you start changing the options stick to ports solely.
 
You can mix and match packages and ports ... if you are careful! Packages are built using the default options. So, if you install a port, configure it to have the minimum OPTIONS set, and then install a package that depends on that port ... you may run into problems. The package will try to use features that aren't present because you did a custom port install.

I find using packages to get a system up and running quickly, and the upgrading using the ports tree works well. And using portmaster(8) with the "use packages for build dependencies" option works well.

But, you really shouldn't install packages onto a system after using the ports tree for awhile, as the dependencies and features may not match up correctly.
 
@kpa: /etc/master.passwd was not screwed, my default shell was screwed while installing the package gnome2-lite.

@phoenix: I liked your idea of converting packages into ports in upgrade. Thank you, will give a try. I have a decent laptop system, and don't want to build heavy ports like browsers very often, as they get updated every alternate week. thats the reason I use packages, else only ports.

Thank you for all the input provided.. You helped a FreeBSD newbie.
 
v_mallikarjun said:
@kpa: /etc/master.passwd was not screwed, my default shell was screwed while installing the package gnome2-lite.
No port changes a user's shell, certainly not root's shell.
 
No, but a port upgrade may upgrade (or break) an installed port (aka, the bash shell), which would then royally screw someone who had used that shell in places they shouldn't (aka root). :)
 
Back
Top