Re: Use network printer from NetBSD

2020-06-25 Thread JingYuan Chen
How about using pdf2ps and netcat ?

pdf2ps urpdf.pdf - | netcat -w 1 printer_IP printer_port

On Fri, Jun 26, 2020, 10:03 AM Robert Nestor  wrote:

> On my old Brother HL-1270N I found I had to append a “\004” to the end of
> any file sent to the printer to get it to print.  This was true for plain
> text as well as Postscript files.  The printer has different internal
> “queues” for plain text and Postscript so I wrote a simple filter that
> convetred plain text files into Postscript using enscript  and sent
> everything to the POSTSCRIPT_P1 queue on the printer.
>
> I now use a newer Brother HL-3230CDW that has the same setups but i’ve
> discovered I don’t need to append anything to either type of files to get
> them to print and the printer is smart enough to handle both plain text and
> Postscript regardless of which internal queue the file is sent to, so I
> don’t need any special handling anymore.
>
> The printer on my local network is named “patches” at a fixed address of
> 192.168.1.2 and my /etc/printcap entry is:
>
> lp|patches:\
>  :sh:lp=:mx#0:rm=patches:rp=TEXT_P1:lf=/var/log/lpd-errs:\
>  :sd=/var/spool/output/lpd:
>
> Hope this helps,
> -bob


Re: Use network printer from NetBSD

2020-06-25 Thread Greg Troxel
Rocky Hotas  writes:

> In fact, the printer is not directly connected to my NetBSD host: it
> is a stand-alone network printer, with its own LAN IP address.  I know
> the printer hostname and its IP address. How to send from NetBSD a
> print job?

The first thing to understand is what format the printer wants.  Back in
the old days, printers were postscript, and you basically had to send
them postscript.  (Or HP's PCL.)

> I tried with and without pjlfilter, and also with and without
> /usr/libexec/lpr/lpf. It makes no difference. I also tried port 515
> instead of 9100: they are surely open. Printer also supports `LDP (PC
> Fax Send)', `Raw Port', `IPP', `Mopria', `AirPrint'.

I think 9100 is what HP called "jetdirect".  I somewhat fuzzily think
that connecting to that is just like sending bytes over a serial port.

> For my attempts, after starting the lpd daemon, I simply use:
>
> $ lpr -P remote a_test_file
>
> The curious fact is that, in any of these attempts:
> - when a_test_file is a plain-text file, the printer display just lights
> up, but nothing else happens;
> - when a_test_file is a non-blank PDF, the printer seems to print, but
> the output is an endless series of white papers. I have to stop the job
> from the printer stop button.

That doesn't really surprise me if the printer expects postscript.  You
omitted the model from your email.

> Am I doing something wrong? What is the correct way to configure
> /etc/printcap in this case?

0) read enough docs/etc. to find out what the printer wants

1) Try a postscript file.

2) what you are basically trying to do is have  a printer configured,
just like it was attached, except you it isn't physically attached.  For
a 'network printer', my preferred approach is

  - put it on an Ethernet by itself, hooked up to an extra interface on
a computer, firewalled, because printers have poor cybersecurity
hygiene

  - configure a print server that owns the printer, perhaps cups, and
probably use the 9100 raw port instead of a serial/usb/parallel
port.  Cups or whatever has to do conversion from whate1ver input
format is printed to the format understood by the printer.

  - make all access go through the daemon.  Mutliple users accessing a
network printer at once is a bit of a mess anyway.


Use network printer from NetBSD

2020-06-25 Thread Rocky Hotas
Hello!
I would like to be able to print on NetBSD, but I don't want (and don't
need) to create a printer server. In fact, the printer is not directly
connected to my NetBSD host: it is a stand-alone network printer, with
its own LAN IP address.
I know the printer hostname and its IP address. How to send from NetBSD
a print job?

The system default /etc/printcap file is all commented, and it includes
some examples. Looking them, I tried to create my own entry:

remote|My network printer:\
   :sh:lp=9100@:rm=:rp=:\
   :sd=/var/spool/output/remote:\
   :lf=/var/log/lpd-errs:if=/usr/libexec/lpr/pjlfilter:

