Monthly Archives: January 2014

Ethernet Internals

MAC Address

What range of MAC addresses can I safely use for my virtual machines?
MAC Address: Universally or Locally Administered Bit and Individual/Group Bit

Frame Check Sequence (FCS) = Cyclic Redundancy Check (CRC)

Blockprüfzeichenfolge (BPF)

CRC Implementation Code in C, very detailed description
Zyklische Redundanzprüfung
A Painless Guide to CRC Error Detection Algorithms

Forum

CRC32: C Implemtierung OHNE Lookup-Table
CRC32 C or C++ implementation
CRC-CCITT Implementation
How is a CRC32 checksum calculated?

Only pure implementation

CRC library with routines to check for errors in the data transfer.

CRC-32

CRC-32 in different programming languages
crc32.c, Apple

CRC-16

crc16.c, mikrocontroller.net
CRC-16 Prüfsumme (serielle Übertragung), mikrocontroller.net
crc-16.c, www8.cs.umu.se/~isak/snippets/crc-16.c‎
CRC-16-CCITT

Calculate / Test

On-line CRC calculation and free library
Calculate 16 bit and 32 bit CRC’s
Catalogue of parametrised CRC algorithms with 16 bits
Summary of the CRC Catalogue

UDP Checksum

Short UDP Checksum Calculation HowTo

Following is a description by Ed Beroset of the calculation of the UDP checksum for this packet. Many thanks to Ed for figuring out the details and writing it up.

First, the checksum calculation is defined in RFC 768 but hints as to how to calculate it efficiently are in RFC 1071. Both are worth reading and contain a much more in-depth description that I’m going to write here.

The basic idea is that the UDP checksum is a the complement of a 16-bit one’s complement sum calculated over an IP “pseudo-header” and the actual UDP data. The IP pseudo-header is the source address, destination address, protocol (padded with a zero byte) and UDP length. So to take the example of this short packet, the source IP address is 152.1.51.27, and the destination IP address is 152.14.94.75. Divided into 16-bit quantities, these are 0x9801, 0x331b and 0x980e, 0x5e4b. If you add those together using two’s complement (e.g. with Windows calculator), you get 0x1c175. Note that this overflows a 16-bit quantity, but we’ll take care of that later. Next is to add in the protocol and UDP length. For this packet, the protocol is UDP so the protocol type byte is 17or 0x11. We pad that with zero to get 0x0011 and then add the UDP length which is 0x000a (10 bytes). So 0x1c175 + 0x0011 + 0x0! 00a = 0x1c190.

Now we add the entire UDP datagram, treating it all as 16-bit quantities and skipping the checksum (until we finish calculating it!). For this datagram, that’s 0xa08f, 0x2694, 0x000a, 0x6262, so if we add all that to our running sum, we get 0x1c190 + 0xa08f + 0x2694 + 0x000a + 0x6262 = 0x2eb1f.

Now to convert to a ones complement 16-bit sum we just treat our current sum (0x2eb1f) as a 32-bit quantity and add the high half to the low half. 0x0002 + 0xeb1f = 0xeb21. (If that still had an overflow, we’d add the high and low halves again until there was no longer an overflow.) Now we complement that quantity (i.e. flip all the bits, or do a NOT operation) and we get a value of 0x14de which is exactly what the reported checksum shows in the packet.

Short UDP Checksum Calculation HowTo
How to Calculate IP/TCP/UDP Checksum–Part 1 Theory

/*
 * Our algorithm is simple, using a 32 bit accumulator (sum), we add
 * sequential 16 bit words to it, and at the end, fold back all the
 * carry bits from the top 16 bits into the lower 16 bits.
 */
uint16_t
raw_packet_calc_checksum(uint16_t *buffer, uint16_t len)
{
    const uint16_t  words = len / 2;
    uint32_t        sum;
    uint16_t        i;
    
    sum = 0;
    for (i = 0; i < words; i++) {
        sum = sum + *(buffer + i);
    }
    
    /* add carry */
    sum = (sum >> 16) + sum;
    
    /* truncate to 16 bits */
    return ~sum;
}

tcpdump Packet Capture / Sniffer / Analyzer

$ tcpdump -i em0 -s 65535 -w packet.pcap
$ xz -z packet.pcap 

