Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP of VSCode On TailsOS #1

Closed
fititnt opened this issue Oct 17, 2020 · 10 comments
Closed

MVP of VSCode On TailsOS #1

fititnt opened this issue Oct 17, 2020 · 10 comments

Comments

@fititnt
Copy link
Owner

fititnt commented Oct 17, 2020

Document (or maybe do some shell scripting) of an minimum viable product (MVP) of usage of VSCode on TailsOS

@fititnt
Copy link
Owner Author

fititnt commented Oct 17, 2020

Ow fuck. I deleted by mistake the docs/vscode-setup.sh (so, around 30min of work lost). VSCode even warned about not be able to move files to trash.

fititnt added a commit that referenced this issue Oct 17, 2020
…that it would be unable to send files to trash, it was not kidding)
@fititnt
Copy link
Owner Author

fititnt commented Oct 17, 2020

Hummmm...

From https://code.visualstudio.com/docs/setup/linux#_debian-and-moving-files-to-trash

Debian and moving files to trash#

If you see an error when deleting files from the VS Code Explorer on the Debian operating system, it might be because the trash implementation that VS Code is using is not there.

Run these commands to solve this issue:

sudo apt-get install gvfs-bin

@fititnt
Copy link
Owner Author

fititnt commented Oct 17, 2020

The first option was explicitly the portable option of VSCode. But tails also allows to install deb files. Not sure which one would be better.

I'm doing a draft of docs/vscode-deb-setup.sh and at some point this error show up

docs/vscode-deb-setup.sh

amnesia@amnesia:~$ wget https://go.microsoft.com/fwlink/?LinkID=760868 -O /home/amnesia/Persistent/downloads/vscode.deb
(...)

amnesia@amnesia:~$ sudo apt install /home/amnesia/Persistent/downloads/vscode.deb
[sudo] password for amnesia: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'code' instead of '/home/amnesia/Persistent/downloads/vscode.deb'
The following package was automatically installed and is no longer required:
  libpcre2-posix0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  code
0 upgraded, 1 newly installed, 0 to remove and 34 not upgraded.
Need to get 0 B/64.5 MB of archives.
After this operation, 276 MB of additional disk space will be used.
Get:1 /home/amnesia/Persistent/downloads/vscode.deb code amd64 1.50.1-1602600906 [64.5 MB]
[INFO] Saving package changes
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 297, in __getitem__
    rawpkg = self._cache[key]
KeyError: 'code'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/sbin/tails-additional-software", line 672, in <module>
    apt_hook_pre()
  File "/usr/local/sbin/tails-additional-software", line 459, in apt_hook_pre
    if not apt_cache[package_name].is_installed:
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 299, in __getitem__
    raise KeyError('The cache has no package named %r' % key)
KeyError: "The cache has no package named 'code'"
N: Download is performed unsandboxed as root as file '/home/amnesia/Persistent/downloads/vscode.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
E: Sub-process /usr/local/sbin/tails-additional-software apt-pre returned an error code (1)
E: Failure running script /usr/local/sbin/tails-additional-software apt-pre

fititnt added a commit that referenced this issue Oct 17, 2020
@fititnt
Copy link
Owner Author

fititnt commented Oct 20, 2020

The current vscode-portable-setup.sh have the link to vscode .deb, not the .tar.gz. Needs update later.

vscode-portable-setup.sh

# (...)
# @see https://code.visualstudio.com/docs/editor/portable
wget https://go.microsoft.com/fwlink/?LinkID=620884 -O /tmp/vscode.tar.gz
cd /home/amnesia/Persistent
tar -vzxf /tmp/vscode.tar.gz
# (...)

@fititnt
Copy link
Owner Author

fititnt commented Oct 23, 2020

Interesting. I'm testing the vscode.deb alternative install via the root terminal and Tails by default deny connect via tor. Maybe it's an security hardening. makes sense.

root@amnesia:~# wget https://go.microsoft.com/fwlink/?LinkID=760868 -O /tmp/vscode.deb
--2020-10-23 15:45:01--  https://go.microsoft.com/fwlink/?LinkID=760868
Resolving go.microsoft.com (go.microsoft.com)... 1603467902 PERROR torsocks[1584]: socks5 libc connect: Connection refused (in socks5_connect() at socks5.c:202)
failed: Non-recoverable failure in name resolution.
wget: unable to resolve host address ‘go.microsoft.com’
root@amnesia:~# wget https://go.microsoft.com/fwlink/?LinkID=760868 -O /tmp/vscode.deb
--2020-10-23 15:45:30--  https://go.microsoft.com/fwlink/?LinkID=760868
Resolving go.microsoft.com (go.microsoft.com)... 1603467931 PERROR torsocks[1646]: socks5 libc connect: Connection refused (in socks5_connect() at socks5.c:202)
failed: Non-recoverable failure in name resolution.
wget: unable to resolve host address ‘go.microsoft.com’

@fititnt
Copy link
Owner Author

fititnt commented Oct 23, 2020

Humm... I think I found an bug on Tails

@fititnt
Copy link
Owner Author

fititnt commented Oct 23, 2020

With the hotfix from here #12 (comment) we can install the vscode.deb

