Working Ninja
2020-11-22T15:13:45

After upgrading to Linux kernel 5.4.0-54-generic, I was unable to adjust my display brightness.

dmesg output shows i915 'Y' invalid for parameter 'enable_dpcd_backlight'

/etc/default/grub contains i915.enable_dpcd_backlight=Y for GRUB_CMDLINE_LINUX_DEFAULT.

Removing the i915.enable_dpcd_backlight=Y from GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub resolved the issue.

2020-06-27T08:08:39

A while back, I found that my iDRAC firmware was out of date. Being a good sysadmin, I downloaded the update and followed the instructions to perform the update via the iDRAC itself. Being a while back, I don't remember exactly what transpired but the update failed in one way or another. Upon rebooting the server, my fans were running full throttle and I was unable to connect to the iDRAC.

I did some sleuthing on the Internet and found another poor soul with a similar issue. His solution was to perform a recovery of the iDRAC via a serial connection to the iDRAC and a TFTP server to serve the firmware.

Source: https://buildingtents.com/2014/04/24/idrac6-recovery-through-tftp-and-serial/

2019-10-15T21:44:13

lirc mysteriously stopped working when I upgraded to kernel 4.19.66-v7+ on my Raspberry Pi a while back. After an initial battle that lead to no success, I let it collect dust until this fateful night when she returned to her full functionality.

tl;dr

The kernel module lirc_rpi has been replaced with two modules: gpio_ir_recv (for receiving) and gpio_ir_tx (for sending, naturally). There are handful of configurations that need to point to and load the new modules.

My setup

  • GPIO 22 for IR transmission.
  • lircd 0.9.4c
  • kernel 4.19.66-v7+
  • Raspbian GNU/Linux 9 (stretch)

/boot/config.txt

Replace lirc-rpi with gpio-ir-tx. Take note that gpio_out_pin is now gpio_pin (see /boot/overlays/README for more info [search for gpio-ir-tx]).

dtoverlay=lirc-rpi,gpio_out_pin=22
dtoverlay=gpio-ir-tx,gpio_pin=22

/etc/lirc/hardware.conf

Replace loading of lirc_rpi with gpio_ir_tx.

MODULES="lirc_rpi"
MODULES="gpio_ir_tx"

/etc/modules

Remove lirc_* in /etc/modules (or comment out).

lirc_dev
lirc_rpi gpio_out_pin=22

/etc/lirc/lircd.conf

I had my remote configurations in lircd.conf and the upgrade to kernel 4.19. These were blown away, unfortunately. Fortunately, I had copies elsewhere. The new lircd.conf contains a single line that loads in all .conf files in /etc/lirc/lircd.conf.d/. I copied my remote conf files here and called it good (just in case another update blows things away =]

/etc/lirc/lirc.conf.d/devinput.lircd.conf

This file was unnecessary for my setup so I renamed it so it would not be loaded. See /etc/lirc/lircd.conf.d/README.conf.d for more info.

mv devinput.lircd.conf devinput.lircd.conf.dist

Extra Help:

  • If you need IR receive functionality, the dtoverlay will be gpio-ir (and not gpio-ir-recv, like the module). See /boot/overlays/README for more information. Also see modinfo gpio-ir-recv and modinfo gpio-ir-tx for more info.
2019-09-16T20:53:45

Add the following to your ~/.bash_profile for simple merging of PDFs:

pdfmerge() { 
    gs -dPDFSETTINGS=/prepress -dBATCH -dNOPAUSE -sDEVICE=pdfwrite [email protected]
}

Usage:

pdfmerge merged.pdf first.pdf second.pdf

Source:
https://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf

2019-06-16T20:30:46

I recently ran into a situation where I needed to copy some CSV data residing on a Windows machine to a Linux machine. The remote desktop client software I was using (on my Linux machine) wasn't set up to nativiely allow copy and paste to and from the server. It just so happened that I was recently working with netcat and thought this would be a great way to send the data to my destination machine. Sadly, Windows does not include netcat, so I dug around a bit and found that telnet would be able to take its place. So with a tool to use on both the sending and receiving side of things, I set out to implement what I'm calling "'universal' copy and paste".

So on my Linux machine (destination), I set up the netcat to listen on port 1234:

netcat -l 1234

On the Windows machine (source), I used telnet to connect to my Linux machine on port 1234, like so:

telnet 1.2.3.4 1234

I could then paste the CSV data on my Windows machine and it would immediately start outputting on my Linux machine. Ta-da, simple and "universal" copy and paste.

Finally, I would be remis if I did not mention that--while this is a working approach--it is not a secure one. The connection is not encrypted so everything is transmitted in clear-text.

