Whats wrong with periodic boundaries?
The potential is the integral of the field, so there is a constant of integration. In fact the physics is totally unchanged by adding a constant (or a constant slope) to the potential. Depending on how you do the minimisation, you might get lucky and hit a solution, or the constants might keep increasing for ever. The only way to resolve this is to fix the value of the potential somewhere. Analytically the (implicit) choice is usually at infinity: this is obviously not an option in a program. Hence fixing the field to zero at the edges of a cube is one possibility (particle in a box) or at all eight corners where it should anyway be equal by symmetry is another (array of charges).