Is the government liable in all cases of the open-source software? Who except the government is to accept liability in the first place (later on, liability will be fixed on the erring officer)?
You seem to have several misconceptions about free (open-source) software, but the principal one for the purposes of your question is that someone has to be responsible if it goes wrong.
Just about all free software licences contain disclaimers. MIT says that
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
GPLv3 says that
There is no warranty for the program, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the program “as is” without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. the entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction.
In both cases, I've removed most of the traditional caps to keep the shouting to a minimum, but they both boil down to the same thing, which is that if you decide to run this software, you assume all risks associated with it. You don't need to approach Apache for permission to run their web server, because they've already made it available to everyone under the terms of their licence, which makes it clear that although there are no charges and fees for running it, the Apache people take on board no responsibility for the correct operation of their software. The government doesn't need to absorb any responsibility, because there's none to absorb.
If you don't like that, you should pay for your software, and get support contracts with SLAs, and the like. You'll very likely find that the software provider still isn't responsible when things break, but at least you get a phone number with someone on the end of it who's paid to be shouted at.