2018-12-21T07:46:50

First, list the shares available from the server:

smbclient -L <server> -U <user>

Next, make sure cifs-utils is available (so we can pass in the credentials option):

sudo apt install cifs-utils

Finally, add the desired share to /etc/fstab:

//ip/share /mnt/point cifs vers=3,credentials=/path/to/credentials,noexec 0 0
2018-08-19T10:29:23

The following example looks for the "idle" time before backlight brightness is reduced.

Find what you're looking for:

gsettings list-recursively | grep idle

Get the value:

gsettings get org.gnome.settings-daemon.plugins.power idle-brightness

Set the value:

gsettings set org.gnome.settings-daemon.plugins.power idle-brightness 120

 

2018-03-04T07:53:22

Give your hand some relief from reaching for Ctrl and take advantage of the close proximity of Caps Lock.

# Note any previous values for xdb-options (most likely none)
gsettings get org.gnome.desktop.input-sources xkb-options

# Set our xkb-options (plus anything from our get, if needed)
gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"

Now to retrain your brain ;)

Source: https://askubuntu.com/questions/33774/how-do-i-remap-the-caps-lock-and-ctrl-keys

2018-01-06T17:16:21

Completely disable systemd power-saving modules:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Disable systemd lid switch (for laptops):

sed -i -e 's/HandleLidSwitch=suspend/HandleLidSwitch=ignore/' /etc/systemd/logind.conf

The above became necessary as systemd-logind was detecting that the lid was closed and calling suspend.target. The calls were numerous and consumed large amounts of CPU.

Sources:
https://askubuntu.com/a/858617 and https://unix.stackexchange.com/a/52645

2017-12-30T20:13:20

Objective:

Enable the "Start up automatically after a power failure" feature found within OS X without OS X installed.

Solution:

  1. Find the LPC controller via lspci.
  2. Reference the LPC controller datasheet to find the register to update.
  3. Update the register with setpci.
  4. Test.
  5. Add the setpci command to crontab.

I'll be performing the following steps on a 2008 MacBook 4,1. Similar steps should be successful with other models.

1. Find the LPC controller via lscpi.

$ lspci | grep LPC
00:1f.0 ISA bridge: Intel Corporation 82801HM (ICH8M) LPC Interface Controller (rev 04)

Note the PCI address (00:1f.0) of our LPC Interface Controller. This will be referenced later with the setpci command.

2. Reference the LPC controller datasheet to find the register to update.

Searching the Internet for "82801HM datasheet" yields this datasheet from Intel. After opening the PDF, find the page for "AFTERG3_EN" via the Appendix A Register Bit Index (at the end of the PDF):

9.8.1.3 GEN_PMCON_3—General PM Configuration 3 Register (PM—D31:F0)  

Offset Address: A4h
Default Value: 00h
Lockable: No
Attribute: R/W, R/WC
Size: 16-bit
Usage: ACPI, Legacy
Power Well: RTC

Bit: 0
Description: AFTERG3_EN — R/W. This bit determines what state to go to when power is re-applied after a power failure (G3 state). This bit is in the RTC well and is not cleared by any type of reset except writes to CF9h or RTCRST#.

0 = System will return to S0 state (boot) after power is re-applied.
1 = System will return to the S5 state (except if it was in S4, in which case it will return to S4). In the S5 state, the only enabled wake event is the Power Button or any enabled wake event that was preserved through the power failure. NOTE: Bit will be set when THRMTRIP#-based shutdown occurs.

From the above, we find that our register location is 0xA4 (A4h) with bit 0 (AFTERG3_EN) being the one that controls whether or not to power on the device after a power failure. Setting this bit to 0 will power on the machine.

3. Update the register with setpci.

Get the current value (should be 1):

$ sudo setpci -v -s 00:1f.0 0xa4.b
01

Set the bit to 0, per our datasheet:

$ sudo setpci -v -s 00:1f.0 0xa4.b=0

This is where I get lost. I do not see how we are setting just bit 0 to 0 with the above line. Searching online yields the same command for similar devices and different commands for others (who's manuals I cannot find online).

Verify that the bit is now set to 0:

$ sudo setpci -v -s 00:1f.0 0xa4.b
00

4. Test.

Shutdown the machine and disconnect the power supply.

5. Final Things

The AFTERG3_EN bit is reset to its default at reboot, so lets add the above command to our crontab (as root):

@reboot /usr/bin/setpci -s 00:1f.0 0xa4.b=0

Source:
https://superuser.com/questions/212434/reboot-after-power-failure-for-mac-mini-running-ubuntu#212533