§2024-12-19

This post is to set up the Jetson Orin Nan Devlopment Kit to run a RStudio docker container with a volume attched into //munetaka.me/RStudio.

¶Mount SMB //munetaka.me/RStudio, install smb

(base) alexlai@Jetson:~$ $ sudo apt update && sudo apt -y upgrade && sudo apt install samba samba-client cifs-utils  -y 
$ smb --version
$ smbclient -L munetaka.me
$ \alexlai]:  <-- TxxxxYxxLxx#1nnn

        Sharename       Type      Comment
        ---------       ----      -------
        homes           Disk      homes contains all users' home
        JupyterHub      Disk      JupyterHub Shared pholders
        MailPlus        Disk      Synology MailPlus
        pgAdmin4        Disk      pgAdmin4
        postgreSQL      Disk      
        RStudio         Disk      RStudio
        test            Disk      
        web             Disk      System default shared folder
        web_packages    Disk      
        写真          Disk      
        古い写真    Disk      
        柯宅整休案 Disk      
        柯家新築案 Disk      
        IPC$            IPC       IPC Service ()
        home            Disk      Home directory of alexlai
SMB1 disabled -- no workgroup available

&para;Try to mount

$ sudo mkdir /opt/RStudio

$ ~$ sudo mount -t cifs //munetaka.me/RStudio /opt/RStudio/ -o username=alexlai,password=TsungYiuLai#1765 mount: /opt/RStudio: mount(2) system call failed: No route to host. $ sudo dmesg | tail -n 20 [ 542.023583] mmcblk0: recovery failed! [ 542.023623] blk_update_request: I/O error, dev mmcblk0, sector 62333824 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0 [ 542.023677] Buffer I/O error on dev mmcblk0, logical block 7791728, async page read [ 654.609593] loop1: detected capacity change from 0 to 357928 [ 659.478826] blk_update_request: I/O error, dev mmcblk0, sector 62333824 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0 [ 660.287740] mmcblk0: recovery failed! [ 660.287774] blk_update_request: I/O error, dev mmcblk0, sector 62333824 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0 [ 660.287824] Buffer I/O error on dev mmcblk0, logical block 7791728, async page read [ 672.446241] audit: type=1326 audit(1734481052.381:9): auid=1026 uid=1026 gid=1026 ses=3 subj=kernel pid=6545 comm="chrome" exe="/snap/chromium/3008/usr/lib/chromium-browser/chrome" sig=0 arch=c00000b7 syscall=444 compat=0 ip=0xffff845f1c28 code=0x50000 [ 695.431526] audit: type=1326 audit(1734481075.366:10): auid=1026 uid=1026 gid=1026 ses=3 subj=kernel pid=6897 comm="chrome" exe="/snap/chromium/3008/usr/lib/chromium-browser/chrome" sig=0 arch=c00000b7 syscall=444 compat=0 ip=0xffff931f1c28 code=0x50000 [71386.799562] Key type cifs.idmap registered [71386.800428] CIFS: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3.1.1), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3.1.1 (or even SMB3 or SMB2.1) specify vers=1.0 on mount. [71386.800435] CIFS: Unable to determine destination address [71445.121375] CIFS: Unable to determine destination address [71513.362290] CIFS: Unable to determine destination address [71743.443981] CIFS: Unable to determine destination address [71933.299307] CIFS: Unable to determine destination address [72034.403005] CIFS: Unable to determine destination address [72079.849606] CIFS: Unable to determine destination address [72384.718053] CIFS: Unable to determine destination address


But, use ip address

$ sudo mount -t cifs //114.33.29.69/RStudio /opt/RStudio/ -o username=alexlai,password=TsungYiuLai#1765 (base) alexlai@Jetson:$ ls /opt/RStudio/ '#recycle' (base) alexlai@Jetson:

¶Using /etc/fstab

(base) alexlai@Jetson:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# These are the filesystems that are always mounted on boot, you can
# override any of these by copying the appropriate line from this file into
# /etc/fstab and tweaking it as you see fit.  See fstab(5).
#
# <file system> <mount point>             <type>          <options>                               <dump> <pass>
/dev/root            /                     ext4           defaults                                     0 1
UUID=98C8-1EBB /boot/efi vfat defaults 0 1
UUID=94f90cf9-9add-47fc-a2c7-9e32ea29623b       none    swap    defaults        0 0

# mount //munetaka.me/RStudio smb
# mount munetaka.me JupyterHub smb share
//114.33.29.69/RStudio    /opt/RStudio        cifs   credentials=/home/alexlai/.smbpass,noperm 0 0

¶~/.smbpass

user=alexlai
password=TsungYiuLai#1765

¶Install Docker Engine

#!/bin/bash

# https://docs.docker.com/engine/install/ubuntu/

# Run the following command to uninstall all conflicting packages
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

# Add Docker's official GPG key:
sudo apt-get update && \
sudo apt-get install ca-certificates curl && \
sudo install -m 0755 -d /etc/apt/keyrings && \
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
sudo chmod a+r /etc/apt/keyrings/docker.asc 

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \
sudo apt-get update 

# tO install the latest version, run:
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# add alexlai to docker group
sudo usermod -aG docker alexlai
# have to relogin to take into effect

¶ Check docker installation

(base) alexlai@Jetson:~$ id alexlai
uid=1026(alexlai) gid=1026(alexlai) groups=1026(alexlai),4(adm),24(cdrom),27(sudo),29(audio),30(dip),44(video),46(plugdev),104(render),116(i2c),120(lpadmin),135(gdm),999(gpio),996(weston-launch),136(sambashare),994(docker)
(base) alexlai@Jetson:~$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

pull image

(base) alexlai@Jetson:~$ docker pull rocker/rstudio

¶run

docker run -d -p 8787:8787 -e PASSWORD=rstudio --name rstudio -v /opt/RStudio:/home/rstudio  rocker/rstudio

¶ /etc/systemd/system/rstudio.service

[Unit]
Description=RStudio Docker Container
After=docker.service
Requires=docker.service

[Service]
Restart=always
# ExecStartPre=/usr/bin/docker pull rocker/rstudio
# ExecStart=/usr/bin/docker run -d -p 8787:8787 -e PASSWORD=rstudio --name rstudio -v /opt/RStudio:/home/rstudio  rocker/rstudio
# no -d
ExecStart=/usr/bin/docker run -p 8787:8787 -e PASSWORD=rstudio --name rstudio -v /opt/RStudio:/home/rstudio  rocker/rstudio
ExecStop=/usr/bin/docker stop rstudio
ExecStopPost=/usr/bin/docker rm rstudio

[Install]
WantedBy=multi-user.target