# Linux

## It en’t better for Win or Mac or BSD either

The Linux Community: A Corporate controlled committee of people who don’t use Linux and dislike ideas.

Source: Linux Sucks 2020 – YouTube

It’s funny because it’s true.

## Nice

Pretty sure this is the longest I’ve been able to keep a server alive without having to reboot for whatever reason.

Surprisingly, no one in the /. thread mentioned any of them. They were more interested in lighting systemd’s creator ass on fire.

## A Debian Wifi Router: Kernel tuning

So it turns out that if you go with the default kernel parameters on the device you won’t get much throughput. I’m currently paying my ISP for a 25Mbit/s pipe both ways, which is bloody awesome.

I was having problems with throughput and network jitter, though. I was able to have a fast connection from my devices to the router and the router had the full connection available to itself; problems were the router was not able to make the full connection bandwidth available to its clients and the bandwidth would go from 25Mbit/s all the way down to 5Mbit/s all the time.

This is really damn annoying when you’re putting in a good match on Unreal Tournament, let me tell you.

Thinking it could be something related to hostapd I played around with a few more settings but nothing really made a difference. I’m having problems with reception and throughput in my bedroom but that’s for another post, I guess. Suffice to say that with a direct line of sight to the router everything works about as expected.

So it wasn’t hostapd. Played around with iwconfig and iw but neither made much of a difference. That left the network interfaces themselves and the kernel.

Dug around and found plenty of links and articles on what settings to adjust and how to adjust them but all of them are geared towards servers of some sort. There isn’t much information that a home/office IT guy would be able to use for tuning the kernel for bandwidths of less than 100Mbit/s, which is what I’m attempting to do here. The most popular post (which I basically copied into my configuration) is using settings for 1Gbit/s connections that I then changed with the one entry that matched from the Ars Technica post.

Here’s sysctl.conf as I have it right now:

# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#

#kernel.domainname = example.com

# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3

##############################################################3
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#net.ipv6.conf.all.forwarding=1

###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
# 2016/09/12 02:59:32: http://www.nateware.com/linux-network-tuning-for-2013.html
#
kernel.sem = 250 256000 100 1024

# Increase system file descriptor limit
fs.file-max = 100000
#
# # Discourage Linux from swapping idle processes to disk (default = 60)
vm.swappiness = 10
#
# # Increase ephermeral IP ports
net.ipv4.ip_local_port_range = 10000 65000
#
# Increase Linux autotuning TCP buffer limits
# Set max to 16MB for 1GE and 32M (33554432) or 54M (56623104) for 10GE
# Don't set tcp_mem itself! Let the kernel scale it based on RAM.
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_max = 4194304
net.core.rmem_default = 4194304
net.core.wmem_default = 4194304
net.core.optmem_max = 40960
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 65536 4194304

# Make room for more TIME_WAIT sockets due to more clients,
# and allow them to be reused if we run out of sockets
# Also increase the max packet backlog
net.core.netdev_max_backlog = 25000
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_max_tw_buckets = 200000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10

# Disable TCP slow start on idle connections
net.ipv4.tcp_slow_start_after_idle = 0

# If your servers talk UDP, also up these limits
net.ipv4.udp_rmem_min = 8192
net.ipv4.udp_wmem_min = 8192

# Disable source routing and redirects
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0

# Log packets with impossible addresses for security
net.ipv4.conf.all.log_martians = 1


Everything in here I’m sure can be tuned further and the file itself is so damn ugly to look at but for now at least I have a starting point I can use.

All this tomfoolery is turning me into a network wonk.

## Things got complicated quickly, to be sure

In essence, we see that nearly everyone is doing the best they can to avoiding addressing anything, immediately becoming defensive.

Source: ProSystemdAntiSystemd

## Blackslab back on Linux

Title says it all. First I tried using Windows 8 on her and it kinda sorta worked… but it was just too much for the computer.

I tried Windows 7 and it worked without a hitch… before I actually installed software. Once I did, the system bogged down to the point where I would dread using it. Even youtube videos would bring the system to its knees.

Right now I’ve been using Linux Mint 14 Debian Edition without problems except the usual Pulseaudio bullshit, but that will require very smart minds to fix.

## Linux desktop “progress”

Northfield/Norwood isn’t about changing anything fundamentally with Wayland/Weston, but Moreau doesn’t like the pace of development within Wayland/Weston and it being bottlenecked at times by Kristian’s workload. Moreau is also more focused on just “desktop bling” and effects than low-level graphics subsystem work. Among the desktop effects he wants to bring over from Compiz into a Wayland compositor include the desktop cube, desktop wall, scale, wobbly windows, expo, and Emerald Theme support.

