Forum archive
Mediawiki Appliance: /bin/sh: can't access tty: job control turned off
Almost a year ago I had a mediawiki appliance on a server which got relocated to my company's corporate headquarters. The host died. Those who had physical access to the box concluded that the RAID1 array had completely died, or maybe the RAID controller card, or who knows what. It took awhile, but I finally got the server, and after a few months of being busy with other stuff, I got one disk mounted and found the VMDK file No clue what happened to the rest of the VM. I grabbed a VMX from a Turnkey Redmine appliance, changed the references in the VMX, added the VM to inventory, removed the VMDK and re-added it. And now my VM is resurrected.
So, I load it up and it comes to an error " /bin/sh: can't access tty: job control turned off" and dumps me off at the terminal prompt. The top of the console window says:
Target filesystem doesn't have requested /sbin/init.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... mount: mounting /dev on /root/dev failed: No such file or directory
done.
No init found. Try passing init= bootarg.
Then several lines starting with [ 52.######] and then BusyBox v1.22.1 (Debian 1:1.22.0-9+eb8u1) built-in shell (ash)
So my question: what are my options now? The webui doesn't load up. Maybe there's a way I could back up the database and copy it over the LAN to extract on a newly deployed appliance? Maybe I need to deploy an older version and copy my VMDK in? I think I'm close, just don't know enough about the filesystem to know how to restore the data.
First up, the easiest way to recover this would be restore from backup... So if you'd been using TKLBAM (or some other automated remote backup tool), you could start a new server of the same version and simply restore your most recent backup. Bam, done! If you have that set up, then skip this post and just do that! :)
If you don't have a backup, read on, but please make sure you do set up automated backups once it's up and running. Remember data loss due to hardware (or other) failure is a matter of when; not if! Data that isn't backed up should be considered living on borrowed time!
If you don't have a backup to restore from, what I would do first is take a copy of the VMDK and work with the copy from here on. Then it won't matter what you do as worst case, you can trash it and start again with a new copy (and you still have the untouched original).
Then after that, there are a ton of factors to consider and the process is a little hard to describe exactly from memory. Especially without being able to look over your shoulder. But I'll do my best... :)
Next step would be to boot the machine with a live Linux ISO of some description. Any relatively recent distro would do the job, even a TurnKey ISO would do. Although if you need to dig deeper, then perhaps something built for purpose may be better? E.g. SystemRescueCD (download page is here). Keep in mind though that if not using TurnKey, then you likely won't be root, so many/most of these commands, may need to be prefixed with sudo.
So boot from the ISO and run a live session. If it asks if you want to mount drives/partitions (TurnKey won't but others might), select no. Then you'll need to find what the drive is. The disk should be named something like /dev/sdX; where X is a letter (i.e. a-z; but most likely a, b or c). And partitions are numbered 1-n (e.g. 1, 2, 3, etc). You can look at all available drives using this:
If that shows too much info, you can look at a specific disk by appending it's name at the end. E.g.:
IIRC our VM builds are generally installed with LVM. Older ones have a separate boot partition (of type 'extN' - where 'N' is a number between 2 & 4), whereas newer ones have the boot directory inside the LVM. So assuming you have an old one, you'll want to check the filesystem of both the /boot partition (/dev/sdX1 e.g. /dev/sda1) and the LVM (where the root filesystem is). If you have a newer one, then you can skip the first bit regarding running fsck on "/dev/sdX1" (where X is a letter) and go straight to the LVM related commands further down.
Note that the system will not let you run fsck on a mounted volume, so if the live ISO automounts the volumes (and fsck complains it's mounted) you will need to unmount them (with the 'umount /dev/sdXn' command). If it complains that it's busy, then it's likely the wrong disk.
Then run fsck. E.g. to run fsck on /dev/sda1
If that reports errors (or that the disk is clean) then re-run with these options (to force a check and to fix any errors found). Remember that /dev/sda1 is just an example, it may be /dev/sdb1, etc.:
Then assuming that completes successfully, and my memory serves me correctly regarding the root filesystem being on LVM, you'll need to do some more work to get that ready to check. The following commands should allow you to find the right one (the bits after the # are just comments, you don't need to include them, but can safely copy/paste them if it's easier).
If you get stuck or find conflicting info, please feel free to post back for clarification.
Once you've done that, you'll likely need to reinstall grub (the bootloader). That may be a little trickier to set up and do, but should be something along the lines of this:
Assuming that all goes to plan (fingers crossed), your system will now boot... If not, then you'll need to do your own research, but it's likely corrupted beyond repair. You may be able to recover stuff if it's not too damaged, but that's well beyond the scope of what I can provide here...
Hopefully the above does the trick. FWIW, you should find plenty of info about these commands online (they're pretty generic Linux commands). If you keep in mind that TurnKey is based on Debian (which Ubuntu is also based on) then you should find plenty of relevant info.
And last, but certainly not least: set up automated daily backups!!!. Ideally they should be stored offsite. TKLBAM is an ideal tool for the job, but there are plenty of alternate options...