While running opam install [packages], several packages installed fine and then one failed with:

The compilation of oasis.0.3.0 failed in /home/aa144/.opam/3.12.1/build/oasis.0.3.0.
cannot unlock /home/aa144/.opam/3.12.1/lock (29885)

I was running 'opam list' in another window, so perhaps that caused some problems. After this, most commands kept failing with the same error until I manually removed the lock file. But still I get the following errors:

$ opam switch system
  'opam.opt switch system' failed

Fatal error: exception End_of_file
    at
 Raised at file "pervasives.ml", line 333, characters 20-31
Called from file "src/opamSystem.ml", line 396, characters 12-25
Called from file "src/opamFilename.ml", line 251, characters 4-39
Called from file "src/opamFilename.ml", line 247, characters 12-15
Re-raised at file "src/opamFilename.ml", line 252, characters 10-11
Called from file "src/opamFilename.ml", line 247, characters 12-15
Re-raised at file "src/opamFilename.ml", line 252, characters 10-11
Called from file "src/opamMain.ml", line 480, characters 6-102

$ opam install oasis
  'opam.opt install oasis' failed

Fatal error: exception End_of_file
    at
 Raised at file "pervasives.ml", line 333, characters 20-31
Called from file "src/opamSystem.ml", line 396, characters 12-25
Called from file "src/opamFilename.ml", line 251, characters 4-39
Called from file "src/opamMain.ml", line 480, characters 6-102