In a couple of years you’ll have to get a new computer to run any sort of Linux desktop environment, while your old computers get Windows installed on them.

## Redesigning the Thinkpad for Windows 8 and ONLY Windows 8

ThinkPad loyalists will almost certainly direct their attention to the new trackpad when first laying eyes on the T431s. Or, perhaps, they’ll spot the notable (and very deliberate) omission of the physical buttons that have historically sat just beneath and above a far smaller tracking surface. According to Parrish, the overall concept was to “simplify the appearance of two pointing devices in ThinkPad notebook design and maximize touchpad area — while optimizing it for interaction with Windows 8.” A tricky approach, no doubt, given that a solid swath of ThinkPad users have no doubt grown used to mousing with the crimson-clad, centrally located nub. The end result is a five-button clickpad, as it was detailed to me, which supports 20 gestures and handles northerly clicks for those who refuse to switch from using the aforementioned pointing stick.

So I guess Linux support is out? Right now I’m pissed at the desktop environment mess, but once the dust has settled, I’ll probably be going back. I’d like to go back to Linux on a Thinkpad, but if Lenovo chooses to block me from that, I’ll buy a computer from some other OEM that does let me.

Just like me, people are switching back and forth.

• OS X is getting a lot of iOS stuff into it that professional creators don’t want or need.
• Windows 8 is not everyone’s cuppa tea… but it’s quite solid as long as you learn how to deal with don’t-call-it-Metro interface.
• Linux is in a state of disarray. KDE is pure eye candy, GNOME is griefing, Xfce and Enlightenment kind of refuse to pick up the slack, MATE and Cinnamon are still bug ridden.
• BSD is stable… if you’ve got compatible hardware and don’t mind using libraries that are often years old.

Shit’s broken and no one ain’t fixin’ it.

By the pits of elemental chaos, I don’t know where to begin. I truly don’t. I’m typing this up trying to calm down after I was taken against my will on an odyssey of bad documentation, stupid changes and general assholery.

It all started with an innocuous aptitude update; aptitude upgrade. Package linux-image-3.2.0-4-686-pae refused to install properly, but that can be dealt with later. Reboot.

All hell breaks loose upon Xorg. All 2D/3D hardware acceleration is gone. Xrandr refuses to work and the most it can do is clone the displays, displaying the following error with a command that worked for years before today:
 $xrandr --output LVDS --auto --preferred --output VGA-0 --auto --preferred --right-of LVDS xrandr: screen cannot be larger than 1600x1200 (desired size 2680x1200)  Dig into documentation… nope, I’m setting all options properly. The xorg.conf man page has this golden nugget of information:  VIDEOADAPTOR SECTION Nobody wants to say how this works. Maybe nobody knows ...  Is it any wonder people are using sites like StackExchange as their first stop when trying to fix issues? Man pages refuse to evolve and more and more applications simply don’t provide them, telling you to go to their website when seeking help. Anyway, back to Xorg. Installing the proprietary fglrx driver doesn’t work; the Radeon Mobility X1400 card on this Thinkpad T60 is not supported anymore. I could try apt pinning to get it to work… but Debian doesn’t really encourage its use. Purged the driver from the system. Now I’ll have to do the one thing I really didn’t want to do. Setup a xorg.conf file manually. Switch to a VT (Ctrl+Alt+F1), uplift to root, Kill X (/etc/init.d/lightdm stop), issue X -configure. Get this error:  Number of created screens does not match number of detected devices. Configuration failed.  2003 called. They want XFree86 back. All right then, let’s manually create a xorg.conf file that X can use without shitting itself. Visit thinkwiki.org and found useful nuggets of information, including a mostly working xorg.conf file. Couple this with another demonstration xorg.conf file and I came up with this beauty:  Section "Device" Identifier "ATI X1400" Driver "radeon" Option "AGPMode" "8" Option "AGPFastWrite" "1" Option "RenderAccel" "1" Option "AccelMethod" "EXA" Option "AccelDFS" "1" Option "EnablePageFlip" "1" Option "ColorTiling" "1" Option "DynamicClocks" "1" Option "BIOSHotkeys" "1" BusID "PCI:1:0:0" EndSection  Section "Monitor" Identifier "LVDS" Option "DPMS" EndSection  Section "Screen" Identifier "Default Screen" Device "ATI X1400" DefaultDepth 24 SubSection "Display" Virtual 2680 1050 EndSubSection EndSection  It’s ugly, it’s messy. It mostly works. Video performance is, hmm, how to describe it… quirky; I’m getting lots of drawing artifacts all over the place; CPU usage seems to come and go. Hell, the performance of iceweasel while typing this post leaves much to be desired. But now I’ve got a starting point from which to improve the situation. Was any of this necessary? No. Would I have run into these issues if I were using Windows or OS X? Certainly not. The urge to leave Linux behind on the desktop and move back to Windows is becoming ever stronger. Windows 8 runs quite nicely on my Thinkpad X61t, and I don’t have to deal with forced changes to my desktop environment. I’m tired of this. All of this. First Amarok 2 became a monster that still can’t compare with Amarok 1.4.x — Clementine does the job well enough, but really. Then GNOME 2 turned into GNOME 3, throwing into disarray the desktop environment landscape; people haven’t recovered and the alternatives aren’t working yet. Interacting with Android devices remains a pain in the ass. Interacting with iOS devices is basically impossible. The big companies are treating Linux like a third-class citizen. Should I not be able to get performance to what it was before, I will be migrating back to Windows. I am not alone in this consideration. Right now a whole lot of people are migrating to OS X or Windows to avoid these headaches; they too are tired of having to fight the desktop in order to do real work. Linux is victorious on the server and mobile spaces, but I now truly don’t expect it to remain more than a plaything for common desktop users. I hope to someday come back to the Linux fold but this won’t probably happen for a few years, when things have changed. ## Sadly, this guy is right Then again, he’s using a FreeBSD offshoot. ## UNIX vs. FLOS To me, the core of a UNIX system is a philosophical matter. To quote Mike Gancarz’s The UNIX Philosophy from 1994, UNIX has 9 paramount precepts: 1. Small is beautiful. 2. Make each program do one thing well. 3. Build a prototype as soon as possible. 4. Choose portability over efficiency. 5. Store data in flat text files. 6. Use software leverage to your advantage. 7. Use shell scripts to increase leverage and portability. 8. Avoid captive user interfaces. 9. Make every program a filter. FLOS is a nearly diametrically opposed design, with design concepts like the following: • FLOS avoids scripts, and prefers to split tasks into compiled logic interacting with logic-less configuration files. • FLOS prioritizes ease of machine manipulablity over human manipulablity. • The components of FLOS communicate over D-Bus rather than sockets and pipes. • FLOS is built on a core of monolithic programs which attempt to synergisticly manage multiple complex components. • FLOS leverages features specific to Linux and ignores portability. • FLOS prefers tightly integrated components to generic solutions. I’m not sure that this is a bad design, but it is most definitely not UNIX or anything like it. via Linux Reddit. This here explains why a lot of stuff simply doesn’t work the way it used to: Xorg, NetworkManager, Pulseaudio. It also explains why no one outside of IT uses Linux for real-world software development; you don’t have to fight OS X to get started writing code. FreeBSD is almost there as well, with people switching over to it to avoid dealing with the eldritch abomination that is D-Bus. Are FLOS proponents still butthurt by Microsoft? So much that they would turn the OS on top of Linux-the-kernel into a bad imitation of Windows? ## Bury yourself already. My reaction when I read this is “This will be its death.” ## Sinful Interfaces It is quite telling that Linux is nowhere on the list. This is how hard all open source desktop environments have failed. GNOME lusted after OSX and became a bad imitation of it. KDE lusted after Windows 7’s candied interfaces, and became bloated. Xfce remains too static and people use it only it is known and stable. There is some semblance of hope with MATE, Cinnamon, Trinity and Razor-qt, but they’re too young and still need years to achieve feature parity with Windows XP. I’ve been using Windows 8 and I’ve found I have to fight its UI quirks less than those of Xfce, GNOME or KDE, enticing me to jump back and stop dealing with all these changes. ## Want to win a war when they can’t even put gas in the car. Hi guys, I recently updated Arch and I got the new gtk3 stuff. All would be fine except for the fact that now, my gtk2 apps use a theme and the gtk3 ones use another (ugly) one. I searched the forum and I basically found that I should wait for gtk3 and gtk2 to become armonic or gtk2 apps use the gtk3 libraries This is why Linux will never win on the desktop, and I have been a Linux desktop user for 5 years now. ## Fire and brimstone ## No, it did not work. In short, KDE 4 is about one thing and one thing only: 3D rendered eye candy. If that’s what you want, that’s what you’ll get, in spades. But as a desktop, as a single, integrated, holistic sense of place and set of potentialities and operations that are intuitive, minimal, and streamlined and that support productivity, KDE 4 is an epic fail in a way that makes KDE 3 roll in its grave. That specific comment states the plain truth about KDE4. I tried to run it on my trusty Thinkpad T60 for a few days, finding out it is basically unusable with compositing turned off. Turning it on makes it work too much for too little return; I couldn’t even listen to music on Grooveshark without the music slowing down! ## All that remains All that remains, a photo by nullrend on Flickr. Going, going ## Linux + Bluetooth What a fucking joke. Save yourself the trouble and stick with Windows. Yet another source of constant annoyance for the so-called “Year of Linux on the Desktop”. It is not worth your time to fight Linux on this. ## C’mon, now I’ve been trying to get the damn Debian Wheezy installer to work via USB on a Thinkpad T60 for the past three days without any success. Sure, it works like a charm when put on a CD or a DVD and booting from there, but that is beside the point. I’ve tried various methods I’ve found on the web and on the Debian wiki without avail. To use any of them, you need to fuck around with the terminal, or installing things (as in the case of unetbootin). As it is right now, most Linux installers still can’t easily be put on USB drives without fucking around on the command line and getting things wrong a few times. I realize I’m just venting, but… really, it is now past mid-2012. Apple is selling its OS X via digital delivery. Microsoft is about to do the same with Windows 8, and did sell Windows 7 installers on USB drives. Linux should have gotten there years ago, to make it easy for people to try it out and keep their files around with them. Instead, we have lots and lots of guides for “the perfect$LINUXDISTRO USB install”, all of which are outdated within a few months. This would have led to Linux spreading virally among the common user, instead of just staying in the nerd ghetto.

Combine this with motherboards implementing UEFI and Linux installers not supporting it, and the future is getting ever dimmer for “Linux on the desktop.” Next time someone says “This is the year of Linux on the desktop” I will laugh at them on their face.

## Reblog if you run Linux as your primary desktop OS

Curious how many of my tumblr followers do.

The correct time to back up your computer was today, two hours ago.

## The easy way to print from Linux to Windows

The usual way printing works on Linux is by connecting your printer directly to your system, or printing through IPP. But what if you need to print to a printer connected to a Windows system?

Here is how to get it working while keeping fuss to a minimum. Once again, these instructions are made with Debian Squeeze in mind, so adjust them if you’re using a different distribution. I used Windows XP but I believe these instructions should also work for Vista and Windows 7.

1. In Windows, make sure the printer is shared.
2. Make note of the printer’s share name and the system’s hostname, viewable in System Properties (right-click the My Computer icon).

3. Install smbclient.
4. # aptitude install smbclient

5. In GNOME go to System/Administration/Printing. On the menu bar go to Server/New/Printer. You’ll probably have to provide your root password to continue.
6. Click “Network Printer”, then select “Windows Printer via SAMBA.”
7. On the right pane you’ll see a textbox to enter the address for the printer itself. Click Forward.
8. You have to enter both the Windows hostname and the printer’s share name, so you’d type something like mywindowspc/myprinter. Make sure you get the case right.

9. It is likely CUPS already has a working driver for your printer, so look for it on the list of drivers. If you want to provide a PPD file or look for another driver, you can also do that.
10. In my own case there were three available drivers for the printer, so I went with the one marked “recommended” by the wizard.

11. Assign a printer name, description, and location. You may have to re-enter your root password to save all settings.
12. Print a test page.

That should do the trick. If it doesn’t work you can try using another print driver. If that still doesn’t work, try looking for a Linux driver for your printer.

## Network Printing

The easiest way to share a printer between Linux, Windows and Mac OS is to get a fucking print server and have the computers print to it.

## Set Qt mouse pointer inside GNOME

You don’t have to install theme packages, engines or extra apps. All you need is already on your Debian system:

 # update-alternatives --config x-cursor-theme There are 2 choices for the alternative x-cursor-theme (providing /usr/share/icons/default/index.theme).

 Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/share/icons/DMZ-White/cursor.theme 90 auto mode 1 /usr/share/icons/DMZ-Black/cursor.theme 30 manual mode 2 /usr/share/icons/DMZ-White/cursor.theme 90 manual mode 

Press enter to keep the current choice[*], or type selection number: 1 update-alternatives: using /usr/share/icons/DMZ-Black/cursor.theme to provide /usr/share/icons/default/index.theme (x-cursor-theme) in manual mode.

If you’re not using Debian, it seems the way to go is to follow /usr/share/icons/default/index.theme with the following:

 [Icon Theme] Inherits=DMZ-Black

Either method sets the cursor theme systemwide through Xorg itself. To set it for a single user, add the following to ~/.Xdefaults:

 Xcursor.theme: DMZ-Black Xcursor.size: SIZE #optional

In my own case, I was using the the DMZ-Black theme on GTK applications, but Qt3/Qt4 applications (Amarok 1.4, Clementine, Skype, KeepassX) had the mouse pointer switch to DMZ-White when it entered their windows. Nothing that would cause trouble, but annoying if you want a consistent look across your environment.

As said before, this avoids unnecesary cruft on your system and works for all desktop environments you might have on your system.

Tips grabbed from here.

## The no-bullshit Samba plus Nautilus network shares method.

Here is how to setup Samba and GNOME Nautilus to allow user directory sharing without having to allow root access. These commands are made with Debian in mind, so if you want to use them for your Linux distribution, you’ll have to adapt them.

1. Install samba and nautilus-share.
2.  # aptitude install samba nautilus-share

3. Rename your smb.conf to smb.conf.master
4.  # cd /etc/samba # mv smb.conf smb.conf.master

5. Add the following to smb.conf.master somewhere under the [global] stanza using your favorite text editor.
6.  security = SHARE usershare allow guests = Yes usershare owner only = No

7. Run the following command:
8. # testparm -s smb.conf.master > smb.conf

This tests the samba master configuration file, then outputs the results to the file samba itself will use for its configuration. If it finds errors, it will warn you about them.

According to the Samba docs, a small smb.conf file improves performance. It also improves readability once you’re familiar with Samba options.

9. Restart samba.
10.  # /etc/init.d/samba restart

11. Add your user to the sambashare group. If more people use the system and they need to share files, make sure to add them as well.
12.  # useradd -G sambashare foo

13. Log out of your user session, then log back in.
14. On Nautilus, when you right-click directories you will now see a “Sharing options” item. Through this item you can:
• Share the folder, assigning a share name.
• Enable Guest access, which allows people without a user account on the system to access the share.

This last option is the most useful as people can now get stuff through the network without having to deal with usernames or passwords. Does this make the Linux system behave like a Windows system? Yes, it does.

There is something to be said, however, about the convenience of creating shares without having to muck around the smb.conf.master file whenever you want to make a change.

## Cablemas DNS

So it seems cablemas decided to block DNS requests (port 53) going out of their network. I’m not sure if they’re doing this at the network level — which would be extremely stupid on their part — or by reconfiguring their modem. Either way this means:

• Cannot use OpenDNS or Google Public DNS for domain resolution.
• I’m forced to use Cablemas DNS servers. They are very, very slow. Most lookups are above 20s, with 30s-40s latency being common.

Since DNS queries take long to resolve, internet connectivity is slow as hell. Enter DNS caching (DNS proxy).

Most DNS servers can do caching on the side (BIND, djbdns, dnsmasq) without too much additional work. The problem is most of the time the cache disappears when the computer is rebooted. If your system is a server, you’re fine. But what if you’re on a laptop or a desktop? It’s no good having a cache if you have to rebuild it every day.

There isalso the fact the electric system in Mexico isn’t the best, so often computers go down hard when the electricity fails. UPS units are expensive to put them on a single desktop computer.

So that’s when I discovered pdnsd. It’s a light DNS proxy that can act as a caching system, working on localhost to speed up queries.

Being on Debian Sid, all I had to do to install it was

# aptitude install pdnsd

When asked which mode to use, I chose ‘manual’. When it was done I added my ISP’s DNS servers like so to /etc/pdnsd.conf

server {
label=cablemas;
ip=200.95.144.3;
ip=10.147.0.43;
ip=10.147.0.15;
timeout=30;
uptest=ping;
ping_timeout= 300;
}

You’re free to use other DNS resolvers like OpenDNS or Google Public DNS obviously. The caching will work regardless of what upstream server does the actual resolving.

Then set it up so it runs on boot by editing /etc/default/pdnsd

This sets up the daemon to work; you still have to set up your network interfaces to make use of the cache. In my own case my system is getting an IP address from the cablemodem itself dynamically, so I had to edit /etc/dhcp3/dhclient.conf and enable the prepend domain-name-servers directive:

prepend domain-name-servers 127.0.0.1

If you’re setting manually via /etc/network/interfaces, you’ll have to manually edit /etc/resolv.conf so your local DNS is queried first.

Once everything is done, bring down the interface (eth0 in my case):

# ifdown eth0

Then bring it back up:

# ifup eth0

I’m pretty sure it’d be same for wlan interfaces. This should be more useful on laptops or systems that connect to networks of unknown quality.

This all goes to show Cablemas is one of the worst ISPs around and you should avoid it like the plague.

Sources: