Comment by zamadatix

1 year ago

My biggest annoyance is "systemctl status" gives you just enough of the service's log to make the output take up most of the terminal each time you run it but never enough of the service's log to get a useful picture of what's actually happened with the service lately.

Not to mention unless the problem with the service completely prevented it from running (it advises some commands to run in that case) you're supposed to just always remember "journalctl -xeu $SERVICE" was the incantation, less you want to go look up the flags again or manually parse the entire "journalctl" output.

Overall I generally like systemd though. The syntax can just be a burden sometimes.

it's the same mentality that brought us the git design - the easiest, least typing options are rarely, if ever the thing you want to do.

Instead, these invocations give cryptic messages, throw errors, or sometimes, even break things.

The most common and helpful things are hidden deep behind multiple flags and command line arguments in manuals that read like dictionaries more than guides.

I'm always at a complete loss as to how such decisions are made. For instance, "git branch -vv" is the useful output you would like to see, every time, that should be "git branch". Why not make the current output, "git branch -qq"? Is a humane interface too much to ask for? Apparently...

I know people defend this stuff, but as a senior engineer in programming pits for 30 years, they're wrong. Needless mistakes and confusions are the norm. We can do better.

We need to stop conflating elitism with fucked up design.

  •   > Why not make the current output, "git branch -qq"? Is a humane interface too much to ask for? Apparently...
    

    Yes, it is too much.

    You have the wrong mentality, and I hope this can help make your life easier. Programs are made so that the simplest option is the base option. This is because there is a high expectation that things will be scripted AND understanding that there is a wide breadth of user preference. There's an important rule

      DON'T TRY TO MAKE A ONE SIZE FITS ALL PROGRAM
    

    Customization is at the root of everything. We have aliases that solve most of the problems and small functions for everything else. You default to an non-noisy output, showing only __essentials__ and nothing more unless asked. Similarly, you do no filtering other than hidden files. This way, everyone can get what they want. Btw, this is why so many people are upset with default options on things like fdfind and ripgrep.

    For your problem with git, there are 2 solutions you have.

      # alias git branch using git
      git config --global alias.branch 'branch -vv'
    
      # write a simple function and add to .bashrc or .zshrc or .*rc
      git() {
          case "$1" in
              branch)
                  shift
                  command git branch -vv "$@"
                  ;;
              *)
                  command git "$@"
                  ;;
          esac
      }
    
      > We need to stop conflating elitism with fucked up design.
    

    The design isn't fucked up, it is that you don't understand the model. This is okay. You aren't going to learn it unless you read docs or books on linux. If you learn the normal way, by usage, then it is really confusing at first. But there is a method to the madness. Things will start making more sense if you understand the reason for the design choices. (In a sibling comment I wrote the abstraction to command patterns that makes the gp's confusion odd. Because systemd follows the standard)

    Side note: if you try to design something that works for everyone or works for the average person, you end up designing something that is BAD for most people. This is because people's preference is not uniformly distributed, meaning the average person is not representative of any person in the distribution. This is because anything that is normally distributed has its density along the shell while a uniform distribution has a uniform density all throughout it.

    • You're fundamentally misunderstanding things.

      If every person has the same point of confusion than they are not the problem, it's the thing they're confused by.

      There's better ways to do things and calling people naive for suggesting the obvious is the problem.

      And about your side note: no. For example, when people checkout a branch, they want to track the remote branch 99.9% of the time. It should be the default.

      The default journalctl should show where things have failed, that's why people are invoking it.

      Also there's plenty of counterexamples that do these things. "ping host" genuinely pings the host. "ssh host" genuinely ssh's into the host.

      You don't need to specify say, the encryption algorithm, that you want a shell, use say, "--resolve=dns" to specify the hostname resolution... It has sensible defaults that do what most people intend.

      Under the model you advocate for "ssh host" would simply open up a random socket connection and then you'd have to manually attach a virtual terminal to it and request the invocation of shell separately, stacking each piece on top of the other, before you log in.

      This design could be defended in the same way: Some people do port mapping, tunneling, SOCKS proxies, there's too many use cases! How can we assume the user wants a shell? Answer: because they do.

      Most things are reasonable like certbot, apt, tune2fs, mkfs, awk, cut, paste, grep, sort, so many reasonable things. Even emacs is reasonable.

      But systemd and git are not and the users are not the problems. Choices were made to be hostile to usability and they continue to be defended by being hostile to usability. Things like lex and yacc are inherently complicated and there's nothing to do there. Other things are intentionally complicated. Those can be fixed.

      6 replies →

    • I've heard this reasoning multiple times, but that doesn't make it right. Like you said, you ARE presuming something: That scripting and a (useless) base case are the most common usage.

      How many people script Git? More importantly, how often do you change that script? Rarely, and rarely. That means it's FAR FAR less work for the scripter to look up the weird incantations to remove the "human" parts (like a quiet flag).

      Conversely, the human is far more likely to write git commands impromptu, and I dare say, this is the FAR FAR more common use case.

      That means Git (and a lot of these kinds of commands) optimize for the RARE choice that happens infrequently over the common case that happens often. That's horrible design.

      TL;DR: Just because there's a consistent design philosophy behind obtuse linux commands does not make a good, helpful, useful, modern, or simple philosophy. If a library author wrote code this way, we'd all realize how horrible that design is.

      3 replies →

    • Fully this. For all its foibles, Linux was built to never presume too much, and its users tend to be power users who will almost certainly have dotfiles to tune their systems to their needs. In the context of making choices that will necessarily be universal, I admire how thoughtfully most standard Linux packages have been designed to never interfere with the users’ intentions.

      3 replies →

    • None of those problems are unsolvable. The basic idea is: your terminal and script can get two different outputs. Git can already do that with colours, so it can also use more verbose for basic commands.

      The other part is - scripts can use longer options while the console commands should be optimised for typing.

      This has nothing to do with understanding the model or model itself. Complex things can have good interfaces - those just require good interface design and git did not get much of that.

      3 replies →

In case you don't know, you can use the `-n` argument to `systemctl status` to tweak the log output, e.g. `-n0` to disable the log output and `-n40` to get more than the default 10 lines.

  • That's a great option to tweak the behavior and I hadn't known about it (or if I ever had, I'd well forgotten). Thanks!

    From the man page it ?looks like? if you want reverse or full then it's still off to the journalctl command and arguments but at least "-n9999" is better than "always 10 lines".

    • FWIW, I don't want that behavior. 10 lines is great for my usage.

      And IIRC you can change the default behavior. In the worst case, just alias it if it is bothering you that much.

      2 replies →

  • Nice! I didn't know that was an option. Definitely something I should make configurable in `isd` :+1:

In my experience, most of the times a service fails, it fails on startup (misconfiguration, missing resources). So the status is OK. Also, you can always request more lines, if you think that's helpful.

This wouldn't be my problem with systemd. Not by a long shot.

> My biggest annoyance is "systemctl status" gives you just enough of the service's log to make the output take up most of the terminal each time you run it but never enough of the service's log to get a useful picture of what's actually happened with the service lately.

How about

systemctl status foo | tail