user60683: I'm trying to program an ATtiny85, using an AVRISP mkII programmer (this one: https://www.amazon.de/dp/B00IYNAXUC/ref=cm_sw_r_sms_c_api_i_VXOWDb3H3N5ND) with the Arduino IDE (version 1.8.10 on Ubuntu 18.10). For the ATtiny, I've installed https://github.com/damellis/attiny using the board manager, as recommended in countless tutorials.
Now, everything seems to be recognized fine, and I've selected the programmers port in the IDE: /dev/ttyACM0.
But when I try to upload a sketch, the IDE instead trys to pass usb as the port to avrdude. This is only visble when enabling verbose output: (paths abbreviated)
/home/[...]/avrdude -C/home/[...]/avr/etc/avrdude.conf -v -pattiny85 -cstk500v2 -Pusb -Uflash:w:/tmp/arduino_build_728460/sketch.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/[...]/avrdude.conf"
         User configuration file is "/home/[...]/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : stk500v2
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)

avrdude done.  Thank you.

usb isn't even a selectable port in the IDE!
Simply pasting the avrdude command (first line in the output above) to a terminal and changing usb to /dev/ttyACM0 makes it program the IC perfectly (but of course, that's a rather cumbersome workaround).
Also, selecting another programmer in the IDE (like AVR ISP, without the mkII) makes it use the correct port (but of course it won't work, since it's the wrong programmer).
Am I doing something wrong, or is this an actual bug in the Arduino IDE?

user10285: I would say you have to select  the Arduino as ISP Programmer. Not the mkII ISP. Perhaps the attiny board library can handle connection to attiny dev boards over usb if you use the standard programmer. But that's just a very very rough guess. But selecting the Arduino as ISP is a requirement.
Edit:
No you can not use the Arduino as ISP if you use an STK500 programmer. 
D. A. Mellis' tool is designed for an Arduino as a programmer. 
But if your work around does the programming, the mkII is the right tool. You have to find out, how the IDE builds the CLI string to start avrdude.
The tool you installed contains a text file called platform.txt:
name=ATtiny Microcontrollers

tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.erase.params.verbose=-v -v -v -v
tools.avrdude.erase.params.quiet=-q -q
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m

tools.avrdude.bootloader.params.verbose=-v -v -v -v
tools.avrdude.bootloader.params.quiet=-q -q
tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params}

I would say the entry tools.avrdude.bootloader.pattern does the trick. Especially the variable {program.extra_params}. You have to find out how the IDE is building this variable. One of it's options must be -P<Port>. But why does the IDE use the value usb for <port>?  
I'll try to find out. But I have no access to an IDE at the moment. If you (or someone else) find a solution before me, please add an answer and mark it as accepted, so I need not investigate further. 

user7508: You mean that the STK500 v2 programmer uses an emulated serial port
rather than direct USB? Then I guess there is a bug in the Arduino IDE.
The file programmers.txt contains the following lines
describing the programmer:
avrispmkii.name=AVRISP mkII
avrispmkii.communication=usb
avrispmkii.protocol=stk500v2
avrispmkii.program.protocol=stk500v2
avrispmkii.program.tool=avrdude
avrispmkii.program.extra_params=-Pusb

You may locate this file in your Arduino installation and replace the
last line from this snippet by
avrispmkii.program.extra_params=-P{serial.port}

If that works, it would be a good idea to submit a pull request with the
fix to the Arduino team.
Alternatively, you may try selecting “Atmel STK500 development board” as
a programmer. This is supposed to autodetect the version of the STK500
protocol, and uses the correct serial port.
Edit: you may also have to replace
avrispmkii.communication=usb

by
avrispmkii.communication=serial

C.f. this bug report, which seems to cover the exact issue you are
facing.

60683: <p>I'm trying to program an ATtiny85, using an <em>AVRISP mkII</em> programmer (this one: <a href="https://www.amazon.de/dp/B00IYNAXUC/ref=cm_sw_r_sms_c_api_i_VXOWDb3H3N5ND" rel="nofollow noreferrer">https://www.amazon.de/dp/B00IYNAXUC/ref=cm_sw_r_sms_c_api_i_VXOWDb3H3N5ND</a>) with the Arduino IDE (version 1.8.10 on Ubuntu 18.10). For the ATtiny, I've installed <a href="https://github.com/damellis/attiny" rel="nofollow noreferrer">https://github.com/damellis/attiny</a> using the board manager, as recommended in countless tutorials.</p>

