I’m working on a Linux machine running Ubuntu Bionic Beaver, release 18.04.
The other day I mistakenly changed the
/usr/ directory to be owned by a user, instead of root. Unfortunately, I did that recursively, and so messed quite a bit of the system up because it also changed the
suid permissions on some of the commands (e.g.
sudo). We really can’t reinstall (well we can but it’ll cost!), so I booted from a LiveUSB, and changed manually all the correct user/group/permissions for each file that I could identify had a non-
Root:Root User:Group. I did this by comparing the output of another Ubuntu computer of
ls -lha /usr/.
It seems to be mostly fixed, but now I’m running into the error ‘std::bad_alloc’ after running some pretty standard python scripts. The strange part about this is that it only comes up sometimes. For example, if I open python from the command line and copy and paste code, the code will all run fine with no error. However if I run the entire script from the command line (e.g.
python script.py) then I get this error. The full error message is:
terminate called after throwing an instance of 'std::bad_alloc'
Aborted (core dumped)
But to add another twist – sometimes I can run the same python script from the command line with no problem, and others I get this error as above.
If anybody has ideas as to where to specifically look to fix this that’d be great! I’m going to try and do the same thing as before but with the
ls -lha /usr/ output from an 18.04 release, as I only had a 16 release output on hand.