this post was submitted on 21 Nov 2023
698 points (97.7% liked)

Linux

48329 readers
639 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
top 50 comments
sorted by: hot top controversial new old
[–] TootSweet@lemmy.world 368 points 1 year ago (4 children)

If it makes you feel any better, I decided earlier today to experiment with "castnow", a command-line program for casting to a Chromecast device.

I grabbed the url of a video off of Archive.org, used wget on a box I was ssh'd into to download the video, and then ran my "castnow" command to cast it to the Chromecast.

I got a progress bar and current/total time on the TV, but aside from that only a black screen and no audio.

I tried getting the latest version of "castnow" from the Git repo. I tried transcoding 7 different ways with FFMPEG. A bunch of things.

Finally, copied the video to my local machine and ran it in mpv.

The video itself was solid black with no audio and the Archive.org page had comments on it saying "why is there no video or audio?"

I tried a different video and it worked fine.

[–] breakcore@discuss.tchncs.de 67 points 1 year ago

Beautiful story. Feel that we've all been there. Every now and then, when the assumption is that the stupid piece of tech isn't working, and there it is, just functioning as intended :)

Thanks for sharing

[–] SpezCanLigmaBalls@lemmy.world 37 points 1 year ago

This is hilarious

[–] mindbleach@sh.itjust.works 17 points 1 year ago

My desktop background used to be solid black with faint grey text reading "Yes, the monitor works."

[–] thelastknowngod@lemm.ee 158 points 1 year ago (11 children)

Back in the dark, old days of Linux I spent 5-6 hours digging through dbus events and X11 configs to get my mouse working. It was unplugged.

In my defense, in those days, Linux was such an insane asylum that diving into dbus and X11 as a first step was usually the logical approach.

[–] init@lemmy.ml 48 points 1 year ago (1 children)

Jesus Christ. I've never been so thankful for being a Linux noob in my life. That sounds awful.

[–] thelastknowngod@lemm.ee 41 points 1 year ago (2 children)

Those days gave me a career so I can't really complain.

[–] SzethFriendOfNimi@lemmy.world 22 points 1 year ago (1 children)

Remember make

Oh wait. Missing something.

Download it.

Tar unzip make missing something else. Tar unzip make.

1 hour later. What was I doing?

[–] Slotos@feddit.nl 15 points 1 year ago

Turns out, I do need therapy.

load more comments (1 replies)
[–] scytale@lemm.ee 18 points 1 year ago

Had a similar experience with Mint (of all distros) on an old laptop where it would not detect the headphones I plugged in. Spent like 30 minutes troubleshooting the settings/configuration and googling. Turns out the cable was weird and I just needed to not push it in too deep for it to be detected.

[–] BCsven@lemmy.ca 14 points 1 year ago (2 children)

Been there with those old printer cables that had the two thumb screws. I spent way too long troubleshooting print problems turned out with some cables if you dont screw the thumb screws all the way in you don't get a good cable connection.

load more comments (2 replies)
[–] grue@lemmy.world 13 points 1 year ago* (last edited 1 year ago) (1 children)

Back in the dark, old days of Linux I spent 5-6 hours digging through dbus events

That's not possible. In the dark, old days of Linux, dbus didn't exist yet.

load more comments (1 replies)
load more comments (7 replies)
[–] PatFussy@lemm.ee 153 points 1 year ago (4 children)
[–] mvirts@lemmy.world 36 points 1 year ago* (last edited 1 year ago)

mkdir -p eez/nuts

cd eez/nuts

[–] KISSmyOS@lemmy.world 24 points 1 year ago

This is serious, ls not make it a pun thread.

load more comments (2 replies)
[–] Magnetar@feddit.de 126 points 1 year ago (2 children)

No, you just had a 3 hour learning experience.

[–] duncesplayed@lemmy.one 18 points 1 year ago (2 children)

Educator here. This is called "discovery learning". (The alternative to discovery learning, "direct instruction", would be if someone had told OP about these permissions before OP got themselves into a pickle)

When discovery learning is successful, it leads to better learning outcomes. Compared to direct instruction, you learn the material more deeply and will have better recall of the material, often for the rest of your life. The downsides to discovery learning are that it's very time-consuming, very frustrating, and many students will just fail (give up) before learning is completed.

Consider yourself one of the lucky ones, OP.

load more comments (2 replies)
load more comments (1 replies)
[–] deadbeef79000@lemmy.nz 71 points 1 year ago (2 children)