TCPDUMP Quick Reference (PDF)

Tcpdump Commands – A Network Sniffer Tool
A tcpdump Tutorial and Primer
How to gather DNS A record requests?
Monitoring DNS Queries with tcpdump
Packet Analyzer: 15 TCPDUMP Command Examples
tcpdump: Capturing with tcpdump for viewing with Wireshark

Manual pages

tcpdump

Wikipedia

tcpdump (de)
tcpdump (en)
pcap (de)

Change PCAP files

Bit-Twist: Libpcap-based Ethernet packet generator
Strip off GTP Headers
Bittwiste: pcap Capture File Editor (by Joke Snelders)
Strip radiotap headers from capture files?

Bash scripting

Keyboard shortcuts

Command Line Editing
Commands For Moving
Mastering The Linux Shell – Bash Shortcuts Explained (Now With Cheat Sheets)
Bash Keyboard Shortcuts

[CTRL + P]      Print previous command (Up arrow)
[CTRL + N]      Print next command (Down arrow)
[CTRL + R]      History search
[ALT  + R]      Cancel changes, put back like in the history
[!    + !]      Repeat last command
[!    + <cmd>]  Run last command starting with <cmd>
[!    + *]      Run all argument of previous command
[!    + $]      Run last argument of previous command
[ALT  + .]      Print last argument of previous command
[^<p1> + ^<p2>] Run last command, replace <p1> with <p2>
[CTRL + F]      Move forward one character (Right arrow)
[CTRL + B]      Move backward one character (Left arrow)

[ALT  + F]      Move forward one word
[ALT  + B]      Move backward one word

[CTRL + A]      Move to the start of the line
[CTRL + E]      Move to the end of the line

[CTRL + X + X]  Toggle between start of word and cursor
[CTRL + H]      Delete previous character from the cursor
                (= Rubout, like Backspace)