I tried with and without pjlfilter, and also with and without
/usr/libexec/lpr/lpf. It makes no difference. I also tried port 515
instead of 9100: they are surely open. Printer also supports `LDP (PC
Fax Send)', `Raw Port', `IPP', `Mopria', `AirPrint'.
For my attempts, after starting the lpd daemon, I simply use:

$ lpr -P remote a_test_file

The curious fact is that, in any of these attempts:
- when a_test_file is a plain-text file, the printer display just lights
up, but nothing else happens;
- when a_test_file is a non-blank PDF, the printer seems to print, but
the output is an endless series of white papers. I have to stop the job
from the printer stop button.

Am I doing something wrong? What is the correct way to configure
/etc/printcap in this case?
Bye,

Rocky


Re: Valgrind on netbsd x86 and amd64

2020-06-25 Thread Jan Danielsson
On 2020-06-25 16:01, Riccardo Mottola wrote:
> how is the status of Valgrind? om amd64?
> I have a program which fails on NetBSD, but works on Linux and FreeBSD.
> I was asked to run it on Valgrind.
> 
> I noticed, thet it is not available in packages. Some references show it
> is an ongoing project, it is dead? or perhaps avaiable only on 32bit intel?

   I remember seeing someone writing a blog post about how they stopped
their porting attempts to NetBSD because they said that Valgrind is
simply too Linux-specific, and even if a reasonably functional port
would be made, maintaining it would be too much work.

   Granted, this was many years ago -- things might be different now.


   As an alternative, what's the status of ASan and its cousin
sanitizers on NetBSD?

-- 
Kind Regards,
Jan


Update guides to using wedges.

2020-06-25 Thread Ahi Brown
Hi.

 I didn't get my NetBSD 9.0 amd64 install booting from the hard drive but on 
