Linux on the Toshiba Tecra C40-C1401
Author: Michael Minn (www.michaelminn.com)
15 June 2017
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:
- Intel Core i3-606UU 2.0 GHz two-core/four-thread Processor with 3MB SmartCache
- 4GB DDR3L 1600 MHz RAM (one slot occupied)
- 750.2 GB 2.5" 5,400 SATA Toshiba MQ01ABD0 hard drive
- 14-inch-diagonal WXGA (1366 x 768, 16:9) TFT LED-backlit display
- DVD SuperMulti drive supporting 11 formats
- Webcam and Microphone
- Intel Dual Band Wireless-AC 3165 (rev 81)
- Intel I219V (rev 21) Ethernet controller
- Intel HD graphics 520 with 64MB-1696MB shared graphics memory
- Three USB Ports
- HDMI Port
- VGA Port
- Realtek RTS 5227 PCI Express Card Reader: SD, SDHC, MS, MS Pro, MMC, xD
- 1/8" audio in/out jacks
- Dimensions: 13.4" x 9.6" x 0.94"
- 3.97 pounds
- 19v 2.37 amp AC adapter: 65W rated, draws around 20 W idle
- 86-key US keyboard, Touchpad
- Purchased from CDW for $647.63
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
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:
- exim4 (mail transfer agent)
- saned (network scanning)
- avahi-daemon (web server)
- nfs-common (only needed if you are a server providing NFS file services to a network)
- rpcbind: Only needed with NFS - leaves a bunch of other mysterious ports like 1001 and 1002 open as well
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
The Intel Dual Band Wireless-AC 3165 (rev 81) is supported by the iwlwifi in the kernel, although you will need to install 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-126.96.36.199.tgz cd iwlwifi-7265-ucode-188.8.131.52 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
Network Manager: 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 wireless network can be started with the command "ifup wlp2s0" and stopped with "ifdown wlp2s0". Don't forget to turn on the wireless switch on the front edge of the machine (next to the antenna graphic).
Access points can be displayed with the "iwlist wlp2s0 scan" command and configured with "sudo iwconfig wlp2s0 essid <ESSID>". If you use a specific ESSID regularly, you can add an entry for it to the /etc/network/interfaces file (replace ESSID with the name appropriate to your network):
iface wlp2s0 inet dhcp wireless-essid <ESSID>
The webcam is /dev/video0 and you can look at yourself with:
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.
- Install the System V init packages:
- Copy the new inittab booting run level file:
- Add this line to /etc/default/grub (not sure this is necessary):
- Update the GRUB bootloader:
- Remove the systemd package:
- Set up /etc/X11/Xwrapper.config to run Xorg as root.
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:
- 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.
- Verify systemd is gone from your system. It is an insidious package that is a bit difficult to confirm is gone:
sudo apt-get install sysvinit-core sysvinit-utils
sudo cp /usr/share/sysvinit/inittab /etc/inittab
sudo apt-get remove --purge --auto-remove systemd
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
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:
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.
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:
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 .fonts.conf 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>
My will is strong but my won't is weak. (Cole Porter)