Posted on Leave a comment

Printing from Canon MF4150 printer using CUPS – Raspberry Pi Forums

I’m trying to print Canon ImageClass from my raspberry pi running raspbian jessie and from my iPad running iOS 10 using the manufacturers latest linux driver but I’m not having any luck. I have setup up the printer using CUPS, samba, avahi-daemon and avahi discover on the raspberry pi and used the manufacturers linux driver 3.31 of the CNCUPSMF4100ZS.ppd file in the CUPS configuration. I have shared the printer and installed the windows driver in a Windows 10 machine and I have no problem printing from windows 10 machine. At first I went to check the status of the printer in the CUPS printers page, it said ” IDLE – “File “usr/lib/cups/filter/pstoufr2cpca” not available: no such file or directory.” Then I copied the pstoufr2cpca directory from the manufacturers 3.31 linux driver to the /usr/lib/cups/filter/pstoufr2cpca and now I get this message ” Idle – “File “/Usr/lib/cups/filter/pstoufr2cpca” not available: Too many levels of symbolic links”.
Any suggestions? I would gladly appreciate it. … imageCLASS

Source: Printing from Canon MF4150 printer using CUPS – Raspberry Pi Forums

Posted on Leave a comment

Logging – Dovecot Wiki

Dovecot Logging

Dovecot always logs a detailed error message if something goes wrong. If it doesn’t, it’s considered a bug and will be fixed. However almost always the problem is that you’re looking at the wrong log file; error messages may be logged to a different file than informational messages. By default Dovecot logs to syslog using mail facility. You can change the facility from syslog_facility setting. You can also configure Dovecot to write to log files directly, see below.

When using syslog, Dovecot uses 4 different logging levels:

  • info: Informational and debug messages.

  • warning: Warnings that don’t cause an actual error, but are useful to know about.

  • err: Non-fatal errors.

  • crit: Fatal errors that cause the process to die.

Where exactly these messages are logged depends entirely on your syslog configuration. Often everything is logged to /var/log/mail.log or /var/log/maillog, and err and crit are logged to /var/log/mail.err. This is not necessarily true for your configuration though.