some tutorials (this one as an example 
https://www.netbsd.org/docs/misc/index.html#moving-usr).

 The tutorial seems to use partitions instead of wedges (slices???) which when 
jumping between pages and how-tos, I get some using /dev/dkx and then others 
doing /dev/wd0x or /dev/sd0x maybe an example of each for beginners like me?

 Thanks



Re: Providing temporary storage space to a VM: qcow, nfs etc

2020-06-25 Thread Michael van Elst
mayur...@acm.org (Mayuresh) writes:

>Yes, such thought occurred to me. I wish pkgsrc had a feature where `work'
>could reside on a separate path (which I'll keep on a separate FS). This
>way I can keep deleting the work FS, but don't have to check out pkgsrc
>too many times.

>Or is there such feature already... (Will search through the guide.)

You can set WRKOBJDIR for the work directories, PACKAGES for the
created package files and DISTDIR for downloading the distribution
files.

-- 
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: Providing temporary storage space to a VM: qcow, nfs etc

2020-06-25 Thread Ottavio Caruso
On Thu, 25 Jun 2020 at 10:21, Mayuresh  wrote:
>
> On Thu, Jun 25, 2020 at 10:10:47AM +0100, David Brownlee wrote:
> > A quick if not necessarily elegant option would be to have multiple
> > qcow2 files - one for the system and one for space to build. You can
> > release the build space by stopping the vm, just recreating the second
> > qcow2 file and restarting the VM
>
> Yes, such thought occurred to me. I wish pkgsrc had a feature where `work'
> could reside on a separate path (which I'll keep on a separate FS). This
> way I can keep deleting the work FS, but don't have to check out pkgsrc
> too many times.
>
> Or is there such feature already... (Will search through the guide.)
>

I have:

DISTDIR= /home/oc/pkgsrc/distfiles
WRKOBJDIR= /home/oc/pkgsrc/work
PACKAGES= /home/oc/pkgsrc/packages

Nothing stops you from allocating a specific block device to each of the above.

You'd have to play with machine types and virtio devices to have more
than 4 drives. Qemu "-drive" invocation defaults to ide drives.

-- 
Ottavio Caruso

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


Re: Providing temporary storage space to a VM: qcow, nfs etc

2020-06-25 Thread Mayuresh
On Thu, Jun 25, 2020 at 11:23:15AM +0200, Martin Husemann wrote:
> I add a new file system for WRKOBJDIR when building packages and totaly
> remove it afterwards (as it is empty again). I have PACKAGES set to
> a different path so they are outside of WRKOBJDIR.

Precisely the practice I'd like to borrow. Thanks.

BTW isn't PACKAGES already outside WRKOBJDIR?

Another related problem is, whether we can conserve the space on /usr/pkg.
If it's only a build server they are not required to hang around there
after build. So that requires 2 mechanisms:

1. How do I do a clean pkg_delete of everything other than bootstrap.

2. Whenever a build needs a package, can I have an option to install from
packages automatically if the version has not changed. [Yes, other things
can change with a package, like configuration options. But then I'll have
to delete the package so that it gets rebuilt.]

Mayuresh


Panic on 9.0-STABLE (built and checked out 23 May 2020)

2020-06-25 Thread Mike Pumford

Backtrace is as follows:

[ 2364420.854318] fatal page fault in supervisor mode
[ 2364420.854318] trap type 6 code 0x2 rip 0x80227d4c cs 0x8 
rflags 0x10

246 cr2 0x50 ilevel 0x8 rsp 0x80013b4f1ee8
[ 2364420.854318] curlwp 0xa37c4b8e4b00 pid 0.58 lowest kstack 
0x80013b4

ef2c0
[ 2364420.854318] panic: trap
[ 2364420.854318] cpu7: Begin traceback...
[ 2364420.854318] vpanic() at netbsd:vpanic+0x160
[ 2364420.854318] snprintf() at netbsd:snprintf
[ 2364420.854318] startlwp() at netbsd:startlwp
[ 2364420.854318] alltraps() at netbsd:alltraps+0xbb
[ 2364420.854318] nvme_ns_dobio() at netbsd:nvme_ns_dobio+0xa2
[ 2364420.854318] ld_nvme_start() at netbsd:ld_nvme_start+0x6e
[ 2364420.854318] ld_diskstart() at netbsd:ld_diskstart+0x7d
[ 2364420.854318] dk_start() at netbsd:dk_start+0x102
[ 2364420.854318] nvme_q_complete() at netbsd:nvme_q_complete+0xd6
[ 2364420.854318] softint_dispatch() at netbsd:softint_dispatch+0xab
[ 2364420.864322] cpu7: End traceback...


Based on the datestamp of the crash the system is likely to have been 
doing a couple of pkgsrc builds in chroot environments.


I've got the crashdump from the failure so if someone wants additional 
information I should be able to get it.


If this has already been fixed let me know and I'll update to a new 
9.0-STABLE :)


Mike


Re: Providing temporary storage space to a VM: qcow, nfs etc

2020-06-25 Thread Martin Husemann
On Thu, Jun 25, 2020 at 02:49:25PM +0530, Mayuresh wrote:
> But that's not the primary concern. Concern is to allow for spikes in
> space usage which some builds require. And want to achieve it without
> pre-reserving too much space and reclaiming space for the host.

I add a new file system for WRKOBJDIR when building packages and totaly
remove it afterwards (as it is empty again). I have PACKAGES set to
a different path so they are outside of WRKOBJDIR.

Martin


Re: Providing temporary storage space to a VM: qcow, nfs etc

2020-06-25 Thread Mayuresh
On Thu, Jun 25, 2020 at 10:10:47AM +0100, David Brownlee wrote:
> A quick if not necessarily elegant option would be to have multiple
> qcow2 files - one for the system and one for space to build. You can
> release the build space by stopping the vm, just recreating the second
> qcow2 file and restarting the VM

Yes, such thought occurred to me. I wish pkgsrc had a feature where `work'
could reside on a separate path (which I'll keep on a separate FS). This
way I can keep deleting the work FS, but don't have to check out pkgsrc
too many times.

Or is there such feature already... (Will search through the guide.)

Mayuresh


Re: Providing temporary storage space to a VM: qcow, nfs etc

2020-06-25 Thread Mayuresh
On Thu, Jun 25, 2020 at 10:00:46AM +0100, Ottavio Caruso wrote:
> You need to put a bit of context here. What do you want to achieve?
> What parts of the filesystem(s) do you want to share between host and
> guest?

At present I am not thinking about sharing, though I could set it up such
that /usr/pkgsrc and distfiles are shared, though I'll have to ensure that
when I switch the pkgsrc activity between systems I always do pkgclean.

But that's not the primary concern. Concern is to allow for spikes in
space usage which some builds require. And want to achieve it without
pre-reserving too much space and reclaiming space for the host.

Yes, your solution to shrink qcow2 would work. But looking for
alternatives as well - such as NFS (or equivalent) which will not involve
those hassles and will be more flexible in terms of managing space. Not
expecting it to match the virtual disk performance, but it should not be
much slower also.

In short which network based file system (I guess it's only NFS), with
some tuning, can give me a good performance, and what sort of tuning
tricks are involved. Here the network is local between host and guest. If
that can't improve beyond a point I'll go for qcow2 shrinking.

Mayuresh


Re: Providing temporary storage space to a VM: qcow, nfs etc

2020-06-25 Thread David Brownlee
On Thu, 25 Jun 2020 at 04:32, Mayuresh  wrote:
>
> I am using a Linux guest as a pkgsrc build server and the host isn't
> particularly rich in disk space. So can't completely reserve all the space
> required, but spikes in usage during compilation are accommodatable.
>
> I was using qcow2 disk image, but as someone already pointed out it fills
> up rapidly and I searched further on that - it doesn't actually delete
> anything. I don't find an easy way to compress it other than using a qemu
> tool to create a duplicate image and delete the old one.
>
> Looking for something more conservative on space. So turned to network
> file systems with the host. But they aren't particularly speedy. Here are
> speeds shown by dd for write operations:
>
> qcow2: 64MB/s - good but disk fills up rapidly, no easy way to shrink
> nfs: 9.8MB/s - about 6 to 7 times slower than virtual qcow2 disk
> sshfs: 1.8MB/s - no need as nfs does better
>
> If I could reduce the gap between nfs and qcow2 even to some extent I'd
> probably settle for that, as it gives me a lot of flexibility in storage.

A quick if not necessarily elegant option would be to have multiple
qcow2 files - one for the system and one for space to build. You can
release the build space by stopping the vm, just recreating the second
qcow2 file and restarting the VM

David


Re: Providing temporary storage space to a VM: qcow, nfs etc

2020-06-25 Thread Ottavio Caruso
On Thu, 25 Jun 2020 at 04:32, Mayuresh  wrote:
>
> I am using a Linux guest as a pkgsrc build server and the host isn't
> particularly rich in disk space. So can't completely reserve all the space
> required, but spikes in usage during compilation are accommodatable.
>
> I was using qcow2 disk image, but as someone already pointed out it fills
> up rapidly and I searched further on that - it doesn't actually delete
> anything. I don't find an easy way to compress it other than using a qemu
> tool to create a duplicate image and delete the old one.
>
> Looking for something more conservative on space. So turned to network
> file systems with the host. But they aren't particularly speedy. Here are
> speeds shown by dd for write operations:
>
> qcow2: 64MB/s - good but disk fills up rapidly, no easy way to shrink
> nfs: 9.8MB/s - about 6 to 7 times slower than virtual qcow2 disk
> sshfs: 1.8MB/s - no need as nfs does better
>
> If I could reduce the gap between nfs and qcow2 even to some extent I'd
> probably settle for that, as it gives me a lot of flexibility in storage.

You need to put a bit of context here. What do you want to achieve?
What parts of the filesystem(s) do you want to share between host and
guest?
Does the guest need to run all the time? If not, just make a script
that shrinks the qcow2 image whenever it fills up.

#!/bin/sh
qemu-img convert -O qcow2 guest.qcow2 shrunk.qcow2
rm guest.qcow2
mv shrunk.qcow2 guest.qcow2

You could prepend that to the script that launches qemu. There are
similar ways to achieve this from the qemu monitor, but I haven't
tried.

If you use qcow2 a lot, it's worth investigating using snapshots.

(Incidentally, what you're doing is the reverse of what I plan to do,
that is using a Linux host to build pkgsrc in *BSD guests, and I also
want to find an elegant way to export my cvs tree from host to guest)


-- 
Ottavio Caruso

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?