I'm running Ubuntu 14.04 Trusty Tahr in a Microsoft Hyper-V virtual machine on Windows Server 2012 R2.  I've stopped the VM, replaced an EXT4-formatted virtual disk volume (/dev/sdb) with a new (unformatted) disk volume and restarted the VM.  I see the following messages:Filesystem check or mount failed.A maintenance shell will now be started.CONTROL-D will terminate this shell and continue booting after re-tryingfilesystems.  Any further errors will be ignoredGive root password for maintenance(or type Control-D to continue):Upon typing the root password, I see:Segmentation FaultI would like to determine which process has caused the segmentation fault and why.  I am reproducing a issue that was brought to my attention and would like to provide an explanation for the segmentation fault.  Is it a bug in Ubuntu 14.04?  If so, is there a work-around?  If there is a work-around, I would like to see it documented here.
What Causes Maintenance Shell Segmentation Fault?
shell;ubuntu;filesystems;data recovery;segmentation fault
OP and I worked through this; see comments & chat for details. First, to find the problem process and location, this line in /etc/init/mountall-shell.conf/sbin/suloginwas changed to/usr/bin/ltrace -S -f -o /root/sulogin-ltrace.log /bin/suloginExcerpt from log:837 crypt(password, x) = nil837 strcmp(nil, x <no return ...>837 --- SIGSEGV (Segmentation fault) The log indicates that the segfault occurs in the following code in sulogin, where crypt is returning NULL.if ((p = getpasswd(pwd->pw_passwd)) == NULL) break;if (pwd->pw_passwd[0] == 0 ||    strcmp(crypt(p, pwd->pw_passwd), pwd->pw_passwd) == 0)        sushell(pwd);Next question is, what's causing crypt to return NULL?OP confirmed that the encrypted password really was x; the shadow entry for root was root:x:16273:0:99999:7:::. In a stock Ubuntu 14.04, root's encrypted password is !; OP had changed it to x awhile ago and this is the first time since then that he's had to use single-user mode.sulogin has its own interpretation of special encrypted passwords. If it sees * or !, it lets the user in with no password. Anything else, it does some validity checking, but x sails right through, yet crypt doesn't like it (salt not long enough?) and returns NULL.OP is going to file a bug report for sysvinit-utils; sulogin ought to handle a NULL return from crypt more gracefully.