Wednesday, June 14, 2017

Firefox print freeze solved by iptables rules on Debian Linux

Firefox is a web browser you use to view web pages.

Try these if Firefox hangs when you press Ctrl + P to print:

# allow local connections to port 631

iptables -A INPUT -p tcp --sport 631 -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --dport 631 -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --dport 631 -j DROP
iptables -A INPUT -p tcp --sport 631 -j DROP
iptables -A INPUT -j DROP

ip6tables -A INPUT -p tcp --dport 631 -s ::1 -d ::1 -j ACCEPT
ip6tables -A INPUT -p tcp --sport 631 -s ::1 -d ::1 -j ACCEPT
ip6tables -A INPUT -p tcp --dport 631 -j DROP
ip6tables -A INPUT -p tcp --sport 631 -j DROP
ip6tables -A INPUT -j DROP

# save across reboot
netfilter-persistent save

iptables -L -n
ip6tables -L -n

Tuesday, January 24, 2017

A start job is running for Raise network interfaces (long time / 5 minutes)

This is January 2017. "systemd" should not be used for critical missions.

When the network was down (without electricity), I noticed:

A start job is running for Raise network interfaces (long time / 5 minutes)

In /etc/systemd/system.conf,

#default
#DefaultTimeoutStartSec=90s

#changed
DefaultTimeoutStartSec=40s

#default
#DefaultTimeoutStopSec=90s

#changed
DefaultTimeoutStopSec=40s


These settings did not work as expected. It was a long waiting time.

Thursday, June 9, 2016

Workaround: A stop / start job is running

A stop / start job is running ...

For this error, I do:


echo '' >> /etc/systemd/system.conf
echo 'DefaultTimeoutStartSec=6s' >> /etc/systemd/system.conf
echo 'DefaultTimeoutStopSec=6s' >> /etc/systemd/system.conf



systemctl reboot



This works for me.

Saturday, June 4, 2016

Print a page as a PDF file on Debian Jessie

For those people wondering how to print a page in a web browser as a PDF file successfully on Debian Jessie:

The command

aptitude install cups-core-drivers 

The following NEW packages will be installed:
avahi-daemon{a} bc{a} bind9-host{a} cups-browsed{a} cups-core-drivers cups-daemon{a} cups-filters-core-drivers{a} geoip-database{a} libavahi-core7{a} libbind9-90{a} libcupsmime1{a} libdaemon0{a} libdns100{a} libgeoip1{a} libisc95{a} libisccc90{a} libisccfg90{a} liblwres90{a} libnss-mdns{a} libqpdf13{a} poppler-utils{a} qpdf{a} ssl-cert{a} 0 packages upgraded, 23 newly installed, 0 to remove and 0 not upgraded. Need to get 4,620 kB of archives. After unpacking 13.4 MB will be used. Do you want to continue? [Y/n/?] y

An example

In Google Chrome, please see the example screenshot below after pressing Ctrl+P:

I click Save. I save the PDF file nearly immediately when the file is not too large. This is a virtual printer. It just prints to a file.

I can do something similar in Firefox.

Avoid cups-pdf in this case

In my experience on Debian Jessie, I should not use cups-pdf together with the setup above. Installation issues occur.


Friday, June 3, 2016

Go back to sysvinit while keeping systemd

Latest workaround:

Another workaround.
If I want systemd, see the workaround above.

If I want to use sysvinit, continue...

---

This is June 2016. systemd is still not for me. My current workaround:

The command

aptitude install sysvinit-core init-select

Choose sysvinit.

What does the command do?

This helps me to use sysvinit instead. I could not boot or shut down properly with systemd. For shutting down and booting correctly, I use this workaround. I will try to test if the problem ceases to exist.

Time constraint

I don't have enough time to look for systemd issues and fixes. 

Not publicized
I don't know why this command above is not publicized here: (when a user wants to go back to sysvinit)

systemd - system and service manager
https://wiki.debian.org/systemd

No obvious choice when installing Debian

