Hacker News new | ask | show | jobs
Show HN: Oops I deleted my bin/ dir (oops.cmdchallenge.com)
30 points by jarv 2151 days ago
9 comments

Really fun, kind of trains you to when the situation happens IRL, whether you're thinking about how to escape a shell or if you really did it by mistake.

I love showing this screenshot to people: https://imgur.com/a/ziHqJxB. I was having problems trying to create a jailed shell, so I decided to bind mount /bin. That of course was a bad idea. I gave up and rm -rf'd the mountpoint without unmounting it. The screenshot has the serial logs from after that :P.

I had a good time enjoying my stupidity.

The top of the image is unreadable due to excessive lossy image compression.
After clicking on it I can read it fine.
Hello HN: This is a a modification to an old side-project that explores what is possible when you are left with a shell and no utilities on a Linux machine.
It's not really that educational tbh. I am not a bash guru, nor do I wish to be one, so the second question left me cold with no desire to proceed any further.

It's a fun game for those with the skills, but an instructional tool it is not.

It's an algebra game.

Given a set of operations, can you get to state X?

Usually requires a lot of searching and/or expertise, however the solutions will break pretty easily depending on which shell you're using, etc. So doesn't really teach you anything aside from iterating over a set of all possible operation combinations.

It's also a variation of the classic tech thought experiment/game 'If you only had X and how would you do Y?'. Like 'If all you had was telnet and had to send an email how would you do it?' or some variation of it, was a common one.
If it helps you can click on 'view solutions' to see correct answers if you are stuck.
I can’t type a space in this app on Mobile Safari. $ requires several key presses to register.
Very amusing - and brings back memories of when a friend actually did remove the /bin (and IIRC the /lib64) a couple months ago :-)

Getting stuck on #/oops_print_file_contents - the command times out. Not sure if I'm missing a better solution or perhaps the server is overloaded

The command I tried was (here protected with rot13):

zncsvyr sbbone < zl-qvffregngvba.gkg; rpub "${sbbone[@]}"

--

A mild irritant is that the usual ^W (delete word to the left) instead closes tab in Firefox. Perhaps this could be prevented...?

Thanks! It looks like this is adding leading spaces on every line after the first one. The solutions can be viewed https://oops.cmdchallenge.com/#/oops_print_file_contents by clicking on "view solutions" if you want to compare.

For the ^W thing I'm not sure if it's possible to avoid it, I'll check it out.

Very cool! I was a bit confused with the marking criteria. For example, my solution for "list all files on one line" appears to work correctly but is said to be incorrect.

    shopt -s dotglob; for i in *; do echo -n "$i "; done
EDIT: I now see that the correct answer is simply "`echo *`". Despite having a dotfile in the directory, it should not be shown.
Ah, that is a bug the dotfile should not be there. Thanks!
So the dotfile is resolved but the solution:

  shopt -s dotglob; for i in *; do echo -n "$i "; done
still isn't valid unfortunately because of the extra space at the end, maybe it should be more forgiving about that.
Great fun! As a non-native speaker, I was confused by the "Print its contents" exercise. I tried things involving /dev/lpr.
thanks for the feedback, maybe something like "display its contents" would be clearer.
Yeah that sounds clear. Awesome puzzle game, very educational.
Maybe I'm missing something obvious here but on the one that asks you to get the proc's cmdline, how do the examples know it's pid 42?

Only way I can see to do this would be to echo /proc/* first to see what PID it is, guess it's 42, then go from there, but that violates the "do it in one command" rule at the beginning.

I haven't dug into the puzzle very far and it didn't seem to like my experiments, but in bash and zsh `$$` will expand to the shells PID.

Edit: Oh, I see what you mean now. I think it's just that you're expected to see that there's only a handful of PIDs in /proc and just try them each.

I do understand that this is meant to be a challenge but if this ever happened to me I'd just boot the archlinux iso and run pacstrap to reinstall pacman and then just reinstall all packages.
Really fun game, finally finished it.