Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
jaegerx
Sep 10, 2012

Maybe this post will get me on your ignore list!


You have confused the poo poo out of me. What are you trying to do?

Adbot
ADBOT LOVES YOU

v1ld
Apr 16, 2012

Saukkis posted:

'if [ $(w -h | grep -v "^root " | wc -l) -eq 0 ] ; then reboot ; fi'

Assuming you want to do something if there are no non-root logins, which is how I read your wc -l -eq 0:
code:
w -h | grep -v \^root || reboot
Since you're not actually using the line count here other than to check for the (non-)existence of something, no need to count it in the first place. It's generally considered good shell style to rely on process exit codes over variables or values unless strictly necessary. grep exits non-zero/failure if it doesn't match anything on its input. Which also means you don't need to use "if", "test" or "[" and can just let process exit codes condition execution as above.

E: You want to use "grep -q -v" as -q will force grep to return success if it encounters an actual error but it will continue to return failure if there's no match.

v1ld fucked around with this message at 03:44 on Nov 16, 2022

xzzy
Mar 5, 2009

Why hasn't systemd reinvented utmp for us? Why do we still have to parse binary files to figure out who's logged in.

:can:

v1ld
Apr 16, 2012

The classic Kernighan & Pike book, The UNIX Programming Environment, is dated and simple by today's modern UNIX standards but it devotes chapters to the original UNIX dream of pipes as compositional tools, and how to chain programs together with them.

Highly recommended reading even today as it leads to simpler shell code in the long run. Much modern shell code uses mainstream programming language control flow instead of exploiting some of the power in the shell's ability to control execution using process success/failure.

Chunks of the book will seem unnecessary and useless, but the shell programming chapters are pure gold. IIRC they develop a cheap and simple version control system using some elegant shell scripts.

jaegerx
Sep 10, 2012

Maybe this post will get me on your ignore list!


I'm rereading it. I think you want awk for your poo poo.

v1ld
Apr 16, 2012

jaegerx posted:

I'm rereading it. I think you want awk for your poo poo.

Aho-Weinberger-Kernighan. QED.

Bad joke. But it's cool that you mentioned awk right after I mentioned K&P. :)

E: Actually, I forgot that it was last page in this very thread that I saw the mention of how he's still hacking on awk. For which I'll atone with this cool interview:
https://www.youtube.com/watch?v=EY6q5dv_B-o

There's a super cool anecdote about Doug McIlroy in there that frankly blows the mind. The long story starts at 38:40. The original UNIX crew were all so super talented people.

v1ld fucked around with this message at 04:23 on Nov 16, 2022

Mr. Crow
May 22, 2008

Snap City mayor for life
I have a phantom entry in my gub, any suggestions to track it down what's generating it? It's an old recovery entry from some old Fedora 33 or 35 kernel, I've looked for it before and couldn't figure it out and am deciding that it's now annoying me enough to ask...

I have

  • enabled / disabled recovery via GRUB_DISABLE_RECOVERY in /etc/default/grub
  • done greps for relevant keywords in /etc/default/grub, /etc/grub*, /boot
  • manually inspected /boot/grub2/grubenv, /boot/grub2.cfg, /boot/efi/EFI/fedora/grub.cfg

I can see the initrd etc. under /boot but deleting them obviously won't don anything and it gets generated again somehow, I guess dracut is picking it up? I'm not quite sure if dracut reads grub configs or the other way around.

I can also see the actual entry under /boot/loader/entries/3a1483c6483f405ca1e67505c7ac9311-0-rescue.conf, but it's also generated each time...


Where the hell is this coming from? Why is it pulling / building an old fedora version?

Tesseraction
Apr 5, 2009

Seems it might be related to Dracut? https://unix.stackexchange.com/questions/179894/how-do-i-disable-the-creation-of-the-rescue-boot-image-on-centos

Mr. Crow
May 22, 2008

Snap City mayor for life
Yea I think that's it, will need to do some proper testing but seems likely and definitely have that package installed, thanks!

Computer viking
May 30, 2011
Now with less breakage.

I wish whoever decided the "make grub appear" and "dismiss the menu and drop to the grub command line" keys should both be Esc hits their shin on a table. Not bad or anything, just enough to make up for the amount of time I've wasted trying to get the timing Just Right to trigger a grub menu without a key repeat dropping me out to the CLI.

Computer viking fucked around with this message at 11:46 on Nov 22, 2022