amnesia@amnesia:~$ sudo apt install /tmp/vscode.deb
[sudo] password for amnesia: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'code' instead of '/tmp/vscode.deb'
The following package was automatically installed and is no longer required:
  libpcre2-posix0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  code
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 0 B/64.5 MB of archives.
After this operation, 276 MB of additional disk space will be used.
Get:1 /tmp/vscode.deb code amd64 1.50.1-1602600906 [64.5 MB]
[INFO] Saving package changes
Selecting previously unselected package code.
(Reading database ... 138407 files and directories currently installed.)
Preparing to unpack /tmp/vscode.deb ...
Unpacking code (1.50.1-1602600906) ...
Setting up code (1.50.1-1602600906) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for gnome-menus (3.31.4-3) ...
Processing triggers for shared-mime-info (1.10-1) ...
Processing triggers for desktop-file-utils (0.23-4.0tails1) ...
[INFO] Examining package changes
amnesia@amnesia:~$ [INFO] New packages manually installed: {'code'}
[INFO] Adding to additional packages list: {'code'}

fititnt added a commit that referenced this issue Oct 23, 2020
HOTFIX: Error "KeyError: "The cache has no package named 'code'""

sudo gedit /usr/local/sbin/tails-additional-software
change
    if not apt_cache[package_name].is_installed:
for this
    if (package_name not in apt_cache) or apt_cache[package_name].is_installed:
@fititnt
Copy link
Owner Author

fititnt commented Oct 23, 2020

Good. Not great. Not terrible.

The docs/vscode-portable-setup.sh v1.2 explain how to install. The helper bin/tails-code, that is mean to be added to the path, will automaticaly load installed portable VSCode to the memory and then run.

The docs/vscode-deb-setup.sh still unreliable (to not say it's shitty). Not only requires hotpatch (See #12) but also did not re-intall automaticaly after reboot and break other additional software to install correctly. On future this bug with docs/vscode-deb-setup.sh may not happens, but it does on Tails v4.12.

@fititnt fititnt closed this as completed Oct 23, 2020
@fititnt
Copy link
Owner Author

fititnt commented Oct 25, 2020

Humm... maybe this could fix the network issue

https://code.visualstudio.com/docs/setup/network

@fititnt
Copy link
Owner Author

fititnt commented Oct 25, 2020

Not there... yet. But maybe would be someting like the curl #17

/home/amnesia/Desktop/VSCode-linux-x64/code --no-sandbox --proxy-server="socks5://127.0.0.1:9050" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE 127.0.0.1"

/home/amnesia/Desktop/VSCode-linux-x64/code --no-sandbox --proxy-server="socks5://127.0.0.1:9050" --verbose .

http_proxy=http://127.0.0.1:9050 https_proxy=http://127.0.0.1:9050 /home/amnesia/Desktop/VSCode-linux-x64/code --no-sandbox --proxy-auto-detect

amnesia@amnesia:~/Persistent/git/fititnt/TailsOS-for-non-whistleblowers$ /home/amnesia/Desktop/VSCode-linux-x64/code --no-sandbox --proxy-server="socks5://127.0.0.1:9050" --verbose .
Warning: 'sandbox' is not in the list of known options, but still passed to Electron/Chromium.
[main 2020-10-25T21:01:48.784Z] Starting VS Code
[main 2020-10-25T21:01:48.785Z] from: /home/amnesia/Desktop/VSCode-linux-x64/resources/app
[main 2020-10-25T21:01:48.785Z] args: {
  _: [


(...)
[main 2020-10-25T21:02:18.910Z] update#setState checking for updates
[main 2020-10-25T21:02:18.910Z] RequestService#request https://update.code.visualstudio.com/api/update/linux-x64/stable/d2e414d9e4239a252d1ab117bd7067f125afd80a
[main 2020-10-25T21:02:18.916Z] Error: net::ERR_PROXY_CONNECTION_FAILED
    at SimpleURLLoaderWrapper.<anonymous> (electron/js2c/browser_init.js:105:6395)
    at SimpleURLLoaderWrapper.emit (events.js:223:5)
[main 2020-10-25T21:02:18.917Z] update#setState idle
[main 2020-10-25T21:02:18.918Z] telemetry/update:notAvailable { explicit: false }

The error at least is different from the

amnesia@amnesia:~/Persistent/git/fititnt/TailsOS-for-non-whistleblowers$ /home/amnesia/Desktop/VSCode-linux-x64/code --no-sandbox --verbose .
Warning: 'sandbox' is not in the list of known options, but still passed to Electron/Chromium.
[main 2020-10-25T21:03:47.783Z] Starting VS Code
[main 2020-10-25T21:03:47.784Z] from: /home/amnesia/Desktop/VSCode-linux-x64/resources/app
[main 2020-10-25T21:03:47.784Z] args: {
  _: [

# (...)

[main 2020-10-25T21:06:47.594Z] update#setState checking for updates
[main 2020-10-25T21:06:47.595Z] RequestService#request https://update.code.visualstudio.com/api/update/linux-x64/stable/d2e414d9e4239a252d1ab117bd7067f125afd80a
[main 2020-10-25T21:06:47.599Z] Error: net::ERR_CONNECTION_REFUSED
    at SimpleURLLoaderWrapper.<anonymous> (electron/js2c/browser_init.js:105:6395)
    at SimpleURLLoaderWrapper.emit (events.js:223:5)
[main 2020-10-25T21:06:47.601Z] update#setState idle
[main 2020-10-25T21:06:47.601Z] telemetry/update:notAvailable { explicit: false }
[main 2020-10-25T21:06:47.821Z] menubarService#updateMenubar 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant