05 September 2013

510. Kernel 3.11 on Debian

Here's another semi-recycled kernel building post -- the instructions are the same as for (almost) any previous version of the kernel.

There are several ways of building a kernel. The easiest (a purely subjective statement) is to use kernel-package i.e. make-kpkg. However, every now and again I see people writing that it's been deprecated.

I never spent much time with 3.10 as it caused (subjective) slow-downs on my SL410 laptop, and had issues -- at least in the early iterations -- when building the nvidia dkms module. I compiled this on a running 3.9.2-ck kernel.

So here's 3.11 -- note that this kernel too will not build the nvidia 304.88 dkms module, although it seems that 325.15 will build with a little bit of patching.

Either way, start by doing
sudo apt-get install fakeroot build-essential ncurses-dev kernel-package
mkdir ~/tmp
cd ~/tmp
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.11.tar.xz
tar xvf linux-3.11.tar.xz
cd linux-3.11/
cat /boot/config-`uname -r`>.config
make oldconfig
Compile also drivers which will not load (COMPILE_TEST) [N/y/?] (NEW) N Kernel compression mode > 1. Gzip (KERNEL_GZIP) 2. Bzip2 (KERNEL_BZIP2) 3. LZMA (KERNEL_LZMA) 4. XZ (KERNEL_XZ) 5. LZO (KERNEL_LZO) 6. LZ4 (KERNEL_LZ4) (NEW) choice[1-6?]: 1 Timer tick handling 1. Periodic timer ticks (constant rate, no dynticks) (HZ_PERIODIC) (NEW) > 2. Idle dynticks system (tickless idle) (NO_HZ_IDLE) (NEW) 3. Full dynticks system (tickless) (NO_HZ_FULL) (NEW) choice[1-3]: 2 Memory placement aware NUMA scheduler (NUMA_BALANCING) [N/y/?] (NEW) N Simple CPU accounting cgroup subsystem (CGROUP_CPUACCT) [N/y/?] (NEW) Group CPU scheduler (CGROUP_SCHED) [N/y/?] (NEW) Automatic process group scheduling (SCHED_AUTOGROUP) [N/y/?] (NEW) Choose SLAB allocator 1. SLAB (SLAB) (NEW) > 2. SLUB (Unqueued Allocator) (SLUB) choice[1-2?]: SLUB per cpu partial cache (SLUB_CPU_PARTIAL) [Y/n/?] (NEW) AIX basic partition table support (AIX_PARTITION) [N/y/?] (NEW) Linux guest support (HYPERVISOR_GUEST) [N/y/?] (NEW) N Timer frequency 1. 100 HZ (HZ_100) 2. 250 HZ (HZ_250) (NEW) 3. 300 HZ (HZ_300) > 4. 1000 HZ (HZ_1000) choice[1-4?]: Enable workqueue power-efficient mode by default (WQ_POWER_EFFICIENT_DEFAULT) [N/y/?] (NEW) Memory Hotplug (ACPI_HOTPLUG_MEMORY) [N/y/?] (NEW) AMD frequency sensitivity feedback powersave bias (X86_AMD_FREQ_SENSITIVITY) [N/m/?] (NEW) Support for PCI Hotplug (HOTPLUG_PCI) [N/y/?] (NEW) Kernel support for scripts starting with #! (BINFMT_SCRIPT) [Y/n/m/?] (NEW) InfiniBand media type support (TIPC_MEDIA_IB) [N/y/?] (NEW) Network Coding (BATMAN_ADV_NC) [N/y/?] (NEW) NETLINK: mmaped IO (NETLINK_MMAP) [N/y/?] (NEW) NETLINK: socket monitoring interface (NETLINK_DIAG) [N/m/y/?] (NEW) MPLS: GSO support (NET_MPLS_GSO) [N/m/y/?] (NEW) NCI over SPI protocol support (NFC_NCI_SPI) [N/y/?] (NEW) NFC hardware simulator driver (NFC_SIM) [N/m/?] (NEW) Dummy IRQ handler (DUMMY_IRQ) [N/m/y/?] (NEW) Generic on-chip SRAM driver (SRAM) [N/y/?] (NEW) ME Enabled Intel Chipsets (INTEL_MEI_ME) [N/m/y/?] (NEW) FlashPoint support (SCSI_FLASHPOINT) [N/y/?] (NEW) Renesas R-Car SATA support (SATA_RCAR) [N/m/?] (NEW) Block device as cache (BCACHE) [N/m/y/?] (NEW) Switch target support (EXPERIMENTAL) (DM_SWITCH) [N/m/?] (NEW) Virtual netlink monitoring device (NLMON) [N/m/y/?] (NEW) ARC devices (NET_VENDOR_ARC) [Y/n/?] (NEW) Qualcomm Atheros AR816x/AR817x support (ALX) [N/m/y/?] (NEW) QLOGIC QLCNIC 83XX family SR-IOV Support (QLCNIC_SRIOV) [Y/n/?] (NEW) Renesas SuperH Ethernet support (SH_ETH) [N/m/y/?] (NEW) SMSC LAN911x/LAN921x families embedded ethernet support (SMSC911X) [N/m/y/?] (NEW) Realtek RTL8152 Based USB 2.0 Ethernet Adapters (USB_RTL8152) [N/m/?] (NEW) m Atheros ath9k rate control (ATH9K_LEGACY_RATE_CONTROL) [N/y/?] (NEW) Atheros 802.11ac wireless cards support (ATH10K) [N/m/?] (NEW) m Atheros ath10k PCI support (ATH10K_PCI) [N/m/?] (NEW) m Atheros ath10k debugging (ATH10K_DEBUG) [N/y/?] (NEW) Atheros ath10k debugfs support (ATH10K_DEBUGFS) [N/y/?] (NEW) Atheros ath10k tracing support (ATH10K_TRACING) [N/y/?] (NEW) rt2800usb - Include support for rt55xx devices (EXPERIMENTAL) (RT2800USB_RT55XX) [N/y/?] (NEW) y Realtek rtlwifi family of devices (RTL_CARDS) [M/n/?] (NEW) Realtek RTL8188EE Wireless Network Adapter (RTL8188EE) [N/m/?] (NEW) m CW1200 WLAN support (CW1200) [N/m/?] (NEW) Cypress TrueTouch Gen4 Touchscreen Driver (TOUCHSCREEN_CYTTSP4_CORE) [N/m/y/?] (NEW) IMS Passenger Control Unit driver (INPUT_IMS_PCU) [N/m/?] (NEW) Freescale lpuart serial port support (SERIAL_FSL_LPUART) [N/m/y/?] (NEW) Analog Devices ADT7310/ADT7320 (SENSORS_ADT7310) [N/m/y/?] (NEW) GMT G762 and G763 (SENSORS_G762) [N/m/?] (NEW) National Semiconductor LM95234 (SENSORS_LM95234) [N/m/?] (NEW) Nuvoton NCT6775F and compatibles (SENSORS_NCT6775) [N/m/y/?] (NEW) generic cpu cooling support (CPU_THERMAL) [N/y/?] (NEW) X86 package temperature thermal driver (X86_PKG_TEMP_THERMAL) [M/n/?] (NEW) MEN A21 VME CPU Carrier Board Watchdog Timer (MEN_A21_WDT) [N/m/y/?] (NEW) ChromeOS Embedded Controller (MFD_CROS_EC) [N/m/y/?] (NEW) Kontron module PLD device (MFD_KEMPLD) [N/m/y/?] (NEW) Silicon Laboratories 4761/64/68 AM/FM radio. (MFD_SI476X_CORE) [N/m/?] (NEW) System Controller Register R/W Based on Regmap (MFD_SYSCON) [N/y/?] (NEW) TI TPS65912 Power Management chip (MFD_TPS65912) [N/y/?] (NEW) USBTV007 video capture support (VIDEO_USBTV) [N/m/?] (NEW) Conexant cx25821 support (VIDEO_CX25821) [N/m/?] (NEW) Cypress firmware helper routines (CYPRESS_FIRMWARE) [N/m] (NEW) QXL virtual GPU (DRM_QXL) [N/m/?] (NEW) Max number of sound cards (SND_MAX_CARDS) [32] (NEW) Build Display HD-audio controller/codec power well support for i915 cards (SND_HDA_I915) [N/y/?] (NEW) y M2Tech hiFace USB-SPDIF driver (SND_USB_HIFACE) [N/m/?] (NEW) Apple infrared receiver (HID_APPLEIR) [N/m/?] (NEW) ELO USB 4000/4500 touchscreen (HID_ELO) [N/m/?] (NEW) Huion tablets (HID_HUION) [N/m/?] (NEW) Enable USB persist by default (USB_DEFAULT_PERSIST) [Y/n/?] (NEW) Y FUSBH200 HCD support (USB_FUSBH200_HCD) [N/m/?] (NEW) OHCI support for PCI-bus USB controllers (USB_OHCI_HCD_PCI) [M/n/?] (NEW) USB-Wishbone adapter interface driver (USB_SERIAL_WISHBONE) [N/m/?] (NEW) Infineon Modem Flashloader USB interface driver (USB_SERIAL_FLASHLOADER) [N/m/?] (NEW) USB Suunto ANT+ driver (USB_SERIAL_SUUNTO) [N/m/?] (NEW) USB Physical Layer drivers (USB_PHY) [N/y/?] (NEW) Faraday FOTG210 USB Peripheral Controller (USB_FOTG210_UDC) [N/m/?] (NEW) PXA 27x (USB_PXA27X) [N/m/?] (NEW) MARVELL PXA2128 USB 3.0 controller (USB_MV_U3D) [N/m/?] (NEW) USB functions configurable through configfs (USB_CONFIGFS) [N/m/?] (NEW) LED Support for TI LP5562 LED driver chip (LEDS_LP5562) [N/m/?] (NEW) LED Camera Flash/Torch Trigger (LEDS_TRIGGER_CAMERA) [N/m/y/?] (NEW) QIB DCA support (INFINIBAND_QIB_DCA) [Y/n/?] (NEW) Mellanox Connect-IB HCA support (MLX5_INFINIBAND) [N/m/?] (NEW) iSCSI Extentions for RDMA (iSER) target support (INFINIBAND_ISERT) [N/m/?] (NEW) Set system time from RTC on startup and resume (RTC_HCTOSYS) [Y/n/?] (NEW) Set the RTC time based on NTP synchronization (RTC_SYSTOHC) [Y/n/?] (NEW) RTC used to set the system time (RTC_HCTOSYS_DEVICE) [rtc0] (NEW) NXP PCF2127 (RTC_DRV_PCF2127) [N/m/?] (NEW) Synopsys DesignWare AHB DMA support (DW_DMAC_CORE) [N/m/y] (NEW) Synopsys DesignWare AHB DMA PCI driver (DW_DMAC_PCI) [N/m/y/?] (NEW) WIS GO7007 MPEG encoder support (VIDEO_GO7007) [N/m/?] (NEW) DesignWare USB2 DRD Core Support (USB_DWC2) [N/m/?] (NEW) Mediatek Bluetooth support (USB_BTMTK) [N/m/?] (NEW) Intel Rapid Start Technology Driver (INTEL_RST) [N/m/y/?] (NEW) Intel Smart Connect disabling driver (INTEL_SMARTCONNECT) [N/m/y/?] (NEW) pvpanic device support (PVPANIC) [N/m/y/?] (NEW) Reset Controller Support (RESET_CONTROLLER) [N/y/?] (NEW) FMC support (FMC) [N/m/y/?] (NEW) XFS Verbose Warnings (XFS_WARN) [N/y/?] (NEW) Btrfs will run sanity tests upon loading (BTRFS_FS_RUN_SANITY_TESTS) [N/y/?] (NEW) Btrfs debugging support (BTRFS_DEBUG) [N/y/?] (NEW) EFI Variable filesystem (EFIVAR_FS) [N/m/y/?] (NEW) NFS client support for NFSv4.2 (NFS_V4_2) [N/y/?] (NEW) Provide Security Label support for NFSv4 server (NFSD_V4_SECURITY_LABEL) [N/y/?] (NEW) 9P Security Labels (9P_FS_SECURITY) [N/y/?] (NEW) Wait/wound mutex debugging: Slowpath testing (DEBUG_WW_MUTEX_SLOWPATH) [N/y/?] (NEW) torture tests for RCU (RCU_TORTURE_TEST) [N/m/y/?] (NEW) Ring buffer startup self test (RING_BUFFER_STARTUP_TEST) [N/y/?] (NEW) Test functions located in the string_helpers module at runtime (TEST_STRING_HELPERS) [N/m/y] (NEW) Debug alternatives (X86_DEBUG_STATIC_CPU_HAS) [N/y/?] (NEW) CMAC support (CRYPTO_CMAC) [M/y/?] (NEW) SHA256 digest algorithm (SSSE3/AVX/AVX2) (CRYPTO_SHA256_SSSE3) [N/m/y/?] (NEW) SHA512 digest algorithm (SSSE3/AVX/AVX2) (CRYPTO_SHA512_SSSE3) [N/m/y/?] (NEW) Camellia cipher algorithm (x86_64/AES-NI/AVX2) (CRYPTO_CAMELLIA_AESNI_AVX2_X86_64) [N/m/y/?] (NEW) Serpent cipher algorithm (x86_64/AVX2) (CRYPTO_SERPENT_AVX2_X86_64) [N/m/y/?] (NEW) LZ4 compression algorithm (CRYPTO_LZ4) [N/m/y/?] (NEW) LZ4HC compression algorithm (CRYPTO_LZ4HC) [N/m/y/?] (NEW) KVM legacy PCI device assignment support (KVM_DEVICE_ASSIGNMENT) [Y/n/?] (NEW) VHOST_SCSI TCM fabric driver (VHOST_SCSI) [N/m/?] (NEW)
make menuconfig

