blog.lobraun.de Gentoo

CIFS

Most Linux distributions provide their pre-compiled kernels with most options enabled as kernel modules. When self-compiling the kernel, you sometimes miss modules because you did not care to enable all available modules. That can sometimes lead to problems, such as when mounting SMB shares:

# mount -t cifs //<myhost>/<myshare> /mnt/myshare
mount error: cifs filesystem not supported by the system
mount error(19): No such device
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

These problems can be overcome by providing and loading the CIFS kernel module under:

File Systems ---> 
    Network File Systems --->
       <M> CIFS support (advanced network filesystems, SMBFS successor)

Compile and install your kernel and kernel modules. The kernel module should be loaded when trying to mount a share. If it is not loaded automatically on mount, then load the module manually:

# modprobe cifs

Hibernate/Suspend with Nvidia Drivers on Gentoo

The proprietary Nvidia drivers from x11-drivers/nvidia-drivers contain the closed-sources drivers from Nvidia for Linux. On my laptop, the current version show problems when hibernating/suspending. Several people found that the resume operations do not properly bring up the X-sessions. The same problem occurs on my GTX 1060 laptop. None of the helpful tips found on the Internet would allow me to hibernate/resume when the drivers are loaded.

The only solution that worked for me, is to unload the drivers before going into hibernate and to load them after the resume operation is completed. If you configured your hibernate using this tutorial, and are using sys-power/pm-utils and sys-power/upower-pm-utils, then you can place the following script in /etc/pm/sleep.d/ to unload and load the drivers:

#!/bin/sh
#
# 01nvidia_drivers: unloads and loads nvidia drivers before and after suspend operations

function unload_if_loaded() {
    MODULE=$1
    if lsmod | grep "$MODULE" &>/dev/null; then
        rmmod $MODULE
    fi
}

case "$1" in
   hibernate|suspend)
       unload_if_loaded nvidia_drm
       unload_if_loaded nvidia_modeset
       unload_if_loaded nvidia
   ;;
   thaw|resume)
       modprobe nvidia_drm
   ;;
   *) exit $NA
   ;;
esac

You can place the script to /etc/pm/sleep.d/01nvidia_drivers and make sure it is executable.

chmod +x /etc/pm/sleep.d/01nvidia_drivers

Afterwards, you should be able to hibernate/resume properly.