$5$ balls have been randomly distributed among $10$ boxes. You randomly select one box, then reach inside to draw out one ball. The probability of successfully extracting a ball is denoted as '$p$.' You repeat this process of trying to draw balls from this randomly selected box until you no longer can draw balls from this box.
The probability of extracting '$n$' balls can be expressed as $P(n) = p^n \cdot q,$ where $p = \frac{1}{10}$ and $n \leq 5$. This seems like a geometric distribution. However is this the right approach?
Because if you approach the problem during distributing the balls, the chance of distributing $n$ balls in a box you picked follows a binomial distribution I think.
The reason that the experiment is not characterized by geometric distribution is that the trials are not independent of each other, which is one of the traits of the geometric distribution. This is easy to see, since in the case of the first 4 boxes all containing a ball, then clearly you are much more likely than "$\frac{5}{10}$" to select an empty box in the fifth trial.
Another way to calculate the probability of selecting $n$ balls before choosing an empty box is by counting the favorable events.
If you denote the boxes that contain a ball as $A$, and those that do not as $B$, the total number of possible events is the same as the number of the possible permutations of the ten letters: $\frac{10!}{5!\cdot5!}$. If you want to calculate for example the probability $P(n=3)$ you need to count the number of chains that begin with $AAAB$, using combinatorics. (Note that this method describes you placing the boxes in the order that you will open them while they are closed, instead of choosing a box at random after opening another, but essentially it is the same thing in the given experiment).
I'm going to leave the above, for the conversation history to be available. Now, for the experiment as you described it the second time, I believe it again won't be characterised by the geometric distribution. The probability $P(n$ balls are selected$)$ can be expressed, conditioning on how many boxes have $n$ balls, as follows;
Say we denote the number of balls that the box we choose has as $X$, and the number of boxes with exactly $n$ balls as $k_n$.
$P($ we pick $n$ balls before failure$) =$ $ \sum_{i=1}^{5} P(X=n \mid k_n=i) \cdot P(k_n=i)$.
Obviously, for some combinations of $n$ and $i$, $P(k_n=i)$ will be zero. I'm afraid the formula can't be worked out further in the general case of $n$, but let's look at the case of $n=3$ for example:
$P($ we pick $3$ balls before failure$) =$ $\sum_{i=1}^{5} P(X=3 \mid k_3=i) \cdot P(k_3=i) $ $$=P(X=3 \mid k_3=1) \cdot P(k_3=1)$$ $$=\frac{1}{10} \cdot P(k_3=1)$$ To calculate $P(k_3=1)$, we can observe that there are $10$ choices for the box that will get the $3$ balls, and $9$ choices for the rest $2$ balls. By the Fundamental Counting Principle, we have $10 \cdot 9^2$ number of ways this can happen (assuming the balls are identical). Divide by the $10^5$ total number of ways the ball can be arranged in the boxes, we get $P(k_3=1)=81 \cdot 10^{-4}$.
So we get to the final result, $P($ we pick $3$ balls before failure$) = 81 \cdot 10^{-5}$.
Note that the case $X=4$ or $5$ will be mostly like the above, whereas case $X=2$ and $X=1$ will be much harder, since there will be more probabilities in the sum that you'll need to calculate.