rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.17k stars 888 forks source link

rustup check does not list all installed versions #4013

Closed rtdietrich closed 2 months ago

rtdietrich commented 2 months ago

Verification

Problem

rustup check does not list all installed rust versions in special situations

Steps

  1. We start at the point where only Rust stable is installed on the system (in my case Linux). It then looks like this
rtdietrich@pcx:~$ rustup check
stable-x86_64-unknown-linux-gnu - Up to date : 1.81.0 (eeb90cda1 2024-09-04)
rustup - Up to date : 1.27.1
rtdietrich@pcx:~$
  1. We now install version 1.80.0 on purpose, although 1.80.1 is already available at the time of writing and then try to list this installation with rustup check.

    
    rtdietrich@pcx:~$ rustup install 1.80.0
    info: syncing channel updates for '1.80.0-x86_64-unknown-linux-gnu'
    info: latest update on 2024-07-25, rust version 1.80.0 (051478957 2024-07-21)
    info: downloading component 'cargo'
    info: downloading component 'clippy'
    info: downloading component 'rust-docs'
    15.8 MiB /  15.8 MiB (100 %)   9.8 MiB/s in  1s ETA:  0s
    info: downloading component 'rust-std'
    24.4 MiB /  24.4 MiB (100 %)   9.8 MiB/s in  2s ETA:  0s
    info: downloading component 'rustc'
    65.0 MiB /  65.0 MiB (100 %)   9.3 MiB/s in  6s ETA:  0s
    info: downloading component 'rustfmt'
    info: installing component 'cargo'
    info: installing component 'clippy'
    info: installing component 'rust-docs'
    15.8 MiB /  15.8 MiB (100 %)  12.5 MiB/s in  1s ETA:  0s
    info: installing component 'rust-std'
    24.4 MiB /  24.4 MiB (100 %)  17.6 MiB/s in  1s ETA:  0s
    info: installing component 'rustc'
    65.0 MiB /  65.0 MiB (100 %)  18.8 MiB/s in  3s ETA:  0s
    info: installing component 'rustfmt'
    
    1.80.0-x86_64-unknown-linux-gnu installed - rustc 1.80.0 (051478957 2024-07-21)

info: checking for self-update rtdietrich@pcx:~$ rustup check stable-x86_64-unknown-linux-gnu - Up to date : 1.81.0 (eeb90cda1 2024-09-04) rustup - Up to date : 1.27.1 rtdietrich@pcx:~$


As can be seen, the `rust check` command incorrectly does not indicate that version 1.80.0 is installed on the system.

If you had entered `rustup install 1.80` instead of 1.80.0 under point 2, a subsequent `rustup check` would have listed all installed versions correctly

### Possible Solution(s)

_No response_

### Notes
Subsequently, I also discovered this and assume that this is not correct behavior

```terminal
rtdietrich@pcx:~$ rustup uninstall 1.80
info: no toolchain installed for '1.80-x86_64-unknown-linux-gnu'
info: toolchain '1.80-x86_64-unknown-linux-gnu' uninstalled
rtdietrich@pcx:~$ rustup uninstall 1.80.0
info: uninstalling toolchain '1.80.0-x86_64-unknown-linux-gnu'
info: toolchain '1.80.0-x86_64-unknown-linux-gnu' uninstalled
rtdietrich@pcx:~$ 

No response

Rustup version

rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.83.0-nightly (12b26c13f 2024-09-07)`

Installed toolchains

rtdietrich@pcx:~$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/rtdietrich/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
1.80.0-x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.81.0 (eeb90cda1 2024-09-04)

rtdietrich@pcx:~$

OS version

System:
  Kernel: 6.8.0-41-generic arch: x86_64 bits: 64 compiler: gcc v: 13.2.0 clocksource: tsc
  Desktop: Cinnamon v: 6.2.9 tk: GTK v: 3.24.41 wm: Muffin v: 6.2.0 vt: 7 dm: LightDM v: 1.30.0
    Distro: Linux Mint 22 Wilma base: Ubuntu 24.04 noble