You can now enable any additional modules by navigating the menu structure. Note that most likely you don't have to enable anything in this step, but it can come in handy if there's a major transition (e.g. the way multimedia was handled changed between kernel 3.5 and 3.6) or if you want to enable a previously disabled option.

If you only want to compile modules that are currently in use (not a good idea if you want to use the same kernel on a range of computers, or have USB devices that aren't currently plugged in) you can do that by using make localmodconfig instead of make oldconfig. I wouldn't recommend it -- in most cases it won't make a faster kernel, and space and memory tends not to be much of in the way of issues these days.

Below, change -j2 to -jX, where X is the number of cores in your CPU (not cores+1 or anything funny like that. See other posts on this blog for compilation performance tests)


make-kpkg clean
time fakeroot make-kpkg -j2 --initrd kernel_image kernel_headers
sudo dpkg -i ../linux-image-3.11.0_3.11.0-10.00.Custom_amd64.deb ../linux-headers-3.11.0_3.11.0-10.00.Custom_amd64.deb


And that's it.

04 September 2013

509. Very briefly: Send remote commands via the dropbox folder

This is probably fairly obvious to most people.

I've got a reverse ssh tunnel set up so that I can access my work computer from home. However, for the past few days I've had the connection get stuffed up on a regular basis (it doesn't get dropped, but the connection gets refused), and it frustrates me a little bit.

While a proper ssh connection is unbeatable, I would at least be able to copy files back and forth via dropbox if I only had a way of sending commands to my work computer.

And an obvious way of doing that would be to use a cronjob and a tiny bit of bash scripting. So here we go:
While we don't have to (we could just have an empty script file instead) I like the idea of testing for the presence of a specific file in the Dropbox folder, and if it exists, execute it.

Let's call the file that tests for it runremote.sh, and put it in our home folder (~/). I personally suspect that making sure that execution output and error messages get properly logged is a good thing if you're going to fly blind like this, hence the 1> and 2>

runremote.sh
if [ -e ~/Dropbox/runme.sh ]; then sh ~/Dropbox/runme.sh 1>> ~/Dropbox/runme.log 2>> ~/Dropbox/runme.error & fi

Then when you want something executed, put a file called runme.sh in ~/Dropbox:
pwd echo 'Is it working?' cp ~/testfile.text ~/Dropbox date
Note that any command in runme.sh is going to be run in the ~/ folder -- not in ~/Dropbox.

And set the runremote.sh file to be executed e.g. every five minutes through cron:

crontab -e
*/5 * * * * sh ~/runremote.sh

Again, you don't need to have it test for the presence of a file, but I just instinctively like the idea.

Anyway, any command you put in ~/Dropbox/runme.sh should be executed and logged within five minutes from being synced.

You CAN use sudo (echo mypassword| sudo -S ls /root )as well by providing your password in the script file, but this is obviously not terribly safe.

02 September 2013

508. Very, very briefly: why apt-get purge exists (anecdote)

Sometimes my brain and I fall out, and we refuse to communicate. Yesterday was a day like that.

Having put my TV computer back together again (see post), I realised that I hadn't installed conky or guake on it. So I did. Having edited my default conky.conf (a bit like the one in this post) to change eth0 to eth1, I was wondering why my wireless card wasn't showing up in the ifconfig -a output. lspci showed that I had a broadcom chip, so I installed broadcom-sta-dkms. Nothing much happened, so I rebooted. And...no network card whatsoever recognised (including the ethernet one).

Face palm. I don't have a wireless pci/pci-e card on that computer. I should know -- I had just rebuilt it...

Oh well. apt-get autoremove broadcom-sta-dkms. Nothing. Reboot. Still no eth card -- also, the eth card was obviously the broadcom one (broadcom 4401). But why wasn't it working? I had uninstalled the broadcom package after all.

A bit of googling suggested loading b44 so modprobe b44 it was. Still nothing. Then a thought hit me -- ls /etc/modprobe.d/*blacklist*

And yes -- the broadcom package had installed a broadcom-wl-blacklist.conf file in /etc/modprobe.d -- and b44 was blacklisted. At this point I could either edited the file and comment out b44, delete the file entirely or purge the package and everything would be back to normal. So I did.

So remember: just because you uninstall a package (apt-get autoremovedoesn't mean that you've restore your system to the state it was before you installed the package. To at least have a chance of restoring it you need to purge your package so that settings files are removed too (apt-get purge).