WimsBits linux xubuntu tools and shell commands

tools and shell commands for hardware problems 

down to end |

xubuntu tools and shell commands

Install and configure xubuntu 22.04 lts linux on a PC.
For troubleshooting use:
var/log/kern.log.1 and Xorg.0.log

Memory type check Ryzen

Check RAM memory type:
sudo dmidecode --type memory | less
Type: DDR4
Speed: 2133 MT/s
Configured Clock Speed: 1067 MT/s
Test memory with memtester:
sudo memtester 2048M 4

No PC power-down after shutdown with: "ACPI Disabled:"

"ACPI Disabled" results in no power-down after shutdown, on vintage PC.
Solution:
open bios
configure: ACPI Function: Enabled
configure: ACPI Standby State: S3
All other Power settings can be configured disabled or off.
save bios

Read pci and usb devices detection:

Install and configure hardware:
first check out about hardware and detection:
Run in Shell: tail -f /var/log/syslog
Run in Shell: dmesg, or: lspci -v, lspci -vvnn, or: lsusb -v, or: lshw, or: lsmod
(To see whether the hardware was detected)

Parole configuration: headphone or HDMI out.

Audio mixer shows, while Parole is playing music: wrong output, a moving sound level but no sound
Directory with test sounds in linux installation: /usr/share/sounds/sound-icons/piano-3.wav
Check what hardware you have: type: in shell:
lsmod | grep realtek
snd_hda_codec_realtek 163840 1
lspci -nnk | grep -A2 Audio
AMD/ATI Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM] [1002:a...
Kernel driver in use: snd_hda_intel
AMD Family 17h (Models 00h-0fh) HD Audio Controller [1022:1457], Realtek ALC898
Kernel driver in use: snd_hda_intel

Volume, Audio mixer
Display on: HDMI 1.4a
tab: Configuration: Caicos HDMI Audio [Radeon HD 6450... / RS 230...]
Profile: Digital Stereo (HDMI) Output
tab: Configuration: Family 17h ... HD Audio Controller
Profile: Analog Stereo Output
tab: Playback: FireFox... on: Family 17h ... HD Audio Controller...
or for HDMI output:
tab: Playback: FireFox... on: Caicos HDMI Audio [Radeon...
Sound output on "HDMI Audio".
Also sound on Dual-Link DVI-D via DVI-HDMI adapter and HDMI cable. (Max Resolution: 2560 x 1600 @60 Hz)

Parole does not play all movies or music in firefox:

No CD plays music.
Error: could not handle CDDA URI
Parole CDDA URI error
Shell: parole --device=% cdda://
Parole plays video dvd's, by browsing and running the 'video_1.vob' straight away.

Ethernet Network disconnects: link down

Network disconnects, after trying to connect, kernel log shows a link down.
kernel: r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
r8169 0000:21:00.0 enp33s0: link down
r8169 0000:21:00.0 enp33s0: link up
r8169 0000:21:00.0 enp33s0: link down
kernel: r8169 0000:21:00.0 eth0: RTL8168h/8111h

Internet suggests more than once: disable Automatic Link negotiation, set it to speed 100 Mb/s and duplex full.
Network Connections, select connection, tab: Ethernet
Wake on Lan: Default or Ignore
Link negotiation: Ignore or Manual: Speed: 100 Mb/s and Duplex: Full.
Link negotiation: Automatic and 1 Gb/s disconnect, 10 Mb/s remains untested, but could do, with a maximum internet download of 60 Mb/s or 7,5MB/s.
tab: IPv4 settings:
Method: Automatic (DHCP)
tab: IPv6 settings:
Method: Ignore

DHCP started working again recently (July 2019) on RTL8168.
Sometimes with the default value: Link negotiation: Ignore
Or with Link negotiation: Manual, Speed: 100 Mb/s and Duplex: Full.
Both on RTL8168d/8111d and RTL8168h/8111h.

Open ports on Gufw firewall on linux xubuntu 18.04 lts:

Open ports on Gufw:
For p2p and some other networking, opening a port can be useful.
Rules: plus: tab: Simple, Name: tor rent, Policy: Allow, Direction: In, Protocol: both, Port: 51413, Add, Close
menu: firewall, quit

Unable to create file /tmp/test: No space left on device

When updating linux, the 'no space left on device error' appears and an 'unable to create file' message appears. kernel linux-headers modules take too much inodes and a lot of disk space.
Shell command: df -h
Shell command: du -h -t 1000
no full disk
Shell command: df -i
many inodes in: /usr, in /usr/src
many files in: /usr, in /lib/modules/ and in /boot/

Numlock is always "on," before and after logging in on xubuntu 18.04 lts.

Always "on" numlock annoyance. All of a sudden, on xubuntu 18.04 lts, numlock is always on, except when you have a laptop.

Just manipulate the files.

/etc/X11/Xsession.d/55numlockx
The third or fourth line says: NUMLOCK=auto

/etc/default/numlockx
The last line says: NUMLOCK=auto
Set value to off to turn numlock off:
NUMLOCK=off

Go to the file below, check if it exists, it does, no need to install it.
/usr/bin/numlockx
Just manipulate the files.
End of numlock "on."

How to restore missing icons on the desktop and missing All Settings on xubuntu 18.04 lts.

Restore missing icons on the desktop and missing All Settings on xubuntu 18.04 lts.

Use Thunar in sudo mode to copy hidden directory: .config from correct working user home to faulty user home folder.
change root rights to correct user rights Solution: type: in shell:
sudo chown -c -R userX:userX .config
log off from correct working user to repaired user
It should work now.

Startup disk with xubuntu 18.04 does not boot.

Startup disk boots with error: Missing parameter in configuration file. Keyword: path, etc.
Solution: type: "help" at boot shell
Menu appears. Press: Enter.
Error appeared only when CRT monitor was connected, with TFT it booted fine.

Add a partition, on xubuntu linux, e.g. a primary disk:

Mount a physical disk in linux, requirements:
Print partition table in sector order format:
Run in Shell:
sudo cfdisk /dev/sda (supports MBR DOS, GPT, SUN and SGI disk)
or: sudo fdisk -l (supports GPT, MBR DOS, SUN and SGI disk)

Run cfdisk, choose GPT, to create linux raid 0. Just choose type RAID.

Read, create and format dos or ext4 partition hard disk:

lsblk (lists information about all available or the specified block devices)
blkid (lists this too)
or: sudo parted /dev/sdc print (supports GPT and MBR DOS)

Add partition:
sudo cfdisk /dev/sda
select: GPT (or: dos)
select: menu: new, type, Linux filesystem, write, quit
Reboot

Use linux fdisk: sudo cfdisk /dev/sda
select: menu: new, primary, size in MB, beginning, write, quit
type: 0B, 83, 82 (W95 FAT32, Linux, Linux / swap Solaris)
Reboot

the xubuntu 20.04 root disk uses about 8.1 GB
the xubuntu 22.04 root disk uses about 9.3 GB
partitions: free: 1M, EFI system partition, min. 35 MB: 100M, os: 85G, swap: 8G, home: 45G, data: what is left
Remark: only four primary partitions per physical disk are possible and the boot partition should be within 1024 cylinders because of bios limitations
choose from: man mke2fs or man mkdosfs

Make fat32, check for bad blocks, fat32, name volume: EFI, sectors-per-cluster: 4096, verbose, device /dev/sdb1:
sudo mkdosfs -c -F 32 -n EFI -S 4096 -v /dev/sdb1

or for an usb sticky, linux & winxp readable:
sudo mkdosfs -c -F 32 -n data4gb -v /dev/sdc1

Format 2GB fat32 SDcard for phone
Format SDcard 2 GB (linux vfat b W95 FAT32) for mobile phone: check for bad blocks, auto fat choice, name volume: SDC, verbose, device /dev/sdc1:
sudo mkdosfs -c -n SDC -v /dev/sdc1

Make ext4: block size: 4096, check for bad blocks, label volume: dataxy, no execute but demo will be done first, verbose, type filesystem: ext4, type filesystem usage: default, device
(demo, remove -n for real format)
mke2fs 1.46.5 (30-Dec-2021)
sudo mke2fs -c -L ext4gb -n -t ext4 -T default -v /dev/sdc1

When for a sticky:
sudo mkdir data
sudo chown -c -R root:user data
changed ownership of 'data' from root:root to root:user
sudo chmod -c -R 775 data
mode of 'data' changed from 0755 (rwxr-xr-x) to 0775 (rwxrwxr-x)
If sticky root folder needs to be user writeable, repeat the above for the sticky.

Default ext4 block size usually is 4096, see /etc/mke2fs.conf.
Format options:
Type filesystem usage: ext4 has a default file usage of inode_ratio of 16384, for disks of about 512 MB to 4 TB
Type filesystem usage: ext4 has a big file usage of inode_ratio 32768, for disks of about 4 to 16 TB.
Type filesystem usage: ext4 has a huge file usage of inode_ratio 65536, for disks of about 16 TB or greater.
Running command: badblocks -b 4096 -X -s /dev/sdc1 977529
Checking for bad blocks (read-only test): 0.00% done, 0:00 elapsed. (0/0/0 err done

Wiping, syncing, unmounting disks:

more information about a command is found by running man before or --help after a command in Shell

sudo dd status=progress if=/dev/zero of=/dev/sdb
dd: writing to '/dev/sdb': No space left on device
1250263729+0 records in
1250263728+0 records out
640135028736 bytes (640 GB, 596 GiB) copied, 34242 s, 18,7 MB/s, taking 9,5 hours.

rsync -av /media/username/data01 /media/username/data90/ (archive mode)
rsync -rv /media/username/data01 /media/username/data90/ (recurse into directories)

/dev/sdc1 is mounted; will not make a filesystem here!
sudo umount /dev/sdc1

Shred, to overwrite file or disk with zero's:

overwrite file or disk random and with zero's with shred:
shred -v -z file zeroed.doc
shred --verbose /dev/sda5
remove, delete file:
rm zeroed.doc
remove, delete directories and file:
rm -r *
rmdir, remove empty directories:
rmdir Folder

Mount a disk, add a directory not mounted yet on linux xubuntu:

Add a directory in linux:
Create directory:
sudo mkdir /media/user03/data01/
to copy a file: cp file filecopy
when a type error requires a rename: sudo mv dataxz dataxy
when a type error requires a delete: rm -r dataxz
to change rights:
sudo chown -c -R root:userxy dataxy
sudo chmod -c -R g+w dataxy
or:
sudo chmod 0775 dataxy

Mount temporarily: sudo mount -t ext4 /dev/sda4 /media/user03/data01/
To find out what to add to fstab to identify the disk, the UUID, run:
lsblk
lists new unpartitioned disks, not yet labelled e.g. gpt
sudo blkid
sudo blkid does not see unlabelled disks
other parameters:
media/to/mount
file type
(defaults: sets specific standard rights: rw, suid, dev, exec, auto, nouser, and async
for vfat only:
iocharset=utf8: sets the character set and makes it case sensitive, just like ext is
umask=007: sets the rights: rgo: rwx,rwx,---
gid=46: for plugdev

for all file systems:
# <partition> <mount point> <file system> <mount options> <dump> <fsck order>
the 0 second last: for dump to decide to disable (or enable: 1) backing up of the device/partition
the 2 at the end: for running a file check not first, a 0 for not & a 1 for first: /, usually)

Which could end up like this added disk:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0

# / was on /dev/sda2 during installation
UUID=063eaefa-72a9-4c85-ae9d-732df1268088 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=8D4E-5F61 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sda3 during installation
UUID=77759a71-edd4-40c4-a0b0-7d39f4e86a9a /home ext4 defaults 0 2
/swapfile none swap sw 0 0

# added 640GB disk
UUID="5904f0e9-8b8a-477c-b3c7-b41b689e87d6" /media/user3/diskdata/ ext4 defaults,errors=remount-ro 1 2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

to verify if swap is activated or not:
free -m
-------- total used free shared buff/cache available
Mem: 1721 732 162 28 826 814
Swap: 2047 0 2047

Reboot to test this.

cd ~
Create link to disk:
ln -s /media/sdb3/hodata hodat

How to check a linux vfat filesystem, on an usb stick? 

Checking an usb linux vfat filesystem.

Run in Shell:
sudo dosfsck -t /dev/sdb1
or: sudo dosfsck -a /dev/sdb1
-a automatically repair the filesystem
-n no-op, check non-interactively without changing
-r interactively repair the filesystem (default)
-t test for bad clusters
-v verbose mode

0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action

Printer error: systemctl restart cups.service

Printer crash because of error: systemctl restart cups.service
Solution: type: in shell:
sudo cp /usr/share/cups/cupsd.conf.default /etc/cups/cupsd.conf
sudo service cups restart
One original script is copied to overwrite a corrupt, almost empty, copy.

Some handsome Shell network commands:

Shell network commands which could be of help:
dig
host
ifdown eth0
ifup eth0
ip a
ip addr show
ip addr add dev eth0 192.168.0.1/16
ip addr del dev eth0 172.16.2/12
ip link show
ip neigh show
ip route show
ip route add dev eth0 10.0.0.3 via 172.19.0.4
ip route del dev eth0 172.23.6.5 via 10.0.49.6
service iptables save
iptables -L -v
iptables -A INPUT -m limit --limit 15/minute -j LOG
iptables -A OUTPUT -m limit --limit 15/minute -j LOG
mtr: network diagnostic tool, with pings from the entire route
e.g.: mtr www.speedtest.nl
nstat
ping 192.168.214.7
ping6 -I eth0 fc00::6
ss
su - username: substitute user login with profile
tracepath, tracepath6: traces path to a network host discovering MTU along this path
e.g.: tracepath 192.168.99.8

a network configuration example, for xubuntu 18.04:
/etc/hosts:
127.0.0.1 localhost
127.0.1.1 xubuntu18

Shell miscellaneous software and tools in xubuntu linux:

Display contents of a file in various ways:
sudo cat "/etc/NetworkManager/system-connections/Ethernet m100full"
sudo cat "/etc/NetworkManager/system-connections/Ethernet m100full" > net.txt
sudo head "/etc/NetworkManager/system-connections/Ethernet m100full"
sudo tail "/etc/NetworkManager/system-connections/Ethernet m100full"
sudo more "/etc/NetworkManager/system-connections/Ethernet m100full"
sudo less "/etc/NetworkManager/system-connections/Ethernet m100full"
sudo grep "mac" "/etc/NetworkManager/system-connections/Ethernet m100full"

Compare FILES line by line:
diff textfile_old.txt textfile_new.txt

Prints contents of a file:
man lp
lp - print files

lpq
HL-2140-series is ready
no entries

lpoptions | tr " " '\n'
copies=1
printer-is-accepting-jobs=true
printer-make-and-model='Brother
HL-2140
Foomatic/hl1250'

lpstat -p -d
printer HL-2140-series is idle. enabled since zo 19 apr 2020 09:50:39 CEST
system default destination: HL-2140-series

lp "net.txt"
request id is HL-2140-series-89 (1 file(s))

lp -o landscape net.txt
request id is HL-2140-series-92 (1 file(s))

find ~/ -name main*
find ~/ -mtime -3 -name main*

ldd program: print shared library dependencies

lspci -nn: Show both textual and numeric ID's (names & numbers) of devices.

netstat: Print network connections
netstat -t
netstat -tn

run gufw, firewall, first
sudo iptables -L -v > firewall-rules.txt

show hanging programs:
run in Shell:
ps -f
pstree -hp
jobs
fg 1 (i.e.)
control + z
jobs
ps -f

Vim manual, short:

Some Vim commands from a larger manual.
arrow keys: hjkl
first press key: escape
add: a
copy line: yy
delete: x
delete line: dd
down 5 lines: 5j
end of line: $
end of file: shift + G
find forward: /wordtofind, type n for further search
find backward: ?wordtofind, type n for further search
insert: i
insert line: o
insert from other window : insert mode, <ctrl>+<shift>+<ins>
join line: J
paste line: p
replace: r
scroll forward one screen: control + f
scroll backward one screen: control + b
search forward: /wordtofind, type n for further search
start of line: 0
write: :w
quit: :q
quit without save: :q!
undo: u
undo 3x: 3u
https://hpcc.ucr.edu/manuals/linux_basics/vim/
ASCI html codes, regularly used: # % & ( ) + - / : ; < = > ?@ | é ë € ï " ® ™
ASCI html codes, add: & before: #35;: # #37; % amp; & #40; ( #41; ) #43; + #45; - #47; / #58; : #59; ; #60; < #61; = #62; > #63; ? #64; @ #124; | eacute; é euml; ë euro; € iuml; ï quot; " reg; ® trade; ™

touch, to change date and time of file:

change date and time of file:
touch -d "1998-01-02 14:02:00" testfile.txt
show result: ls --full-time
show readable characters: strings testfile.txt
show both hex and asci characters: xxd testfile.txt
show file statistics, access time etc.: file testfile.txt

show help of a command, e.g. apt:
man apt
info apt
apt -h
apt --help

Run a compressed program by copying it in a directory on linux:

Install a compressed program by copying it:
rename unzipped folder in: pwsafeswt-090
Run in Shell:
sudo cp -r pwsafeswt-090 /usr/local/pwsafeswt-090
sudo chown -c -R root:username pwsafeswt-090
sudo chmod -c -R g+x pwsafe.sh
run: sh pwsafe.sh
icon command line: sh /usr/local/pwsafeswt-090/pwsafe.sh

System program problem detected, on pop up, cancel, report problem

Pop up with: System program problem detected
Shell command: sudo rm /var/crash/*
This will remove any old crash reports, causing a pop up, that needlessly might be reported. Reboot to take action into effect. (in error).
Any further pop-ups still need to be investigated.

Install S.M.A.R.T. for hard disk error detection on linux:

Install S.M.A.R.T.:
S.M.A.R.T.: (ubuntu) smartmontools: Control and monitor storage systems using S.M.A.R.T.
S.M.A.R.T.: (all) smart-notifier: Graphical hard disk health status notifier.
S.M.A.R.T. enable self-test; show error log usage: sudo smartctl -s on, sudo smartctl -l error /dev/sda
S.M.A.R.T. show all smart; health status usage: sudo smartctl -a /dev/sda | less; sudo smartctl -H /dev/sda
S.M.A.R.T. test short; long usage: sudo smartctl -t short /dev/sda; sudo smartctl -t long /dev/sda
S.M.A.R.T. show selftest log usage: sudo smartctl -l selftest /dev/sda
S.M.A.R.T. show all device usage: sudo smartctl -x /dev/sda | less

back to begin