[CTRL + D]      Delete current character from the cursor (Delete)
[CTRL + K]      Cut from the cursor to the end of the line
[CTRL + U]      Cut from the cursor to the start of the line
                (like [CTRL + X + BACKSPACE]

[ALT  + D]      Cut from the cursor to the end of the current word
[CTRL + W]      Cut from the cursor to the previous whitespace

[CTRL + Y]      Paste
[ALT  + T]      Swap current word with previous (or [ESC + T])
[CTRL + T]      Swap the last two characters before the cursor (typo)

[ALT  + U]      Upper-case word and move to the end of the word
[ALT  + L]      Lower-case word and move to the end of the word
[ALT  + C]      Capitalize word and move to the end of the word

Job ID / Percent sign (%)

Percent sign (%) in front of shell command

$ tail -f /var/log/messages
[CTRL + Z]
[1]+  Stopped                 tail -f /var/log/messages

$ tail -f /var/log/maillog
[CTRL + Z]
[2]+  Stopped                 tail -f /var/log/maillog

$ jobs
[1]-  Stopped                 tail -f /var/log/messages
[2]+  Stopped                 tail -f /var/log/maillog

$ fg %2
tail -f /var/log/maillog
[CTRL + Z]
[2]+  Stopped                 tail -f /var/log/maillog

$ fg %1
tail -f /var/log/messages
[CTRL + Z]
[1]+  Stopped                 tail -f /var/log/messages

$ kill %1 %2
[1]-  Terminated              tail -f /var/log/messages
[2]+  Terminated              tail -f /var/log/maillog

Process List (ps)

$ ps auxf
$ ps auxd

#!/usr/bin/env

Howto Make Script More Portable With #!/usr/bin/env As a Shebang

#!/usr/bin/env bash

rather than

#!/bin/bash

Bash Conditional Expressions
The Set Builtin

Default values

APP_NAME=${APP_NAME:-"default_name"}

$ export FOO=first
$ echo "The ${FOO:-second} choice"
The first choice

$ unset FOO
$ echo "The ${FOO:-second} choice"
The second choice

$ export FOO=
$ echo "The ${FOO:-second} choice"
The second choice

Default values
bash assign default value

Parameter Expansion

Parameter expansion
Parameter Expansion

  • Simple usage
  • Indirection
  • Case modification
  • Variable name expansion
  • Substring removal
  • Search and replace
  • String length
  • Substring expansion
  • Use a default value
  • Assign a default value
  • Use an alternate value
  • Display error if null or unset

Bash : removing part of a string (= Parameter Expansion)

From the beginning:
path1="/usr/local/bin/bash"
${PARAMETER#PATTERN}  => shortest matching: ${path1#/*}  => usr/local/bin/bash
${PARAMETER##PATTERN} => longest matching:  ${path1##*/} => bash

From the end:
path2="x/usr/local/bin/bash"
${PARAMETER%PATTERN}  => shortest matching: ${path2%/*}  => x/usr/local/bin
${PARAMETER%%PATTERN} => longest matching:  ${path2%%/*} => x

var="Memory Used: 19.54M"
var=${var#*: }            # Remove everything up to a colon and space
var=${var%M}              # Remove the M at the end

Lists of Commands, Command Sequences

Lists of Commands
Writing Better Shell Scripts – Part 2
Meaning of colon in Bash after a double pipe
Bourne Shell Builtins
Is there a difference between how two ampersands and a semi-colon operate in bash?

  • Two logical short-circuits are the double ampersand (&&) and double pipe (||) operators.
  • The && only allows the command that comes after it in the series to be executed if the previous command exited with a status of 0.
  • The || operator does the opposite by only allowing the next command to be executed if the previous one returned a non-zero exit status.
  • The ; just separates one command from another.
  • The : is a null statement, so it does nothing.
  • The . executes a script in the current shell, not starting a new shell
$ true; echo $?
0

$ false; echo $?
1


=== && ===
$ true && echo "hello"
hello

$ false && echo "hello"
<no output>


=== || ===
$ true || echo "hello"
<no output>

$ false || echo "hello"
hello


=== ; ===
$ true; echo "hallo"
hallo

$ false; echo "hallo"
hallo


=======================

[ -n STRING ] => True if the length of "STRING" is non-zero.

=== return value ===
$ [ -n "hallo" ]; echo $?
0

$ [ -n "" ]; echo $?
1


=== if then ===
$ if [ -n "hallo" ]; then echo "welt"; fi
welt

$ if [ -n "" ]; then echo "welt"; fi
<no output>


=== && ===
$ [ -n "hallo" ] && echo "welt"
welt

$ [ -n "" ] && echo "welt"
<no output>


=== || ===
$ [ -n "hallo" ] || echo "welt"
<no output>

$ [ -n "" ] || echo "welt"
welt

Bang dollar-sign

Advancing in the Bash Shell

$ ./app a b c d e f

$ !*
a b c d e f
-bash: a: command not found

$ !$
f
-bash: f: command not found

Brace Expansion

Advancing in the Bash Shell

$ cp filename filename-old
$ cp filename-old filename
$ cp filename{,-old}
$ cp filename{-old,}
$ cp filename{-v1,-v2}

Exit code

Exit and Exit Status
Exit Codes With Special Meanings
Understanding Exit Codes and how to use them in bash scripts

$ bla
-bash: bla: command not found

$ echo $?
127
Exit Code Number Meaning Example Comments
1 Catchall for general errors let “var1 = 1/0” Miscellaneous errors, such as “divide by
zero”
and other impermissible operations
2 Misuse of shell builtins (according to Bash documentation) empty_function() {} Missing keyword
or command, or permission problem (and diff return code
on a failed binary file comparison
).
126 Command invoked cannot execute /dev/null Permission problem or command is not an executable
127 “command not found” illegal_command Possible problem with $PATH or a typo
128 Invalid argument to exit exit 3.14159 exit takes only integer args in the
range 0 – 255 (see
first footnote)
128+n Fatal error signal “n” kill -9 $PPID of script $? returns
137 (128 + 9)
130 Script terminated by Control-C Ctl-C Control-C is fatal error signal
2, (130 = 128 + 2, see above)
255* Exit status out of range exit -1 exit takes only integer args in the
range 0 – 255

Quartus FAQ

Links

Altera Qsys Erfahrungen
em4fun Altera DE0-Nano

FAQ

Question

Error (176310): Can't place multiple pins assigned to pin location Pin_D1 (IOPAD_X0_Y37_N7)
	Info (176311): Pin epcs_config_asd0_o is assigned to pin location Pin_D1 (IOPAD_X0_Y37_N7)
	Info (176311): Pin ~ALTERA_ASDO_DATA1~ is assigned to pin location Pin_D1 (IOPAD_X0_Y37_N7)

Answer

Use SOPC or Qsys and add “EPCS Serial Flash Controller”

error: can’t place multiple pins assigned to pin location

Question

Qsys: Warning: No matching role found

Answer

You may safely ignore these messages for Altera components because the signals are not required for design operation.
Qsys: Warning: No matching role found

Question

Info (209060): Started Programmer operation at Fri Jan 24 15:27:32 2014
Info (209016): Configuring device index 1
Info (209017): Device 1 contains JTAG ID code 0x020F40DD
Error (209014): CONF_DONE pin failed to go high in device 1
Error (209012): Operation failed
Info (209061): Ended Programmer operation at Fri Jan 24 15:27:38 2014

Answer

Reset Hardware or
Error (209014): CONF_DONE pin failed to go high in device
Why do I receive the error ‘CONF_DONE pin failed to go high in device X’ when I try to JTAG configure my Altera FPGA using the Quartus II software and a download cable?

Question

Remove VHDL commentar from component declartion

Answer

RegEx Code

[ -]*[ .][a-z0-9_.]*$
or
[ -]*\w[a-z0-9_]*$

Question

Warning- "Properties (isMemoryDevice) have been set on interface uas - in composed mode these are ignored"

Answer

This warning means that the NIOS® II software tools may not see the isMemoryDevice assignment which will make it harder in the GUI to choose memory addresses at this range as being valid to store boot data
Warning- “Properties (isMemoryDevice) have been set on interface uas – in composed mode these are ignored”

Question

component nios is
    port (
        [...]
        bridge_cfi_flash_read_n         : out   std_logic_vector(0 downto 0);
        [...]
    );
Error (10476): VHDL error at dionysos_top.vhd(238): type of identifier "flash_oe_n_o" does not agree with its usage as "std_logic_vector" type
Error (10558): VHDL error at dionysos_top.vhd(238): cannot associate formal port "bridge_cfi_flash_read_n" of mode "out" with an expression

Answer

Generate as Verilog, edit componen from std_logic_vector to std_logic!
Tri-state conduits and VHDL component
Qsys and tristate bridge

Wrong Answer

Re-create Qsys tree. Updating from earlyer versions (ex. 12.1) to current version (13.1) is NOT safe!

Question

/opt/altera13.1/nios2eds/bin/sof2flash: 6: /opt/altera13.1/nios2eds/bin/sh_jar.sh: Bad substitution

Answer

Question

Why does sof2flash, elf2flash,elf2hex and bin2flash fail from Quartus II 13.1 when run on a Windows PC?

Answer

$ export QUARTUS_BINDIR=${QUARTUS_ROOTDIR}/bin

Why does sof2flash, elf2flash,elf2hex and bin2flash fail from Quartus II 13.1 when run on a Windows PC?

Installation of Quartus 13.1

Question

# ./setup.sh 
bash: ./setup.sh: /bin/env: bad interpreter: No such file or directory

Answer

# ln -s /usr/bin/env env

Question

# ./setup.sh 

You must have the 32-bit compatibility libraries installed for the Quartus II installer and software to operate properly.

Answer

Ubuntu apt-get install ia32 for 32-bit on 64-bit
Installing 32-bit libs on a 64-bit Linux system

$ sudo dpkg --add-architecture i386
$ sudo apt-get install lib32z1
$ sudo apt-get install gcc-4.9-base:i386 libc6:i386 libgcc1:i386 libx11-6:i386 libxau6:i386 libxcb1:i386 libxdmcp6:i386 libxext6:i386
$ sudo apt-get install fontconfig:i386 libexpat1:i386 libfontconfig1:i386 libfreetype6:i386 libpng12-0:i386 zlib1g:i386

Question

How to synthesis the whole project or just some VHDL files in the command-line?

Answer

Using Quartus from command line

Quartus-II Handbook Version 13.0, page 2-10 (or search ASSIGNMENT_FILES)
==> produces one example Makefile

$ quartus_map --help=makefiles

or

$ PATH=$PATH:/opt/altera/13.0/quartus/bin
$ quartus_map binary_ops_00000000 --source=binary_ops_00000000.v --family="Cyclone III" 
$ quartus_fit binary_ops_00000000
$ quartus_eda binary_ops_00000000 --formal_verification --tool=conformal
$ cp -v fv/conformal/binary_ops_00000000.vo output.v

Generating a System for Synthesis or Simulation – Generating a Qsys system using the command-line
Knowledge Base: Can I open the Qsys tool from the Command line?
Qsys Scripts
Qsys on 64-bit Linux error
Quartus II Tcl Example: Automatic Script Execution

$ <Quartus II installation directory>\quartus\sopc_builder\bin\ip-generate --help
$ <Quartus II installation directory>\quartus\sopc_builder\bin\ip-make-simscript --help
$ <ACDS install directory>\quartus\sopc_builder\bin\qsys-edit
$ qsys-script 
$ qsys-generate <QSYS-file> --family=""

Question

How to use SVN revision and current time in VHDL.

Answer

Use TCL-script
Quartus II Tcl Example: Get Subversion Revision Number

$ quartus_sh.exe -t svn_version.tcl
[...]
Info: Command: quartus_sh -t svn_version.tcl
Info: Revision for ../.. is 658
Info: Build time 1425395821
Info (23030): Evaluation of Tcl script svn_version.tcl was successful
[...]
# this .tcl script is from http://www.altera.com/support/examples/tcl/tcl-svn-revision.html

proc get_subversion_revision { file_name } {

    global done

    # The maximum number of seconds to wait for the svn info
    # command to complete
    set timeout_seconds 30

    # The svn info command with filename that is run (the ./trunk/hdl directory)
    set cmd "svn info ../.."

    # Attempt to get the version information.
    # If the command can't be run, return an error.
    # Otherwise set up a file event to process the command output.
    if { [catch {open "|$cmd"} input] } {
        return -code error $input
    } else {

        fileevent $input readable [list get_revision_info $input ]

        # Set up a timeout so that the process can't hang if the
        # repository is down.
        set timeout [after [ expr { $timeout_seconds * 1000 } ] \
            [list set done -1] ]

        # Don't continue until the revision number is found,
        # or the operation times out. Cancel the timeout anyway.
        vwait done
        after cancel $timeout
    }
}

proc get_build_time { } {

    global build_time
    global tcl_platform
    
    set timeout_seconds 30

    set OS [lindex $tcl_platform(os) 0]
    if { $OS == "Windows" } {
        post_message "Build on Windows: use batch file"
        set cmd "build_date_win32.bat"
    } else {
        post_message "Build on Linux: use date"
        set cmd "date +%s"
    }
    
    if { [catch {open "|$cmd"} input] } {
        return -code error $input
    }
    
    gets $input build_time
}

proc get_revision_info { inp  } {

    global done revision_number

    if { [eof $inp] } {
        catch {close $inp}
        set done 1
    } elseif { $done } {
        gets $inp line
    } else {
        gets $inp line
        # Use a regular expression to match the line with the
        # revision number.
        if { [regexp {^Revision:\s+(\d+)\s*$} $line match revision_number] } {
            set done 1
        }
    }
}

set path $::env(PATH)
post_message "PATH = $path"

set done 0
set revision_number ""
set build_time ""

# The file name is usually your project file .qpf
set file_name "../.."
#set file_name [lindex $quartus(args) 1]

if { [catch { get_subversion_revision $file_name } msg] } {
    post_message -type critical_warning "Couldn't run command to get revision number. $msg"
} else {

    if { -1 == $done } {
        post_message -type critical_warning "Timeout getting revision number."
        set revision_number "0"
    } elseif { [string equal "" $revision_number] } {
        post_message -type critical_warning "Couldn't find revision number in output of svn info $file_name."
        set revision_number "0"
    }
    post_message "Revision for $file_name is $revision_number"
    
    if { [catch { get_build_time } msg] } {
        post_message -type critical_warning "Couldn't run command to get build time: $msg"
    }
    post_message "Build time $build_time"
        
    #create file, overwite if already existing
    set output [open "../../common_source/core/pm_revision_number.vhd" w]
    puts $output "LIBRARY IEEE;"
    puts $output "USE IEEE.STD_LOGIC_1164.ALL;"
    puts $output "USE IEEE.NUMERIC_STD.ALL;"
    puts $output "PACKAGE pm_revision_number IS"
    puts $output ""
    puts $output "CONSTANT ci_rev_num     : integer := $revision_number;"
    puts $output "CONSTANT ci_build_time  : integer := $build_time;"
    puts $output ""
    puts $output "END PACKAGE;"
    puts $output ""
    
    close $output
}
Info: Command: quartus_sh -t svn_version.tcl compile TCC_PTP_v2 TCC_PTP_v2_top
Info: Quartus(args): compile TCC_PTP_v2 TCC_PTP_v2_top
Info: PATH = c:\altera\14.1\quartus\bin64\;c:\altera\14.1\quartus\bin64\;C:\Windows\...
Info: Revision for ../.. is 658
Critical Warning: Couldn't run command to get build time: couldn't execute "date": no such file or directory
Info: Build time 
Info (23030): Evaluation of Tcl script svn_version.tcl was successful

No PATH to C:/altera/14.1/quartus/bin64/cygwin/bin !!! ==> no date

Scripting and Options for quartus_sh
Run common TCL script on Windows and Linux
what is the windows equivalent of the command “date+%s”

:UnixTime  [ReturnVar]  [TimeStamp]
::
:: Computes the Unix time from the current local time as reported by the
:: operating system. The Unix time is the number of seconds that have elapsed
:: since midnight Coordinated Universal Time (UTC), January 1, 1970, not
:: counting leap seconds.
::
:: The result is returned in variable ReturnVar,
:: or the result is echoed if ReturnVar is not specified
::
:: If the TimeStamp is provided in the 2nd parameter, then the Unix time for
:: the TimeStamp is computed, rather then for the current time.
::
:: The TimeStamp must have the same format as used by WMIC:
::
::   YYYYMMDDhhmmss.ffffffSzzz
::
:: where:
::
::   YYYY   = gregorian year
::   MM     = month
::   DD     = day
::   hh     = hour in 24 hour format
::   mm     = minute
::   ss     = seconds
::   ffffff = fractional seconds (microseconds)
::   S      = timezone sign: + or -
::   zzz    = timezone: minutes difference from GMT
::
:: Each component must be zero prefixed as needed to maintain the proper width.
::
:: The ReturnVar parameter must be provided in order to use the TimeStamp.
:: A ReturnVar of "" will function the same as no ReturnVar. This enables the
:: specification of a TimeStamp without an actual ReturnVar.
::
@echo off
setlocal
set "ts=%~2"
if not defined ts for /f "skip=1 delims=" %%A in ('wmic os get localdatetime') do if not defined ts set "ts=%%A"
set /a "yy=10000%ts:~0,4% %% 10000, mm=100%ts:~4,2% %% 100, dd=100%ts:~6,2% %% 100"
set /a "dd=dd-2472663+1461*(yy+4800+(mm-14)/12)/4+367*(mm-2-(mm-14)/12*12)/12-3*((yy+4900+(mm-14)/12)/100)/4"
set /a ss=(((1%ts:~8,2%*60)+1%ts:~10,2%)*60)+1%ts:~12,2%-366100-%ts:~21,1%((1%ts:~22,3%*60)-60000)
set /a ss+=dd*86400
endlocal & if "%~1" neq "" (set %~1=%ss%) else echo %ss%
exit /b

Question

Comparator
Identitäts-Komparatoren (engl. Identity Comparator)
Größen-Komparatoren (engl. Magnitude Comparator)

Komparator (Digitaltechnik)
SN74LS682 – 8-Bit Identity/Magnitude Comparators

How to use dedicate carry in and cascade chain in Altera FPGA?
n-bit generic magnitude comparator
Magnitude Comparator (arithmetical) Generator

Altera: Advanced Synthesis Cookbook
Altera: Logic Elements and Logic Array Blocks in Cyclone IV Device
Altera-Provided Logic & Symbol Libraries
Altera VHDL & Verilog HDL alt_mf Logic Function Library

Lesson 36 – VHDL Example 20: 4-Bit Comparator – Procedures

Parallelized magnitude comparator
N-bit comparator

Answer

Linux BIOS Information

$ sudo dmidecode -t bios
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
	Vendor: Dell Inc.                
	Version: 2.3.1 
	Release Date: 05/21/2007
	Address: 0xF0000
	Runtime Size: 64 kB
	ROM Size: 1024 kB
	Characteristics:
		PCI is supported
		PNP is supported
		APM is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		Boot from CD is supported
		Selectable boot is supported
		EDD is supported
		Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
		Print screen service is supported (int 5h)
		8042 keyboard services are supported (int 9h)
		Serial services are supported (int 14h)
		Printer services are supported (int 17h)
		ACPI is supported
		USB legacy is supported
		LS-120 boot is supported
		BIOS boot specification is supported
		Function key-initiated network boot is supported
		Targeted content distribution is supported
	BIOS Revision: 2.3

$ sudo dmidecode
[...]
Handle 0x0100, DMI type 1, 27 bytes
System Information
	Manufacturer: Dell Inc.                
	Product Name: OptiPlex 745                 
	Version: Not Specified
	Serial Number: 4Y2563J
	UUID: 44454C4C-5900-1032-8035-B4C04F36334A
	Wake-up Type: Power Switch
	SKU Number: Not Specified
	Family: Not Specified
[...]
Handle 0x0400, DMI type 4, 40 bytes
Processor Information
	Socket Designation: Microprocessor
	Type: Central Processor
	Family: Core 2
	Manufacturer: Intel
[...]
Handle 0x080D, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: ENET
	Internal Connector Type: None
	External Reference Designator: Not Specified
	External Connector Type: RJ-45
	Port Type: Network Port
[...]
Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: System Memory
	Error Correction Type: Single-bit ECC
	Maximum Capacity: 8 GB
	Error Information Handle: Not Provided
	Number Of Devices: 4
[...]
Handle 0x1100, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x1000
	Error Information Handle: Not Provided
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 1024 MB
	Form Factor: DIMM
	Set: None
	Locator: DIMM_1
	Bank Locator: Not Specified
	Type: DDR
	Type Detail: Synchronous
	Speed: 667 MHz
[...]

Upgrade Ubuntu

Preferred method

sudo apt-get install update-manager-core
sudo do-release-upgrade

or

sudo apt-get update
sudo apt-get upgrade
sudo apt-get -f install (not "install -f"!)
sudo apt-get -y install apt
sudo do-release-upgrade

Use the update-manager

sudo apt-get install update-manager
sudo update-manager -d

Can also been used

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Ubuntu Saucy – Upgrading from older versions

FAQ

How to Upgrade From Ubuntu 12.04 LTS to Ubuntu 13.04
How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander – See more at: http://www.unixmen.com/upgrade-ubuntu-13-04-raring-ubuntu-13-10-saucy-salamander/#sthash.00K4bvFQ.dpuf
Can I skip over releases when upgrading?
Upgrade from 12.04 to 13.04?

How do I fix a “Could not get lock /var/lib/dpkg/lock” problem?
/var/cache/debconf/config.dat is locked by another process
debconf: DbDriver “config”: /var/cache/debconf/config.dat is locked by another process
Unable to install due to debconf problem

What do I select for “GRUB install devices” after an update?

Question

$ sudo apt-get install -f
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

Answer

$ sudo rm /var/lib/dpkg/lock 
$ sudo rm /var/cache/apt/archives/lock
$ sudo rm /var/lib/apt/lists/lock

Question

$ sudo apt-get install -f
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 

Answer

$ sudo dpkg --configure -a
[...]
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing samba-common (--configure):
 subprocess installed post-installation script returned error exit status 1
[...]
dpkg: dependency problems prevent configuration of smbclient:
 smbclient depends on samba-common (= 2:3.6.6-3ubuntu5.3); however:
  Package samba-common is not configured yet.

dpkg: error processing smbclient (--configure):
 dependency problems - leaving unconfigured
[...]
Errors were encountered while processing:
 samba-common
 smbclient
 samba-common-bin
 rsyslog
 isc-dhcp-client
 samba
 network-manager

Question

debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing samba-common (--configure)

Answer

$ fuser -v /var/cache/debconf/config.dat
# No process uses this file
# cp -R /var/cache/debconf /var/cache/debconf.backup
# rm /var/cache/debconf/*.dat
# dpkg --configure -a
Setting up samba-common (2:3.6.6-3ubuntu5.3) ...
Replacing config file /etc/samba/smb.conf with new version
Setting up smbclient (2:3.6.6-3ubuntu5.3) ...
Setting up samba-common-bin (2:3.6.6-3ubuntu5.3) ...
Setting up rsyslog (5.8.6-1ubuntu9.3) ...
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
rsyslog stop/waiting
rsyslog start/running, process 3290
Setting up isc-dhcp-client (4.2.4-1ubuntu10.4) ...
Setting up samba (2:3.6.6-3ubuntu5.3) ...
smbd start/running, process 3348
nmbd start/running, process 3382
Setting up network-manager (0.9.6.0-0ubuntu7.1) ...

Question

Trigger für ureadahead (0.100.0-19) werden verarbeitet ...
Trigger für dbus (1.10.6-1ubuntu3) werden verarbeitet ...
Trigger für systemd (229-4ubuntu6) werden verarbeitet ...
Trigger für initramfs-tools (0.122ubuntu8.1) werden verarbeitet ...
update-initramfs: Generating /boot/initrd.img-4.4.0-28-generic
Fehler traten auf beim Bearbeiten von:
 apt
 apt-utils
 apt-offline
E: Sub-process /usr/bin/dpkg returned an error code (1)

##############

apt (1.2.12~ubuntu16.04.1) wird eingerichtet ...
useradd: existing lock file /etc/gshadow.lock without a PID
useradd: /etc/gshadow konnte nicht gesperrt werden; versuchen Sie es später noch einmal.
adduser: »/usr/sbin/useradd -d /nonexistent -g nogroup -s /bin/false -u 122 _apt« gab den Fehlercode 10 zurück. Programmende.
usermod: Benutzer »_apt« ist nicht vorhanden.
dpkg: Fehler beim Bearbeiten des Paketes apt (--configure):
 Unterprozess installiertes post-installation-Skript gab den Fehlerwert 6 zurück
dpkg: Abhängigkeitsprobleme verhindern Konfiguration von apt-utils:
 apt-utils hängt ab von apt (= 1.2.12~ubuntu16.04.1); aber:
  Paket apt ist noch nicht konfiguriert.

dpkg: Fehler beim Bearbeiten des Paketes apt-utils (--configure):
 Abhängigkeitsprobleme - verbleibt unkonfiguriert
dpkg: Abhängigkeitsprobleme verhindern Konfiguration von apt-offline:
 apt-offline hängt ab von apt; aber:
  Paket apt ist noch nicht konfiguriert.

dpkg: Fehler beim Bearbeiten des Paketes apt-offline (--configure):
 Abhängigkeitsprobleme - verbleibt unkonfiguriert
Trigger für libc-bin (2.23-0ubuntu3) werden verarbeitet ...
Es wurde kein Apport-Bericht verfasst, da die Fehlermeldung darauf hindeutet, dass dies lediglich ein Folgefehler eines vorherigen Problems ist.
                                                                                                                                                Es wurde kein Apport-Bericht verfasst, da die Fehlermeldung darauf hindeutet, dass dies lediglich ein Folgefehler eines vorherigen Problems ist.
                                                                                                            /sbin/ldconfig.real: /usr/lib/libbrscandec2.so.1 is not a symbolic link

/sbin/ldconfig.real: /usr/lib/libbrcolm2.so.1 is not a symbolic link

Fehler traten auf beim Bearbeiten von:
 apt
 apt-utils
 apt-offline
W: No sandbox user '_apt' on the system, can not drop privileges
E: Sub-process /usr/bin/dpkg returned an error code (1)

Answer

$ sudo mv /etc/sub /etc/gshadow.lock_old
$ sudo mv /etc/subgid.lock /etc/subgid.lock_old
$ sudo mv /etc/subuid.lock /etc/subuid.lock_old
$ sudo /usr/sbin/useradd -d /nonexistent -g nogroup -s /bin/false -u 122 _apt