Machine:
  Type: Desktop System: ASUS product: N/A v: N/A serial: <superuser required>
  Mobo: ASUSTeK model: PRIME B450M-K II v: Rev X.0x serial: <superuser required> part-nu: SKU
    uuid: <superuser required> UEFI: American Megatrends v: 4604 date: 03/19/2024
CPU:
  Info: 6-core model: AMD Ryzen 5 4500 bits: 64 type: MT MCP smt: enabled arch: Zen 2 rev: 1 cache:
    L1: 384 KiB L2: 3 MiB L3: 8 MiB
  Speed (MHz): avg: 2301 high: 4174 min/max: 400/4208 cores: 1: 3097 2: 400 3: 2994 4: 400
    5: 3593 6: 400 7: 400 8: 2994 9: 3099 10: 4174 11: 3130 12: 2937 bogomips: 86236
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3
Graphics:
  Device-1: NVIDIA TU106 [GeForce GTX 1650] driver: nvidia v: 535.183.01 arch: Turing pcie:
    speed: 2.5 GT/s lanes: 16 ports: active: none off: DP-1 empty: DVI-D-1,HDMI-A-1 bus-ID: 01:00.0
    chip-ID: 10de:1f0a class-ID: 0300
  Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 23.2.6 driver: X:
    loaded: modesetting,nouveau,nvidia unloaded: fbdev,vesa gpu: nvidia,nvidia-nvswitch
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 5120x1440 s-dpi: 96 s-size: 1355x381mm (53.35x15.00")
    s-diag: 1408mm (55.42")
  Monitor-1: DP-1 mapped: DP-0 note: disabled pos: primary model: Samsung C49RG9x
    serial: <filter> res: 5120x1440 hz: 120 dpi: 130048 size: 1x1mm (0.04x0.04") diag: 1239mm (48.8")
    modes: max: 3840x1080 min: 640x480
  Monitor-2: Unknown-1 mapped: None-1-1 note: disabled size-res: N/A modes: 1024x768
  API: EGL v: 1.5 hw: drv: nvidia platforms: device: 0 drv: nvidia device: 2 drv: swrast gbm:
    drv: kms_swrast surfaceless: drv: nvidia x11: drv: nvidia inactive: wayland,device-1
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 535.183.01 glx-v: 1.4
    direct-render: yes renderer: NVIDIA GeForce GTX 1650/PCIe/SSE2
Audio:
  Device-1: NVIDIA TU106 High Definition Audio driver: snd_hda_intel v: kernel pcie: speed: 8 GT/s
    lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:10f9 class-ID: 0403
  Device-2: AMD Renoir Radeon High Definition Audio vendor: ASUSTeK driver: snd_hda_intel
    v: kernel pcie: speed: 8 GT/s lanes: 16 bus-ID: 0a:00.1 chip-ID: 1002:1637 class-ID: 0403
  Device-3: AMD Family 17h/19h HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel pcie:
    speed: 8 GT/s lanes: 16 bus-ID: 0a:00.6 chip-ID: 1022:15e3 class-ID: 0403
  Device-4: HP HyperX Cloud Alpha Wireless driver: cdc_acm,hid-generic,snd-usb-audio,usbhid
    type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 bus-ID: 1-4:4 chip-ID: 03f0:098d class-ID: 0a00
    serial: <filter>
  API: ALSA v: k6.8.0-41-generic status: kernel-api
  Server-1: PipeWire v: 1.0.5 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin
Network:
  Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK RTL8111H
    driver: r8169 v: kernel pcie: speed: 2.5 GT/s lanes: 1 port: e000 bus-ID: 08:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: enp8s0 state: up speed: 100 Mbps duplex: full mac: <filter>
Drives:
  Local Storage: total: 953.87 GiB used: 44.66 GiB (4.7%)
  ID-1: /dev/nvme0n1 vendor: AGI model: 1T0GIMAI298 size: 953.87 GiB speed: 31.6 Gb/s lanes: 4
    tech: SSD serial: <filter> fw-rev: VC2S038E temp: 51.9 C scheme: GPT
Partition:
  ID-1: / size: 913.75 GiB used: 44.46 GiB (4.9%) fs: ext4 dev: /dev/dm-1 mapped: vgmint-root
  ID-2: /boot size: 1.61 GiB used: 196.5 MiB (11.9%) fs: ext4 dev: /dev/nvme0n1p3
  ID-3: /boot/efi size: 512 MiB used: 6.1 MiB (1.2%) fs: vfat dev: /dev/nvme0n1p2
Swap:
  ID-1: swap-1 type: partition size: 1.91 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/dm-2
    mapped: vgmint-swap_1
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 10 rev: 2.0 speed: 480 Mb/s lanes: 1
    chip-ID: 1d6b:0002 class-ID: 0900
  Device-1: 1-1:2 info: Logitech Keyboard K120 type: keyboard,HID driver: hid-generic,usbhid
    interfaces: 2 rev: 1.1 speed: 1.5 Mb/s lanes: 1 power: 90mA chip-ID: 046d:c31c class-ID: 0300
  Device-2: 1-2:3 info: Logitech Mouse type: mouse driver: hid-generic,usbhid interfaces: 1
    rev: 2.0 speed: 1.5 Mb/s lanes: 1 power: 100mA chip-ID: 046d:c077 class-ID: 0301
  Device-3: 1-4:4 info: HP HyperX Cloud Alpha Wireless type: audio,HID,abstract (modem),CDC-data
    driver: cdc_acm,hid-generic,snd-usb-audio,usbhid interfaces: 6 rev: 2.0 speed: 12 Mb/s lanes: 1
    power: 100mA chip-ID: 03f0:098d class-ID: 0a00 serial: <filter>
  Hub-2: 2-0:1 info: super-speed hub ports: 4 rev: 3.1 speed: 10 Gb/s lanes: 1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-3: 3-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0 speed: 480 Mb/s lanes: 1
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-4: 3-2:2 info: Realtek RTS5411 Hub ports: 4 rev: 2.1 speed: 480 Mb/s lanes: 1
    chip-ID: 0bda:5411 class-ID: 0900
  Hub-5: 4-0:1 info: super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s lanes: 1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-6: 4-2:2 info: Realtek Hub ports: 2 rev: 3.2 speed: 5 Gb/s lanes: 1 chip-ID: 0bda:0411
    class-ID: 0900
  Hub-7: 5-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0 speed: 480 Mb/s lanes: 1
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-8: 6-0:1 info: super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s lanes: 1 chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 37.1 C mobo: N/A gpu: nvidia temp: 32 C
  Fan Speeds (rpm): N/A gpu: nvidia fan: 38%
Repos:
  Packages: 2282 pm: dpkg pkgs: 2271 pm: flatpak pkgs: 11
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb http: //packages.linuxmint.com wilma main upstream import backport
    2: deb http: //archive.ubuntu.com/ubuntu noble main restricted universe multiverse
    3: deb http: //archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse
    4: deb http: //archive.ubuntu.com/ubuntu noble-backports main restricted universe multiverse
    5: deb http: //security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
Info:
  Memory: total: 16 GiB note: est. available: 15.41 GiB used: 2.98 GiB (19.3%)
  Processes: 369 Power: uptime: 16h 37m states: freeze,mem,disk suspend: deep wakeups: 2
    hibernate: platform Init: systemd v: 255 target: graphical (5) default: graphical
  Compilers: clang: 18.1.3 gcc: 13.2.0 Client: Cinnamon v: 6.2.9 inxi: 3.3.34
rami3l commented 2 months ago

@rtdietrich Thanks for filing this issue!

The rationale here is that 1.80.0 is pinned to a certain version, so it is not updatable. Thus, there's no point in checking updates for this channel. On the other hand, your 1.80 toolchain can be updated within the 1.80 series.

To check for all installed toolchains, use rustup show.

As for your concern on the message printed on rustup toolchain uninstall, see https://github.com/rust-lang/rustup/issues/3861.

Please feel free to tell us if you have further concerns.

rtdietrich commented 2 months ago

I find everything you have written confusing, but as a newbie who is not really fit in the subject, I will leave it at that. Even though I think it will confuse a lot of users out there.

I would have liked rustup check to show version 1.80.0 and tell me that an update is available.

PS: Fortunately you have revised your post again and with the new explanation I understand a little more why things are like this: "pinned" brings light in my mind