Klyith
Aug 3, 2007

GBS Pledge Week

Computer viking posted:

I wish whoever decided the "make grub appear" and "dismiss the menu and drop to the grub command line" keys should both be Esc hits their shin on a table. Not bad or anything, just enough to make up for the amount of time I've wasted trying to get the timing Just Right to trigger a grub menu without a key repeat dropping me out to the CLI.

Hold shift instead of tapping esc (or tap F4 if shift doesn't work for some reason).

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

I get doubled keystrokes in grub, which makes picking the right OS be sort of a little game of towers of Hanoi, and I cannot figure out why. It’s also laggy, probably related.

Klyith
Aug 3, 2007

GBS Pledge Week

Subjunctive posted:

I get doubled keystrokes in grub, which makes picking the right OS be sort of a little game of towers of Hanoi, and I cannot figure out why. It’s also laggy, probably related.

You might check out what BIOS options your machine has for USB & peripherals, particularly "legacy USB support". That makes the bios emulate a PS/2 keyboard & mouse for old poo poo that doesn't talk to USB. And if you haven't, switch the bios to UEFI-only rather than legacy / compatibility.

Basically at this point you should disable anything in the BIOS called "legacy". It's all generally enabled by default which sucks but what can you do.

Computer viking
May 30, 2011
Now with less breakage.

Klyith posted:

Hold shift instead of tapping esc (or tap F4 if shift doesn't work for some reason).

Shift didn't seem to work for me, and I've seen suggestions that it only works in BIOS mode - but if it was user error and I just gave up too quickly, that would be good. And I didn't know about F4. Next time, etc; thanks.

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!
Ubuntu still the desktop distro of choice?

RFC2324
Jun 7, 2012

http 418

Lol no
Fedora

Tesseraction
Apr 5, 2009

If you're going for the Aptitude software universe I'd always pick Debian over Ubuntu, but given I work with RHEL-based stuff yeah Fedora.

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!
Hrm, I see fractional scaling is still a shitshow.

Nitrousoxide
May 30, 2011

do not buy a oneplus phone



Combat Pretzel posted:

Ubuntu still the desktop distro of choice?

I've been very happy with my Fedora install.

Pablo Bluth
Sep 7, 2007

I've made a huge mistake.

RFC2324 posted:

Lol no
Fedora
I recently finally upgraded my linux pc, and snaps finally got me to ditch Ubuntu after ~15 years to give Fedora a go (Centos long being my server distro of choice).

Arch (or derivatives such as Manjaro) seem to be all the rage these days. I tried Manjaro in a VM once but an upgrade eventually broke something. :shrug:
Mint still seems to be a decent Debian/Ubuntu derivative, plus they hate snaps.
KDE Neon if you want Ubuntu running the latest and greatest KDE.
ElementaryOS if you want to pretend to have a Mac
I interactive with some OpenSUSE machines at work. It seems entirely cromulent and whelming.
Solus if you like the Budgie desktop and are also a weirdo who wants to rail against the big corporate distros. (It's a rare case of a minor distro made from scratch and not off one of the big distros)
Kali if you're watched too much Mr Robot.

Tesseraction
Apr 5, 2009

Mint is good if you want a lightweight VM. Although if someone knows something lighter then pray tell.

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!

Nitrousoxide posted:

I've been very happy with my Fedora install.
I used it for a while back then. I'm still a bit sour about it, tho, because for seemingly slightly workstationy servery orientated, their Open-iSCSI package back then didn't implement a specific patch to be fully functional, despite documentation pretending otherwise. I sure spent way too much time figuring that out. And Poettering still has too much influence.

Kibner
Oct 21, 2008

#1 Pelican Fan

Tesseraction posted:

Mint is good if you want a lightweight VM. Although if someone knows something lighter then pray tell.

I know Alpine is often used as the base for Docker containers that build from source. That probably doesn't translate cleanly to using as an actual VM as opposed to a build machine, though. I am admittedly very new and naive to this.

RFC2324
Jun 7, 2012

http 418

Combat Pretzel posted:

I used it for a while back then. I'm still a bit sour about it, tho, because for seemingly slightly workstationy servery orientated, their Open-iSCSI package back then didn't implement a specific patch to be fully functional, despite documentation pretending otherwise. I sure spent way too much time figuring that out. And Poettering still has too much influence.

At this point escaping lenarts influence is about as likely as escaping linus's

Nitrousoxide
May 30, 2011

do not buy a oneplus phone



Kibner posted:

I know Alpine is often used as the base for Docker containers that build from source. That probably doesn't translate cleanly to using as an actual VM as opposed to a build machine, though. I am admittedly very new and naive to this.

Alpine is definitely not a workstation OS. Its a container or VM os to provide an extremely lightweight base for you to build the additional dependencies on for a single or small set of apps to work on.

RFC2324
Jun 7, 2012

http 418

Yeah, alpine isn't a full OS, its a framework for minimal containers

Does it even have a kernel with real hardware drivers, or just minimal stubs for docker devices?

ExcessBLarg!
Sep 1, 2001

Combat Pretzel posted:

Ubuntu still the desktop distro of choice?
The only real "problem" with Ubuntu is that the stock Firefox installation uses a snap package, which itself is only a problem if you have issues with snaps. If you don't want snaps you can "sudo apt-get purge snapd" as soon as the installation is done and then install the Firefox flatpak or mozillateam PPA instead, and it's functionally equivalent to any other Debian-based distribution at that point.

Now, maybe that's enough that you don't want to use Ubuntu anymore, which is fair. But if you're currently a Ubuntu user it's largely still the same as it's ever been.

CaptainSarcastic
Jul 6, 2013



Combat Pretzel posted:

Ubuntu still the desktop distro of choice?

I abandoned Ubuntu in like 2009.

OpenSUSE is nice and boring, just how I like it.

xzzy
Mar 5, 2009

windows 11 with wsl is the actual best desktop. :can:

VictualSquid
Feb 29, 2012

Gently enveloping the target with indiscriminate love.

RFC2324 posted:

Yeah, alpine isn't a full OS, its a framework for minimal containers

Does it even have a kernel with real hardware drivers, or just minimal stubs for docker devices?

It actually has some interesting and strange live-stick options. But it still isn't good for any actual interactive usage.

RFC2324
Jun 7, 2012

http 418

My experience interacting with alpine is "wait what, I have to use /proc to find any info?"

Klyith
Aug 3, 2007

GBS Pledge Week

Pablo Bluth posted:

Arch (or derivatives such as Manjaro) seem to be all the rage these days. I tried Manjaro in a VM once but an upgrade eventually broke something. :shrug:

I'm pretty meh on Manjaro now, the whole "Arch but we hold things for 2 weeks of testing" is kinda bogus. They aren't really testing much of anything, so mainly what it means is you live with bugs longer.


I'm thinking of hopping to a new distro at some point, but not sure where I'd go. Possibly I just do Fedora for more stability. I do like the rolling release style though. Sometimes it sucks when you get an update that has bugs, but at least it sucks for a short time. So I might do OpenSuse Tumbleweed to see if they're better managed.

(But this time I format / as btrfs to get snapshots and rollback, and ignore the vocal btrfs-hater who doesn't know what they're talking about.)

CaptainSarcastic
Jul 6, 2013



Klyith posted:

I'm pretty meh on Manjaro now, the whole "Arch but we hold things for 2 weeks of testing" is kinda bogus. They aren't really testing much of anything, so mainly what it means is you live with bugs longer.


I'm thinking of hopping to a new distro at some point, but not sure where I'd go. Possibly I just do Fedora for more stability. I do like the rolling release style though. Sometimes it sucks when you get an update that has bugs, but at least it sucks for a short time. So I might do OpenSuse Tumbleweed to see if they're better managed.

(But this time I format / as btrfs to get snapshots and rollback, and ignore the vocal btrfs-hater who doesn't know what they're talking about.)

I'm back to running Tumbleweed on one of my desktops (I needed a more recent kernel for the onboard wifi on this motherboard) after running it as my daily driver for a long time on my main desktop, and it's pretty solid. If you go with the btrfs and snapshots then odds are it would be great as a daily driver. The biggest issues I ran into were kernel updates coming out before the Nvidia driver was updated for them, and losing X, but I got in the habit of checking the update list to see if there was a significant kernel update without a corresponding Nvidia driver update.

I have not tried running Tumbleweed with secure boot turned on, as with the Nvidia driver that's enough of a hassle that I've been forgoing it on my 15.4 install, and I haven't put in the time or effort to properly figure it out.

Computer viking
May 30, 2011
Now with less breakage.

xzzy posted:

windows 11 with wsl is the actual best desktop. :can:

For that authentic "it's perfect except for this weird bug that would completely derail a normal user" Linux desktop experience, the sidebar in my Windows 11 file explorer windows randomly stays completely blank for minutes at the time on my laptop.

Also, Fedora seems fine, both on the desktop and laptop. I've had more luck with version upgrades than on Ubuntu, too.

waffle iron
Jan 16, 2004
I use Debian for a tiny NUC home server and a Chrome OS Linux container. Both of them are on stable (bullseye) and have backports (bullseye-backports). Between backports, pipx and flatpak, it covers what I want for newer packages.

Nitrousoxide
May 30, 2011

do not buy a oneplus phone



Klyith posted:

I'm pretty meh on Manjaro now, the whole "Arch but we hold things for 2 weeks of testing" is kinda bogus. They aren't really testing much of anything, so mainly what it means is you live with bugs longer.


I'm thinking of hopping to a new distro at some point, but not sure where I'd go. Possibly I just do Fedora for more stability. I do like the rolling release style though. Sometimes it sucks when you get an update that has bugs, but at least it sucks for a short time. So I might do OpenSuse Tumbleweed to see if they're better managed.

(But this time I format / as btrfs to get snapshots and rollback, and ignore the vocal btrfs-hater who doesn't know what they're talking about.)

You could try Fedora Silverblue if you're worried about update bugs since it's an immutable system that uses ostree to track the changes from the updates you can roll back to a previous system image if an update breaks something critical.

That said, I've never encountered any gamebreaking bugs in my bog standard Fedora Workstation install.

a dingus
Mar 22, 2008

Rhetorical questions only
Fun Shoe
Has anyone heard anything about HDR support on Linux? I keep a windows install for gaming, mostly for HDR support but I'd love to have the option to move over. I had a nice OLED monitor so HDR actually looks good.

Klyith
Aug 3, 2007

GBS Pledge Week

Nitrousoxide posted:

You could try Fedora Silverblue if you're worried about update bugs since it's an immutable system that uses ostree to track the changes from the updates you can roll back to a previous system image if an update breaks something critical.

Nah I'm pretty chill with the odd bug or three. And everything in containers seems like it has its own occasional frustrations.

That said, Silverblue is a very cool concept -- if you're gonna do containers, go all the way! But not what I'm looking for.

a dingus posted:

Has anyone heard anything about HDR support on Linux? I keep a windows install for gaming, mostly for HDR support but I'd love to have the option to move over. I had a nice OLED monitor so HDR actually looks good.

Still in early development on wayland, so not gonna happen any time soon.

v1ld
Apr 16, 2012

Klyith posted:

I'm pretty meh on Manjaro now, the whole "Arch but we hold things for 2 weeks of testing" is kinda bogus. They aren't really testing much of anything, so mainly what it means is you live with bugs longer.

I'm thinking of hopping to a new distro at some point, but not sure where I'd go.

Some math:
Manajaro = Arch + 2 weeks
EndeavourOS = Arch + a few EOS pkgs that are optional
=> EndeavourOS = Manjaro - 2 weeks + a few optional EOS pkgs

If you like Arch, EOS is a great alternative. After using it as daily driver for months now, I'd skip the group of EOS pkgs in the installer since none of those are particularly useful and all they do is add another repo you're dependent on. Removing them after the install seems a bit more work given some pkg dependencies.

But it's not like Arch is the one true way or anything, lots of interesting distros and approaches out there.

Adbot
ADBOT LOVES YOU

Mr. Crow
May 22, 2008

Snap City mayor for life
So I'm coming across something a peculiarly haven't ever had to deal with before... I have a bunch of pip user installed packages that were installed for 3.10. On upgrading to Fedora 37 it now uses python3.11 which I guess broke a bunch of stuff again? I'm not sure what happened with other older upgrades, I guess I assumed it always worked and they transitioned to the newer python version or something... or maybe I just never used pip user installs before F36, as my old site packages (~/.local/lib/python3.{7,8,9} etc) had nothing in them. For work I use pyenv and don't really think about it but I had started using some pip user installs of applications for... reasons I don't remember; how do people usually handle this situation when using them for dev projects?

I'm just now reading about pipx which I guess is kind of a solution but it also seems to hook into specific python versions, what happens with that when I upgrade to F38? or whenever the next break is?

Why do I always feel like I have stockholms syndrome with python...

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply