Linux on the Toshiba Tecra C40-C1401

Author: Michael Minn (www.michaelminn.com)

27 September 2020

1. Introduction

Toshiba Tecra C40-C1401

This page describes how to set up a Debian 9.0 (Stretch) Linux operating system on a Toshiba Tecra C40-C1401 notebook computer.

The machine that I purchased on 6 June 2017 features:

2. Network Install

A network install after booting from a flash drive is fairly straightforward except for partitioning. The following are my choices and you may need to choose other options depending on your situation.

This install assumes you have a wired ethernet connection.

This installation is based on a Linux-only installation.

Download: the netinst from Debian.org and use it to create a bootable flash drive. Assuming you already have a Linux box, the ISO can be directly copied to the flash drive device. Assuming the device is /dev/sdb (you can check with the dmesg command), all you need is a simple copy:

sudo cp debian-8.5.0-i386-netinst.iso /dev/sdb
sync

Boot from Flash Drive: Insert the flash drive into an USB slot and reboot When the American Megatreds BIOS splash screen comes up press F-12 and choose the USB device.

The machine takes a few seconds to load the OS. You can press ESC to view boot messages, although there aren't alot of meaningful ones issued anymore.

Boot Menu: Select Install

Select a Languate: Your choice (mine is English)

Select Your Location: Your choice (mine is United States)

Configure the Keyboard: Your choide (mine American English)

Hostname: Arbitrary choice that doesn't matter much unless you're setting up a web server. You can change it later in /etc/hostname

Domain Name: Another arbitrary choice that doesn't matter much unless you're setting up a web server

Root Password: Choose the way you choose a spouse: memorable but strong

First User Full Name: You may want to use a fake name to preserve anonymity

Username: This will be what you normally log in with

Password: Ditto

Time Zone: Your choice (Pacific)

Partition Method: Using Guided - use entire disk, with Separate /home partition these were my choices:

SCSI2 (0,0,0) (sda) - 750.2 GB ATA TOSHIBA MQ01ABD0
		  1.0 MB	FREE SPACE
	#1	536.9 MB   B f	ESP
	#2	 30.0 GB     f	ext4		/
	#3	  8.4 GB     f  swap		swap
	#4	711.2 GB     f	ext4		/home
		892.4 kB	FREE SPACE

Installing Base System: The installer will run for a few minutes

Configure the Package Manager: This determines which mirror server to use. Closer is better. I chose United States and my Alma Mater, debian.cites.illinois.edu

HTTP Proxy: If you're in a corporate network, you may need one. Home folks can usually leave this blank

Configuring Popularity-contest: Sounds too Windoze-phone-home for me (NO)

Software Selection: Another personal preference. I use IceWM as a window manager with no desktop (see below), so my choices were the Debian Desktop, no graphic desktop, no print server, standard system utilities.

Package Installation: With my choices, the system had to retrieve 1466 files, which took around 30 minutes

Finish the Installation

3. Unneeded Services

By default Debian enables a number of services that may be unneeded by single-user machines, and may present security vulnerabilities.

netstat displays open ports, and when run as root with the -lp options, you see the processes listening on those ports.

$ sudo netstat -lp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      4819/rpcbind        
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      4598/exim4          
tcp6       0      0 :::111                  :::*                    LISTEN      4819/rpcbind        
tcp6       0      0 ::1:25                  :::*                    LISTEN      4598/exim4          
tcp6       0      0 :::6566                 :::*                    LISTEN      4639/saned          
udp        0      0 0.0.0.0:754             0.0.0.0:*                           4819/rpcbind        
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           4672/avahi-daemon:  
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           4705/minissdpd      
udp        0      0 0.0.0.0:49012           0.0.0.0:*                           4672/avahi-daemon:  
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1736/dhclient       
udp        0      0 0.0.0.0:111             0.0.0.0:*                           4819/rpcbind        
udp6       0      0 :::754                  :::*                                4819/rpcbind        
udp6       0      0 :::5353                 :::*                                4672/avahi-daemon:  
udp6       0      0 :::111                  :::*                                4819/rpcbind        
udp6       0      0 :::35143                :::*                                4672/avahi-daemon:  

None of these open ports are necessary on a single-user system except port 68 (bootpc) used by dhclient with DHCP to get an IP address from your ISP.

Services can be stopped with:

sudo service <service> stop

Services can be disabled so they are not started at boot time with:

sudo update-rc.d <service> disable

The following are services I stopped and disabled:

When those are shut down, netstat gives a nice, clean, secure listing:

$ sudo netstat -lp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
udp        0      0 0.0.0.0:bootpc          0.0.0.0:*                           1719/dhclient       

4. Wireless

The Intel Dual Band Wireless-AC 3165 (rev 81) is supported by the iwlwifi in the kernel, although you will need to install firmware.

Firmware

Install the existing firmware-iwlwifi package:

$ sudo apt-get install firmware-iwlwifi

Download and unpack the appropriate tarball from the Intel website, and rename/copy it to the firmware directory:

$ tar -zxvf iwlwifi-7265-ucode-25.30.14.0.tgz

$ cd iwlwifi-7265-ucode-25.30.14.0

$ sudo cp iwlwifi-7265D-14.ucode /lib/firmware/iwlwifi-3165-9.ucode
$ sudo cp iwlwifi-7265-14.ucode /lib/firmware/iwlwifi-3165-13.ucode

When you reboot, iwconfig should show the device as wlp2s0:

$ sudo iwconfig

wlp2s0    IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

Manual Configuration

I prefer to start and stop my networks manually, and removed the network-manager to avoid conflicts and problems encountered on other machines:

$ sudo apt-get remove network-manager

The interface can be started with the ifup command:

$ sudo ifup wlp2s0

The interface can be stopped with the ifdown command:

$ sudo ifdown wlp2s0

Access points can be displayed with the iwlist command:

$ sudo iwlist wlp2s0 scan

Access points can be configured with the iwconfig command:

$ sudo iwconfig wlp2s0 essid <SSID>

File Configuration

If you have an access point that you regulaly connect to, you can configure the SSID and password in the /etc/network/interfaces file:

iface wlp2s0 inet dhcp
wpa-ssid "<SSID>"
wpa-psk "<PASSWORD>"

To have the interface start automatically on boot:

auto wlp2s0
iface wlp2s0 inet dhcp
wpa-ssid "<SSID>"
wpa-psk "<PASSWORD>"

5. Multimedia

The webcam is /dev/video0 and you can look at yourself with:

mplayer tv://dev/video0

Data DVDs can be burned on-the-fly with the growisofs utility from the dvd+rw-tools package. Assuming your files are in <directory>:

growisofs -Z /dev/sc0 -R -J <directory>

6. Removing systemd

systemd is an init system that bootstraps user space and manages processes. It has largely replaced the UNIX System V init systems on most distributions, with the objective of unifying basic Linux configurations across distributions. systemd has provoked considerable controversy because of its complexity and violation of fundamental Unix dependency philosophy.

It is actually fairly easy to remove and replace with classic Sys V, as described in these instructions. As with any major system change, full backup is recommended before proceeding.

  1. Install the System V init packages:
  2. sudo apt-get install sysvinit-core sysvinit-utils
    
  3. Copy the new inittab booting run level file:
  4. sudo cp /usr/share/sysvinit/inittab /etc/inittab
    
  5. Add this line to /etc/default/grub (not sure this is necessary):

    GRUB_CMDLINE_LINUX_DEFAULT="init=/lib/sysvinit/init text"
    
  6. Update the GRUB bootloader:
  7. sudo update-grub
    
  8. Remove the systemd package:
  9. sudo apt-get remove --purge --auto-remove systemd
    
  10. Set up /etc/X11/Xwrapper.config to run Xorg as root. While past versions of X accessed hardware directly and needed root access, some current drivers use kernel mode-setting (KMS). Although I'm not clear exactly what is going on with the driver for this chip, startx as a user other than root fail with messages like these:

    [    27.330] xf86EnableIOPorts: failed to set IOPL for I/O (Operation not permitted)
    [    27.907] (EE) modeset(0): drmSetMaster failed: Permission denied
    [    27.907] (EE) Fatal server error:
    [    27.907] (EE) AddScreen/ScreenInit failed for driver 0
    

    The workaround is to install the xserver-xorg-legacy package and add the following line to the /etc/X11/Xwrapper.config file:

    needs_root_rights=yes
    
  11. Reboot
  12. sudo reboot
    
  13. Create the /etc/apt/preferences.d/systemd file and add these lines to it. Pinning allows pulling particular packages from a later release version. Giving systemd packages negative pin priority prohibits installation.
  14. Package: systemd
    Pin: release *
    Pin-Priority: -1
    Package: *systemd*
    Pin: release *
    Pin-Priority: -1
    Package: systemd:amd64
    Pin: release *
    Pin-Priority: -1
    Package: systemd:i386
    Pin: release *
    Pin-Priority: -1
    
  15. Verify systemd is gone from your system. It is an insidious package that is a bit difficult to confirm is gone:
  16. aptitude search systemd
    
    	The systemd package should be listed with a 
    	"p" beside it, indicating it is
    	a package that is not installed
    
    pstree -p
    
    	The root process should be init rather
    	than systemd
    
    ls -l /sbin/init
    
    	The file /sbin/init should be an executable 
    	binary (ELF) file rather than a symbolic link
    

7. Removing the Desktop

If you're hard core command line and don't want the clutter and delay of the a desktop, you might consider getting rid of the desktop altogether and just using a window manager to manage xterms and X applications started from the xterms. This will speed your boot time a bit and get rid of some annoying background daemons.

IceWM: Although I used the venerable Motif Window Manager (MWM) for a number of years (from the motif-clients package), this version of mwm locks up when X is started. So I switched to the ICE Window Manager, which has a few more features (like a task bar with graphical system monitoring) but is still fast and lightweight:

sudo apt-get install icewm

.xinitrc is a file that is executed when X is started. Create a .xinitrc in your home directory (/home/<username>) and type the following lines. This creates a couple single terminal window, sets the "desktop" color to pleasant shade of greenish grey blue and starts the window manager. When you type "startx", from the text login, it will start an xterm, in which you can type commands to start other programs. You can create additional terminal windows from a popup menu when you right-click on the desktop.

I found the full brightness to be a bit much, especially in contrast to older, dimmer LCD displays. The backlight doesn't seem to be accessible through ACPI, but the xgamma command adjusts midtones (gamma) and warms things up a bit, although this is optional.

xgamma -gamma .7
xsetroot -solid "dark slate gray"
xterm -geometry 128x24+10+10&
xterm -geometry 128x24+10+375&
exec icewm
xgamma -gamma .7

PulseAudio is a nasty sound server that adds latency and eats up CPU. If you don't have the desktop you can ditch it.

sudo apt-get purge pulseaudio

However, you will need to deal with protections set up for ALSA that will keep your applications from being able to access the sound devices. Add yourself to the audio group:

adduser <username> audio

Configure GRUB for terminal mode start: It is helpful to see what is goin on during boot rather than have boot messages hidden behind the splash bitmap just in case there's a boot problem (which used to happen alot). Adding this line to the /etc/default/grub file will cause the machine to boot in console mode:

GRUB_TERMINAL=console

Then run:

sudo update-grub

After these changes, on boot you will see the system startup messages and then be greeted with a console login prompt. After logging in, you can use the startx command to start the graphical desktop.

startx

IceWM Themes: There are a wide variety of additional IceWM themes available in the icewm-themes package. I happen to be fond of Crux-Teal:

sudo apt-get install icewm-themes

Firefox Icon: Firefox is the default browser, but the toolbar contains only a blank icon for the browser. To set it to the Firefox logo, create a ~/.icewm/toolbar file and add one line:

prog    "WWW" /usr/share/icons/hicolor/48x48/apps/firefox-esr.png /usr/bin/firefox

8. TrueType Fonts

The X window server supports TrueType (tm) fonts, although installing them via the command line is a bit more cumbersome than with an installer program or package. If you've got some on a Windoze box, TrueType fonts tend to look quite a bit better than the fonts that come with the distributions. And if you're doing any web development, you need them to have at least a guess as to what your pages look like on a Windoze box.

Unfortunately, the FontPath configuration that specifies the directories where fonts are located is compiled into the X binary and is not configurable. While "xset +fp" can add a directory to the font path, that setting is not permanent and is lost when you reboot. xset cannot be added to a local configuration file like .xinitrc. This is not a problem for newer applications that use fontconfig, but this may represent an issue for older applications that only use the X font paths. The kludge is to copy the fonts you want to add into one of the configured truetype font directories.

Copy the fonts into a shared font directory: You can do an "xset -q" to find the configured Font Paths for your X configuration:

xset -q

Chose one of the directories listed in "Font Path" and copy your .ttf font files into that directory. In my case, I chose to use /usr/share/fonts/X11/misc. While you could create a new directory under /usr/share/fonts, fonts installed there would not be visible to xlsfonts or older X applications.

sudo cp your-fonts/*.ttf /usr/share/fonts/X11/misc

Then run mkfontscale to create the fonts.scale file and mkfontdir to create the fonts.dir files used by the X server. You should also change the owner of all the files to root to avoid permission problems. The mkfontscale and mkfontdir steps are critical if you want to be able to list your fonts with xlsfonts or other legacy X applications.

cd /usr/share/fonts/X11/misc
sudo mkfontscale
sudo mkfontdir
sudo chmod 644 *.ttf
sudo chown root:root *.ttf

You can check to verify the fonts are loading by starting an X application (like gimp). The xlsfonts command lists fonts available directly from X and the fc-list command lists fonts available through fontconfig.

xlsfonts | less
fc-list | less

The listing will likely be long, but if the fonts are loading correctly, you will see X font names like these (for Arial and Garamond, respectively):

-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-1
-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-10
-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-15
-monotype-arial-medium-i-normal--0-0-0-0-p-0-iso8859-2

-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-1
-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-10
-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-15
-monotype-garamond-medium-i-normal--0-0-0-0-p-0-iso8859-2

Fonts, especially in the browser may look a bit jagged if fontconfig does not have subpixel-hinting and font-smoothing turned on. Create a .config/fontconfig/.fonts.conf file in your home directory and add the following contents:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
  <match target="font">
  <edit mode="assign" name="lcdfilter">
    <const>lcddefault</const>
  </edit>
  </match>
</fontconfig>

Time is the cruelest teacher; first she gives the test, then teaches the lesson (Leonard Bernstein)