this post was submitted on 26 Nov 2023
218 points (95.8% liked)

Linux

48193 readers
1725 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
 

In the end of November 2022 (1 year ago), I switched from MacOs to Linux (Debian with KDE Plasma) on my MacBook.

No regret! Was a very good decision.

I think, I'll never go back.

Experience:

  • I did not know about KDE Plasma until 1 year ago. The picture in my head about Linux was pretty much GNOME. I'm a huge fan of KDE Plasma now. KDE Plasma 6 in 2024 will probably be awesome.
  • The GitHub repository "Awesome-Linux-Software" was awesome during the first weeks. It made me realize that most of the stuff I was already using, is also available for Linux. Only software I had to leave behind: Affinity Designer (IMO far more intuitive to use than GIMP, sorry FOSS community) and Visual Studio for Mac (which is dead anyway)
  • The only advanced thing I had to do in the beginning: My WIFI connection is always gone when I close my MacBook, but there is not automatic reconnect when I reopen it. None of the usual stuff recommended when using Debian on a MacBook helped. So, I had to write a service that checks for this (something with rmmod, modprobe, brcmfmac, ...). Probably too much for a casual user and hopefully not necessary for them..

TODO in the next year:

  • Trying out gaming on Linux, maybe buying a Steam Deck
  • Migrating to KDE Plasma 6 (and switching to Wayland)
  • Recommending ~~our religion~~ Linux to others
you are viewing a single comment's thread
view the rest of the comments
[–] MonkderZweite@feddit.ch 5 points 11 months ago* (last edited 11 months ago) (1 children)

You can probably replace your service script (sorry, but that's a hack) with a line in /etc/modules or /etc/modules-load.d/.

If that doesn't work, add your modprobe script to /usr/lib/logind/system-sleep/ (simple switch case with example). Not sure about the logind part, it's elogind for me since i use dinit, not Systemd.

[–] ndsvw@feddit.de 2 points 11 months ago (1 children)

I know that it's a hack. A really bad hack TBH.

But I wasn't able to get it working differently.

This is the service code I'm using (yes, I know... It's very bad, especially the pinging):

while :
do
	if [[ $(ping 192.168.178.1 -c 3) ]]
	then
		echo "pinged"
	else
		if [[ $(lsmod | grep brcmfmac) ]]
		then
			sudo rmmod brcmfmac
		fi
		sudo modprobe brcmfmac
		sleep 250
	fi
	sleep 15

done

When closing and opening my MacBook, it's necessary to execute sudo rmmod brcmfmac and then sudo modprobe brcmfmac. Only executing the 2nd command is not enough.


@MonkderZweite@feddit.ch

Your first 2 paths under /etc have a description like this:

kernel modules to load at boot time.

The problem I'm having is that I have to reload the module when the laptop was closed and reopened.

So, I think, the first 2 paths won't work, right? It's not boot time?


Something like the 2nd path was described in a tutorial about getting started on a MacBook with Linux. I remember it.

But the path you described does not exist on my system.

I have a path /usr/lib/systemd/system-sleep/, do you mean that one?

This contains 1 file (probably created by me in the beginning) called lid_wakeup_disable:

 #!/bin/sh

# /lib/systemd/system-sleep/lid_wakeup_disable
#
# Avoids that system wakes up immediately after suspend or hibernate
# with lid open (e.g. suspend/hibernate through KDE menu entry)
#
# Tested on MacBookPro12,1

case $1 in
  pre)
    if cat /proc/acpi/wakeup | grep -qE '^LID0.*enabled'; then
        echo LID0 > /proc/acpi/wakeup
    fi
    ;;
esac

Do I add rmmod brcmfmac; modprobe brcmfmac; (without sudo) at the bottom?

I'm thankful for any help to get rid of the service.

[–] MonkderZweite@feddit.ch 2 points 11 months ago* (last edited 11 months ago) (1 children)

Guess that was udev and not modprobe, where changes made are picked up immediately? My bad.

What i do have though, is a bunch of scripts in /etc/modprobe.d, with a comment:

# 'modinfo -p your-module' to list possible values
# 'systool -m your-module -av' to list active modules
# modinfo -p your-module |sort |awk -F':' '{print "\n# "$2"\n#options your-module "$1"="}' for a preset

Maybe there is a module-functionality active that causes trouble? Btw, dmesg -H says nothing? Looks like brcmfmac is troublesome generally (of course broadcum, huh).

Bttw: if you can't /etc/modprobe for some reason, you can load module settings as kernel parameters (via Grub or whatever) like module.option=value.

About the wakeup script, i have this in mine:

#!/bin/sh
case $1/$2 in
  pre/*)
    # Put here any commands expected to be run when suspending or hibernating.

    # so bluetooth doesn't prevent sleep
    /usr/bin/bluetoothctl power off ;;
  post/*)
    # Put here any commands expected to be run when resuming from suspension or thawing from hibernation.

    # bluetooth on after resume
    /usr/bin/bluetoothctl power on ;;
esac

Sorry, this is about as far as i can help without access to your computer.

[–] ndsvw@feddit.de 2 points 11 months ago (1 children)

Hi,

Thank you.

I was able to get it working.

What really helped me was the fact that you can see the logs of stuff in /usr/lib/systemd/system-sleep/:

sudo journalctl -u systemd-suspend --since "7 minutes ago"

I think, I had a bug in there or the execution rights of a file was not set or similar.

Now, I have pretty much done what the suggest here: https://wiki.debian.org/InstallingDebianOn/Apple/MacBookPro/Early-2015-13-inch

I'm glad, this is working as intended now.