SELinux enters the chat

Sure you own it, your groups owns it, its permissions are 777, SELinux says GEEEEEEET FUUUUUUCKED.

[–] possiblylinux127@lemmy.zip 38 points 1 year ago (1 children)

Selinux is great. It provides actual security to a system

[–] MassRedundancy@lemm.ee 25 points 1 year ago (2 children)

But it is hard to operate. Source: did more than audit2allow for years.

load more comments (2 replies)
load more comments (1 replies)
[–] pocopene@lemmy.world 64 points 1 year ago (3 children)

A friend of mine told me a long time ago: "if a windows system is behaving funny, it has to do with virus. If a Linux system is behaving funny, it has to do with permissions"

load more comments (3 replies)
[–] yardy_sardley@lemmy.ca 45 points 1 year ago (1 children)

You wasted 3 hours of your life so far lol

But yeah. I find the most mysterious and time-consuming of problems are usually caused by a very minor detail that is so obvious it gets overlooked immediately.

And even if you know that's probably the case, sometimes your brain will just discard information that isn't consistent with its assumed reality, and it tells you the piece of code you just read is fine when it's obviously not.

Troubleshooting/debugging is fun.

load more comments (1 replies)
[–] vsis@feddit.cl 44 points 1 year ago (5 children)

I remember myself asking why directories had x flags in their permissions. Like, you don't execute them. What do they use the x flag for?

[–] TootSweet@lemmy.world 33 points 1 year ago (3 children)

There needs to be a Linux kernel fork that when you try to execute a directory executes all programs in the directory. In parallel. Juuuuuuuust to fuck with people who might accidentally execute the /usr/bin directory.

[–] rotopenguin@infosec.pub 28 points 1 year ago

And if there's a circular symlink, we fork bomb

[–] SzethFriendOfNimi@lemmy.world 16 points 1 year ago (2 children)

Or worse… In order. Based on last Modified date. And use that as the basis for some scheduling agent where timing and order of execution is essential.

load more comments (2 replies)
load more comments (1 replies)
[–] TQuid@beehaw.org 22 points 1 year ago (1 children)

For directories, it’s permission to cd into it. Read is whether you can list files, and write is remove, rename, or create new files. Don’t ask questions about the secret sticky bit

load more comments (1 replies)
[–] _s10e@feddit.de 17 points 1 year ago (2 children)

The x permission on directories is exactly for this purpose. You can use the directory. You cannot read (requires rx), you cannot write (w), but you can 'cd' and operate on files in the directory.

This is important, you can lock someone out from a directory tree buy not giving them 'x' on the root. So, if your home is rwx------, no one but the owner can do anything in your home. This is effective even if some files and subdirectories have less restrictive permissions.

load more comments (2 replies)
[–] SzethFriendOfNimi@lemmy.world 14 points 1 year ago

Executing a list read of the inode?

load more comments (1 replies)
[–] Pyro@programming.dev 44 points 1 year ago

I love posts like these because they help me avoid mistakes I would've definitely made too. Thanks OP!

[–] lloram239@feddit.de 40 points 1 year ago (1 children)

ls reaction to this is unexpected:

$ mkdir foo
$ echo Foo > foo/file
$ chmod a-x  foo
$ ls -l foo
ls: cannot access 'foo/file': Permission denied
total 0
-????????? ? ? ? ?            ? file

I expected to just get a "Permission denied", but listing the content it can still do. So x is for following the name to the inode and r for listing directory content (i.e. just names)?

load more comments (1 replies)
[–] neonred@lemmy.world 39 points 1 year ago* (last edited 1 year ago) (10 children)

sudo chmod -R 777 /

Edit: don't do this, it will allow everyone and everything to read and modify all files of all mounted filesystems, this includes your personal files, system wide passwords, config files, everything and might break the whole system as not all files are meant to have these permissions, e.g. mapped hardware settings or your ssh key store.

sudo comes with immense power, do not, under any circumstances, enter commands you found on the internet without an intense look about what they do and what their implications could be. Never sudo or doas, etc., without a strong and valid reason.

[–] THE_STORM_BLADE@lemmy.world 51 points 1 year ago (14 children)

For anyone that didn't recognise this as a joke, do not do this!

load more comments (14 replies)
[–] lseif@sopuli.xyz 24 points 1 year ago (1 children)