<p>Now, everything seems to be recognized fine, and I've selected the programmers port in the IDE: <code>/dev/ttyACM0</code>.<br>
But when I try to upload a sketch, the IDE instead trys to pass <code>usb</code> as the port to <code>avrdude</code>. This is only visble when enabling verbose output: (paths abbreviated)</p>

<pre><code>/home/[...]/avrdude -C/home/[...]/avr/etc/avrdude.conf -v -pattiny85 -cstk500v2 -Pusb -Uflash:w:/tmp/arduino_build_728460/sketch.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/[...]/avrdude.conf"
         User configuration file is "/home/[...]/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : stk500v2
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)

avrdude done.  Thank you.
</code></pre>

<p><code>usb</code> isn't even a selectable port in the IDE!</p>

<p>Simply pasting the avrdude command (first line in the output above) to a terminal and changing <code>usb</code> to <code>/dev/ttyACM0</code> makes it program the IC perfectly (but of course, that's a rather cumbersome workaround).</p>

<p>Also, selecting another programmer in the IDE (like AVR ISP, without the mkII) makes it use the correct port (but of course it won't work, since it's the wrong programmer).</p>

<p>Am I doing something wrong, or is this an actual bug in the Arduino IDE?</p>
 10285: <p>I would say you have to select  the Arduino as ISP Programmer. Not the mkII ISP. Perhaps the attiny board library can handle connection to attiny dev boards over usb if you use the standard programmer. But that's just a very very rough guess. But selecting the Arduino as ISP is a requirement.</p>

<p><strong>Edit:</strong></p>

<p>No you can not use the Arduino as ISP if you use an STK500 programmer. </p>

<p>D. A. Mellis' tool is designed for an Arduino as a programmer. </p>

<p>But if your work around does the programming, the mkII is the right tool. You have to find out, how the IDE builds the CLI string to start <code>avrdude</code>.</p>

<p>The tool you installed contains a text file called <code>platform.txt</code>:</p>

<pre><code>name=ATtiny Microcontrollers

tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.erase.params.verbose=-v -v -v -v
tools.avrdude.erase.params.quiet=-q -q
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m

tools.avrdude.bootloader.params.verbose=-v -v -v -v
tools.avrdude.bootloader.params.quiet=-q -q
tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params}
</code></pre>

<p>I would say the entry <code>tools.avrdude.bootloader.pattern</code> does the trick. Especially the variable <code>{program.extra_params}</code>. You have to find out how the IDE is building this variable. One of it's options must be <code>-P&lt;Port&gt;</code>. But why does the IDE use the value <code>usb</code> for <code>&lt;port&gt;</code>?  </p>

<p>I'll try to find out. But I have no access to an IDE at the moment. If you (or someone else) find a solution before me, please add an answer and mark it as accepted, so I need not investigate further. </p>
 7508: <p>You mean that the STK500 v2 programmer uses an emulated serial port
rather than direct USB? Then I guess there is a bug in the Arduino IDE.
The file <code>programmers.txt</code> <a href="https://github.com/arduino/ArduinoCore-avr/blob/1.8.1/programmers.txt#L8-L13" rel="nofollow noreferrer">contains the following lines</a>
describing the programmer:</p>

<pre><code>avrispmkii.name=AVRISP mkII
avrispmkii.communication=usb
avrispmkii.protocol=stk500v2
avrispmkii.program.protocol=stk500v2
avrispmkii.program.tool=avrdude
avrispmkii.program.extra_params=-Pusb
</code></pre>

<p>You may locate this file in your Arduino installation and replace the
last line from this snippet by</p>

<pre><code>avrispmkii.program.extra_params=-P{serial.port}
</code></pre>

<p>If that works, it would be a good idea to submit a pull request with the
fix to the Arduino team.</p>

<p>Alternatively, you may try selecting “Atmel STK500 development board” as
a programmer. This is supposed to autodetect the version of the STK500
protocol, and uses the correct serial port.</p>

<p><strong>Edit</strong>: you may also have to replace</p>

<pre><code>avrispmkii.communication=usb
</code></pre>

<p>by</p>

<pre><code>avrispmkii.communication=serial
</code></pre>

<p>C.f. <a href="https://github.com/arduino/ArduinoCore-avr/issues/258" rel="nofollow noreferrer">this bug report</a>, which seems to cover the exact issue you are
facing.</p>