You can find the correct log files using these methods:

  • Info log: After starting Dovecot, grep "starting up" /var/log/*. It should show a line such as: Dovecot v1.0.0 starting up

  • Error logs: Use dovecot --log-error command, which makes Dovecot log a few messages and exit. Then grep "This is Dovecot's" /var/log/* to find them. You should see:

    • With Dovecot v1.0.0 you’ll find only the crit log: This is Dovecot's error log

    • With Dovecot v1.0.1+ you’ll find all of them:
      • warningThis is Dovecot's warning log

      • errThis is Dovecot's error log

      • critThis is Dovecot's fatal log

  • You can also check your /etc/syslog.conf to see how it’s configured.

Internal Errors

If IMAP or POP3 processes encounter some error, they don’t show the exact reason for clients. Instead they show:

Internal error occurred. Refer to server log for more information. [2006-01-07 22:35:11]

The point is that whenever anything unexpected happens, Dovecot doesn’t leak any extra information about it to clients. They don’t need it and they might try to exploit it in some ways, so the less they know the better.

The real error message is written to the error log file. The timestamp is meant for you to help you find it.

Changing Log File Paths

If you don’t want to use syslog, or if you just can’t find the Dovecot’s error logs, you can make Dovecot log elsewhere as well:

log_path = /var/log/dovecot.log
# If you want everything in one file, just don't specify info_log_path
info_log_path = /var/log/dovecot-info.log

The warning and error messages will go to file specified by log_path, while everything else goes to info_log_path. If you do this, make sure you’re really looking at the log_path file for error messages, since the “Starting up” message is written to info_log_path file.

Rotating Logs

If you change from syslog to an external log file, you can use logrotate (available on most recent linux distros) to maintain the Dovecot logfile so it doesn’t grow beyond a manageable size. Save the below scriptlet as /etc/logrotate.d/dovecot:

# dovecot SIGUSR1: Re-opens the log files.
/var/log/dovecot*.log {
    /bin/kill -USR1 `cat /var/run/dovecot/ 2>/dev/null` 2> /dev/null || true

NOTE: change the path to the logfile(s) and the file as appropriate for your system configuration. The default location of is /usr/local/var/run/dovecot/

Logging verbosity

There are several settings that control logging verbosity. By default they’re all disabled, but they may be useful for debugging.

  • auth_verbose=yes enables logging all failed authentication attempts.

  • auth_debug=yes enables all authentication debug logging (also enables auth_verbose). Passwords are logged as <hidden>.

  • auth_debug_passwords=yes does everything that auth_debug=yes does, but it also removes password hiding.

  • mail_debug=yes enables all kinds of mail related debug logging, such as showing where Dovecot is looking for mails.

  • verbose_ssl=yes enables logging SSL errors and warnings. Even without this setting if connection is closed because of an SSL error, the error is logged as the disconnection reason (v1.1+).

Source: Logging – Dovecot Wiki

Posted on Leave a comment

Virtual user mail system with Postfix, Dovecot and Roundcube – ArchWiki

This article describes how to set up a virtual user mail system, i.e. where the senders and recipients do not correspond to the Linux system users.

Roughly, the components used in this article are Postfix as the mail server, Dovecot as the IMAP server, Roundcube as the webmail interface and PostfixAdmin as the administration interface to manage it all.

In the end, the provided solution will allow you to use the best currently available security mechanisms, you will be able to send mails using SMTP and SMTPS and receive mails using POP3, POP3S, IMAP and IMAPS. Additionally, configuration will be easy thanks to PostfixAdmin and users will be able to login using Roundcube.

Source: Virtual user mail system with Postfix, Dovecot and Roundcube – ArchWiki

Posted on Leave a comment

How to Partition and Format Drives on Linux – Pi My Life Up

Partitioning a Drive on Linux via Command Line

1. For most of this tutorial, we will be making use of a piece of software called parted. Parted is the CLI (Command-Line Interface) version of its GUI brother, gparted.

Parted will allow us to do numerous things such as being able to format drives as well as creating different partitions.

Before we get too far ahead of ourselves, we must first work out what drive we want to partition and format. For that purpose, we can use a tool such as blkid to find the drive we want to format.

Enter the command below to get information on your available drives.

sudo blkid

Below we have included a sample of what the command provided for us. The drive that we are interested in is located at the bottom of the list mounted at /dev/sda.

/dev/mmcblk0p1: LABEL="boot" UUID="6228-7918" TYPE="vfat" PARTUUID="76b5801c-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="6bfc8851-cf63-4362-abf1-045dda421aad" TYPE="ext4" PARTUUID="76b5801c-02"
/dev/mmcblk0: PTUUID="76b5801c" PTTYPE="dos"
/dev/sda: PTUUID="09c74626" PTTYPE="dos"

2. Now that we have our mount location for our USB drive available to us we can go ahead and start interacting with it using the parted software.

Now before we go ahead and start formatting our drive, we must first create the partition table for the drive. If your drive already has a partition table, then you can skip to the next step.

To create a partition table we can use a straightforward command, we need to reference the mount path, in our case /dev/sda, the mklabel command and the type of partition table we want to create.

In this case we are going to be using the more modern GPT table type. However, if you want or need you can utilize the much older msdos partition table (It’s also known as MBR or Master Boot Record)

To set this, run the following command. Swap out the mount path and table type where required.

sudo parted /dev/sda mklabel gpt

If a boot label already exists you will be shown a warning asking if you want to continue.

3. To create a partition on our new drive, we need to know the file format we intend on using, and the starting and ending position for that partition.

For example, if we wanted to create a 2GB partition on our empty 4GB USB, we would set the start position at 0 and the end position at 2GB.

Also if you want the partition to cover a percentage of the drive or the whole drive, you can specify sizes in %. For instance, 100% would fill the remaining space after the starting position.

Since we want to do that with our USB, we will be running the following command on it. Referencing its mount position of /dev/sda, the filesystem we want to use, fat32, and our starting and ending positions for the partition.

The parted tool also supports other filesystems such as ext2ext3ext4fat16fat32NTFS and more.

sudo parted /dev/sda mkpart primary fat32 0G 2G

4. Now that we have created our first partition on the drive, it should now be displayed using the blkid tool.

Just run the following command in your terminal on the Raspberry Pi to list all available partitions.

sudo blkid

Below you can see what the output looks like now, with our partition at /dev/sda1 now being shown.

/dev/mmcblk0p1: LABEL="boot" UUID="6228-7918" TYPE="vfat" PARTUUID="76b5801c-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="6bfc8851-cf63-4362-abf1-045dda421aad" TYPE="ext4" PARTUUID="76b5801c-02"
/dev/mmcblk0: PTUUID="76b5801c" PTTYPE="dos"
/dev/sda1: PARTLABEL="primary" PARTUUID="47470959-981d-4fe9-bb58-84bafeddbab5"

5. With our first partition now created we still have 2GB of spare space available on our 4GB drive.

We can now go ahead and format that partition using the various available mkfs tools if you don’t need to know how to handle multiple partitions you can move onto our “Formatting a partition” section.

To help give you more of an idea on how to use parted we will make another three partitions, two 512 MB partitions, and one 1 GB partition.

One thing to remember when creating additional partitions is that your new partitions must allocate space that isn’t already allocated. For example, the first partition we created filled from 0MB to 2 GB meaning that any additional partition must fill space after the first 2 GB of data.

The starting and ending positions are something that you will see more of in the three commands below.

Additionally our examples below we will be using the filesystem formats, NTFS, ext2, ext4. We are using a variety of filesystem formats to give you an idea of how each of these will be formatted.

sudo parted /dev/sda mkpart primary ntfs 2GB 3GB
sudo parted /dev/sda mkpart primary ext2 3000MB 3500MB
sudo parted /dev/sda mkpart primary ext4 3.5G 100%

6. Now that we have successfully created all our partitions lets go ahead and rerun the blkid tool to see our new partitions show up.

sudo blkid

Below is the output of the command.

/dev/mmcblk0p1: LABEL="boot" UUID="6228-7918" TYPE="vfat" PARTUUID="76b5801c-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="6bfc8851-cf63-4362-abf1-045dda421aad" TYPE="ext4" PARTUUID="76b5801c-02"
/dev/mmcblk0: PTUUID="76b5801c" PTTYPE="dos"
/dev/sda1: PARTLABEL="primary" PARTUUID="47470959-981d-4fe9-bb58-84bafeddbab5"
/dev/sda2: PARTLABEL="primary" PARTUUID="07e3d328-3fb7-4a09-8ded-cf74178bde2a"
/dev/sda3: PARTLABEL="primary" PARTUUID="82d3de54-07e2-42de-94b6-825bf8dcfe7a"
/dev/sda4: PARTLABEL="primary" PARTUUID="df1af8e1-5e8b-4909-b754-f3a54aa4c2ac"

7. Now that we are all done with creating our partitions, and can see them, we should now proceed onto actually formatting these partitions.

 Formatting Partitions on Linux via Command Line

1. Now that we have created all our partitions, we need to format them. The parted tool only creates the partitions themselves and sets a few bytes so that the system can understand what format to expect on that partition

To format these partitions, we will be making use of a tool called mkfs. This tool is primarily designed to format partitions and has support for a wide range of filesystems.

Thankfully mkfs is very easy to use. Basically you need to call it with the filesystem type you want to use and the device that it should be formatting.

Let’s begin by formatting our first partition. This partition is located at /dev/sda1. For this partition, we will be formatting it in the fat32 filesystem type. For mkfs this means we need to use vfat as the filesystem type.

To do this we can use a shorthand version of the mkfs command, you can see below that we simply need to call mkfs.vfat followed by the partitions mount location.

sudo mkfs.vfat /dev/sda1

2. As you can see with the previous command it is very easy to format your partitions, and is a much simpler process then creating partitions.

Below we will showcase a few examples of other filesystems you can format using this method.

sudo mkfs.ntfs /dev/sda2
sudo mkfs.ext2 /dev/sda3
sudo mkfs.ext4 /dev/sda4

3. Now that we have formatted all of our partitions, we can now mount them if we choose to do so.

If you want to verify that each partition has actually been formatted we can again make use of the blkid tool to show us all the partitions and their formatted filesystem type.

sudo blkid

Below you can see what the output looks like now, with our four different partitions being formatted with four different filesystem types.

/dev/mmcblk0p1: LABEL="boot" UUID="6228-7918" TYPE="vfat" PARTUUID="76b5801c-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="6bfc8851-cf63-4362-abf1-045dda421aad" TYPE="ext4" PARTUUID="76b5801c-02"
/dev/sda1: UUID="DCF5-DDF6" TYPE="vfat" PARTLABEL="primary" PARTUUID="d7e89b84-3817-4393-b348-75f47618dd3e"
/dev/mmcblk0: PTUUID="76b5801c" PTTYPE="dos"
/dev/sda2: UUID="656268AC53B5530D" TYPE="ntfs" PTTYPE="dos" PARTLABEL="primary" PARTUUID="07e3d328-3fb7-4a09-8ded-cf74178bde2a"
/dev/sda3: UUID="9887c8c7-f5f9-4440-9ec1-b84793877366" TYPE="ext2" PARTLABEL="primary" PARTUUID="82d3de54-07e2-42de-94b6-825bf8dcfe7a"
/dev/sda4: UUID="3d8b1983-4a46-4c7d-9c97-e4adb233dcb7" TYPE="ext4" PARTLABEL="primary" PARTUUID="df1af8e1-5e8b-4909-b754-f3a54aa4c2ac"

4. You should hopefully now have an idea on how you can use tools that come with an operating system such as Raspbian to create new partitions and also format those partitions in various filesystem types.

If you are interested in what various filesystems that are supported by default you can look at our list below.

These can vary depending on what Linux distribution you are running, additionally you can add support for NTFS and exFAT by installing certain packages

Supported Filesystem types: msdos, bfs, cpm, ext2, ext3, ext4, minix, fat, vfat, hfs, vxfs, rf, rk, dec, NTFS.

I hope by the end of this tutorial you will now have an idea on how to partition and format drives using your Raspberry Pi or your Linux device.

How to Partition and Format Drives on Linux

Source: How to Partition and Format Drives on Linux – Pi My Life Up