the 777 stands for 'lucky jackpot number', as in 'youre lucky if you dont break your entire system'

load more comments (1 replies)
[–] MTK@lemmy.world 21 points 1 year ago (1 children)

This is so useful! Now I can just run:

rm -rf /

Without the sudo!

load more comments (1 replies)
load more comments (7 replies)
[–] Quereller@lemmy.one 38 points 1 year ago (2 children)

No one mentioned ACLs so far. If you see a + using ls -l like this drwxrwx---+, you have an access control list entry.

access control lists

[–] redcalcium@lemmy.institute 16 points 1 year ago (4 children)

More than a decade of using linux and I still can't remember setfacl syntax. I have better luck remembering tar syntax.

load more comments (4 replies)
load more comments (1 replies)
[–] xlash123@sh.itjust.works 33 points 1 year ago

Ouch. I'm sorry you had to find out that way. But in the plus side, you'll never forget.

[–] punkwalrus@lemmy.world 27 points 1 year ago* (last edited 1 year ago)

I worked in a job with build scripts. Developers would list what they wanted in a drop-down menu on a website, with very few "fill in the blanks." This would create a template, which was sanity-checked.

One of the "fill in the blanks" was "home directory of user, if not default /home/username." Some people filled it in, some didn't. A lot of "users" might be apps with /home being "/opt/appname" "/var/www/html" or something. We checked to make sure that directory existed, if not, create, and set permissions. Easy peasy, all automated. Ran this lots of times.

Then one day, the script failed. Borked the whole box. Sometimes the VM was corrupt, so delete VM and try again. Usually worked. But this time, the build kept failing. The box went down. Wasn't even bootable. This happened several times with this one build. So we mounted the borked drive under a new VM and checked out the logs. Just like the dessert stage of Willy Wonka chewing gum, it always failed at the last stage: making /home directories.

It would create them, then halt that it could not find bash. We looked for bash on the bad drive, and it was the usual /bin/bash shortcut to /usr/bin/bash and we were truly puzzled. I did a chroot to the drive and NOTHING worked. It just hung. That was the first clue.

The second was looking through the build script (in bash, which we didn't write) and checking the steps. Looked it the logs. Always died at creating some user named sapadm, the user for the HANA database. Eventually, I checked the configure file, and noticed it was the only user with the odd home directory "/usr/sap." Then it hit me: the permissions.

The script, thinking it was a home directory, did a chmod - R 755 for all directories and chmod - R 644 for all files! That meant, while creating home, it made everything under /usr not executable anymore! Holy shit, no wonder nothing worked! So we commented out that user in the config, ran the build again, and we were good! We created the sapadm by hand, and then later fixed the bug in the script.

SANITIZE YOUR DATA. Or you might turn Violet Beauregarde into a blueberry.

[–] WindowsEnjoyer@sh.itjust.works 26 points 1 year ago (2 children)

Learned that when dealing with Ansible:

  • Folder in most cases 755
  • File in most cases 644 or 755 if executable.
load more comments (2 replies)
[–] agent_flounder@lemmy.world 17 points 1 year ago

I have wasted lots of time on this once, long ago.

Here's another one I wasted time on. Mount point didn't have proper permissions (SunOS I think it was). Couldn't access the mounted filesystem.

[–] lea@feddit.de 14 points 1 year ago (1 children)

I once wasted 2 hours on getting an ssl cert working on an irc server by just giving its user access to my nginx certs, which turned out to also need +x. That was when I realized everything I knew about the execute permission was wrong.

load more comments (1 replies)
[–] 30p87@feddit.de 13 points 1 year ago (5 children)

Yup. Took me weeks to figure out why I explicitly need to use sudo nvim for my nginx config on my Pi, while on my server my little helper script could automatically use sudo for me. Turns out, I chmoded the sites-available and sites-enabled on my pi to 644 but left them untouched on my server.

I still don't know what numbers would be 644 but with execute permissions, but in the end, idc.

[–] GenderNeutralBro@lemmy.sdf.org 17 points 1 year ago (1 children)

You can also do chmod +x to add the executable bit to whatever the existing perms are.

0: no permissions
+4: read
+2: write
+1: execute

[–] tunetardis@lemmy.ca 14 points 1 year ago

I often go chmod -R go+rX . if I want to give read-only access to whatever I'm working on to everyone else. The capital X only sets the executable bit on directories.

load more comments (4 replies)
load more comments
view more: next ›