There is no option to choose between systemd and sysvinit when installing Debian Jessie.  (I don't know how to do this when installing.) I can hopefully switch after installing.

Remove systemd or not

This command below will cause packages that depend on systemd to stop working:

Some packages depend on systemd. (Sigh) I will not remove systemd by

apt-get remove --purge --auto-remove systemd

as seen here:

How to remove systemd from a Debian jessie/sid installation
http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation

Now, I go back to sysvinit while keeping systemd. More testing continues.

Saturday, May 7, 2016

Workaround: A stop job is running for Avahi mDNS/DNS-SD stack

The error message appears when shutting down or rebooting the computer:
A stop job is running for Avahi mDNS/DNS-SD stack (seemingly forever/1 minute 55 seconds)

My temporary workaround:
systemctl stop avahi-daemon.service

# reboot
systemctl reboot


# shutdown
systemctl poweroff



Make this workaround above automatic:

Create a file:
nano /home/user_name/systemd_workaround.sh

The contents of the file:
#!/bin/bash
# systemd_workaround.sh


# explicitly stop this service:

/bin/systemctl --force stop avahi-daemon.service


Save:
Ctrl+x


Create another file:
nano  /lib/systemd/system/workaround.service



[Unit]
Description=cannot shut down or reboot properly
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target kexec.target


[Service]
ExecStart=/home/user_name/systemd_workaround.sh
Type=oneshot


Save:
Ctrl+x


Run this command:

chmod 755 /home/user_name/systemd_workaround.sh

Then, run this command:
systemctl daemon-reload

Now, shut down or reboot.
Instead of shutdown -r now, I entered
/bin/systemctl reboot


Instead of shutdown -h now, I entered
/bin/systemctl poweroff

Wow! Shut down and reboot properly. (I will observe and see if this is the best workaround.)


Update:

Latest workaround:

Another workaround.


---
Previously, I did...

If it was unfortunate, I would go back to sysvinit.



 I used:
/bin/systemctl poweroff

/bin/systemctl reboot

to test if it works. This method appeared to work. More testing continues. "A stop job is running" problem still exists. It occurs once every two or few weeks (already less frequently).


I had used:
/bin/systemctl --force stop avahi-daemon.service
to test if it works. Sorry, this reduced the frequency of the problem. This is still not the best workaround.

/bin/systemctl stop avahi-daemon.service
does not work as I expected.

Monday, May 2, 2016

How to change the terminal or console font size?


To change the terminal or console font size, type:

dpkg-reconfigure -plow console-setup

Reference:

Can I change the font of terminal?
http://unix.stackexchange.com/questions/49779/can-i-change-the-font-of-terminal

Reviewing my Debian experience up to April 2016



What does "stable" mean? To me, this means that the system boots correctly all the time. The system shuts down correctly too. There is no "blue / black screen of death". The chart shows my experience.

Upgrade the kernel on Debian Jessie

Note: Back up your / my data first.

When there is a booting problem, I could upgrade the kernel to see if it helps:

Type the command:
nano /etc/apt/sources.list

Add this line:
deb http://httpredir.debian.org/debian/ jessie-backports main

Save by typing:
Ctrl+x

Type the command: 
apt-get update
apt-cache search linux-image


See:
linux-image-_version_
linux-headers-_version_



Type:
apt-get install linux-headers-_version_
apt-get install linux-image-_version_


Type:
shutdown -r now

References:

How To Upgrade Kernel
https://wiki.debian.org/HowToUpgradeKernel





Xfce on Debian Jessie 8.4 experiment again

I said it worked. Debian Jessie worked.

I still got 'A start job is running...' error that I had seen previously. No luck. I have seen this error on Debian (supposedly stable) and on Fedora (supposedly cutting edge).

This error showed that such process would run for, eh, the time of no limit. Scary and frustrating.

Then, I thought that this might be a kernel issue as Jessie depends on systemd. To be fair, systemd has caused a lot of changes to the kernel. These changes are somewhat risky, i.e., making the system fail to boot properly or making the system fail to shutdown properly.

Xfce depends on systemd especially when shutting down or restarting.

It looks as if Debian was not stable.

I temporarily upgrade the kernel and see no error. I will observe and see if this is the best workaround.

References:   

OpenRC and systemd? Which one?
http://mindmapapp.blogspot.com/2015/09/openrc-and-systemd-which-one.html

A start job is running for /boot
http://mindmapapp.blogspot.com/2015/09/a-start-job-is-running-for-boot.html
RSS